Bläddra i källkod

Merge pull request #1450 from nockawa/master

BaseTexture: adding uid read-only property that uniquely identifies the object
David Catuhe 8 år sedan
förälder
incheckning
a180d55097
1 ändrade filer med 9 tillägg och 0 borttagningar
  1. 9 0
      src/Materials/Textures/babylon.baseTexture.ts

+ 9 - 0
src/Materials/Textures/babylon.baseTexture.ts

@@ -33,6 +33,13 @@
         @serialize()
         public isRenderTarget = false;
 
+        public get uid(): string {
+            if (!this._uid) {
+                this._uid = Tools.RandomId();
+            }
+            return this._uid;
+        }
+
         public toString(): string {
             return this.name;
         }
@@ -59,10 +66,12 @@
 
         private _scene: Scene;
         public _texture: WebGLTexture;
+        private _uid: string;
 
         constructor(scene: Scene) {
             this._scene = scene;
             this._scene.textures.push(this);
+            this._uid = null;
         }
 
         public getScene(): Scene {