Skip to content

Commit f9a3638

Browse files
committed
Docs: Simplified light setup in material browser.
1 parent 5a51f73 commit f9a3638

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

docs/scenes/material-browser.html

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,8 @@
637637

638638
// only use a single point light
639639

640-
lights[ 0 ].visible = false;
641-
lights[ 2 ].visible = false;
640+
light1.visible = false;
641+
light3.visible = false;
642642

643643
return material;
644644

@@ -718,18 +718,17 @@
718718
const ambientLight = new THREE.AmbientLight( 0x000000 );
719719
scene.add( ambientLight );
720720

721-
const lights = [];
722-
lights[ 0 ] = new THREE.PointLight( 0xffffff, 1, 0 );
723-
lights[ 1 ] = new THREE.PointLight( 0xffffff, 1, 0 );
724-
lights[ 2 ] = new THREE.PointLight( 0xffffff, 1, 0 );
721+
const light1 = new THREE.PointLight( 0xffffff, 1, 0 );
722+
light1.position.set( 0, 200, 0 );
723+
scene.add( light1 );
725724

726-
lights[ 0 ].position.set( 0, 200, 0 );
727-
lights[ 1 ].position.set( 100, 200, 100 );
728-
lights[ 2 ].position.set( - 100, - 200, - 100 );
725+
const light2 = new THREE.PointLight( 0xffffff, 1, 0 );
726+
light2.position.set( 100, 200, 100 );
727+
scene.add( light2 );
729728

730-
scene.add( lights[ 0 ] );
731-
scene.add( lights[ 1 ] );
732-
scene.add( lights[ 2 ] );
729+
const light3 = new THREE.PointLight( 0xffffff, 1, 0 );
730+
light3.position.set( - 100, - 200, - 100 );
731+
scene.add( light3 );
733732

734733
guiScene( gui, scene, camera );
735734

0 commit comments

Comments
 (0)