David Catuhe 9 years ago
parent
commit
8e85e43325

File diff suppressed because it is too large
+ 12 - 12
dist/preview release/babylon.core.js


File diff suppressed because it is too large
+ 548 - 546
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 27 - 27
dist/preview release/babylon.js


+ 39 - 17
dist/preview release/babylon.max.js

@@ -9927,7 +9927,7 @@ var BABYLON;
          * @Deprecated. Use getPhysicsImpostor().getParam("restitution");
          * @Deprecated. Use getPhysicsImpostor().getParam("restitution");
          */
          */
         AbstractMesh.prototype.getPhysicsRestitution = function () {
         AbstractMesh.prototype.getPhysicsRestitution = function () {
-            return this.physicsImpostor.getParam("resitution");
+            return this.physicsImpostor.getParam("restitution");
         };
         };
         AbstractMesh.prototype.getPositionInCameraSpace = function (camera) {
         AbstractMesh.prototype.getPositionInCameraSpace = function (camera) {
             if (!camera) {
             if (!camera) {
@@ -10814,7 +10814,7 @@ var BABYLON;
                     return;
                     return;
                 }
                 }
                 if (!_this._shadowMap2) {
                 if (!_this._shadowMap2) {
-                    _this._shadowMap2 = new BABYLON.RenderTargetTexture(light.name + "_shadowMap", mapSize, _this._scene, false);
+                    _this._shadowMap2 = new BABYLON.RenderTargetTexture(light.name + "_shadowMap", mapSize, _this._scene, false, true, textureType);
                     _this._shadowMap2.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
                     _this._shadowMap2.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
                     _this._shadowMap2.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
                     _this._shadowMap2.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
                     _this._shadowMap2.updateSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE);
                     _this._shadowMap2.updateSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE);
@@ -21516,20 +21516,20 @@ var BABYLON;
         };
         };
         BaseTexture.prototype.getSize = function () {
         BaseTexture.prototype.getSize = function () {
             if (this._texture._width) {
             if (this._texture._width) {
-                return { width: this._texture._width, height: this._texture._height };
+                return new BABYLON.Size(this._texture._width, this._texture._height);
             }
             }
             if (this._texture._size) {
             if (this._texture._size) {
-                return { width: this._texture._size, height: this._texture._size };
+                return new BABYLON.Size(this._texture._size, this._texture._size);
             }
             }
-            return { width: 0, height: 0 };
+            return BABYLON.Size.Zero();
         };
         };
         BaseTexture.prototype.getBaseSize = function () {
         BaseTexture.prototype.getBaseSize = function () {
             if (!this.isReady() || !this._texture)
             if (!this.isReady() || !this._texture)
-                return { width: 0, height: 0 };
+                return BABYLON.Size.Zero();
             if (this._texture._size) {
             if (this._texture._size) {
-                return { width: this._texture._size, height: this._texture._size };
+                return new BABYLON.Size(this._texture._size, this._texture._size);
             }
             }
-            return { width: this._texture._baseWidth, height: this._texture._baseHeight };
+            return new BABYLON.Size(this._texture._baseWidth, this._texture._baseHeight);
         };
         };
         BaseTexture.prototype.scale = function (ratio) {
         BaseTexture.prototype.scale = function (ratio) {
         };
         };
