Răsfoiți Sursa

Recommended Updates

Thanks for the peer review, all excellent points.
Master James 9 ani în urmă
părinte
comite
9c04c89e24
1 a modificat fișierele cu 16 adăugiri și 18 ștergeri
  1. 16 18
      examples/webgl_lights_spotlight.html

+ 16 - 18
examples/webgl_lights_spotlight.html

@@ -45,26 +45,26 @@
 		<script src="js/Detector.js"></script>
 
 		<script>
-			let container = document.getElementById( 'container' );
+			var container = document.getElementById( 'container' );
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
-			let rnd = new THREE.WebGLRenderer();
-			let cam = new THREE.PerspectiveCamera(34, window.innerWidth / window.innerHeight, 0.1, 20000);
-			let orb = new THREE.OrbitControls(cam, document);
+			var rnd = new THREE.WebGLRenderer();
+			var cam = new THREE.PerspectiveCamera(34, window.innerWidth / window.innerHeight, 0.1, 20000);
+			var orb = new THREE.OrbitControls(cam, rnd.domElement);
 
-			let scn = new THREE.Scene();
-			let matFloor = new THREE.MeshPhongMaterial();
-			let matBox = new THREE.MeshPhongMaterial();
-			let geoFloor = new THREE.BoxGeometry(2000, 0.1, 2000);
-			let geoBox = new THREE.BoxGeometry(Math.PI, Math.sqrt(2), Math.E);
-			let mshFloor = new THREE.Mesh(geoFloor, matFloor);
-			let mshBox = new THREE.Mesh(geoBox, matBox);
-			let amb = new THREE.AmbientLight(0x121422);
-			let spt = new THREE.SpotLight(0xFFFFFF);
-			let lightHelper;
+			var scn = new THREE.Scene();
+			var matFloor = new THREE.MeshPhongMaterial();
+			var matBox = new THREE.MeshPhongMaterial();
+			var geoFloor = new THREE.BoxGeometry(2000, 0.1, 2000);
+			var geoBox = new THREE.BoxGeometry(Math.PI, Math.sqrt(2), Math.E);
+			var mshFloor = new THREE.Mesh(geoFloor, matFloor);
+			var mshBox = new THREE.Mesh(geoBox, matBox);
+			var amb = new THREE.AmbientLight(0x121422);
+			var spt = new THREE.SpotLight(0xFFFFFF);
+			var lightHelper;
 
-			let gui, guiElements, param = { color: '0xffffff' };
+			var gui, guiElements, param = { color: '0xffffff' };
 
 			function init() {
 				rnd.shadowMap.enabled = true;
@@ -93,17 +93,15 @@
 				lightHelper = new THREE.SpotLightHelper( spt );
 
 				matFloor.color.set( 0x808080 );
-				matFloor.color.a = 1.0;
 
 				mshFloor.receiveShadow = true;
 				mshFloor.position.set(0, -0.05, 0);
 
-				matBox.color = { r: Math.random(), g: Math.random(), b: Math.random(), a: 1.0 };
+				matBox.color.setHex( 0xffffff * Math.random() );
 				mshBox.castShadow = true;
 				mshBox.receiveShadow = true;
 				mshBox.position.set(40, 1.8, 0);
 
-
 				scn.add(cam);
 				scn.add(mshFloor);
 				scn.add(mshBox);