Browse Source

Examples: Updated webgl_loader_lwo.

Mr.doob 4 years ago
parent
commit
f4601f33b2
2 changed files with 10 additions and 28 deletions
  1. BIN
      examples/screenshots/webgl_loader_lwo.jpg
  2. 10 28
      examples/webgl_loader_lwo.html

BIN
examples/screenshots/webgl_loader_lwo.jpg


+ 10 - 28
examples/webgl_loader_lwo.html

@@ -37,30 +37,13 @@
 				scene = new THREE.Scene();
 				scene.background = new THREE.Color( 0xa0a0a0 );
 
-				const ambientLight = new THREE.AmbientLight( 0xaaaaaa, 1.75 );
+				const ambientLight = new THREE.AmbientLight( 0x222222 );
 				scene.add( ambientLight );
 
-				const light1 = new THREE.DirectionalLight( 0xffffff, 1 );
+				const light1 = new THREE.DirectionalLight( 0x888888 );
 				light1.position.set( 0, 200, 100 );
-				light1.castShadow = true;
-				light1.shadow.camera.top = 180;
-				light1.shadow.camera.bottom = - 100;
-				light1.shadow.camera.left = - 120;
-				light1.shadow.camera.right = 120;
 				scene.add( light1 );
 
-				const light2 = new THREE.DirectionalLight( 0xffffff, 0.7 );
-				light2.position.set( - 100, 200, - 100 );
-				scene.add( light2 );
-
-				const light3 = new THREE.DirectionalLight( 0xffffff, 0.4 );
-				light3.position.set( 100, - 200, 100 );
-				scene.add( light3 );
-
-				const light4 = new THREE.DirectionalLight( 0xffffff, 1 );
-				light4.position.set( - 100, - 100, 100 );
-				scene.add( light4 );
-
 				const grid = new THREE.GridHelper( 200, 20, 0x000000, 0x000000 );
 				grid.material.opacity = 0.3;
 				grid.material.transparent = true;
@@ -85,22 +68,15 @@
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				renderer.shadowMap.enabled = true;
-				renderer.physicallyCorrectLights = true;
-				renderer.gammaFactor = 1.18;
+				renderer.setAnimationLoop( animation );
 				renderer.outputEncoding = THREE.sRGBEncoding;
+				renderer.toneMapping = THREE.ACESFilmicToneMapping;
 				container.appendChild( renderer.domElement );
 
 				const controls = new OrbitControls( camera, renderer.domElement );
 				controls.target.set( 1.33, 10, - 6.7 );
 				controls.update();
 
-				renderer.setAnimationLoop( function () {
-
-					renderer.render( scene, camera );
-
-				} );
-
 				window.addEventListener( 'resize', onWindowResize );
 
 			}
@@ -114,6 +90,12 @@
 
 			}
 
+			function animation() {
+
+				renderer.render( scene, camera );
+
+			}
+
 		</script>
 
 	</body>