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

Function renderFace3

Three.js/js/Three62dev.js:15878–16038  ·  view source on GitHub ↗
( v1, v2, v3, uv1, uv2, uv3, element, material )

Source from the content-addressed store, hash-verified

15876 }
15877
15878 function renderFace3( v1, v2, v3, uv1, uv2, uv3, element, material ) {
15879
15880 _this.info.render.vertices += 3;
15881 _this.info.render.faces ++;
15882
15883 setOpacity( material.opacity );
15884 setBlending( material.blending );
15885
15886 _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y;
15887 _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y;
15888 _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y;
15889
15890 drawTriangle( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y );
15891
15892 if ( ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) && material.map === null ) {
15893
15894 _diffuseColor.copy( material.color );
15895 _emissiveColor.copy( material.emissive );
15896
15897 if ( material.vertexColors === THREE.FaceColors ) {
15898
15899 _diffuseColor.multiply( element.color );
15900
15901 }
15902
15903 if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 3 ) {
15904
15905 _color1.copy( _ambientLight );
15906 _color2.copy( _ambientLight );
15907 _color3.copy( _ambientLight );
15908
15909 calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 );
15910 calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 );
15911 calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color3 );
15912
15913 _color1.multiply( _diffuseColor ).add( _emissiveColor );
15914 _color2.multiply( _diffuseColor ).add( _emissiveColor );
15915 _color3.multiply( _diffuseColor ).add( _emissiveColor );
15916 _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 );
15917
15918 _image = getGradientTexture( _color1, _color2, _color3, _color4 );
15919
15920 clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image );
15921
15922 } else {
15923
15924 _color.copy( _ambientLight );
15925
15926 calculateLight( element.centroidModel, element.normalModel, _color );
15927
15928 _color.multiply( _diffuseColor ).add( _emissiveColor );
15929
15930 material.wireframe === true
15931 ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
15932 : fillPath( _color );
15933
15934 }
15935

Callers 1

Three62dev.jsFile · 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