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

Function renderFace3

Three.js/js/Three59dev.js:15482–15642  ·  view source on GitHub ↗
( v1, v2, v3, uv1, uv2, uv3, element, material )

Source from the content-addressed store, hash-verified

15480 }
15481
15482 function renderFace3( v1, v2, v3, uv1, uv2, uv3, element, material ) {
15483
15484 _this.info.render.vertices += 3;
15485 _this.info.render.faces ++;
15486
15487 setOpacity( material.opacity );
15488 setBlending( material.blending );
15489
15490 _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y;
15491 _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y;
15492 _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y;
15493
15494 drawTriangle( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y );
15495
15496 if ( ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) && material.map === null ) {
15497
15498 _diffuseColor.copy( material.color );
15499 _emissiveColor.copy( material.emissive );
15500
15501 if ( material.vertexColors === THREE.FaceColors ) {
15502
15503 _diffuseColor.multiply( element.color );
15504
15505 }
15506
15507 if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 3 ) {
15508
15509 _color1.copy( _ambientLight );
15510 _color2.copy( _ambientLight );
15511 _color3.copy( _ambientLight );
15512
15513 calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 );
15514 calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 );
15515 calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color3 );
15516
15517 _color1.multiply( _diffuseColor ).add( _emissiveColor );
15518 _color2.multiply( _diffuseColor ).add( _emissiveColor );
15519 _color3.multiply( _diffuseColor ).add( _emissiveColor );
15520 _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 );
15521
15522 _image = getGradientTexture( _color1, _color2, _color3, _color4 );
15523
15524 clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image );
15525
15526 } else {
15527
15528 _color.copy( _ambientLight );
15529
15530 calculateLight( element.centroidModel, element.normalModel, _color );
15531
15532 _color.multiply( _diffuseColor ).add( _emissiveColor );
15533
15534 material.wireframe === true
15535 ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
15536 : fillPath( _color );
15537
15538 }
15539

Callers 2

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