Browse Source

Making Object3D.remove() also remove virtual lights when removing cascade light

MiiBond 12 years ago
parent
commit
3766a77c5f
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/scenes/Scene.js

+ 6 - 0
src/scenes/Scene.js

@@ -79,6 +79,12 @@ THREE.Scene.prototype.__removeObject = function ( object ) {
 
 		}
 
+		if ( object.shadowCascadeArray ) {
+			for ( var x = 0; x < object.shadowCascadeArray.length; x++ ) {
+				this.__removeObject( object.shadowCascadeArray[ x ] );
+			}
+		}
+
 	} else if ( !( object instanceof THREE.Camera ) ) {
 
 		var i = this.__objects.indexOf( object );