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

Function renderFace4

7DFPS/js/Three.js:16017–16174  ·  view source on GitHub ↗
( v1, v2, v3, v4, v5, v6, element, material )

Source from the content-addressed store, hash-verified

16015 }
16016
16017 function renderFace4( v1, v2, v3, v4, v5, v6, element, material ) {
16018
16019 _this.info.render.vertices += 4;
16020 _this.info.render.faces ++;
16021
16022 setOpacity( material.opacity );
16023 setBlending( material.blending );
16024
16025 if ( ( material.map !== undefined && material.map !== null ) || ( material.envMap !== undefined && material.envMap !== null ) ) {
16026
16027 // Let renderFace3() handle this
16028
16029 renderFace3( v1, v2, v4, 0, 1, 3, element, material );
16030 renderFace3( v5, v3, v6, 1, 2, 3, element, material );
16031
16032 return;
16033
16034 }
16035
16036 _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y;
16037 _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y;
16038 _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y;
16039 _v4x = v4.positionScreen.x; _v4y = v4.positionScreen.y;
16040 _v5x = v5.positionScreen.x; _v5y = v5.positionScreen.y;
16041 _v6x = v6.positionScreen.x; _v6y = v6.positionScreen.y;
16042
16043 if ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) {
16044
16045 _diffuseColor.copy( material.color );
16046 _emissiveColor.copy( material.emissive );
16047
16048 if ( material.vertexColors === THREE.FaceColors ) {
16049
16050 _diffuseColor.multiply( element.color );
16051
16052 }
16053
16054 if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 4 ) {
16055
16056 _color1.copy( _ambientLight );
16057 _color2.copy( _ambientLight );
16058 _color3.copy( _ambientLight );
16059 _color4.copy( _ambientLight );
16060
16061 calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 );
16062 calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 );
16063 calculateLight( element.v4.positionWorld, element.vertexNormalsModel[ 3 ], _color3 );
16064 calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color4 );
16065
16066 _color1.multiply( _diffuseColor ).add( _emissiveColor );
16067 _color2.multiply( _diffuseColor ).add( _emissiveColor );
16068 _color3.multiply( _diffuseColor ).add( _emissiveColor );
16069 _color4.multiply( _diffuseColor ).add( _emissiveColor );
16070
16071 _image = getGradientTexture( _color1, _color2, _color3, _color4 );
16072
16073 // TODO: UVs are incorrect, v4->v3?
16074

Callers 1

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