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

Function renderFace3

Three.js/js/Three62.js:15920–16080  ·  view source on GitHub ↗
( v1, v2, v3, uv1, uv2, uv3, element, material )

Source from the content-addressed store, hash-verified

15918 }
15919
15920 function renderFace3( v1, v2, v3, uv1, uv2, uv3, element, material ) {
15921
15922 _this.info.render.vertices += 3;
15923 _this.info.render.faces ++;
15924
15925 setOpacity( material.opacity );
15926 setBlending( material.blending );
15927
15928 _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y;
15929 _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y;
15930 _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y;
15931
15932 drawTriangle( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y );
15933
15934 if ( ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) && material.map === null ) {
15935
15936 _diffuseColor.copy( material.color );
15937 _emissiveColor.copy( material.emissive );
15938
15939 if ( material.vertexColors === THREE.FaceColors ) {
15940
15941 _diffuseColor.multiply( element.color );
15942
15943 }
15944
15945 if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 3 ) {
15946
15947 _color1.copy( _ambientLight );
15948 _color2.copy( _ambientLight );
15949 _color3.copy( _ambientLight );
15950
15951 calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 );
15952 calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 );
15953 calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color3 );
15954
15955 _color1.multiply( _diffuseColor ).add( _emissiveColor );
15956 _color2.multiply( _diffuseColor ).add( _emissiveColor );
15957 _color3.multiply( _diffuseColor ).add( _emissiveColor );
15958 _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 );
15959
15960 _image = getGradientTexture( _color1, _color2, _color3, _color4 );
15961
15962 clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image );
15963
15964 } else {
15965
15966 _color.copy( _ambientLight );
15967
15968 calculateLight( element.centroidModel, element.normalModel, _color );
15969
15970 _color.multiply( _diffuseColor ).add( _emissiveColor );
15971
15972 material.wireframe === true
15973 ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
15974 : fillPath( _color );
15975
15976 }
15977

Callers 1

Three62.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