New build files for RC testing.

This commit is contained in:
photonstorm 2014-11-08 19:26:34 +00:00
parent c47d9ea238
commit a74a181074
15 changed files with 352 additions and 262 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.1.4 "Bethal" - Built: Sat Nov 08 2014 19:03:01
* v2.2.0 "Bethal" - Built: Sat Nov 08 2014 19:24:51
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -365,8 +365,8 @@ PIXI.Matrix.prototype.apply = function(pos, newPos)
{
newPos = newPos || new PIXI.Point();
newPos.x = this.a * pos.x + this.b * pos.y + this.tx;
newPos.y = this.c * pos.x + this.d * pos.y + this.ty;
newPos.x = this.a * pos.x + this.c * pos.y + this.tx;
newPos.y = this.b * pos.x + this.d * pos.y + this.ty;
return newPos;
};
@ -1802,8 +1802,8 @@ PIXI.DisplayObjectContainer.prototype._renderCanvas = function(renderSession)
* @extends DisplayObjectContainer
* @constructor
* @param texture {Texture} The texture for this sprite
*
* A sprite can be created directly from an image like this :
*
* A sprite can be created directly from an image like this :
* var sprite = new PIXI.Sprite.fromImage('assets/image.png');
* yourStage.addChild(sprite);
* then obviously don't forget to add it to the stage you have already created
@ -1857,7 +1857,7 @@ PIXI.Sprite = function(texture)
* @default 0xFFFFFF
*/
this.tint = 0xFFFFFF;
/**
* The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode.
*
@ -1882,8 +1882,7 @@ PIXI.Sprite = function(texture)
}
else
{
this.onTextureUpdateBind = this.onTextureUpdate.bind(this);
this.texture.on( 'update', this.onTextureUpdateBind );
this.texture.on( 'update', this.onTextureUpdate.bind(this) );
}
this.renderable = true;
@ -2037,14 +2036,14 @@ PIXI.Sprite.prototype.getBounds = function(matrix)
* Renders the object using the WebGL renderer
*
* @method _renderWebGL
* @param renderSession {RenderSession}
* @param renderSession {RenderSession}
* @private
*/
PIXI.Sprite.prototype._renderWebGL = function(renderSession)
{
// if the sprite is not visible or the alpha is 0 then no need to render this element
if(!this.visible || this.alpha <= 0)return;
var i,j;
// do a quick check to see if this element has a mask or a filter.
@ -2080,7 +2079,7 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
if(this._mask)renderSession.maskManager.popMask(this._mask, renderSession);
if(this._filters)renderSession.filterManager.popFilter();
spriteBatch.start();
}
else
@ -2092,7 +2091,7 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
{
this.children[i]._renderWebGL(renderSession);
}
}
};
@ -2100,14 +2099,14 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
* Renders the object using the Canvas renderer
*
* @method _renderCanvas
* @param renderSession {RenderSession}
* @param renderSession {RenderSession}
* @private
*/
PIXI.Sprite.prototype._renderCanvas = function(renderSession)
{
// If the sprite is not visible or the alpha is 0 then no need to render this element
if (this.visible === false || this.alpha === 0 || this.texture.crop.width <= 0 || this.texture.crop.height <= 0) return;
if (this.blendMode !== renderSession.currentBlendMode)
{
renderSession.currentBlendMode = this.blendMode;
@ -2164,7 +2163,7 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession)
if (this.cachedTint !== this.tint)
{
this.cachedTint = this.tint;
// TODO clean up caching - how to clean up the caches?
this.tintedTexture = PIXI.CanvasTinter.getTintedTexture(this, this.tint);
}
@ -2662,7 +2661,7 @@ PIXI.Text.prototype.updateText = function()
this.context.strokeStyle = this.style.stroke;
this.context.lineWidth = this.style.strokeThickness;
this.context.textBaseline = 'alphabetic';
this.context.lineJoin = 'round';
//this.context.lineJoin = 'round';
var linePositionX;
var linePositionY;
@ -3598,7 +3597,7 @@ PIXI.EventTarget = {
//iterate the listeners
if(this._listeners && this._listeners[eventName]) {
var listeners = this._listeners[eventName],
var listeners = this._listeners[eventName].slice(0),
length = listeners.length,
fn = listeners[0],
i;
@ -4655,7 +4654,7 @@ PIXI.StripShader = function(gl)
'uniform sampler2D uSampler;',
'void main(void) {',
' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));',
' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * alpha;',
// ' gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);',//gl_FragColor * alpha;',
'}'
];
@ -5839,12 +5838,12 @@ PIXI.WebGLGraphicsData.prototype.upload = function()
var gl = this.gl;
// this.lastIndex = graphics.graphicsData.length;
this.glPoints = new Float32Array(this.points);
this.glPoints = new PIXI.Float32Array(this.points);
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
gl.bufferData(gl.ARRAY_BUFFER, this.glPoints, gl.STATIC_DRAW);
this.glIndicies = new Uint16Array(this.indices);
this.glIndicies = new PIXI.Uint16Array(this.indices);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.glIndicies, gl.STATIC_DRAW);
@ -6319,8 +6318,8 @@ PIXI.WebGLRenderer.prototype.handleContextRestored = function()
PIXI.WebGLRenderer.prototype.destroy = function()
{
// remove listeners
this.view.off('webglcontextlost', this.contextLostBound);
this.view.off('webglcontextrestored', this.contextRestoredBound);
this.view.removeEventListener('webglcontextlost', this.contextLostBound);
this.view.removeEventListener('webglcontextrestored', this.contextRestoredBound);
PIXI.glContexts[this.glContextId] = null;
@ -7001,7 +7000,7 @@ PIXI.WebGLSpriteBatch = function()
* @property vertices
* @type Float32Array
*/
this.vertices = new Float32Array(numVerts);
this.vertices = new PIXI.Float32Array(numVerts);
/**
* Holds the indices
@ -7009,7 +7008,7 @@ PIXI.WebGLSpriteBatch = function()
* @property indices
* @type Uint16Array
*/
this.indices = new Uint16Array(numIndices);
this.indices = new PIXI.Uint16Array(numIndices);
/**
* @property lastIndexCount
@ -7610,14 +7609,14 @@ PIXI.WebGLFastSpriteBatch = function(gl)
* @property vertices
* @type Float32Array
*/
this.vertices = new Float32Array(numVerts);
this.vertices = new PIXI.Float32Array(numVerts);
/**
* Index data
* @property indices
* @type Uint16Array
*/
this.indices = new Uint16Array(numIndices);
this.indices = new PIXI.Uint16Array(numIndices);
/**
* @property vertexBuffer
@ -8386,7 +8385,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
// bind and upload the vertexs..
// keep a reference to the vertexFloatData..
this.vertexArray = new Float32Array([0.0, 0.0,
this.vertexArray = new PIXI.Float32Array([0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 1.0]);
@ -8395,7 +8394,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bufferData(gl.ARRAY_BUFFER, this.vertexArray, gl.STATIC_DRAW);
// bind and upload the uv buffer
this.uvArray = new Float32Array([0.0, 0.0,
this.uvArray = new PIXI.Float32Array([0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 1.0]);
@ -8403,7 +8402,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer);
gl.bufferData(gl.ARRAY_BUFFER, this.uvArray, gl.STATIC_DRAW);
this.colorArray = new Float32Array([1.0, 0xFFFFFF,
this.colorArray = new PIXI.Float32Array([1.0, 0xFFFFFF,
1.0, 0xFFFFFF,
1.0, 0xFFFFFF,
1.0, 0xFFFFFF]);
@ -10724,19 +10723,7 @@ PIXI.BaseTexture.prototype.destroy = function()
}
this.source = null;
// delete the webGL textures if any.
for (var i = this._glTextures.length - 1; i >= 0; i--)
{
var glTexture = this._glTextures[i];
var gl = PIXI.glContexts[i];
if(gl && glTexture)
{
gl.deleteTexture(glTexture);
}
}
this._glTextures.length = 0;
this.unloadFromGPU();
};
/**
@ -10765,6 +10752,34 @@ PIXI.BaseTexture.prototype.dirty = function()
}
};
/**
* Removes the base texture from the GPU, useful for managing resources on the GPU.
* Atexture is still 100% usable and will simply be reuploaded if there is a sprite on screen that is using it.
*
* @method unloadFromGPU
*/
PIXI.BaseTexture.prototype.unloadFromGPU = function()
{
this.dirty();
// delete the webGL textures if any.
for (var i = this._glTextures.length - 1; i >= 0; i--)
{
var glTexture = this._glTextures[i];
var gl = PIXI.glContexts[i];
if(gl && glTexture)
{
gl.deleteTexture(glTexture);
}
}
this._glTextures.length = 0;
this.dirty();
};
/**
* Helper function that creates a base texture from the given image url.
* If the image is not in the base texture cache it will be created and loaded.
@ -11413,6 +11428,9 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, matrix, clea
var wt = displayObject.worldTransform;
wt.identity();
if(matrix)wt.append(matrix);
// 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;
@ -11606,7 +11624,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*
* Phaser - http://phaser.io
*
* v2.1.4 "Bethal" - Built: Sat Nov 08 2014 19:03:01
* v2.2.0 "Bethal" - Built: Sat Nov 08 2014 19:24:51
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -11649,7 +11667,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*/
var Phaser = Phaser || {
VERSION: '2.1.4-dev',
VERSION: '2.2.0-dev',
GAMES: [],
AUTO: 0,
@ -16319,7 +16337,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
this.dirty = false;
}
this._cachedSprite.alpha = this.alpha;
this._cachedSprite.worldAlpha = this.worldAlpha;
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
return;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.1.4 "Bethal" - Built: Sat Nov 08 2014 19:03:01
* v2.2.0 "Bethal" - Built: Sat Nov 08 2014 19:24:52
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -365,8 +365,8 @@ PIXI.Matrix.prototype.apply = function(pos, newPos)
{
newPos = newPos || new PIXI.Point();
newPos.x = this.a * pos.x + this.b * pos.y + this.tx;
newPos.y = this.c * pos.x + this.d * pos.y + this.ty;
newPos.x = this.a * pos.x + this.c * pos.y + this.tx;
newPos.y = this.b * pos.x + this.d * pos.y + this.ty;
return newPos;
};
@ -1802,8 +1802,8 @@ PIXI.DisplayObjectContainer.prototype._renderCanvas = function(renderSession)
* @extends DisplayObjectContainer
* @constructor
* @param texture {Texture} The texture for this sprite
*
* A sprite can be created directly from an image like this :
*
* A sprite can be created directly from an image like this :
* var sprite = new PIXI.Sprite.fromImage('assets/image.png');
* yourStage.addChild(sprite);
* then obviously don't forget to add it to the stage you have already created
@ -1857,7 +1857,7 @@ PIXI.Sprite = function(texture)
* @default 0xFFFFFF
*/
this.tint = 0xFFFFFF;
/**
* The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode.
*
@ -1882,8 +1882,7 @@ PIXI.Sprite = function(texture)
}
else
{
this.onTextureUpdateBind = this.onTextureUpdate.bind(this);
this.texture.on( 'update', this.onTextureUpdateBind );
this.texture.on( 'update', this.onTextureUpdate.bind(this) );
}
this.renderable = true;
@ -2037,14 +2036,14 @@ PIXI.Sprite.prototype.getBounds = function(matrix)
* Renders the object using the WebGL renderer
*
* @method _renderWebGL
* @param renderSession {RenderSession}
* @param renderSession {RenderSession}
* @private
*/
PIXI.Sprite.prototype._renderWebGL = function(renderSession)
{
// if the sprite is not visible or the alpha is 0 then no need to render this element
if(!this.visible || this.alpha <= 0)return;
var i,j;
// do a quick check to see if this element has a mask or a filter.
@ -2080,7 +2079,7 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
if(this._mask)renderSession.maskManager.popMask(this._mask, renderSession);
if(this._filters)renderSession.filterManager.popFilter();
spriteBatch.start();
}
else
@ -2092,7 +2091,7 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
{
this.children[i]._renderWebGL(renderSession);
}
}
};
@ -2100,14 +2099,14 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
* Renders the object using the Canvas renderer
*
* @method _renderCanvas
* @param renderSession {RenderSession}
* @param renderSession {RenderSession}
* @private
*/
PIXI.Sprite.prototype._renderCanvas = function(renderSession)
{
// If the sprite is not visible or the alpha is 0 then no need to render this element
if (this.visible === false || this.alpha === 0 || this.texture.crop.width <= 0 || this.texture.crop.height <= 0) return;
if (this.blendMode !== renderSession.currentBlendMode)
{
renderSession.currentBlendMode = this.blendMode;
@ -2164,7 +2163,7 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession)
if (this.cachedTint !== this.tint)
{
this.cachedTint = this.tint;
// TODO clean up caching - how to clean up the caches?
this.tintedTexture = PIXI.CanvasTinter.getTintedTexture(this, this.tint);
}
@ -2662,7 +2661,7 @@ PIXI.Text.prototype.updateText = function()
this.context.strokeStyle = this.style.stroke;
this.context.lineWidth = this.style.strokeThickness;
this.context.textBaseline = 'alphabetic';
this.context.lineJoin = 'round';
//this.context.lineJoin = 'round';
var linePositionX;
var linePositionY;
@ -3598,7 +3597,7 @@ PIXI.EventTarget = {
//iterate the listeners
if(this._listeners && this._listeners[eventName]) {
var listeners = this._listeners[eventName],
var listeners = this._listeners[eventName].slice(0),
length = listeners.length,
fn = listeners[0],
i;
@ -4655,7 +4654,7 @@ PIXI.StripShader = function(gl)
'uniform sampler2D uSampler;',
'void main(void) {',
' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));',
' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * alpha;',
// ' gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);',//gl_FragColor * alpha;',
'}'
];
@ -5839,12 +5838,12 @@ PIXI.WebGLGraphicsData.prototype.upload = function()
var gl = this.gl;
// this.lastIndex = graphics.graphicsData.length;
this.glPoints = new Float32Array(this.points);
this.glPoints = new PIXI.Float32Array(this.points);
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
gl.bufferData(gl.ARRAY_BUFFER, this.glPoints, gl.STATIC_DRAW);
this.glIndicies = new Uint16Array(this.indices);
this.glIndicies = new PIXI.Uint16Array(this.indices);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.glIndicies, gl.STATIC_DRAW);
@ -6319,8 +6318,8 @@ PIXI.WebGLRenderer.prototype.handleContextRestored = function()
PIXI.WebGLRenderer.prototype.destroy = function()
{
// remove listeners
this.view.off('webglcontextlost', this.contextLostBound);
this.view.off('webglcontextrestored', this.contextRestoredBound);
this.view.removeEventListener('webglcontextlost', this.contextLostBound);
this.view.removeEventListener('webglcontextrestored', this.contextRestoredBound);
PIXI.glContexts[this.glContextId] = null;
@ -7001,7 +7000,7 @@ PIXI.WebGLSpriteBatch = function()
* @property vertices
* @type Float32Array
*/
this.vertices = new Float32Array(numVerts);
this.vertices = new PIXI.Float32Array(numVerts);
/**
* Holds the indices
@ -7009,7 +7008,7 @@ PIXI.WebGLSpriteBatch = function()
* @property indices
* @type Uint16Array
*/
this.indices = new Uint16Array(numIndices);
this.indices = new PIXI.Uint16Array(numIndices);
/**
* @property lastIndexCount
@ -7610,14 +7609,14 @@ PIXI.WebGLFastSpriteBatch = function(gl)
* @property vertices
* @type Float32Array
*/
this.vertices = new Float32Array(numVerts);
this.vertices = new PIXI.Float32Array(numVerts);
/**
* Index data
* @property indices
* @type Uint16Array
*/
this.indices = new Uint16Array(numIndices);
this.indices = new PIXI.Uint16Array(numIndices);
/**
* @property vertexBuffer
@ -8386,7 +8385,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
// bind and upload the vertexs..
// keep a reference to the vertexFloatData..
this.vertexArray = new Float32Array([0.0, 0.0,
this.vertexArray = new PIXI.Float32Array([0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 1.0]);
@ -8395,7 +8394,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bufferData(gl.ARRAY_BUFFER, this.vertexArray, gl.STATIC_DRAW);
// bind and upload the uv buffer
this.uvArray = new Float32Array([0.0, 0.0,
this.uvArray = new PIXI.Float32Array([0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 1.0]);
@ -8403,7 +8402,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer);
gl.bufferData(gl.ARRAY_BUFFER, this.uvArray, gl.STATIC_DRAW);
this.colorArray = new Float32Array([1.0, 0xFFFFFF,
this.colorArray = new PIXI.Float32Array([1.0, 0xFFFFFF,
1.0, 0xFFFFFF,
1.0, 0xFFFFFF,
1.0, 0xFFFFFF]);
@ -10724,19 +10723,7 @@ PIXI.BaseTexture.prototype.destroy = function()
}
this.source = null;
// delete the webGL textures if any.
for (var i = this._glTextures.length - 1; i >= 0; i--)
{
var glTexture = this._glTextures[i];
var gl = PIXI.glContexts[i];
if(gl && glTexture)
{
gl.deleteTexture(glTexture);
}
}
this._glTextures.length = 0;
this.unloadFromGPU();
};
/**
@ -10765,6 +10752,34 @@ PIXI.BaseTexture.prototype.dirty = function()
}
};
/**
* Removes the base texture from the GPU, useful for managing resources on the GPU.
* Atexture is still 100% usable and will simply be reuploaded if there is a sprite on screen that is using it.
*
* @method unloadFromGPU
*/
PIXI.BaseTexture.prototype.unloadFromGPU = function()
{
this.dirty();
// delete the webGL textures if any.
for (var i = this._glTextures.length - 1; i >= 0; i--)
{
var glTexture = this._glTextures[i];
var gl = PIXI.glContexts[i];
if(gl && glTexture)
{
gl.deleteTexture(glTexture);
}
}
this._glTextures.length = 0;
this.dirty();
};
/**
* Helper function that creates a base texture from the given image url.
* If the image is not in the base texture cache it will be created and loaded.
@ -11413,6 +11428,9 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, matrix, clea
var wt = displayObject.worldTransform;
wt.identity();
if(matrix)wt.append(matrix);
// 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;
@ -11606,7 +11624,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*
* Phaser - http://phaser.io
*
* v2.1.4 "Bethal" - Built: Sat Nov 08 2014 19:03:01
* v2.2.0 "Bethal" - Built: Sat Nov 08 2014 19:24:51
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -11649,7 +11667,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*/
var Phaser = Phaser || {
VERSION: '2.1.4-dev',
VERSION: '2.2.0-dev',
GAMES: [],
AUTO: 0,
@ -16319,7 +16337,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
this.dirty = false;
}
this._cachedSprite.alpha = this.alpha;
this._cachedSprite.worldAlpha = this.worldAlpha;
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
return;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.1.4 "Bethal" - Built: Sat Nov 08 2014 19:03:01
* v2.2.0 "Bethal" - Built: Sat Nov 08 2014 19:24:51
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -50,7 +50,7 @@
*/
var Phaser = Phaser || {
VERSION: '2.1.4-dev',
VERSION: '2.2.0-dev',
GAMES: [],
AUTO: 0,
@ -4720,7 +4720,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
this.dirty = false;
}
this._cachedSprite.alpha = this.alpha;
this._cachedSprite.worldAlpha = this.worldAlpha;
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
return;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.1.4 "Bethal" - Built: Sat Nov 08 2014 19:03:02
* v2.2.0 "Bethal" - Built: Sat Nov 08 2014 19:24:52
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -365,8 +365,8 @@ PIXI.Matrix.prototype.apply = function(pos, newPos)
{
newPos = newPos || new PIXI.Point();
newPos.x = this.a * pos.x + this.b * pos.y + this.tx;
newPos.y = this.c * pos.x + this.d * pos.y + this.ty;
newPos.x = this.a * pos.x + this.c * pos.y + this.tx;
newPos.y = this.b * pos.x + this.d * pos.y + this.ty;
return newPos;
};
@ -1802,8 +1802,8 @@ PIXI.DisplayObjectContainer.prototype._renderCanvas = function(renderSession)
* @extends DisplayObjectContainer
* @constructor
* @param texture {Texture} The texture for this sprite
*
* A sprite can be created directly from an image like this :
*
* A sprite can be created directly from an image like this :
* var sprite = new PIXI.Sprite.fromImage('assets/image.png');
* yourStage.addChild(sprite);
* then obviously don't forget to add it to the stage you have already created
@ -1857,7 +1857,7 @@ PIXI.Sprite = function(texture)
* @default 0xFFFFFF
*/
this.tint = 0xFFFFFF;
/**
* The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode.
*
@ -1882,8 +1882,7 @@ PIXI.Sprite = function(texture)
}
else
{
this.onTextureUpdateBind = this.onTextureUpdate.bind(this);
this.texture.on( 'update', this.onTextureUpdateBind );
this.texture.on( 'update', this.onTextureUpdate.bind(this) );
}
this.renderable = true;
@ -2037,14 +2036,14 @@ PIXI.Sprite.prototype.getBounds = function(matrix)
* Renders the object using the WebGL renderer
*
* @method _renderWebGL
* @param renderSession {RenderSession}
* @param renderSession {RenderSession}
* @private
*/
PIXI.Sprite.prototype._renderWebGL = function(renderSession)
{
// if the sprite is not visible or the alpha is 0 then no need to render this element
if(!this.visible || this.alpha <= 0)return;
var i,j;
// do a quick check to see if this element has a mask or a filter.
@ -2080,7 +2079,7 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
if(this._mask)renderSession.maskManager.popMask(this._mask, renderSession);
if(this._filters)renderSession.filterManager.popFilter();
spriteBatch.start();
}
else
@ -2092,7 +2091,7 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
{
this.children[i]._renderWebGL(renderSession);
}
}
};
@ -2100,14 +2099,14 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
* Renders the object using the Canvas renderer
*
* @method _renderCanvas
* @param renderSession {RenderSession}
* @param renderSession {RenderSession}
* @private
*/
PIXI.Sprite.prototype._renderCanvas = function(renderSession)
{
// If the sprite is not visible or the alpha is 0 then no need to render this element
if (this.visible === false || this.alpha === 0 || this.texture.crop.width <= 0 || this.texture.crop.height <= 0) return;
if (this.blendMode !== renderSession.currentBlendMode)
{
renderSession.currentBlendMode = this.blendMode;
@ -2164,7 +2163,7 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession)
if (this.cachedTint !== this.tint)
{
this.cachedTint = this.tint;
// TODO clean up caching - how to clean up the caches?
this.tintedTexture = PIXI.CanvasTinter.getTintedTexture(this, this.tint);
}
@ -2662,7 +2661,7 @@ PIXI.Text.prototype.updateText = function()
this.context.strokeStyle = this.style.stroke;
this.context.lineWidth = this.style.strokeThickness;
this.context.textBaseline = 'alphabetic';
this.context.lineJoin = 'round';
//this.context.lineJoin = 'round';
var linePositionX;
var linePositionY;
@ -3598,7 +3597,7 @@ PIXI.EventTarget = {
//iterate the listeners
if(this._listeners && this._listeners[eventName]) {
var listeners = this._listeners[eventName],
var listeners = this._listeners[eventName].slice(0),
length = listeners.length,
fn = listeners[0],
i;
@ -4655,7 +4654,7 @@ PIXI.StripShader = function(gl)
'uniform sampler2D uSampler;',
'void main(void) {',
' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));',
' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * alpha;',
// ' gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);',//gl_FragColor * alpha;',
'}'
];
@ -5839,12 +5838,12 @@ PIXI.WebGLGraphicsData.prototype.upload = function()
var gl = this.gl;
// this.lastIndex = graphics.graphicsData.length;
this.glPoints = new Float32Array(this.points);
this.glPoints = new PIXI.Float32Array(this.points);
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
gl.bufferData(gl.ARRAY_BUFFER, this.glPoints, gl.STATIC_DRAW);
this.glIndicies = new Uint16Array(this.indices);
this.glIndicies = new PIXI.Uint16Array(this.indices);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.glIndicies, gl.STATIC_DRAW);
@ -6319,8 +6318,8 @@ PIXI.WebGLRenderer.prototype.handleContextRestored = function()
PIXI.WebGLRenderer.prototype.destroy = function()
{
// remove listeners
this.view.off('webglcontextlost', this.contextLostBound);
this.view.off('webglcontextrestored', this.contextRestoredBound);
this.view.removeEventListener('webglcontextlost', this.contextLostBound);
this.view.removeEventListener('webglcontextrestored', this.contextRestoredBound);
PIXI.glContexts[this.glContextId] = null;
@ -7001,7 +7000,7 @@ PIXI.WebGLSpriteBatch = function()
* @property vertices
* @type Float32Array
*/
this.vertices = new Float32Array(numVerts);
this.vertices = new PIXI.Float32Array(numVerts);
/**
* Holds the indices
@ -7009,7 +7008,7 @@ PIXI.WebGLSpriteBatch = function()
* @property indices
* @type Uint16Array
*/
this.indices = new Uint16Array(numIndices);
this.indices = new PIXI.Uint16Array(numIndices);
/**
* @property lastIndexCount
@ -7610,14 +7609,14 @@ PIXI.WebGLFastSpriteBatch = function(gl)
* @property vertices
* @type Float32Array
*/
this.vertices = new Float32Array(numVerts);
this.vertices = new PIXI.Float32Array(numVerts);
/**
* Index data
* @property indices
* @type Uint16Array
*/
this.indices = new Uint16Array(numIndices);
this.indices = new PIXI.Uint16Array(numIndices);
/**
* @property vertexBuffer
@ -8386,7 +8385,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
// bind and upload the vertexs..
// keep a reference to the vertexFloatData..
this.vertexArray = new Float32Array([0.0, 0.0,
this.vertexArray = new PIXI.Float32Array([0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 1.0]);
@ -8395,7 +8394,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bufferData(gl.ARRAY_BUFFER, this.vertexArray, gl.STATIC_DRAW);
// bind and upload the uv buffer
this.uvArray = new Float32Array([0.0, 0.0,
this.uvArray = new PIXI.Float32Array([0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 1.0]);
@ -8403,7 +8402,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer);
gl.bufferData(gl.ARRAY_BUFFER, this.uvArray, gl.STATIC_DRAW);
this.colorArray = new Float32Array([1.0, 0xFFFFFF,
this.colorArray = new PIXI.Float32Array([1.0, 0xFFFFFF,
1.0, 0xFFFFFF,
1.0, 0xFFFFFF,
1.0, 0xFFFFFF]);
@ -10724,19 +10723,7 @@ PIXI.BaseTexture.prototype.destroy = function()
}
this.source = null;
// delete the webGL textures if any.
for (var i = this._glTextures.length - 1; i >= 0; i--)
{
var glTexture = this._glTextures[i];
var gl = PIXI.glContexts[i];
if(gl && glTexture)
{
gl.deleteTexture(glTexture);
}
}
this._glTextures.length = 0;
this.unloadFromGPU();
};
/**
@ -10765,6 +10752,34 @@ PIXI.BaseTexture.prototype.dirty = function()
}
};
/**
* Removes the base texture from the GPU, useful for managing resources on the GPU.
* Atexture is still 100% usable and will simply be reuploaded if there is a sprite on screen that is using it.
*
* @method unloadFromGPU
*/
PIXI.BaseTexture.prototype.unloadFromGPU = function()
{
this.dirty();
// delete the webGL textures if any.
for (var i = this._glTextures.length - 1; i >= 0; i--)
{
var glTexture = this._glTextures[i];
var gl = PIXI.glContexts[i];
if(gl && glTexture)
{
gl.deleteTexture(glTexture);
}
}
this._glTextures.length = 0;
this.dirty();
};
/**
* Helper function that creates a base texture from the given image url.
* If the image is not in the base texture cache it will be created and loaded.
@ -11413,6 +11428,9 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, matrix, clea
var wt = displayObject.worldTransform;
wt.identity();
if(matrix)wt.append(matrix);
// 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;
@ -11619,7 +11637,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*/
var Phaser = Phaser || {
VERSION: '2.1.4-dev',
VERSION: '2.2.0-dev',
GAMES: [],
AUTO: 0,
@ -16289,7 +16307,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
this.dirty = false;
}
this._cachedSprite.alpha = this.alpha;
this._cachedSprite.worldAlpha = this.worldAlpha;
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
return;

File diff suppressed because one or more lines are too long

View file

@ -335,8 +335,8 @@ PIXI.Matrix.prototype.apply = function(pos, newPos)
{
newPos = newPos || new PIXI.Point();
newPos.x = this.a * pos.x + this.b * pos.y + this.tx;
newPos.y = this.c * pos.x + this.d * pos.y + this.ty;
newPos.x = this.a * pos.x + this.c * pos.y + this.tx;
newPos.y = this.b * pos.x + this.d * pos.y + this.ty;
return newPos;
};
@ -1772,8 +1772,8 @@ PIXI.DisplayObjectContainer.prototype._renderCanvas = function(renderSession)
* @extends DisplayObjectContainer
* @constructor
* @param texture {Texture} The texture for this sprite
*
* A sprite can be created directly from an image like this :
*
* A sprite can be created directly from an image like this :
* var sprite = new PIXI.Sprite.fromImage('assets/image.png');
* yourStage.addChild(sprite);
* then obviously don't forget to add it to the stage you have already created
@ -1827,7 +1827,7 @@ PIXI.Sprite = function(texture)
* @default 0xFFFFFF
*/
this.tint = 0xFFFFFF;
/**
* The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode.
*
@ -1852,8 +1852,7 @@ PIXI.Sprite = function(texture)
}
else
{
this.onTextureUpdateBind = this.onTextureUpdate.bind(this);
this.texture.on( 'update', this.onTextureUpdateBind );
this.texture.on( 'update', this.onTextureUpdate.bind(this) );
}
this.renderable = true;
@ -2007,14 +2006,14 @@ PIXI.Sprite.prototype.getBounds = function(matrix)
* Renders the object using the WebGL renderer
*
* @method _renderWebGL
* @param renderSession {RenderSession}
* @param renderSession {RenderSession}
* @private
*/
PIXI.Sprite.prototype._renderWebGL = function(renderSession)
{
// if the sprite is not visible or the alpha is 0 then no need to render this element
if(!this.visible || this.alpha <= 0)return;
var i,j;
// do a quick check to see if this element has a mask or a filter.
@ -2050,7 +2049,7 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
if(this._mask)renderSession.maskManager.popMask(this._mask, renderSession);
if(this._filters)renderSession.filterManager.popFilter();
spriteBatch.start();
}
else
@ -2062,7 +2061,7 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
{
this.children[i]._renderWebGL(renderSession);
}
}
};
@ -2070,14 +2069,14 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
* Renders the object using the Canvas renderer
*
* @method _renderCanvas
* @param renderSession {RenderSession}
* @param renderSession {RenderSession}
* @private
*/
PIXI.Sprite.prototype._renderCanvas = function(renderSession)
{
// If the sprite is not visible or the alpha is 0 then no need to render this element
if (this.visible === false || this.alpha === 0 || this.texture.crop.width <= 0 || this.texture.crop.height <= 0) return;
if (this.blendMode !== renderSession.currentBlendMode)
{
renderSession.currentBlendMode = this.blendMode;
@ -2134,7 +2133,7 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession)
if (this.cachedTint !== this.tint)
{
this.cachedTint = this.tint;
// TODO clean up caching - how to clean up the caches?
this.tintedTexture = PIXI.CanvasTinter.getTintedTexture(this, this.tint);
}
@ -2632,7 +2631,7 @@ PIXI.Text.prototype.updateText = function()
this.context.strokeStyle = this.style.stroke;
this.context.lineWidth = this.style.strokeThickness;
this.context.textBaseline = 'alphabetic';
this.context.lineJoin = 'round';
//this.context.lineJoin = 'round';
var linePositionX;
var linePositionY;
@ -3568,7 +3567,7 @@ PIXI.EventTarget = {
//iterate the listeners
if(this._listeners && this._listeners[eventName]) {
var listeners = this._listeners[eventName],
var listeners = this._listeners[eventName].slice(0),
length = listeners.length,
fn = listeners[0],
i;
@ -4625,7 +4624,7 @@ PIXI.StripShader = function(gl)
'uniform sampler2D uSampler;',
'void main(void) {',
' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));',
' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * alpha;',
// ' gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);',//gl_FragColor * alpha;',
'}'
];
@ -5809,12 +5808,12 @@ PIXI.WebGLGraphicsData.prototype.upload = function()
var gl = this.gl;
// this.lastIndex = graphics.graphicsData.length;
this.glPoints = new Float32Array(this.points);
this.glPoints = new PIXI.Float32Array(this.points);
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
gl.bufferData(gl.ARRAY_BUFFER, this.glPoints, gl.STATIC_DRAW);
this.glIndicies = new Uint16Array(this.indices);
this.glIndicies = new PIXI.Uint16Array(this.indices);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.glIndicies, gl.STATIC_DRAW);
@ -6289,8 +6288,8 @@ PIXI.WebGLRenderer.prototype.handleContextRestored = function()
PIXI.WebGLRenderer.prototype.destroy = function()
{
// remove listeners
this.view.off('webglcontextlost', this.contextLostBound);
this.view.off('webglcontextrestored', this.contextRestoredBound);
this.view.removeEventListener('webglcontextlost', this.contextLostBound);
this.view.removeEventListener('webglcontextrestored', this.contextRestoredBound);
PIXI.glContexts[this.glContextId] = null;
@ -6971,7 +6970,7 @@ PIXI.WebGLSpriteBatch = function()
* @property vertices
* @type Float32Array
*/
this.vertices = new Float32Array(numVerts);
this.vertices = new PIXI.Float32Array(numVerts);
/**
* Holds the indices
@ -6979,7 +6978,7 @@ PIXI.WebGLSpriteBatch = function()
* @property indices
* @type Uint16Array
*/
this.indices = new Uint16Array(numIndices);
this.indices = new PIXI.Uint16Array(numIndices);
/**
* @property lastIndexCount
@ -7580,14 +7579,14 @@ PIXI.WebGLFastSpriteBatch = function(gl)
* @property vertices
* @type Float32Array
*/
this.vertices = new Float32Array(numVerts);
this.vertices = new PIXI.Float32Array(numVerts);
/**
* Index data
* @property indices
* @type Uint16Array
*/
this.indices = new Uint16Array(numIndices);
this.indices = new PIXI.Uint16Array(numIndices);
/**
* @property vertexBuffer
@ -8356,7 +8355,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
// bind and upload the vertexs..
// keep a reference to the vertexFloatData..
this.vertexArray = new Float32Array([0.0, 0.0,
this.vertexArray = new PIXI.Float32Array([0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 1.0]);
@ -8365,7 +8364,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bufferData(gl.ARRAY_BUFFER, this.vertexArray, gl.STATIC_DRAW);
// bind and upload the uv buffer
this.uvArray = new Float32Array([0.0, 0.0,
this.uvArray = new PIXI.Float32Array([0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 1.0]);
@ -8373,7 +8372,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer);
gl.bufferData(gl.ARRAY_BUFFER, this.uvArray, gl.STATIC_DRAW);
this.colorArray = new Float32Array([1.0, 0xFFFFFF,
this.colorArray = new PIXI.Float32Array([1.0, 0xFFFFFF,
1.0, 0xFFFFFF,
1.0, 0xFFFFFF,
1.0, 0xFFFFFF]);
@ -10694,19 +10693,7 @@ PIXI.BaseTexture.prototype.destroy = function()
}
this.source = null;
// delete the webGL textures if any.
for (var i = this._glTextures.length - 1; i >= 0; i--)
{
var glTexture = this._glTextures[i];
var gl = PIXI.glContexts[i];
if(gl && glTexture)
{
gl.deleteTexture(glTexture);
}
}
this._glTextures.length = 0;
this.unloadFromGPU();
};
/**
@ -10735,6 +10722,34 @@ PIXI.BaseTexture.prototype.dirty = function()
}
};
/**
* Removes the base texture from the GPU, useful for managing resources on the GPU.
* Atexture is still 100% usable and will simply be reuploaded if there is a sprite on screen that is using it.
*
* @method unloadFromGPU
*/
PIXI.BaseTexture.prototype.unloadFromGPU = function()
{
this.dirty();
// delete the webGL textures if any.
for (var i = this._glTextures.length - 1; i >= 0; i--)
{
var glTexture = this._glTextures[i];
var gl = PIXI.glContexts[i];
if(gl && glTexture)
{
gl.deleteTexture(glTexture);
}
}
this._glTextures.length = 0;
this.dirty();
};
/**
* Helper function that creates a base texture from the given image url.
* If the image is not in the base texture cache it will be created and loaded.
@ -11383,6 +11398,9 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, matrix, clea
var wt = displayObject.worldTransform;
wt.identity();
if(matrix)wt.append(matrix);
// 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;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.1.4 "Bethal" - Built: Sat Nov 08 2014 19:03:02
* v2.2.0 "Bethal" - Built: Sat Nov 08 2014 19:24:52
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -365,8 +365,8 @@ PIXI.Matrix.prototype.apply = function(pos, newPos)
{
newPos = newPos || new PIXI.Point();
newPos.x = this.a * pos.x + this.b * pos.y + this.tx;
newPos.y = this.c * pos.x + this.d * pos.y + this.ty;
newPos.x = this.a * pos.x + this.c * pos.y + this.tx;
newPos.y = this.b * pos.x + this.d * pos.y + this.ty;
return newPos;
};
@ -1802,8 +1802,8 @@ PIXI.DisplayObjectContainer.prototype._renderCanvas = function(renderSession)
* @extends DisplayObjectContainer
* @constructor
* @param texture {Texture} The texture for this sprite
*
* A sprite can be created directly from an image like this :
*
* A sprite can be created directly from an image like this :
* var sprite = new PIXI.Sprite.fromImage('assets/image.png');
* yourStage.addChild(sprite);
* then obviously don't forget to add it to the stage you have already created
@ -1857,7 +1857,7 @@ PIXI.Sprite = function(texture)
* @default 0xFFFFFF
*/
this.tint = 0xFFFFFF;
/**
* The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode.
*
@ -1882,8 +1882,7 @@ PIXI.Sprite = function(texture)
}
else
{
this.onTextureUpdateBind = this.onTextureUpdate.bind(this);
this.texture.on( 'update', this.onTextureUpdateBind );
this.texture.on( 'update', this.onTextureUpdate.bind(this) );
}
this.renderable = true;
@ -2037,14 +2036,14 @@ PIXI.Sprite.prototype.getBounds = function(matrix)
* Renders the object using the WebGL renderer
*
* @method _renderWebGL
* @param renderSession {RenderSession}
* @param renderSession {RenderSession}
* @private
*/
PIXI.Sprite.prototype._renderWebGL = function(renderSession)
{
// if the sprite is not visible or the alpha is 0 then no need to render this element
if(!this.visible || this.alpha <= 0)return;
var i,j;
// do a quick check to see if this element has a mask or a filter.
@ -2080,7 +2079,7 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
if(this._mask)renderSession.maskManager.popMask(this._mask, renderSession);
if(this._filters)renderSession.filterManager.popFilter();
spriteBatch.start();
}
else
@ -2092,7 +2091,7 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
{
this.children[i]._renderWebGL(renderSession);
}
}
};
@ -2100,14 +2099,14 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
* Renders the object using the Canvas renderer
*
* @method _renderCanvas
* @param renderSession {RenderSession}
* @param renderSession {RenderSession}
* @private
*/
PIXI.Sprite.prototype._renderCanvas = function(renderSession)
{
// If the sprite is not visible or the alpha is 0 then no need to render this element
if (this.visible === false || this.alpha === 0 || this.texture.crop.width <= 0 || this.texture.crop.height <= 0) return;
if (this.blendMode !== renderSession.currentBlendMode)
{
renderSession.currentBlendMode = this.blendMode;
@ -2164,7 +2163,7 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession)
if (this.cachedTint !== this.tint)
{
this.cachedTint = this.tint;
// TODO clean up caching - how to clean up the caches?
this.tintedTexture = PIXI.CanvasTinter.getTintedTexture(this, this.tint);
}
@ -2662,7 +2661,7 @@ PIXI.Text.prototype.updateText = function()
this.context.strokeStyle = this.style.stroke;
this.context.lineWidth = this.style.strokeThickness;
this.context.textBaseline = 'alphabetic';
this.context.lineJoin = 'round';
//this.context.lineJoin = 'round';
var linePositionX;
var linePositionY;
@ -3598,7 +3597,7 @@ PIXI.EventTarget = {
//iterate the listeners
if(this._listeners && this._listeners[eventName]) {
var listeners = this._listeners[eventName],
var listeners = this._listeners[eventName].slice(0),
length = listeners.length,
fn = listeners[0],
i;
@ -4655,7 +4654,7 @@ PIXI.StripShader = function(gl)
'uniform sampler2D uSampler;',
'void main(void) {',
' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));',
' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * alpha;',
// ' gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);',//gl_FragColor * alpha;',
'}'
];
@ -5839,12 +5838,12 @@ PIXI.WebGLGraphicsData.prototype.upload = function()
var gl = this.gl;
// this.lastIndex = graphics.graphicsData.length;
this.glPoints = new Float32Array(this.points);
this.glPoints = new PIXI.Float32Array(this.points);
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
gl.bufferData(gl.ARRAY_BUFFER, this.glPoints, gl.STATIC_DRAW);
this.glIndicies = new Uint16Array(this.indices);
this.glIndicies = new PIXI.Uint16Array(this.indices);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.glIndicies, gl.STATIC_DRAW);
@ -6319,8 +6318,8 @@ PIXI.WebGLRenderer.prototype.handleContextRestored = function()
PIXI.WebGLRenderer.prototype.destroy = function()
{
// remove listeners
this.view.off('webglcontextlost', this.contextLostBound);
this.view.off('webglcontextrestored', this.contextRestoredBound);
this.view.removeEventListener('webglcontextlost', this.contextLostBound);
this.view.removeEventListener('webglcontextrestored', this.contextRestoredBound);
PIXI.glContexts[this.glContextId] = null;
@ -7001,7 +7000,7 @@ PIXI.WebGLSpriteBatch = function()
* @property vertices
* @type Float32Array
*/
this.vertices = new Float32Array(numVerts);
this.vertices = new PIXI.Float32Array(numVerts);
/**
* Holds the indices
@ -7009,7 +7008,7 @@ PIXI.WebGLSpriteBatch = function()
* @property indices
* @type Uint16Array
*/
this.indices = new Uint16Array(numIndices);
this.indices = new PIXI.Uint16Array(numIndices);
/**
* @property lastIndexCount
@ -7610,14 +7609,14 @@ PIXI.WebGLFastSpriteBatch = function(gl)
* @property vertices
* @type Float32Array
*/
this.vertices = new Float32Array(numVerts);
this.vertices = new PIXI.Float32Array(numVerts);
/**
* Index data
* @property indices
* @type Uint16Array
*/
this.indices = new Uint16Array(numIndices);
this.indices = new PIXI.Uint16Array(numIndices);
/**
* @property vertexBuffer
@ -8386,7 +8385,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
// bind and upload the vertexs..
// keep a reference to the vertexFloatData..
this.vertexArray = new Float32Array([0.0, 0.0,
this.vertexArray = new PIXI.Float32Array([0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 1.0]);
@ -8395,7 +8394,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bufferData(gl.ARRAY_BUFFER, this.vertexArray, gl.STATIC_DRAW);
// bind and upload the uv buffer
this.uvArray = new Float32Array([0.0, 0.0,
this.uvArray = new PIXI.Float32Array([0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 1.0]);
@ -8403,7 +8402,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer);
gl.bufferData(gl.ARRAY_BUFFER, this.uvArray, gl.STATIC_DRAW);
this.colorArray = new Float32Array([1.0, 0xFFFFFF,
this.colorArray = new PIXI.Float32Array([1.0, 0xFFFFFF,
1.0, 0xFFFFFF,
1.0, 0xFFFFFF,
1.0, 0xFFFFFF]);
@ -10724,19 +10723,7 @@ PIXI.BaseTexture.prototype.destroy = function()
}
this.source = null;
// delete the webGL textures if any.
for (var i = this._glTextures.length - 1; i >= 0; i--)
{
var glTexture = this._glTextures[i];
var gl = PIXI.glContexts[i];
if(gl && glTexture)
{
gl.deleteTexture(glTexture);
}
}
this._glTextures.length = 0;
this.unloadFromGPU();
};
/**
@ -10765,6 +10752,34 @@ PIXI.BaseTexture.prototype.dirty = function()
}
};
/**
* Removes the base texture from the GPU, useful for managing resources on the GPU.
* Atexture is still 100% usable and will simply be reuploaded if there is a sprite on screen that is using it.
*
* @method unloadFromGPU
*/
PIXI.BaseTexture.prototype.unloadFromGPU = function()
{
this.dirty();
// delete the webGL textures if any.
for (var i = this._glTextures.length - 1; i >= 0; i--)
{
var glTexture = this._glTextures[i];
var gl = PIXI.glContexts[i];
if(gl && glTexture)
{
gl.deleteTexture(glTexture);
}
}
this._glTextures.length = 0;
this.dirty();
};
/**
* Helper function that creates a base texture from the given image url.
* If the image is not in the base texture cache it will be created and loaded.
@ -11413,6 +11428,9 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, matrix, clea
var wt = displayObject.worldTransform;
wt.identity();
if(matrix)wt.append(matrix);
// 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;
@ -11606,7 +11624,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*
* Phaser - http://phaser.io
*
* v2.1.4 "Bethal" - Built: Sat Nov 08 2014 19:03:01
* v2.2.0 "Bethal" - Built: Sat Nov 08 2014 19:24:51
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -11649,7 +11667,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*/
var Phaser = Phaser || {
VERSION: '2.1.4-dev',
VERSION: '2.2.0-dev',
GAMES: [],
AUTO: 0,
@ -16319,7 +16337,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
this.dirty = false;
}
this._cachedSprite.alpha = this.alpha;
this._cachedSprite.worldAlpha = this.worldAlpha;
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
return;

File diff suppressed because one or more lines are too long

14
build/phaser.min.js vendored

File diff suppressed because one or more lines are too long