MCPcopy
hub / github.com/stemkoski/stemkoski.github.com / renderFace4

Function renderFace4

Three.js/js/Three59dev.js:15644–15801  ·  view source on GitHub ↗
( v1, v2, v3, v4, v5, v6, element, material )

Source from the content-addressed store, hash-verified

15642 }
15643
15644 function renderFace4( v1, v2, v3, v4, v5, v6, element, material ) {
15645
15646 _this.info.render.vertices += 4;
15647 _this.info.render.faces ++;
15648
15649 setOpacity( material.opacity );
15650 setBlending( material.blending );
15651
15652 if ( ( material.map !== undefined && material.map !== null ) || ( material.envMap !== undefined && material.envMap !== null ) ) {
15653
15654 // Let renderFace3() handle this
15655
15656 renderFace3( v1, v2, v4, 0, 1, 3, element, material );
15657 renderFace3( v5, v3, v6, 1, 2, 3, element, material );
15658
15659 return;
15660
15661 }
15662
15663 _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y;
15664 _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y;
15665 _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y;
15666 _v4x = v4.positionScreen.x; _v4y = v4.positionScreen.y;
15667 _v5x = v5.positionScreen.x; _v5y = v5.positionScreen.y;
15668 _v6x = v6.positionScreen.x; _v6y = v6.positionScreen.y;
15669
15670 if ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) {
15671
15672 _diffuseColor.copy( material.color );
15673 _emissiveColor.copy( material.emissive );
15674
15675 if ( material.vertexColors === THREE.FaceColors ) {
15676
15677 _diffuseColor.multiply( element.color );
15678
15679 }
15680
15681 if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 4 ) {
15682
15683 _color1.copy( _ambientLight );
15684 _color2.copy( _ambientLight );
15685 _color3.copy( _ambientLight );
15686 _color4.copy( _ambientLight );
15687
15688 calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 );
15689 calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 );
15690 calculateLight( element.v4.positionWorld, element.vertexNormalsModel[ 3 ], _color3 );
15691 calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color4 );
15692
15693 _color1.multiply( _diffuseColor ).add( _emissiveColor );
15694 _color2.multiply( _diffuseColor ).add( _emissiveColor );
15695 _color3.multiply( _diffuseColor ).add( _emissiveColor );
15696 _color4.multiply( _diffuseColor ).add( _emissiveColor );
15697
15698 _image = getGradientTexture( _color1, _color2, _color3, _color4 );
15699
15700 // TODO: UVs are incorrect, v4->v3?
15701

Callers 1

Three59dev.jsFile · 0.70

Calls 11

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

Tested by

no test coverage detected