aardgoose 6 anni fa
parent
commit
acac3f260b
1 ha cambiato i file con 5 aggiunte e 4 eliminazioni
  1. 5 4
      examples/webgl_layers.html

+ 5 - 4
examples/webgl_layers.html

@@ -56,13 +56,16 @@
 				scene = new THREE.Scene();
 				scene.background = new THREE.Color( 0xf0f0f0 );
 
-				var light = new THREE.DirectionalLight( 0xffffff, 1 );
+//				var light = new THREE.DirectionalLight( 0xffffff, 1 );
+				var light = new THREE.PointLight( 0xffffff, 1 );
 				light.position.set( 1, 1, 1 ).normalize();
 				light.layers.enable( 0 );
 				light.layers.enable( 1 );
 				light.layers.enable( 2 );
 
-				scene.add( light );
+				scene.add( camera );
+				camera.add( light );
+//				scene.add( light );
 
 				var colors = [ 0xff0000, 0x00ff00, 0x0000ff ];
 				var geometry = new THREE.BoxBufferGeometry( 20, 20, 20 );
@@ -144,8 +147,6 @@
 				camera.position.z = radius * Math.cos( THREE.Math.degToRad( theta ) );
 				camera.lookAt( scene.position );
 
-				camera.updateMatrixWorld();
-
 				renderer.render( scene, camera );
 
 			}