Browse Source

Removed ObjectIdCount, MaterialIdCount and TextureIdCount. See #10095.

Mr.doob 8 years ago
parent
commit
9b6bc2556d
4 changed files with 17 additions and 24 deletions
  1. 2 3
      src/Three.js
  2. 5 7
      src/core/Object3D.js
  3. 4 6
      src/materials/Material.js
  4. 6 8
      src/textures/Texture.js

+ 2 - 3
src/Three.js

@@ -27,10 +27,9 @@ export { CompressedTexture } from './textures/CompressedTexture.js';
 export { CubeTexture } from './textures/CubeTexture.js';
 export { CubeTexture } from './textures/CubeTexture.js';
 export { CanvasTexture } from './textures/CanvasTexture.js';
 export { CanvasTexture } from './textures/CanvasTexture.js';
 export { DepthTexture } from './textures/DepthTexture.js';
 export { DepthTexture } from './textures/DepthTexture.js';
-export { TextureIdCount, Texture } from './textures/Texture.js';
+export { Texture } from './textures/Texture.js';
 export * from './geometries/Geometries.js';
 export * from './geometries/Geometries.js';
 export * from './materials/Materials.js';
 export * from './materials/Materials.js';
-export { MaterialIdCount } from './materials/Material.js';
 export { CompressedTextureLoader } from './loaders/CompressedTextureLoader.js';
 export { CompressedTextureLoader } from './loaders/CompressedTextureLoader.js';
 export { BinaryTextureLoader, DataTextureLoader } from './loaders/BinaryTextureLoader.js';
 export { BinaryTextureLoader, DataTextureLoader } from './loaders/BinaryTextureLoader.js';
 export { CubeTextureLoader } from './loaders/CubeTextureLoader.js';
 export { CubeTextureLoader } from './loaders/CubeTextureLoader.js';
@@ -100,7 +99,7 @@ export {
 	BufferAttribute
 	BufferAttribute
 } from './core/BufferAttribute.js';
 } from './core/BufferAttribute.js';
 export { Face3 } from './core/Face3.js';
 export { Face3 } from './core/Face3.js';
-export { Object3DIdCount, Object3D } from './core/Object3D.js';
+export { Object3D } from './core/Object3D.js';
 export { Raycaster } from './core/Raycaster.js';
 export { Raycaster } from './core/Raycaster.js';
 export { Layers } from './core/Layers.js';
 export { Layers } from './core/Layers.js';
 export { EventDispatcher } from './core/EventDispatcher.js';
 export { EventDispatcher } from './core/EventDispatcher.js';

+ 5 - 7
src/core/Object3D.js

@@ -15,9 +15,11 @@ import { _Math } from '../math/Math';
  * @author elephantatwork / www.elephantatwork.ch
  * @author elephantatwork / www.elephantatwork.ch
  */
  */
 
 
+var object3DId = 0;
+
 function Object3D() {
 function Object3D() {
 
 
-	Object.defineProperty( this, 'id', { value: Object3DIdCount() } );
+	Object.defineProperty( this, 'id', { value: object3DId ++ } );
 
 
 	this.uuid = _Math.generateUUID();
 	this.uuid = _Math.generateUUID();
 
 
@@ -91,7 +93,7 @@ function Object3D() {
 
 
 	this.userData = {};
 	this.userData = {};
 
 
-	this.onBeforeRender = function(){}; 
+	this.onBeforeRender = function(){};
 	this.onAfterRender = function(){};
 	this.onAfterRender = function(){};
 
 
 }
 }
@@ -727,8 +729,4 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
 
 
 } );
 } );
 
 
-var count = 0;
-function Object3DIdCount() { return count++; };
-
-
-export { Object3DIdCount, Object3D };
+export { Object3D };

+ 4 - 6
src/materials/Material.js

@@ -7,9 +7,11 @@ import { _Math } from '../math/Math';
  * @author alteredq / http://alteredqualia.com/
  * @author alteredq / http://alteredqualia.com/
  */
  */
 
 
+var materialId = 0;
+
 function Material() {
 function Material() {
 
 
-	Object.defineProperty( this, 'id', { value: MaterialIdCount() } );
+	Object.defineProperty( this, 'id', { value: materialId ++ } );
 
 
 	this.uuid = _Math.generateUUID();
 	this.uuid = _Math.generateUUID();
 
 
@@ -342,8 +344,4 @@ Material.prototype = {
 
 
 Object.assign( Material.prototype, EventDispatcher.prototype );
 Object.assign( Material.prototype, EventDispatcher.prototype );
 
 
-var count = 0;
-function MaterialIdCount() { return count++; };
-
-
-export { MaterialIdCount, Material };
+export { Material };

+ 6 - 8
src/textures/Texture.js

@@ -10,9 +10,11 @@ import { Vector2 } from '../math/Vector2';
  * @author szimek / https://github.com/szimek/
  * @author szimek / https://github.com/szimek/
  */
  */
 
 
+var textureId = 0;
+
 function Texture( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ) {
 function Texture( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ) {
 
 
-	Object.defineProperty( this, 'id', { value: TextureIdCount() } );
+	Object.defineProperty( this, 'id', { value: textureId ++ } );
 
 
 	this.uuid = _Math.generateUUID();
 	this.uuid = _Math.generateUUID();
 
 
@@ -47,7 +49,7 @@ function Texture( image, mapping, wrapS, wrapT, magFilter, minFilter, format, ty
 	//
 	//
 	// Also changing the encoding after already used by a Material will not automatically make the Material
 	// Also changing the encoding after already used by a Material will not automatically make the Material
 	// update.  You need to explicitly call Material.needsUpdate to trigger it to recompile.
 	// update.  You need to explicitly call Material.needsUpdate to trigger it to recompile.
-	this.encoding = encoding !== undefined ? encoding :  LinearEncoding;
+	this.encoding = encoding !== undefined ? encoding : LinearEncoding;
 
 
 	this.version = 0;
 	this.version = 0;
 	this.onUpdate = null;
 	this.onUpdate = null;
@@ -206,7 +208,7 @@ Texture.prototype = {
 
 
 	transformUv: function ( uv ) {
 	transformUv: function ( uv ) {
 
 
-		if ( this.mapping !== UVMapping )  return;
+		if ( this.mapping !== UVMapping ) return;
 
 
 		uv.multiply( this.repeat );
 		uv.multiply( this.repeat );
 		uv.add( this.offset );
 		uv.add( this.offset );
@@ -285,8 +287,4 @@ Texture.prototype = {
 
 
 Object.assign( Texture.prototype, EventDispatcher.prototype );
 Object.assign( Texture.prototype, EventDispatcher.prototype );
 
 
-var count = 0;
-function TextureIdCount() { return count++; };
-
-
-export { TextureIdCount, Texture };
+export { Texture };