瀏覽代碼

Docs: Simplified light setup in material browser.

Mr.doob 4 年之前
父節點
當前提交
f9a3638732
共有 1 個文件被更改,包括 11 次插入12 次删除
  1. 11 12
      docs/scenes/material-browser.html

+ 11 - 12
docs/scenes/material-browser.html

@@ -637,8 +637,8 @@
 
 						// only use a single point light
 
-						lights[ 0 ].visible = false;
-						lights[ 2 ].visible = false;
+						light1.visible = false;
+						light3.visible = false;
 
 						return material;
 
@@ -718,18 +718,17 @@
 			const ambientLight = new THREE.AmbientLight( 0x000000 );
 			scene.add( ambientLight );
 
-			const lights = [];
-			lights[ 0 ] = new THREE.PointLight( 0xffffff, 1, 0 );
-			lights[ 1 ] = new THREE.PointLight( 0xffffff, 1, 0 );
-			lights[ 2 ] = new THREE.PointLight( 0xffffff, 1, 0 );
+			const light1 = new THREE.PointLight( 0xffffff, 1, 0 );
+			light1.position.set( 0, 200, 0 );
+			scene.add( light1 );
 
-			lights[ 0 ].position.set( 0, 200, 0 );
-			lights[ 1 ].position.set( 100, 200, 100 );
-			lights[ 2 ].position.set( - 100, - 200, - 100 );
+			const light2 = new THREE.PointLight( 0xffffff, 1, 0 );
+			light2.position.set( 100, 200, 100 );
+			scene.add( light2 );
 
-			scene.add( lights[ 0 ] );
-			scene.add( lights[ 1 ] );
-			scene.add( lights[ 2 ] );
+			const light3 = new THREE.PointLight( 0xffffff, 1, 0 );
+			light3.position.set( - 100, - 200, - 100 );
+			scene.add( light3 );
 
 			guiScene( gui, scene, camera );