浏览代码

Fixed *LightShadow .clone(). See b23a98f82b9493a39d52b376545de4a3d69604f4.

Mr.doob 9 年之前
父节点
当前提交
ee927d81eb
共有 2 个文件被更改,包括 15 次插入15 次删除
  1. 3 0
      src/lights/DirectionalLightShadow.js
  2. 12 15
      src/lights/SpotLightShadow.js

+ 3 - 0
src/lights/DirectionalLightShadow.js

@@ -7,3 +7,6 @@ THREE.DirectionalLightShadow = function ( light ) {
 	THREE.LightShadow.call( this, new THREE.OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );
 
 };
+
+THREE.DirectionalLightShadow.prototype = Object.create( THREE.LightShadow.prototype );
+THREE.DirectionalLightShadow.prototype.constructor = THREE.DirectionalLightShadow;

+ 12 - 15
src/lights/SpotLightShadow.js

@@ -8,26 +8,23 @@ THREE.SpotLightShadow = function () {
 
 };
 
-THREE.SpotLightShadow.prototype = {
+THREE.SpotLightShadow.prototype = Object.create( THREE.LightShadow.prototype );
+THREE.SpotLightShadow.prototype.constructor = THREE.SpotLightShadow;
 
-	constructor: THREE.SpotLightShadow,
+THREE.SpotLightShadow.prototype.update = function ( light ) {
 
-	update: function ( light ) {
+	var fov = THREE.Math.radToDeg( 2 * light.angle );
+	var aspect = this.mapSize.width / this.mapSize.height;
+	var far = light.distance || 500;
 
-		var fov = THREE.Math.radToDeg( 2 * light.angle );
-		var aspect = this.mapSize.width / this.mapSize.height;
-		var far = light.distance || 500;
+	var camera = this.camera;
 
-		var camera = this.camera;
+	if ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {
 
-		if ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {
-
-			camera.fov = fov;
-			camera.aspect = aspect;
-			camera.far = far;
-			camera.updateProjectionMatrix();
-
-		}
+		camera.fov = fov;
+		camera.aspect = aspect;
+		camera.far = far;
+		camera.updateProjectionMatrix();
 
 	}