@@ -21649,6 +21649,7 @@ var BABYLON;
     var Texture = (function (_super) {
     var Texture = (function (_super) {
         __extends(Texture, _super);
         __extends(Texture, _super);
         function Texture(url, scene, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer) {
         function Texture(url, scene, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer) {
+            var _this = this;
             if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
             if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
             if (onLoad === void 0) { onLoad = null; }
             if (onLoad === void 0) { onLoad = null; }
             if (onError === void 0) { onError = null; }
             if (onError === void 0) { onError = null; }
@@ -21673,25 +21674,29 @@ var BABYLON;
                 return;
                 return;
             }
             }
             this._texture = this._getFromCache(url, noMipmap, samplingMode);
             this._texture = this._getFromCache(url, noMipmap, samplingMode);
+            var load = function () {
+                if (_this._onLoadObservarble && _this._onLoadObservarble.hasObservers()) {
+                    _this.onLoadObservable.notifyObservers(true);
+                }
+                if (onLoad) {
+                    onLoad();
+                }
+            };
             if (!this._texture) {
             if (!this._texture) {
                 if (!scene.useDelayedTextureLoading) {
                 if (!scene.useDelayedTextureLoading) {
-                    this._texture = scene.getEngine().createTexture(url, noMipmap, invertY, scene, this._samplingMode, onLoad, onError, this._buffer);
+                    this._texture = scene.getEngine().createTexture(url, noMipmap, invertY, scene, this._samplingMode, load, onError, this._buffer);
                     if (deleteBuffer) {
                     if (deleteBuffer) {
                         delete this._buffer;
                         delete this._buffer;
                     }
                     }
                 }
                 }
                 else {
                 else {
                     this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
                     this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
-                    this._delayedOnLoad = onLoad;
+                    this._delayedOnLoad = load;
                     this._delayedOnError = onError;
                     this._delayedOnError = onError;
                 }
                 }
             }
             }
             else {
             else {
-                BABYLON.Tools.SetImmediate(function () {
-                    if (onLoad) {
-                        onLoad();
-                    }
-                });
+                BABYLON.Tools.SetImmediate(function () { return load(); });
             }
             }
         }
         }
         Object.defineProperty(Texture.prototype, "noMipmap", {
         Object.defineProperty(Texture.prototype, "noMipmap", {
@@ -21818,6 +21823,16 @@ var BABYLON;
                 return new Texture(_this._texture.url, _this.getScene(), _this._noMipmap, _this._invertY, _this._samplingMode);
                 return new Texture(_this._texture.url, _this.getScene(), _this._noMipmap, _this._invertY, _this._samplingMode);
             }, this);
             }, this);
         };
         };
