|
@@ -12,7 +12,6 @@ THREE.Scene = function () {
|
|
this.autoUpdate = true; // checked by the renderer
|
|
this.autoUpdate = true; // checked by the renderer
|
|
this.matrixAutoUpdate = false;
|
|
this.matrixAutoUpdate = false;
|
|
|
|
|
|
- this.__objects = [];
|
|
|
|
this.__lights = [];
|
|
this.__lights = [];
|
|
|
|
|
|
this.__objectsAdded = [];
|
|
this.__objectsAdded = [];
|
|
@@ -40,20 +39,15 @@ THREE.Scene.prototype.__addObject = function ( object ) {
|
|
|
|
|
|
} else if ( !( object instanceof THREE.Camera || object instanceof THREE.Bone ) ) {
|
|
} else if ( !( object instanceof THREE.Camera || object instanceof THREE.Bone ) ) {
|
|
|
|
|
|
- if ( this.__objects.indexOf( object ) === - 1 ) {
|
|
|
|
|
|
+ this.__objectsAdded.push( object );
|
|
|
|
|
|
- this.__objects.push( object );
|
|
|
|
- this.__objectsAdded.push( object );
|
|
|
|
|
|
+ // check if previously removed
|
|
|
|
|
|
- // check if previously removed
|
|
|
|
|
|
+ var i = this.__objectsRemoved.indexOf( object );
|
|
|
|
|
|
- var i = this.__objectsRemoved.indexOf( object );
|
|
|
|
-
|
|
|
|
- if ( i !== -1 ) {
|
|
|
|
|
|
+ if ( i !== -1 ) {
|
|
|
|
|
|
- this.__objectsRemoved.splice( i, 1 );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ this.__objectsRemoved.splice( i, 1 );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -91,22 +85,15 @@ THREE.Scene.prototype.__removeObject = function ( object ) {
|
|
|
|
|
|
} else if ( !( object instanceof THREE.Camera ) ) {
|
|
} else if ( !( object instanceof THREE.Camera ) ) {
|
|
|
|
|
|
- var i = this.__objects.indexOf( object );
|
|
|
|
-
|
|
|
|
- if ( i !== -1 ) {
|
|
|
|
-
|
|
|
|
- this.__objects.splice( i, 1 );
|
|
|
|
- this.__objectsRemoved.push( object );
|
|
|
|
-
|
|
|
|
- // check if previously added
|
|
|
|
|
|
+ this.__objectsRemoved.push( object );
|
|
|
|
|
|
- var ai = this.__objectsAdded.indexOf( object );
|
|
|
|
|
|
+ // check if previously added
|
|
|
|
|
|
- if ( ai !== -1 ) {
|
|
|
|
|
|
+ var i = this.__objectsAdded.indexOf( object );
|
|
|
|
|
|
- this.__objectsAdded.splice( ai, 1 );
|
|
|
|
|
|
+ if ( i !== -1 ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ this.__objectsAdded.splice( i, 1 );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|