MCPcopy
hub / github.com/stemkoski/stemkoski.github.com / renderFace3

Function renderFace3

7DFPS/js/Three.js:15855–16015  ·  view source on GitHub ↗
( v1, v2, v3, uv1, uv2, uv3, element, material )

Source from the content-addressed store, hash-verified

15853 }
15854
15855 function renderFace3( v1, v2, v3, uv1, uv2, uv3, element, material ) {
15856
15857 _this.info.render.vertices += 3;
15858 _this.info.render.faces ++;
15859
15860 setOpacity( material.opacity );
15861 setBlending( material.blending );
15862
15863 _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y;
15864 _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y;
15865 _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y;
15866
15867 drawTriangle( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y );
15868
15869 if ( ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) && material.map === null ) {
15870
15871 _diffuseColor.copy( material.color );
15872 _emissiveColor.copy( material.emissive );
15873
15874 if ( material.vertexColors === THREE.FaceColors ) {
15875
15876 _diffuseColor.multiply( element.color );
15877
15878 }
15879
15880 if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 3 ) {
15881
15882 _color1.copy( _ambientLight );
15883 _color2.copy( _ambientLight );
15884 _color3.copy( _ambientLight );
15885
15886 calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 );
15887 calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 );
15888 calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color3 );
15889
15890 _color1.multiply( _diffuseColor ).add( _emissiveColor );
15891 _color2.multiply( _diffuseColor ).add( _emissiveColor );
15892 _color3.multiply( _diffuseColor ).add( _emissiveColor );
15893 _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 );
15894
15895 _image = getGradientTexture( _color1, _color2, _color3, _color4 );
15896
15897 clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image );
15898
15899 } else {
15900
15901 _color.copy( _ambientLight );
15902
15903 calculateLight( element.centroidModel, element.normalModel, _color );
15904
15905 _color.multiply( _diffuseColor ).add( _emissiveColor );
15906
15907 material.wireframe === true
15908 ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
15909 : fillPath( _color );
15910
15911 }
15912

Callers 2

Three.jsFile · 0.70
renderFace4Function · 0.70

Calls 10

smoothstepFunction · 0.85
setOpacityFunction · 0.70
setBlendingFunction · 0.70
drawTriangleFunction · 0.70
calculateLightFunction · 0.70
getGradientTextureFunction · 0.70
clipImageFunction · 0.70
strokePathFunction · 0.70
fillPathFunction · 0.70
patternPathFunction · 0.70

Tested by

no test coverage detected