+        Object.defineProperty(Texture.prototype, "onLoadObservable", {
+            get: function () {
+                if (!this._onLoadObservarble) {
+                    this._onLoadObservarble = new BABYLON.Observable();
+                }
+                return this._onLoadObservarble;
+            },
+            enumerable: true,
+            configurable: true
+        });
         // Statics
         // Statics
         Texture.CreateFromBase64String = function (data, name, scene, noMipmap, invertY, samplingMode, onLoad, onError) {
         Texture.CreateFromBase64String = function (data, name, scene, noMipmap, invertY, samplingMode, onLoad, onError) {
             if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
             if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
@@ -43765,6 +43780,7 @@ var BABYLON;
          * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
          * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
          */
          */
         function Sprite2D(texture, settings) {
         function Sprite2D(texture, settings) {
+            var _this = this;
             if (!settings) {
             if (!settings) {
                 settings = {};
                 settings = {};
             }
             }
@@ -43779,8 +43795,14 @@ var BABYLON;
             this.alignToPixel = (settings.alignToPixel == null) ? true : settings.alignToPixel;
             this.alignToPixel = (settings.alignToPixel == null) ? true : settings.alignToPixel;
             this.isAlphaTest = true;
             this.isAlphaTest = true;
             if (settings.spriteSize == null) {
             if (settings.spriteSize == null) {
-                var s = texture.getSize();
-                this.size = new BABYLON.Size(s.width, s.height);
+                if (texture.isReady()) {
+                    this.size = texture.getSize();
+                }
+                else {
+                    texture.onLoadObservable.add(function () {
+                        _this.size = texture.getSize();
+                    });
+                }
             }
             }
         }
         }
         Object.defineProperty(Sprite2D.prototype, "texture", {
         Object.defineProperty(Sprite2D.prototype, "texture", {

File diff suppressed because it is too large
+ 27 - 27
dist/preview release/babylon.noworker.js


+ 9 - 2
src/Canvas2d/babylon.sprite2d.js

@@ -180,6 +180,7 @@ var BABYLON;
          * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
          * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
          */
          */
         function Sprite2D(texture, settings) {
         function Sprite2D(texture, settings) {
+            var _this = this;
             if (!settings) {
             if (!settings) {
                 settings = {};
                 settings = {};
             }
             }
@@ -194,8 +195,14 @@ var BABYLON;
             this.alignToPixel = (settings.alignToPixel == null) ? true : settings.alignToPixel;
             this.alignToPixel = (settings.alignToPixel == null) ? true : settings.alignToPixel;
             this.isAlphaTest = true;
             this.isAlphaTest = true;
             if (settings.spriteSize == null) {
             if (settings.spriteSize == null) {
-                var s = texture.getSize();
-                this.size = new BABYLON.Size(s.width, s.height);
+                if (texture.isReady()) {
+                    this.size = texture.getSize();
+                }
+                else {
+                    texture.onLoadObservable.add(function () {
+                        _this.size = texture.getSize();
+                    });
+                }
             }
             }
         }
         }
         Object.defineProperty(Sprite2D.prototype, "texture", {
         Object.defineProperty(Sprite2D.prototype, "texture", {

+ 1 - 1
src/Lights/Shadows/babylon.shadowGenerator.js

@@ -48,7 +48,7 @@ var BABYLON;
                     return;
                     return;
                 }
                 }
                 if (!_this._shadowMap2) {
                 if (!_this._shadowMap2) {
-                    _this._shadowMap2 = new BABYLON.RenderTargetTexture(light.name + "_shadowMap", mapSize, _this._scene, false);
+                    _this._shadowMap2 = new BABYLON.RenderTargetTexture(light.name + "_shadowMap", mapSize, _this._scene, false, true, textureType);
                     _this._shadowMap2.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
                     _this._shadowMap2.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
                     _this._shadowMap2.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
                     _this._shadowMap2.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
                     _this._shadowMap2.updateSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE);
                     _this._shadowMap2.updateSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE);

+ 6 - 6
src/Materials/Textures/babylon.baseTexture.js

@@ -64,20 +64,20 @@ var BABYLON;
         };
         };
         BaseTexture.prototype.getSize = function () {
         BaseTexture.prototype.getSize = function () {
             if (this._texture._width) {
             if (this._texture._width) {
-                return { width: this._texture._width, height: this._texture._height };
+                return new BABYLON.Size(this._texture._width, this._texture._height);
             }
             }
             if (this._texture._size) {
             if (this._texture._size) {
-                return { width: this._texture._size, height: this._texture._size };
+                return new BABYLON.Size(this._texture._size, this._texture._size);
             }
             }
-            return { width: 0, height: 0 };
+            return BABYLON.Size.Zero();
         };
         };
         BaseTexture.prototype.getBaseSize = function () {
         BaseTexture.prototype.getBaseSize = function () {
             if (!this.isReady() || !this._texture)
             if (!this.isReady() || !this._texture)
-                return { width: 0, height: 0 };
+                return BABYLON.Size.Zero();
             if (this._texture._size) {
             if (this._texture._size) {
-                return { width: this._texture._size, height: this._texture._size };
+                return new BABYLON.Size(this._texture._size, this._texture._size);
             }
             }
-            return { width: this._texture._baseWidth, height: this._texture._baseHeight };
+            return new BABYLON.Size(this._texture._baseWidth, this._texture._baseHeight);
         };
         };
         BaseTexture.prototype.scale = function (ratio) {
         BaseTexture.prototype.scale = function (ratio) {
         };
         };

+ 3 - 3
src/Materials/Textures/babylon.baseTexture.ts

@@ -93,7 +93,7 @@
             return false;
             return false;
         }
         }
 
 
-        public getSize(): ISize  {
+        public getSize(): ISize {
             if (this._texture._width) {
             if (this._texture._width) {
                 return new Size(this._texture._width, this._texture._height);
                 return new Size(this._texture._width, this._texture._height);
             }
             }
@@ -152,7 +152,7 @@
         }
         }
 
 
         public delayLoad(): void {
         public delayLoad(): void {
-        }        
+        }
 
 
         public clone(): BaseTexture {
         public clone(): BaseTexture {
             return null;
             return null;
@@ -199,6 +199,6 @@
             Animation.AppendSerializedAnimations(this, serializationObject);
             Animation.AppendSerializedAnimations(this, serializationObject);
 
 
             return serializationObject;
             return serializationObject;
-        }     
+        }
     }
     }
 } 
 } 

+ 22 - 7
src/Materials/Textures/babylon.texture.js

