@@ -8,10 +8,10 @@
THREE.Geometry = function () {
- this.id = THREE.GeometryLibrary.length;
-
THREE.GeometryLibrary.push( this );
+ this.id = THREE.GeometryIdCount ++;
+
this.name = '';
this.vertices = [];
@@ -677,10 +677,12 @@ THREE.Geometry.prototype = {
deallocate: function () {
- THREE.GeometryLibrary[ this.id ] = null;
+ var index = THREE.GeometryLibrary.indexOf( this );
+ if ( index !== -1 ) THREE.GeometryLibrary.splice( index, 1 );
}
};
+THREE.GeometryIdCount = 0;
THREE.GeometryLibrary = [];
@@ -6,10 +6,10 @@
THREE.Object3D = function () {
- this.id = THREE.Object3DLibrary.length;
THREE.Object3DLibrary.push( this );
+ this.id = THREE.Object3DIdCount ++;
this.properties = {};
@@ -347,7 +347,8 @@ THREE.Object3D.prototype = {
- THREE.Object3DLibrary[ this.id ] = null;
+ var index = THREE.Object3DLibrary.indexOf( this );
+ if ( index !== -1 ) THREE.Object3DLibrary.splice( index, 1 );
@@ -356,4 +357,5 @@ THREE.Object3D.prototype = {
THREE.Object3D.__m1 = new THREE.Matrix4();
THREE.Object3D.defaultEulerOrder = 'XYZ',
+THREE.Object3DIdCount = 0;
THREE.Object3DLibrary = [];
@@ -5,10 +5,10 @@
THREE.Material = function () {
- this.id = THREE.MaterialLibrary.length;
THREE.MaterialLibrary.push( this );
+ this.id = THREE.MaterialIdCount ++;
this.side = THREE.FrontSide;
@@ -118,8 +118,10 @@ THREE.Material.prototype.clone = function ( material ) {
THREE.Material.prototype.deallocate = function () {
- THREE.MaterialLibrary[ this.id ] = null;
+ var index = THREE.MaterialLibrary.indexOf( this );
+ if ( index !== -1 ) THREE.MaterialLibrary.splice( index, 1 );
+THREE.MaterialIdCount = 0;
THREE.MaterialLibrary = [];
THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
- this.id = THREE.TextureLibrary.length;
THREE.TextureLibrary.push( this );
+ this.id = THREE.TextureIdCount ++;
this.image = image;
this.mapping = mapping !== undefined ? mapping : new THREE.UVMapping();
@@ -73,10 +73,12 @@ THREE.Texture.prototype = {
- THREE.TextureLibrary[ this.id ] = null;
+ var index = THREE.TextureLibrary.indexOf( this );
+ if ( index !== -1 ) THREE.TextureLibrary.splice( index, 1 );
+THREE.TextureIdCount = 0;
THREE.TextureLibrary = [];