diff --git a/src/core/textures/Texture.js b/src/core/textures/Texture.js index 7628ff3..8b27b34 100644 --- a/src/core/textures/Texture.js +++ b/src/core/textures/Texture.js @@ -129,8 +129,6 @@ frame = new math.Rectangle(0, 0, baseTexture.width, baseTexture.height); } this.frame = frame; - - } else { @@ -165,7 +163,8 @@ throw new Error('Texture Error: frame does not fit inside the base Texture dimensions ' + this); } - this.valid = frame && frame.width && frame.height && this.baseTexture.source && this.baseTexture.hasLoaded; + //this.valid = frame && frame.width && frame.height && this.baseTexture.source && this.baseTexture.hasLoaded; + this.valid = frame && frame.width && frame.height && this.baseTexture.hasLoaded; if (this.trim) { @@ -180,7 +179,7 @@ this.crop = frame; } - if (this.valid) + if (this.valid) { this._updateUvs(); } @@ -235,6 +234,11 @@ this.valid = false; }; +Texture.prototype.clone = function () +{ + return new Texture(this.baseTexture, this.frame, this.crop, this.trim, this.rotate); +} + /** * Updates the internal WebGL UV cache. * @@ -287,7 +291,7 @@ if (!texture) { - throw new Error('The frameId "' + frameId + '" does not exist in the texture cache' + this); + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache'); } return texture;