Browse Source

Removed Scene.__objects as per @filgf suggestion in #3840.

Mr.doob 12 years ago
parent
commit
57a96193db
1 changed files with 10 additions and 23 deletions
  1. 10 23
      src/scenes/Scene.js

+ 10 - 23
src/scenes/Scene.js

@@ -12,7 +12,6 @@ THREE.Scene = function () {
 	this.autoUpdate = true; // checked by the renderer
 	this.matrixAutoUpdate = false;
 
-	this.__objects = [];
 	this.__lights = [];
 
 	this.__objectsAdded = [];
@@ -40,20 +39,15 @@ THREE.Scene.prototype.__addObject = function ( object ) {
 
 	} 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 ) ) {
 
-		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 );
 
 		}