Browse Source

Fix minor code style issues in shadowmap code

Olli Etuaho 6 years ago
parent
commit
4080c96cd6
2 changed files with 12 additions and 8 deletions
  1. 9 5
      examples/webgl_shadowmap_pointlight.html
  2. 3 3
      src/renderers/webgl/WebGLLights.js

+ 9 - 5
examples/webgl_shadowmap_pointlight.html

@@ -90,11 +90,12 @@
 
 				// The extra point lights demonstrate that it's possible to have lots of non-shadow-casting lights in
 				// the same scene as the shadow casting lights.
-				var createExtraLight = function() {
+				var createExtraLight = function () {
+
 					var pointLight = new THREE.PointLight( 0xffffff, 0.1, 20 );
-					pointLight.position.x = (Math.random() - 0.5) * 29;
-					pointLight.position.y = (Math.random() - 0.5) * 29;
-					pointLight.position.z = (Math.random() - 0.5) * 29;
+					pointLight.position.x = ( Math.random() - 0.5 ) * 29;
+					pointLight.position.y = ( Math.random() - 0.5 ) * 29;
+					pointLight.position.z = ( Math.random() - 0.5 ) * 29;
 
 					var geometry = new THREE.SphereBufferGeometry( 0.1, 10, 6 );
 					var material = new THREE.MeshBasicMaterial( { color: 0xffffff } );
@@ -102,14 +103,17 @@
 					pointLight.add( sphere );
 
 					return pointLight;
+
 				};
 
 				var extraPointLights = new THREE.Object3D();
 				scene.add( extraPointLights );
 				extraPointLights.position.set( 0, 10, 0 );
 
-				for ( var i = 0; i < 20; ++i ) {
+				for ( var i = 0; i < 20; i ++ ) {
+
 					extraPointLights.add( createExtraLight() );
+
 				}
 
 				//

+ 3 - 3
src/renderers/webgl/WebGLLights.js

@@ -221,7 +221,7 @@ function WebGLLights() {
 					state.directionalShadowMap[ directionalLength ] = shadowMap;
 					state.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix;
 
-					++ numDirectionalShadows;
+					numDirectionalShadows ++;
 
 				}
 
@@ -261,7 +261,7 @@ function WebGLLights() {
 					state.spotShadowMap[ spotLength ] = shadowMap;
 					state.spotShadowMatrix[ spotLength ] = light.shadow.matrix;
 
-					++ numSpotShadows;
+					numSpotShadows ++;
 
 				}
 
@@ -327,7 +327,7 @@ function WebGLLights() {
 					state.pointShadowMap[ pointLength ] = shadowMap;
 					state.pointShadowMatrix[ pointLength ] = light.shadow.matrix;
 
-					++ numPointShadows;
+					numPointShadows ++;
 
 				}