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

Function renderFace3

Three.js/js/Three66.js:16700–16858  ·  view source on GitHub ↗
( v1, v2, v3, uv1, uv2, uv3, element, material )

Source from the content-addressed store, hash-verified

16698 }
16699
16700 function renderFace3( v1, v2, v3, uv1, uv2, uv3, element, material ) {
16701
16702 _this.info.render.vertices += 3;
16703 _this.info.render.faces ++;
16704
16705 setOpacity( material.opacity );
16706 setBlending( material.blending );
16707
16708 _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y;
16709 _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y;
16710 _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y;
16711
16712 drawTriangle( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y );
16713
16714 if ( ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) && material.map === null ) {
16715
16716 _diffuseColor.copy( material.color );
16717 _emissiveColor.copy( material.emissive );
16718
16719 if ( material.vertexColors === THREE.FaceColors ) {
16720
16721 _diffuseColor.multiply( element.color );
16722
16723 }
16724
16725 if ( material.wireframe === false && material.shading === THREE.SmoothShading && element.vertexNormalsLength === 3 ) {
16726
16727 _color1.copy( _ambientLight );
16728 _color2.copy( _ambientLight );
16729 _color3.copy( _ambientLight );
16730
16731 calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 );
16732 calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 );
16733 calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color3 );
16734
16735 _color1.multiply( _diffuseColor ).add( _emissiveColor );
16736 _color2.multiply( _diffuseColor ).add( _emissiveColor );
16737 _color3.multiply( _diffuseColor ).add( _emissiveColor );
16738 _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 );
16739
16740 _image = getGradientTexture( _color1, _color2, _color3, _color4 );
16741
16742 clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image );
16743
16744 } else {
16745
16746 _color.copy( _ambientLight );
16747
16748 calculateLight( element.centroidModel, element.normalModel, _color );
16749
16750 _color.multiply( _diffuseColor ).add( _emissiveColor );
16751
16752 material.wireframe === true
16753 ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
16754 : fillPath( _color );
16755
16756 }
16757

Callers 1

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