diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 2e9a399..4a35dac 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -637,7 +637,11 @@ this._filters = null; this._cachedSprite.filters = tempFilters; - this._cachedSprite.texture.render(this, new PIXI.Point(-bounds.x, -bounds.y) ); + + PIXI.DisplayObject._tempMatrix.tx = -bounds.x; + PIXI.DisplayObject._tempMatrix.ty = -bounds.y; + + this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix ); this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); this._cachedSprite.anchor.y = -( bounds.y / bounds.height ); @@ -687,6 +691,9 @@ renderSession = renderSession; }; + +PIXI.DisplayObject._tempMatrix = new PIXI.Matrix(); + /** * The position of the displayObject on the x axis relative to the local coordinates of the parent. * @@ -716,3 +723,5 @@ this.position.y = value; } }); + + diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 2e9a399..4a35dac 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -637,7 +637,11 @@ this._filters = null; this._cachedSprite.filters = tempFilters; - this._cachedSprite.texture.render(this, new PIXI.Point(-bounds.x, -bounds.y) ); + + PIXI.DisplayObject._tempMatrix.tx = -bounds.x; + PIXI.DisplayObject._tempMatrix.ty = -bounds.y; + + this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix ); this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); this._cachedSprite.anchor.y = -( bounds.y / bounds.height ); @@ -687,6 +691,9 @@ renderSession = renderSession; }; + +PIXI.DisplayObject._tempMatrix = new PIXI.Matrix(); + /** * The position of the displayObject on the x axis relative to the local coordinates of the parent. * @@ -716,3 +723,5 @@ this.position.y = value; } }); + + diff --git a/src/pixi/display/DisplayObjectContainer.js b/src/pixi/display/DisplayObjectContainer.js index 7ad1ad5..3156170 100644 --- a/src/pixi/display/DisplayObjectContainer.js +++ b/src/pixi/display/DisplayObjectContainer.js @@ -278,8 +278,6 @@ */ PIXI.DisplayObjectContainer.prototype.updateTransform = function() { - //this._currentBounds = null; - if(!this.visible)return; PIXI.DisplayObject.prototype.updateTransform.call( this ); diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 2e9a399..4a35dac 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -637,7 +637,11 @@ this._filters = null; this._cachedSprite.filters = tempFilters; - this._cachedSprite.texture.render(this, new PIXI.Point(-bounds.x, -bounds.y) ); + + PIXI.DisplayObject._tempMatrix.tx = -bounds.x; + PIXI.DisplayObject._tempMatrix.ty = -bounds.y; + + this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix ); this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); this._cachedSprite.anchor.y = -( bounds.y / bounds.height ); @@ -687,6 +691,9 @@ renderSession = renderSession; }; + +PIXI.DisplayObject._tempMatrix = new PIXI.Matrix(); + /** * The position of the displayObject on the x axis relative to the local coordinates of the parent. * @@ -716,3 +723,5 @@ this.position.y = value; } }); + + diff --git a/src/pixi/display/DisplayObjectContainer.js b/src/pixi/display/DisplayObjectContainer.js index 7ad1ad5..3156170 100644 --- a/src/pixi/display/DisplayObjectContainer.js +++ b/src/pixi/display/DisplayObjectContainer.js @@ -278,8 +278,6 @@ */ PIXI.DisplayObjectContainer.prototype.updateTransform = function() { - //this._currentBounds = null; - if(!this.visible)return; PIXI.DisplayObject.prototype.updateTransform.call( this ); diff --git a/src/pixi/renderers/canvas/CanvasRenderer.js b/src/pixi/renderers/canvas/CanvasRenderer.js index 81ea948..5903827 100644 --- a/src/pixi/renderers/canvas/CanvasRenderer.js +++ b/src/pixi/renderers/canvas/CanvasRenderer.js @@ -204,7 +204,6 @@ PIXI.CanvasRenderer.prototype.render = function(stage) { // update textures if need be - PIXI.texturesToUpdate.length = 0; PIXI.texturesToDestroy.length = 0; stage.updateTransform(); @@ -241,12 +240,6 @@ } } - // remove frame updates.. // removeing for now... - // TODO remove this eventually! - if(PIXI.Texture.frameUpdates.length > 0) - { - PIXI.Texture.frameUpdates.length = 0; - } }; /** diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 2e9a399..4a35dac 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -637,7 +637,11 @@ this._filters = null; this._cachedSprite.filters = tempFilters; - this._cachedSprite.texture.render(this, new PIXI.Point(-bounds.x, -bounds.y) ); + + PIXI.DisplayObject._tempMatrix.tx = -bounds.x; + PIXI.DisplayObject._tempMatrix.ty = -bounds.y; + + this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix ); this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); this._cachedSprite.anchor.y = -( bounds.y / bounds.height ); @@ -687,6 +691,9 @@ renderSession = renderSession; }; + +PIXI.DisplayObject._tempMatrix = new PIXI.Matrix(); + /** * The position of the displayObject on the x axis relative to the local coordinates of the parent. * @@ -716,3 +723,5 @@ this.position.y = value; } }); + + diff --git a/src/pixi/display/DisplayObjectContainer.js b/src/pixi/display/DisplayObjectContainer.js index 7ad1ad5..3156170 100644 --- a/src/pixi/display/DisplayObjectContainer.js +++ b/src/pixi/display/DisplayObjectContainer.js @@ -278,8 +278,6 @@ */ PIXI.DisplayObjectContainer.prototype.updateTransform = function() { - //this._currentBounds = null; - if(!this.visible)return; PIXI.DisplayObject.prototype.updateTransform.call( this ); diff --git a/src/pixi/renderers/canvas/CanvasRenderer.js b/src/pixi/renderers/canvas/CanvasRenderer.js index 81ea948..5903827 100644 --- a/src/pixi/renderers/canvas/CanvasRenderer.js +++ b/src/pixi/renderers/canvas/CanvasRenderer.js @@ -204,7 +204,6 @@ PIXI.CanvasRenderer.prototype.render = function(stage) { // update textures if need be - PIXI.texturesToUpdate.length = 0; PIXI.texturesToDestroy.length = 0; stage.updateTransform(); @@ -241,12 +240,6 @@ } } - // remove frame updates.. // removeing for now... - // TODO remove this eventually! - if(PIXI.Texture.frameUpdates.length > 0) - { - PIXI.Texture.frameUpdates.length = 0; - } }; /** diff --git a/src/pixi/renderers/webgl/WebGLRenderer.js b/src/pixi/renderers/webgl/WebGLRenderer.js index 3ed5737..5cb7ae9 100644 --- a/src/pixi/renderers/webgl/WebGLRenderer.js +++ b/src/pixi/renderers/webgl/WebGLRenderer.js @@ -187,7 +187,7 @@ gl.disable(gl.CULL_FACE); gl.enable(gl.BLEND); - gl.colorMask(true, true, true, true);//this.transparent); + gl.colorMask(true, true, true, true); }; // constructor @@ -235,7 +235,7 @@ var gl = this.gl; // -- Does this need to be set every frame? -- // - //gl.colorMask(true, true, true, this.transparent); + gl.viewport(0, 0, this.width, this.height); // make sure we are bound to the main frame buffer @@ -337,15 +337,11 @@ { var i = 0; - for (i=0; i < PIXI.Texture.frameUpdates.length; i++) - PIXI.WebGLRenderer.updateTextureFrame(PIXI.Texture.frameUpdates[i]); - for (i = 0; i < PIXI.texturesToDestroy.length; i++) PIXI.WebGLRenderer.destroyTexture(PIXI.texturesToDestroy[i]); PIXI.texturesToUpdate.length = 0; PIXI.texturesToDestroy.length = 0; - PIXI.Texture.frameUpdates.length = 0; }; /** @@ -374,19 +370,6 @@ }; /** - * - * @method updateTextureFrame - * @param texture {Texture} The texture to update the frame from - * @private - */ -PIXI.WebGLRenderer.updateTextureFrame = function(texture) -{ - // now set the uvs. Figured that the uv data sits with a texture rather than a sprite. - // so uv data is stored on the texture itself - texture._updateWebGLuvs(); -}; - -/** * resizes the webGL view to the specified width and height * * @method resize diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 2e9a399..4a35dac 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -637,7 +637,11 @@ this._filters = null; this._cachedSprite.filters = tempFilters; - this._cachedSprite.texture.render(this, new PIXI.Point(-bounds.x, -bounds.y) ); + + PIXI.DisplayObject._tempMatrix.tx = -bounds.x; + PIXI.DisplayObject._tempMatrix.ty = -bounds.y; + + this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix ); this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); this._cachedSprite.anchor.y = -( bounds.y / bounds.height ); @@ -687,6 +691,9 @@ renderSession = renderSession; }; + +PIXI.DisplayObject._tempMatrix = new PIXI.Matrix(); + /** * The position of the displayObject on the x axis relative to the local coordinates of the parent. * @@ -716,3 +723,5 @@ this.position.y = value; } }); + + diff --git a/src/pixi/display/DisplayObjectContainer.js b/src/pixi/display/DisplayObjectContainer.js index 7ad1ad5..3156170 100644 --- a/src/pixi/display/DisplayObjectContainer.js +++ b/src/pixi/display/DisplayObjectContainer.js @@ -278,8 +278,6 @@ */ PIXI.DisplayObjectContainer.prototype.updateTransform = function() { - //this._currentBounds = null; - if(!this.visible)return; PIXI.DisplayObject.prototype.updateTransform.call( this ); diff --git a/src/pixi/renderers/canvas/CanvasRenderer.js b/src/pixi/renderers/canvas/CanvasRenderer.js index 81ea948..5903827 100644 --- a/src/pixi/renderers/canvas/CanvasRenderer.js +++ b/src/pixi/renderers/canvas/CanvasRenderer.js @@ -204,7 +204,6 @@ PIXI.CanvasRenderer.prototype.render = function(stage) { // update textures if need be - PIXI.texturesToUpdate.length = 0; PIXI.texturesToDestroy.length = 0; stage.updateTransform(); @@ -241,12 +240,6 @@ } } - // remove frame updates.. // removeing for now... - // TODO remove this eventually! - if(PIXI.Texture.frameUpdates.length > 0) - { - PIXI.Texture.frameUpdates.length = 0; - } }; /** diff --git a/src/pixi/renderers/webgl/WebGLRenderer.js b/src/pixi/renderers/webgl/WebGLRenderer.js index 3ed5737..5cb7ae9 100644 --- a/src/pixi/renderers/webgl/WebGLRenderer.js +++ b/src/pixi/renderers/webgl/WebGLRenderer.js @@ -187,7 +187,7 @@ gl.disable(gl.CULL_FACE); gl.enable(gl.BLEND); - gl.colorMask(true, true, true, true);//this.transparent); + gl.colorMask(true, true, true, true); }; // constructor @@ -235,7 +235,7 @@ var gl = this.gl; // -- Does this need to be set every frame? -- // - //gl.colorMask(true, true, true, this.transparent); + gl.viewport(0, 0, this.width, this.height); // make sure we are bound to the main frame buffer @@ -337,15 +337,11 @@ { var i = 0; - for (i=0; i < PIXI.Texture.frameUpdates.length; i++) - PIXI.WebGLRenderer.updateTextureFrame(PIXI.Texture.frameUpdates[i]); - for (i = 0; i < PIXI.texturesToDestroy.length; i++) PIXI.WebGLRenderer.destroyTexture(PIXI.texturesToDestroy[i]); PIXI.texturesToUpdate.length = 0; PIXI.texturesToDestroy.length = 0; - PIXI.Texture.frameUpdates.length = 0; }; /** @@ -374,19 +370,6 @@ }; /** - * - * @method updateTextureFrame - * @param texture {Texture} The texture to update the frame from - * @private - */ -PIXI.WebGLRenderer.updateTextureFrame = function(texture) -{ - // now set the uvs. Figured that the uv data sits with a texture rather than a sprite. - // so uv data is stored on the texture itself - texture._updateWebGLuvs(); -}; - -/** * resizes the webGL view to the specified width and height * * @method resize diff --git a/src/pixi/textures/RenderTexture.js b/src/pixi/textures/RenderTexture.js index 2ff2909..7b3ba85 100644 --- a/src/pixi/textures/RenderTexture.js +++ b/src/pixi/textures/RenderTexture.js @@ -118,7 +118,8 @@ } this.valid = true; - PIXI.Texture.frameUpdates.push(this); + + this._updateUvs(); }; @@ -189,13 +190,31 @@ * @param clear {Boolean} If true the texture will be cleared before the displayObject is drawn * @private */ -PIXI.RenderTexture.prototype.renderWebGL = function(displayObject, position, clear) +PIXI.RenderTexture.prototype.renderWebGL = function(displayObject, matrix, clear) { if(!this.valid)return; //TOOD replace position with matrix.. - var gl = this.renderer.gl; + + //Lets create a nice matrix to apply to our display object. Frame buffers come in upside down so we need to flip the matrix + var wt = displayObject.worldTransform; + wt.identity(); + wt.translate(0, this.projection.y * 2); + wt.append(matrix); + wt.scale(1,-1); - gl.colorMask(true, true, true, true); + // setWorld Alpha to ensure that the object is renderer at full opacity + displayObject.worldAlpha = 1; + + // Time to update all the children of the displayObject with the new matrix.. + var children = displayObject.children; + + for(var i=0,j=children.length; i 0) - { - PIXI.Texture.frameUpdates.length = 0; - } }; /** diff --git a/src/pixi/renderers/webgl/WebGLRenderer.js b/src/pixi/renderers/webgl/WebGLRenderer.js index 3ed5737..5cb7ae9 100644 --- a/src/pixi/renderers/webgl/WebGLRenderer.js +++ b/src/pixi/renderers/webgl/WebGLRenderer.js @@ -187,7 +187,7 @@ gl.disable(gl.CULL_FACE); gl.enable(gl.BLEND); - gl.colorMask(true, true, true, true);//this.transparent); + gl.colorMask(true, true, true, true); }; // constructor @@ -235,7 +235,7 @@ var gl = this.gl; // -- Does this need to be set every frame? -- // - //gl.colorMask(true, true, true, this.transparent); + gl.viewport(0, 0, this.width, this.height); // make sure we are bound to the main frame buffer @@ -337,15 +337,11 @@ { var i = 0; - for (i=0; i < PIXI.Texture.frameUpdates.length; i++) - PIXI.WebGLRenderer.updateTextureFrame(PIXI.Texture.frameUpdates[i]); - for (i = 0; i < PIXI.texturesToDestroy.length; i++) PIXI.WebGLRenderer.destroyTexture(PIXI.texturesToDestroy[i]); PIXI.texturesToUpdate.length = 0; PIXI.texturesToDestroy.length = 0; - PIXI.Texture.frameUpdates.length = 0; }; /** @@ -374,19 +370,6 @@ }; /** - * - * @method updateTextureFrame - * @param texture {Texture} The texture to update the frame from - * @private - */ -PIXI.WebGLRenderer.updateTextureFrame = function(texture) -{ - // now set the uvs. Figured that the uv data sits with a texture rather than a sprite. - // so uv data is stored on the texture itself - texture._updateWebGLuvs(); -}; - -/** * resizes the webGL view to the specified width and height * * @method resize diff --git a/src/pixi/textures/RenderTexture.js b/src/pixi/textures/RenderTexture.js index 2ff2909..7b3ba85 100644 --- a/src/pixi/textures/RenderTexture.js +++ b/src/pixi/textures/RenderTexture.js @@ -118,7 +118,8 @@ } this.valid = true; - PIXI.Texture.frameUpdates.push(this); + + this._updateUvs(); }; @@ -189,13 +190,31 @@ * @param clear {Boolean} If true the texture will be cleared before the displayObject is drawn * @private */ -PIXI.RenderTexture.prototype.renderWebGL = function(displayObject, position, clear) +PIXI.RenderTexture.prototype.renderWebGL = function(displayObject, matrix, clear) { if(!this.valid)return; //TOOD replace position with matrix.. - var gl = this.renderer.gl; + + //Lets create a nice matrix to apply to our display object. Frame buffers come in upside down so we need to flip the matrix + var wt = displayObject.worldTransform; + wt.identity(); + wt.translate(0, this.projection.y * 2); + wt.append(matrix); + wt.scale(1,-1); - gl.colorMask(true, true, true, true); + // setWorld Alpha to ensure that the object is renderer at full opacity + displayObject.worldAlpha = 1; + + // Time to update all the children of the displayObject with the new matrix.. + var children = displayObject.children; + + for(var i=0,j=children.length; i