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

Function renderFace4

Three.js/js/ThreeDebug.js:9718–9849  ·  view source on GitHub ↗
( v1, v2, v3, v4, v5, v6, element, material, scene )

Source from the content-addressed store, hash-verified

9716 }
9717
9718 function renderFace4( v1, v2, v3, v4, v5, v6, element, material, scene ) {
9719
9720 _this.info.render.vertices += 4;
9721 _this.info.render.faces ++;
9722
9723 setOpacity( material.opacity );
9724 setBlending( material.blending );
9725
9726 if ( material.map || material.envMap ) {
9727
9728 // Let renderFace3() handle this
9729
9730 renderFace3( v1, v2, v4, 0, 1, 3, element, material, scene );
9731 renderFace3( v5, v3, v6, 1, 2, 3, element, material, scene );
9732
9733 return;
9734
9735 }
9736
9737 _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y;
9738 _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y;
9739 _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y;
9740 _v4x = v4.positionScreen.x; _v4y = v4.positionScreen.y;
9741 _v5x = v5.positionScreen.x; _v5y = v5.positionScreen.y;
9742 _v6x = v6.positionScreen.x; _v6y = v6.positionScreen.y;
9743
9744 if ( material instanceof THREE.MeshBasicMaterial ) {
9745
9746 drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
9747
9748 material.wireframe ? strokePath( material.color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color );
9749
9750 } else if ( material instanceof THREE.MeshLambertMaterial ) {
9751
9752 if ( _enableLighting ) {
9753
9754 if ( !material.wireframe && material.shading == THREE.SmoothShading && element.vertexNormalsWorld.length == 4 ) {
9755
9756 _color1.r = _color2.r = _color3.r = _color4.r = _ambientLight.r;
9757 _color1.g = _color2.g = _color3.g = _color4.g = _ambientLight.g;
9758 _color1.b = _color2.b = _color3.b = _color4.b = _ambientLight.b;
9759
9760 calculateLight( _lights, element.v1.positionWorld, element.vertexNormalsWorld[ 0 ], _color1 );
9761 calculateLight( _lights, element.v2.positionWorld, element.vertexNormalsWorld[ 1 ], _color2 );
9762 calculateLight( _lights, element.v4.positionWorld, element.vertexNormalsWorld[ 3 ], _color3 );
9763 calculateLight( _lights, element.v3.positionWorld, element.vertexNormalsWorld[ 2 ], _color4 );
9764
9765 _color1.r = Math.max( 0, Math.min( material.color.r * _color1.r, 1 ) );
9766 _color1.g = Math.max( 0, Math.min( material.color.g * _color1.g, 1 ) );
9767 _color1.b = Math.max( 0, Math.min( material.color.b * _color1.b, 1 ) );
9768
9769 _color2.r = Math.max( 0, Math.min( material.color.r * _color2.r, 1 ) );
9770 _color2.g = Math.max( 0, Math.min( material.color.g * _color2.g, 1 ) );
9771 _color2.b = Math.max( 0, Math.min( material.color.b * _color2.b, 1 ) );
9772
9773 _color3.r = Math.max( 0, Math.min( material.color.r * _color3.r, 1 ) );
9774 _color3.g = Math.max( 0, Math.min( material.color.g * _color3.g, 1 ) );
9775 _color3.b = Math.max( 0, Math.min( material.color.b * _color3.b, 1 ) );

Callers 1

ThreeDebug.jsFile · 0.70

Calls 13

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

Tested by

no test coverage detected