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

Function renderFace3

Three.js/js/Three56.js:13986–14156  ·  view source on GitHub ↗
( v1, v2, v3, uv1, uv2, uv3, element, material )

Source from the content-addressed store, hash-verified

13984 }
13985
13986 function renderFace3( v1, v2, v3, uv1, uv2, uv3, element, material ) {
13987
13988 _this.info.render.vertices += 3;
13989 _this.info.render.faces ++;
13990
13991 setOpacity( material.opacity );
13992 setBlending( material.blending );
13993
13994 _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y;
13995 _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y;
13996 _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y;
13997
13998 drawTriangle( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y );
13999
14000 if ( ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) && material.map === null ) {
14001
14002 _diffuseColor.copy( material.color );
14003 _emissiveColor.copy( material.emissive );
14004
14005 if ( material.vertexColors === THREE.FaceColors ) {
14006
14007 _diffuseColor.multiply( element.color );
14008
14009 }
14010
14011 if ( _enableLighting === true ) {
14012
14013 if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 3 ) {
14014
14015 _color1.copy( _ambientLight );
14016 _color2.copy( _ambientLight );
14017 _color3.copy( _ambientLight );
14018
14019 calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 );
14020 calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 );
14021 calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color3 );
14022
14023 _color1.multiply( _diffuseColor ).add( _emissiveColor );
14024 _color2.multiply( _diffuseColor ).add( _emissiveColor );
14025 _color3.multiply( _diffuseColor ).add( _emissiveColor );
14026 _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 );
14027
14028 _image = getGradientTexture( _color1, _color2, _color3, _color4 );
14029
14030 clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image );
14031
14032 } else {
14033
14034 _color.copy( _ambientLight );
14035
14036 calculateLight( element.centroidModel, element.normalModel, _color );
14037
14038 _color.multiply( _diffuseColor ).add( _emissiveColor );
14039
14040 material.wireframe === true
14041 ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
14042 : fillPath( _color );
14043

Callers 2

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