فهرست منبع

Examples: Avoid creating instances of LightShadow.

Mugen87 5 سال پیش
والد
کامیت
cecc15939b
2فایلهای تغییر یافته به همراه11 افزوده شده و 17 حذف شده
  1. 3 1
      examples/webgl_geometry_spline_editor.html
  2. 8 16
      examples/webgl_shading_physical.html

+ 3 - 1
examples/webgl_geometry_spline_editor.html

@@ -87,8 +87,10 @@
 				scene.add( new THREE.AmbientLight( 0xf0f0f0 ) );
 				var light = new THREE.SpotLight( 0xffffff, 1.5 );
 				light.position.set( 0, 1500, 200 );
+				light.angle = Math.PI * 0.2;
 				light.castShadow = true;
-				light.shadow = new THREE.LightShadow( new THREE.PerspectiveCamera( 70, 1, 200, 2000 ) );
+				light.shadow.camera.near = 200;
+				light.shadow.camera.far = 2000;
 				light.shadow.bias = - 0.000222;
 				light.shadow.mapSize.width = 1024;
 				light.shadow.mapSize.height = 1024;

+ 8 - 16
examples/webgl_shading_physical.html

@@ -43,7 +43,6 @@
 				shadowCameraVisible: false,
 				shadowCameraNear: 750,
 				shadowCameraFar: 4000,
-				shadowCameraFov: 30,
 				shadowBias: - 0.0002
 
 			};
@@ -191,9 +190,6 @@
 					var s = 200;
 					mesh.scale.set( s, s, s );
 
-					//morph.duration = 8000;
-					//morph.mirroredLoop = true;
-
 					mesh.castShadow = true;
 					mesh.receiveShadow = true;
 
@@ -209,12 +205,16 @@
 				pointLight = new THREE.PointLight( 0xffaa00, 1, 5000 );
 				scene.add( pointLight );
 
-				sunLight = new THREE.SpotLight( 0xffffff, 0.3, 0, Math.PI / 2 );
+				sunLight = new THREE.DirectionalLight( 0xffffff, 0.3 );
 				sunLight.position.set( 1000, 2000, 1000 );
-
 				sunLight.castShadow = true;
-
-				sunLight.shadow = new THREE.LightShadow( new THREE.PerspectiveCamera( shadowConfig.shadowCameraFov, 1, shadowConfig.shadowCameraNear, shadowConfig.shadowCameraFar ) );
+				sunLight.shadow.camera.top = 750;
+				sunLight.shadow.camera.bottom = - 750;
+				sunLight.shadow.camera.left = - 750;
+				sunLight.shadow.camera.right = 750;
+				sunLight.shadow.camera.near = shadowConfig.shadowCameraNear;
+				sunLight.shadow.camera.far = shadowConfig.shadowCameraFar;
+				sunLight.shadow.mapSize.set( 1024, 1024 );
 				sunLight.shadow.bias = shadowConfig.shadowBias;
 
 				scene.add( sunLight );
@@ -291,14 +291,6 @@
 
 				} );
 
-				shadowGUI.add( shadowConfig, 'shadowCameraFov', 1, 120 ).onChange( function () {
-
-					sunLight.shadow.camera.fov = shadowConfig.shadowCameraFov;
-					sunLight.shadow.camera.updateProjectionMatrix();
-					shadowCameraHelper.update();
-
-				} );
-
 				shadowGUI.add( shadowConfig, 'shadowBias', - 0.01, 0.01 ).onChange( function () {
 
 					sunLight.shadow.bias = shadowConfig.shadowBias;