diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 4a35dac..81e519b 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -476,6 +476,13 @@ tx = this.position.x; ty = this.position.y; + // check for pivot.. not often used so geared towards that fact! + if(this.pivot.x || this.pivot.y) + { + tx -= this.pivot.x * a + this.pivot.y * c; + ty -= this.pivot.x * b + this.pivot.y * d; + } + // concat the parent matrix with the objects transform. wt.a = a * pt.a + b * pt.c; wt.b = a * pt.b + b * pt.d; @@ -484,27 +491,22 @@ wt.tx = tx * pt.a + ty * pt.c + pt.tx; wt.ty = tx * pt.b + ty * pt.d + pt.ty; - // check for pivot.. not often used so geared towards that fact! - if(this.pivot.x || this.pivot.y) - { - wt.tx -= this.pivot.x * a + this.pivot.y * c; - wt.ty -= this.pivot.x * b + this.pivot.y * d; - } + } else { // lets do the fast version as we know there is no rotation.. a = this.scale.x; d = this.scale.y; - tx = this.position.x; - ty = this.position.y; + tx = this.position.x - this.pivot.x * a; + ty = this.position.y - this.pivot.y * d; wt.a = pt.a * a; wt.b = pt.b * d; wt.c = pt.c * a; wt.d = pt.d * d; - wt.tx = tx * pt.a + ty * pt.c + pt.tx - this.pivot.x * a; - wt.ty = tx * pt.b + ty * pt.d + pt.ty - this.pivot.y * d; + wt.tx = tx * pt.a + ty * pt.c + pt.tx; + wt.ty = tx * pt.b + ty * pt.d + pt.ty; } // multiply the alphas.. diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 4a35dac..81e519b 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -476,6 +476,13 @@ tx = this.position.x; ty = this.position.y; + // check for pivot.. not often used so geared towards that fact! + if(this.pivot.x || this.pivot.y) + { + tx -= this.pivot.x * a + this.pivot.y * c; + ty -= this.pivot.x * b + this.pivot.y * d; + } + // concat the parent matrix with the objects transform. wt.a = a * pt.a + b * pt.c; wt.b = a * pt.b + b * pt.d; @@ -484,27 +491,22 @@ wt.tx = tx * pt.a + ty * pt.c + pt.tx; wt.ty = tx * pt.b + ty * pt.d + pt.ty; - // check for pivot.. not often used so geared towards that fact! - if(this.pivot.x || this.pivot.y) - { - wt.tx -= this.pivot.x * a + this.pivot.y * c; - wt.ty -= this.pivot.x * b + this.pivot.y * d; - } + } else { // lets do the fast version as we know there is no rotation.. a = this.scale.x; d = this.scale.y; - tx = this.position.x; - ty = this.position.y; + tx = this.position.x - this.pivot.x * a; + ty = this.position.y - this.pivot.y * d; wt.a = pt.a * a; wt.b = pt.b * d; wt.c = pt.c * a; wt.d = pt.d * d; - wt.tx = tx * pt.a + ty * pt.c + pt.tx - this.pivot.x * a; - wt.ty = tx * pt.b + ty * pt.d + pt.ty - this.pivot.y * d; + wt.tx = tx * pt.a + ty * pt.c + pt.tx; + wt.ty = tx * pt.b + ty * pt.d + pt.ty; } // multiply the alphas.. diff --git a/src/pixi/renderers/webgl/utils/WebGLStencilManager.js b/src/pixi/renderers/webgl/utils/WebGLStencilManager.js index e707ce2..f841e6f 100644 --- a/src/pixi/renderers/webgl/utils/WebGLStencilManager.js +++ b/src/pixi/renderers/webgl/utils/WebGLStencilManager.js @@ -269,8 +269,6 @@ } - - //renderSession.shaderManager.deactivatePrimitiveShader(); }; /** diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 4a35dac..81e519b 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -476,6 +476,13 @@ tx = this.position.x; ty = this.position.y; + // check for pivot.. not often used so geared towards that fact! + if(this.pivot.x || this.pivot.y) + { + tx -= this.pivot.x * a + this.pivot.y * c; + ty -= this.pivot.x * b + this.pivot.y * d; + } + // concat the parent matrix with the objects transform. wt.a = a * pt.a + b * pt.c; wt.b = a * pt.b + b * pt.d; @@ -484,27 +491,22 @@ wt.tx = tx * pt.a + ty * pt.c + pt.tx; wt.ty = tx * pt.b + ty * pt.d + pt.ty; - // check for pivot.. not often used so geared towards that fact! - if(this.pivot.x || this.pivot.y) - { - wt.tx -= this.pivot.x * a + this.pivot.y * c; - wt.ty -= this.pivot.x * b + this.pivot.y * d; - } + } else { // lets do the fast version as we know there is no rotation.. a = this.scale.x; d = this.scale.y; - tx = this.position.x; - ty = this.position.y; + tx = this.position.x - this.pivot.x * a; + ty = this.position.y - this.pivot.y * d; wt.a = pt.a * a; wt.b = pt.b * d; wt.c = pt.c * a; wt.d = pt.d * d; - wt.tx = tx * pt.a + ty * pt.c + pt.tx - this.pivot.x * a; - wt.ty = tx * pt.b + ty * pt.d + pt.ty - this.pivot.y * d; + wt.tx = tx * pt.a + ty * pt.c + pt.tx; + wt.ty = tx * pt.b + ty * pt.d + pt.ty; } // multiply the alphas.. diff --git a/src/pixi/renderers/webgl/utils/WebGLStencilManager.js b/src/pixi/renderers/webgl/utils/WebGLStencilManager.js index e707ce2..f841e6f 100644 --- a/src/pixi/renderers/webgl/utils/WebGLStencilManager.js +++ b/src/pixi/renderers/webgl/utils/WebGLStencilManager.js @@ -269,8 +269,6 @@ } - - //renderSession.shaderManager.deactivatePrimitiveShader(); }; /** diff --git a/src/pixi/text/Text.js b/src/pixi/text/Text.js index ee9377a..ba05f6e 100644 --- a/src/pixi/text/Text.js +++ b/src/pixi/text/Text.js @@ -295,6 +295,9 @@ this._width = this.canvas.width; this._height = this.canvas.height; + // update the dirty base textures + this.texture.baseTexture.dirty(); + }; /** @@ -313,8 +316,7 @@ this.updateText(); this.dirty = false; - // update the dirty base textures - this.texture.baseTexture.dirty(); + } PIXI.Sprite.prototype._renderWebGL.call(this, renderSession); diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 4a35dac..81e519b 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -476,6 +476,13 @@ tx = this.position.x; ty = this.position.y; + // check for pivot.. not often used so geared towards that fact! + if(this.pivot.x || this.pivot.y) + { + tx -= this.pivot.x * a + this.pivot.y * c; + ty -= this.pivot.x * b + this.pivot.y * d; + } + // concat the parent matrix with the objects transform. wt.a = a * pt.a + b * pt.c; wt.b = a * pt.b + b * pt.d; @@ -484,27 +491,22 @@ wt.tx = tx * pt.a + ty * pt.c + pt.tx; wt.ty = tx * pt.b + ty * pt.d + pt.ty; - // check for pivot.. not often used so geared towards that fact! - if(this.pivot.x || this.pivot.y) - { - wt.tx -= this.pivot.x * a + this.pivot.y * c; - wt.ty -= this.pivot.x * b + this.pivot.y * d; - } + } else { // lets do the fast version as we know there is no rotation.. a = this.scale.x; d = this.scale.y; - tx = this.position.x; - ty = this.position.y; + tx = this.position.x - this.pivot.x * a; + ty = this.position.y - this.pivot.y * d; wt.a = pt.a * a; wt.b = pt.b * d; wt.c = pt.c * a; wt.d = pt.d * d; - wt.tx = tx * pt.a + ty * pt.c + pt.tx - this.pivot.x * a; - wt.ty = tx * pt.b + ty * pt.d + pt.ty - this.pivot.y * d; + wt.tx = tx * pt.a + ty * pt.c + pt.tx; + wt.ty = tx * pt.b + ty * pt.d + pt.ty; } // multiply the alphas.. diff --git a/src/pixi/renderers/webgl/utils/WebGLStencilManager.js b/src/pixi/renderers/webgl/utils/WebGLStencilManager.js index e707ce2..f841e6f 100644 --- a/src/pixi/renderers/webgl/utils/WebGLStencilManager.js +++ b/src/pixi/renderers/webgl/utils/WebGLStencilManager.js @@ -269,8 +269,6 @@ } - - //renderSession.shaderManager.deactivatePrimitiveShader(); }; /** diff --git a/src/pixi/text/Text.js b/src/pixi/text/Text.js index ee9377a..ba05f6e 100644 --- a/src/pixi/text/Text.js +++ b/src/pixi/text/Text.js @@ -295,6 +295,9 @@ this._width = this.canvas.width; this._height = this.canvas.height; + // update the dirty base textures + this.texture.baseTexture.dirty(); + }; /** @@ -313,8 +316,7 @@ this.updateText(); this.dirty = false; - // update the dirty base textures - this.texture.baseTexture.dirty(); + } PIXI.Sprite.prototype._renderWebGL.call(this, renderSession); diff --git a/src/pixi/textures/RenderTexture.js b/src/pixi/textures/RenderTexture.js index 15445bc..b5c4577 100644 --- a/src/pixi/textures/RenderTexture.js +++ b/src/pixi/textures/RenderTexture.js @@ -120,8 +120,6 @@ this.valid = true; this._updateUvs(); - - }; PIXI.RenderTexture.prototype = Object.create(PIXI.Texture.prototype); @@ -137,10 +135,7 @@ */ PIXI.RenderTexture.prototype.resize = function(width, height, updateBase) { - if (width === this.width && height === this.height) - { - return; - } + if (width === this.width && height === this.height)return; this.valid = (width > 0 && height > 0); @@ -199,7 +194,7 @@ var wt = displayObject.worldTransform; wt.identity(); wt.translate(0, this.projection.y * 2); - wt.append(matrix); + if(matrix)wt.append(matrix); wt.scale(1,-1); // setWorld Alpha to ensure that the object is renderer at full opacity @@ -226,7 +221,6 @@ this.renderer.renderDisplayObject(displayObject, this.projection, this.textureBuffer.frameBuffer); - this.renderer.spriteBatch.dirty = true; }; diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 4a35dac..81e519b 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -476,6 +476,13 @@ tx = this.position.x; ty = this.position.y; + // check for pivot.. not often used so geared towards that fact! + if(this.pivot.x || this.pivot.y) + { + tx -= this.pivot.x * a + this.pivot.y * c; + ty -= this.pivot.x * b + this.pivot.y * d; + } + // concat the parent matrix with the objects transform. wt.a = a * pt.a + b * pt.c; wt.b = a * pt.b + b * pt.d; @@ -484,27 +491,22 @@ wt.tx = tx * pt.a + ty * pt.c + pt.tx; wt.ty = tx * pt.b + ty * pt.d + pt.ty; - // check for pivot.. not often used so geared towards that fact! - if(this.pivot.x || this.pivot.y) - { - wt.tx -= this.pivot.x * a + this.pivot.y * c; - wt.ty -= this.pivot.x * b + this.pivot.y * d; - } + } else { // lets do the fast version as we know there is no rotation.. a = this.scale.x; d = this.scale.y; - tx = this.position.x; - ty = this.position.y; + tx = this.position.x - this.pivot.x * a; + ty = this.position.y - this.pivot.y * d; wt.a = pt.a * a; wt.b = pt.b * d; wt.c = pt.c * a; wt.d = pt.d * d; - wt.tx = tx * pt.a + ty * pt.c + pt.tx - this.pivot.x * a; - wt.ty = tx * pt.b + ty * pt.d + pt.ty - this.pivot.y * d; + wt.tx = tx * pt.a + ty * pt.c + pt.tx; + wt.ty = tx * pt.b + ty * pt.d + pt.ty; } // multiply the alphas.. diff --git a/src/pixi/renderers/webgl/utils/WebGLStencilManager.js b/src/pixi/renderers/webgl/utils/WebGLStencilManager.js index e707ce2..f841e6f 100644 --- a/src/pixi/renderers/webgl/utils/WebGLStencilManager.js +++ b/src/pixi/renderers/webgl/utils/WebGLStencilManager.js @@ -269,8 +269,6 @@ } - - //renderSession.shaderManager.deactivatePrimitiveShader(); }; /** diff --git a/src/pixi/text/Text.js b/src/pixi/text/Text.js index ee9377a..ba05f6e 100644 --- a/src/pixi/text/Text.js +++ b/src/pixi/text/Text.js @@ -295,6 +295,9 @@ this._width = this.canvas.width; this._height = this.canvas.height; + // update the dirty base textures + this.texture.baseTexture.dirty(); + }; /** @@ -313,8 +316,7 @@ this.updateText(); this.dirty = false; - // update the dirty base textures - this.texture.baseTexture.dirty(); + } PIXI.Sprite.prototype._renderWebGL.call(this, renderSession); diff --git a/src/pixi/textures/RenderTexture.js b/src/pixi/textures/RenderTexture.js index 15445bc..b5c4577 100644 --- a/src/pixi/textures/RenderTexture.js +++ b/src/pixi/textures/RenderTexture.js @@ -120,8 +120,6 @@ this.valid = true; this._updateUvs(); - - }; PIXI.RenderTexture.prototype = Object.create(PIXI.Texture.prototype); @@ -137,10 +135,7 @@ */ PIXI.RenderTexture.prototype.resize = function(width, height, updateBase) { - if (width === this.width && height === this.height) - { - return; - } + if (width === this.width && height === this.height)return; this.valid = (width > 0 && height > 0); @@ -199,7 +194,7 @@ var wt = displayObject.worldTransform; wt.identity(); wt.translate(0, this.projection.y * 2); - wt.append(matrix); + if(matrix)wt.append(matrix); wt.scale(1,-1); // setWorld Alpha to ensure that the object is renderer at full opacity @@ -226,7 +221,6 @@ this.renderer.renderDisplayObject(displayObject, this.projection, this.textureBuffer.frameBuffer); - this.renderer.spriteBatch.dirty = true; }; diff --git a/src/pixi/textures/Texture.js b/src/pixi/textures/Texture.js index 8c82dc0..775b6f2 100644 --- a/src/pixi/textures/Texture.js +++ b/src/pixi/textures/Texture.js @@ -209,7 +209,7 @@ var frame = this.crop; var tw = this.baseTexture.width; var th = this.baseTexture.height; - + this._uvs.x0 = frame.x / tw; this._uvs.y0 = frame.y / th;