Skip to content

Commit d0cb1ba

Browse files
committed
WebGLRenderer: Removed unneeded checks.
1 parent b7dbcb0 commit d0cb1ba

File tree

1 file changed

+39
-37
lines changed

1 file changed

+39
-37
lines changed

src/renderers/WebGLRenderer.js

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,9 @@ function WebGLRenderer( parameters ) {
632632

633633
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.normal );
634634

635-
if ( material.type !== 'MeshPhongMaterial' && material.type !== 'MeshStandardMaterial' && material.type !== 'MeshPhysicalMaterial' && material.shading === FlatShading ) {
635+
if ( ! material.isMeshPhongMaterial &&
636+
! material.isMeshStandardMaterial &&
637+
material.shading === FlatShading ) {
636638

637639
for ( var i = 0, l = object.count * 3; i < l; i += 9 ) {
638640

@@ -1442,7 +1444,7 @@ function WebGLRenderer( parameters ) {
14421444

14431445
var geometry = objects.update( object );
14441446

1445-
if ( material && material.isMultiMaterial ) {
1447+
if ( material.isMultiMaterial ) {
14461448

14471449
var groups = geometry.groups;
14481450
var materials = material.materials;
@@ -1625,9 +1627,9 @@ function WebGLRenderer( parameters ) {
16251627

16261628
var uniforms = materialProperties.__webglShader.uniforms;
16271629

1628-
if ( ! ( material && material.isShaderMaterial ) &&
1629-
! ( material && material.isRawShaderMaterial ) ||
1630-
material.clipping === true ) {
1630+
if ( ! material.isShaderMaterial &&
1631+
! material.isRawShaderMaterial |
1632+
material.clipping === true ) {
16311633

16321634
materialProperties.numClippingPlanes = _clipping.numPlanes;
16331635
uniforms.clippingPlanes = _clipping.uniform;
@@ -1806,10 +1808,10 @@ function WebGLRenderer( parameters ) {
18061808
// load material specific uniforms
18071809
// (shader material also gets them for the sake of genericity)
18081810

1809-
if ( ( material && material.isShaderMaterial ) ||
1810-
( material && material.isMeshPhongMaterial ) ||
1811-
( material && material.isMeshStandardMaterial ) ||
1812-
material.envMap ) {
1811+
if ( material.isShaderMaterial ||
1812+
material.isMeshPhongMaterial ||
1813+
material.isMeshStandardMaterial ||
1814+
material.envMap ) {
18131815

18141816
var uCamPos = p_uniforms.map.cameraPosition;
18151817

@@ -1822,12 +1824,12 @@ function WebGLRenderer( parameters ) {
18221824

18231825
}
18241826

1825-
if ( ( material && material.isMeshPhongMaterial ) ||
1826-
( material && material.isMeshLambertMaterial ) ||
1827-
( material && material.isMeshBasicMaterial ) ||
1828-
( material && material.isMeshStandardMaterial ) ||
1829-
( material && material.isShaderMaterial ) ||
1830-
material.skinning ) {
1827+
if ( material.isMeshPhongMaterial ||
1828+
material.isMeshLambertMaterial ||
1829+
material.isMeshBasicMaterial ||
1830+
material.isMeshStandardMaterial ||
1831+
material.isShaderMaterial ||
1832+
material.skinning ) {
18311833

18321834
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
18331835

@@ -1892,48 +1894,48 @@ function WebGLRenderer( parameters ) {
18921894

18931895
}
18941896

1895-
if ( ( material && material.isMeshBasicMaterial ) ||
1896-
( material && material.isMeshLambertMaterial ) ||
1897-
( material && material.isMeshPhongMaterial ) ||
1898-
( material && material.isMeshStandardMaterial ) ||
1899-
( material && material.isMeshDepthMaterial ) ) {
1897+
if ( material.isMeshBasicMaterial ||
1898+
material.isMeshLambertMaterial ||
1899+
material.isMeshPhongMaterial ||
1900+
material.isMeshStandardMaterial ||
1901+
material.isMeshDepthMaterial ) {
19001902

19011903
refreshUniformsCommon( m_uniforms, material );
19021904

19031905
}
19041906

19051907
// refresh single material specific uniforms
19061908

1907-
if ( material && material.isLineBasicMaterial ) {
1909+
if ( material.isLineBasicMaterial ) {
19081910

19091911
refreshUniformsLine( m_uniforms, material );
19101912

1911-
} else if ( material && material.isLineDashedMaterial ) {
1913+
} else if ( material.isLineDashedMaterial ) {
19121914

19131915
refreshUniformsLine( m_uniforms, material );
19141916
refreshUniformsDash( m_uniforms, material );
19151917

1916-
} else if ( material && material.isPointsMaterial ) {
1918+
} else if ( material.isPointsMaterial ) {
19171919

19181920
refreshUniformsPoints( m_uniforms, material );
19191921

1920-
} else if ( material && material.isMeshLambertMaterial ) {
1922+
} else if ( material.isMeshLambertMaterial ) {
19211923

19221924
refreshUniformsLambert( m_uniforms, material );
19231925

1924-
} else if ( material && material.isMeshPhongMaterial ) {
1926+
} else if ( material.isMeshPhongMaterial ) {
19251927

19261928
refreshUniformsPhong( m_uniforms, material );
19271929

1928-
} else if ( material && material.isMeshPhysicalMaterial ) {
1930+
} else if ( material.isMeshPhysicalMaterial ) {
19291931

19301932
refreshUniformsPhysical( m_uniforms, material );
19311933

1932-
} else if ( material && material.isMeshStandardMaterial ) {
1934+
} else if ( material.isMeshStandardMaterial ) {
19331935

19341936
refreshUniformsStandard( m_uniforms, material );
19351937

1936-
} else if ( material && material.isMeshDepthMaterial ) {
1938+
} else if ( material.isMeshDepthMaterial ) {
19371939

19381940
if ( material.displacementMap ) {
19391941

@@ -1943,7 +1945,7 @@ function WebGLRenderer( parameters ) {
19431945

19441946
}
19451947

1946-
} else if ( material && material.isMeshNormalMaterial ) {
1948+
} else if ( material.isMeshNormalMaterial ) {
19471949

19481950
m_uniforms.opacity.value = material.opacity;
19491951

@@ -2055,7 +2057,7 @@ function WebGLRenderer( parameters ) {
20552057
if ( uvScaleMap !== undefined ) {
20562058

20572059
// backwards compatibility
2058-
if ( (uvScaleMap && uvScaleMap.isWebGLRenderTarget) ) {
2060+
if ( uvScaleMap.isWebGLRenderTarget ) {
20592061

20602062
uvScaleMap = uvScaleMap.texture;
20612063

@@ -2120,12 +2122,12 @@ function WebGLRenderer( parameters ) {
21202122

21212123
uniforms.fogColor.value = fog.color;
21222124

2123-
if ( fog && fog.isFog ) {
2125+
if ( fog.isFog ) {
21242126

21252127
uniforms.fogNear.value = fog.near;
21262128
uniforms.fogFar.value = fog.far;
21272129

2128-
} else if ( fog && fog.isFogExp2 ) {
2130+
} else if ( fog.isFogExp2 ) {
21292131

21302132
uniforms.fogDensity.value = fog.density;
21312133

@@ -2323,13 +2325,13 @@ function WebGLRenderer( parameters ) {
23232325

23242326
shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null;
23252327

2326-
if ( light && light.isAmbientLight ) {
2328+
if ( light.isAmbientLight ) {
23272329

23282330
r += color.r * intensity;
23292331
g += color.g * intensity;
23302332
b += color.b * intensity;
23312333

2332-
} else if ( light && light.isDirectionalLight ) {
2334+
} else if ( light.isDirectionalLight ) {
23332335

23342336
var uniforms = lightCache.get( light );
23352337

@@ -2353,7 +2355,7 @@ function WebGLRenderer( parameters ) {
23532355
_lights.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix;
23542356
_lights.directional[ directionalLength ++ ] = uniforms;
23552357

2356-
} else if ( light && light.isSpotLight ) {
2358+
} else if ( light.isSpotLight ) {
23572359

23582360
var uniforms = lightCache.get( light );
23592361

@@ -2386,7 +2388,7 @@ function WebGLRenderer( parameters ) {
23862388
_lights.spotShadowMatrix[ spotLength ] = light.shadow.matrix;
23872389
_lights.spot[ spotLength ++ ] = uniforms;
23882390

2389-
} else if ( light && light.isPointLight ) {
2391+
} else if ( light.isPointLight ) {
23902392

23912393
var uniforms = lightCache.get( light );
23922394

@@ -2422,7 +2424,7 @@ function WebGLRenderer( parameters ) {
24222424

24232425
_lights.point[ pointLength ++ ] = uniforms;
24242426

2425-
} else if ( light && light.isHemisphereLight ) {
2427+
} else if ( light.isHemisphereLight ) {
24262428

24272429
var uniforms = lightCache.get( light );
24282430

0 commit comments

Comments
 (0)