浏览代码

Lights with a target will have their target automatically added to the scene to honor matrixAutoUpdate.

Erik Kitson 13 年之前
父节点
当前提交
39dadf18f4
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 0 1
      examples/webgl_materials_cubemap_dynamic.html
  2. 6 0
      src/scenes/Scene.js

+ 0 - 1
examples/webgl_materials_cubemap_dynamic.html

@@ -178,7 +178,6 @@
 				spotLight.shadowMapHeight = SHADOW_MAP_HEIGHT;
 
 				scene.add( spotLight );
-				scene.add( spotLight.target );
 
 				directionalLight2 = new THREE.PointLight( 0xff9900, 0.25 );
 				directionalLight2.position.set( 0.5, -1, 0.5 );

+ 6 - 0
src/scenes/Scene.js

@@ -32,6 +32,12 @@ THREE.Scene.prototype.addObject = function ( object ) {
 
 		}
 
+		if ( object.target && object.target.parent === undefined ) {
+
+			this.add( object.target );
+
+		}
+
 	} else if ( !( object instanceof THREE.Camera || object instanceof THREE.Bone ) ) {
 
 		if ( this.__objects.indexOf( object ) === - 1 ) {