@@ -14,6 +14,7 @@ var BABYLON;
     var Texture = (function (_super) {
     var Texture = (function (_super) {
         __extends(Texture, _super);
         __extends(Texture, _super);
         function Texture(url, scene, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer) {
         function Texture(url, scene, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer) {
+            var _this = this;
             if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
             if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
             if (onLoad === void 0) { onLoad = null; }
             if (onLoad === void 0) { onLoad = null; }
             if (onError === void 0) { onError = null; }
             if (onError === void 0) { onError = null; }
@@ -38,25 +39,29 @@ var BABYLON;
                 return;
                 return;
             }
             }
             this._texture = this._getFromCache(url, noMipmap, samplingMode);
             this._texture = this._getFromCache(url, noMipmap, samplingMode);
+            var load = function () {
+                if (_this._onLoadObservarble && _this._onLoadObservarble.hasObservers()) {
+                    _this.onLoadObservable.notifyObservers(true);
+                }
+                if (onLoad) {
+                    onLoad();
+                }
+            };
             if (!this._texture) {
             if (!this._texture) {
                 if (!scene.useDelayedTextureLoading) {
                 if (!scene.useDelayedTextureLoading) {
-                    this._texture = scene.getEngine().createTexture(url, noMipmap, invertY, scene, this._samplingMode, onLoad, onError, this._buffer);
+                    this._texture = scene.getEngine().createTexture(url, noMipmap, invertY, scene, this._samplingMode, load, onError, this._buffer);
                     if (deleteBuffer) {
                     if (deleteBuffer) {
                         delete this._buffer;
                         delete this._buffer;
                     }
                     }
                 }
                 }
                 else {
                 else {
                     this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
                     this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
-                    this._delayedOnLoad = onLoad;
+                    this._delayedOnLoad = load;
                     this._delayedOnError = onError;
                     this._delayedOnError = onError;
                 }
                 }
             }
             }
             else {
             else {
-                BABYLON.Tools.SetImmediate(function () {
-                    if (onLoad) {
-                        onLoad();
-                    }
-                });
+                BABYLON.Tools.SetImmediate(function () { return load(); });
             }
             }
         }
         }
         Object.defineProperty(Texture.prototype, "noMipmap", {
         Object.defineProperty(Texture.prototype, "noMipmap", {
@@ -183,6 +188,16 @@ var BABYLON;
                 return new Texture(_this._texture.url, _this.getScene(), _this._noMipmap, _this._invertY, _this._samplingMode);
                 return new Texture(_this._texture.url, _this.getScene(), _this._noMipmap, _this._invertY, _this._samplingMode);
             }, this);
             }, this);
         };
         };
+        Object.defineProperty(Texture.prototype, "onLoadObservable", {
+            get: function () {
+                if (!this._onLoadObservarble) {
+                    this._onLoadObservarble = new BABYLON.Observable();
+                }
+                return this._onLoadObservarble;
+            },
+            enumerable: true,
+            configurable: true
+        });
         // Statics
         // Statics
         Texture.CreateFromBase64String = function (data, name, scene, noMipmap, invertY, samplingMode, onLoad, onError) {
         Texture.CreateFromBase64String = function (data, name, scene, noMipmap, invertY, samplingMode, onLoad, onError) {
             if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
             if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }

+ 3 - 3
src/Materials/Textures/babylon.texture.ts

@@ -245,10 +245,10 @@
             return this._cachedTextureMatrix;
             return this._cachedTextureMatrix;
         }
         }
 
 
-        public clone(): Texture {        
+        public clone(): Texture {
             return SerializationHelper.Clone(() => {
             return SerializationHelper.Clone(() => {
                 return new Texture(this._texture.url, this.getScene(), this._noMipmap, this._invertY, this._samplingMode);
                 return new Texture(this._texture.url, this.getScene(), this._noMipmap, this._invertY, this._samplingMode);
-            }, this);       
+            }, this);
         }
         }
 
 
         public get onLoadObservable(): Observable<boolean> {
         public get onLoadObservable(): Observable<boolean> {
@@ -262,7 +262,7 @@
         public static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, onLoad: () => void = null, onError: () => void = null): Texture {
         public static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, onLoad: () => void = null, onError: () => void = null): Texture {
             return new Texture("data:" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data);
             return new Texture("data:" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data);
         }
         }
-        
+
         public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): BaseTexture {
         public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): BaseTexture {
             if (parsedTexture.isCube) {
             if (parsedTexture.isCube) {
                 return CubeTexture.Parse(parsedTexture, scene, rootUrl);
                 return CubeTexture.Parse(parsedTexture, scene, rootUrl);