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 * 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 * 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 = newPos || new PIXI.Point();
newPos.x = this.a * pos.x + this.b * pos.y + this.tx; newPos.x = this.a * pos.x + this.c * pos.y + this.tx;
newPos.y = this.c * pos.x + this.d * pos.y + this.ty; newPos.y = this.b * pos.x + this.d * pos.y + this.ty;
return newPos; return newPos;
}; };
@ -1882,8 +1882,7 @@ PIXI.Sprite = function(texture)
} }
else else
{ {
this.onTextureUpdateBind = this.onTextureUpdate.bind(this); this.texture.on( 'update', this.onTextureUpdate.bind(this) );
this.texture.on( 'update', this.onTextureUpdateBind );
} }
this.renderable = true; this.renderable = true;
@ -2662,7 +2661,7 @@ PIXI.Text.prototype.updateText = function()
this.context.strokeStyle = this.style.stroke; this.context.strokeStyle = this.style.stroke;
this.context.lineWidth = this.style.strokeThickness; this.context.lineWidth = this.style.strokeThickness;
this.context.textBaseline = 'alphabetic'; this.context.textBaseline = 'alphabetic';
this.context.lineJoin = 'round'; //this.context.lineJoin = 'round';
var linePositionX; var linePositionX;
var linePositionY; var linePositionY;
@ -3598,7 +3597,7 @@ PIXI.EventTarget = {
//iterate the listeners //iterate the listeners
if(this._listeners && this._listeners[eventName]) { if(this._listeners && this._listeners[eventName]) {
var listeners = this._listeners[eventName], var listeners = this._listeners[eventName].slice(0),
length = listeners.length, length = listeners.length,
fn = listeners[0], fn = listeners[0],
i; i;
@ -4655,7 +4654,7 @@ PIXI.StripShader = function(gl)
'uniform sampler2D uSampler;', 'uniform sampler2D uSampler;',
'void main(void) {', '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;', // ' 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; var gl = this.gl;
// this.lastIndex = graphics.graphicsData.length; // 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.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
gl.bufferData(gl.ARRAY_BUFFER, this.glPoints, gl.STATIC_DRAW); 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.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.glIndicies, gl.STATIC_DRAW); 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() PIXI.WebGLRenderer.prototype.destroy = function()
{ {
// remove listeners // remove listeners
this.view.off('webglcontextlost', this.contextLostBound); this.view.removeEventListener('webglcontextlost', this.contextLostBound);
this.view.off('webglcontextrestored', this.contextRestoredBound); this.view.removeEventListener('webglcontextrestored', this.contextRestoredBound);
PIXI.glContexts[this.glContextId] = null; PIXI.glContexts[this.glContextId] = null;
@ -7001,7 +7000,7 @@ PIXI.WebGLSpriteBatch = function()
* @property vertices * @property vertices
* @type Float32Array * @type Float32Array
*/ */
this.vertices = new Float32Array(numVerts); this.vertices = new PIXI.Float32Array(numVerts);
/** /**
* Holds the indices * Holds the indices
@ -7009,7 +7008,7 @@ PIXI.WebGLSpriteBatch = function()
* @property indices * @property indices
* @type Uint16Array * @type Uint16Array
*/ */
this.indices = new Uint16Array(numIndices); this.indices = new PIXI.Uint16Array(numIndices);
/** /**
* @property lastIndexCount * @property lastIndexCount
@ -7610,14 +7609,14 @@ PIXI.WebGLFastSpriteBatch = function(gl)
* @property vertices * @property vertices
* @type Float32Array * @type Float32Array
*/ */
this.vertices = new Float32Array(numVerts); this.vertices = new PIXI.Float32Array(numVerts);
/** /**
* Index data * Index data
* @property indices * @property indices
* @type Uint16Array * @type Uint16Array
*/ */
this.indices = new Uint16Array(numIndices); this.indices = new PIXI.Uint16Array(numIndices);
/** /**
* @property vertexBuffer * @property vertexBuffer
@ -8386,7 +8385,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
// bind and upload the vertexs.. // bind and upload the vertexs..
// keep a reference to the vertexFloatData.. // 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, 1.0, 0.0,
0.0, 1.0, 0.0, 1.0,
1.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); gl.bufferData(gl.ARRAY_BUFFER, this.vertexArray, gl.STATIC_DRAW);
// bind and upload the uv buffer // 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, 1.0, 0.0,
0.0, 1.0, 0.0, 1.0,
1.0, 1.0]); 1.0, 1.0]);
@ -8403,7 +8402,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer); gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer);
gl.bufferData(gl.ARRAY_BUFFER, this.uvArray, gl.STATIC_DRAW); 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, 1.0, 0xFFFFFF,
1.0, 0xFFFFFF]); 1.0, 0xFFFFFF]);
@ -10724,19 +10723,7 @@ PIXI.BaseTexture.prototype.destroy = function()
} }
this.source = null; this.source = null;
// delete the webGL textures if any. this.unloadFromGPU();
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;
}; };
/** /**
@ -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. * 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. * If the image is not in the base texture cache it will be created and loaded.
@ -11414,6 +11429,9 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, matrix, clea
wt.identity(); wt.identity();
if(matrix)wt.append(matrix); 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.. // Time to update all the children of the displayObject with the new matrix..
var children = displayObject.children; var children = displayObject.children;
@ -11606,7 +11624,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
* *
* Phaser - http://phaser.io * 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 * By Richard Davey http://www.photonstorm.com @photonstorm
* *
@ -11649,7 +11667,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*/ */
var Phaser = Phaser || { var Phaser = Phaser || {
VERSION: '2.1.4-dev', VERSION: '2.2.0-dev',
GAMES: [], GAMES: [],
AUTO: 0, AUTO: 0,
@ -16319,7 +16337,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
this.dirty = false; this.dirty = false;
} }
this._cachedSprite.alpha = this.alpha; this._cachedSprite.worldAlpha = this.worldAlpha;
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession); PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
return; return;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
* *
* Phaser - http://phaser.io * 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 * 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 = newPos || new PIXI.Point();
newPos.x = this.a * pos.x + this.b * pos.y + this.tx; newPos.x = this.a * pos.x + this.c * pos.y + this.tx;
newPos.y = this.c * pos.x + this.d * pos.y + this.ty; newPos.y = this.b * pos.x + this.d * pos.y + this.ty;
return newPos; return newPos;
}; };
@ -1882,8 +1882,7 @@ PIXI.Sprite = function(texture)
} }
else else
{ {
this.onTextureUpdateBind = this.onTextureUpdate.bind(this); this.texture.on( 'update', this.onTextureUpdate.bind(this) );
this.texture.on( 'update', this.onTextureUpdateBind );
} }
this.renderable = true; this.renderable = true;
@ -2662,7 +2661,7 @@ PIXI.Text.prototype.updateText = function()
this.context.strokeStyle = this.style.stroke; this.context.strokeStyle = this.style.stroke;
this.context.lineWidth = this.style.strokeThickness; this.context.lineWidth = this.style.strokeThickness;
this.context.textBaseline = 'alphabetic'; this.context.textBaseline = 'alphabetic';
this.context.lineJoin = 'round'; //this.context.lineJoin = 'round';
var linePositionX; var linePositionX;
var linePositionY; var linePositionY;
@ -3598,7 +3597,7 @@ PIXI.EventTarget = {
//iterate the listeners //iterate the listeners
if(this._listeners && this._listeners[eventName]) { if(this._listeners && this._listeners[eventName]) {
var listeners = this._listeners[eventName], var listeners = this._listeners[eventName].slice(0),
length = listeners.length, length = listeners.length,
fn = listeners[0], fn = listeners[0],
i; i;
@ -4655,7 +4654,7 @@ PIXI.StripShader = function(gl)
'uniform sampler2D uSampler;', 'uniform sampler2D uSampler;',
'void main(void) {', '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;', // ' 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; var gl = this.gl;
// this.lastIndex = graphics.graphicsData.length; // 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.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
gl.bufferData(gl.ARRAY_BUFFER, this.glPoints, gl.STATIC_DRAW); 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.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.glIndicies, gl.STATIC_DRAW); 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() PIXI.WebGLRenderer.prototype.destroy = function()
{ {
// remove listeners // remove listeners
this.view.off('webglcontextlost', this.contextLostBound); this.view.removeEventListener('webglcontextlost', this.contextLostBound);
this.view.off('webglcontextrestored', this.contextRestoredBound); this.view.removeEventListener('webglcontextrestored', this.contextRestoredBound);
PIXI.glContexts[this.glContextId] = null; PIXI.glContexts[this.glContextId] = null;
@ -7001,7 +7000,7 @@ PIXI.WebGLSpriteBatch = function()
* @property vertices * @property vertices
* @type Float32Array * @type Float32Array
*/ */
this.vertices = new Float32Array(numVerts); this.vertices = new PIXI.Float32Array(numVerts);
/** /**
* Holds the indices * Holds the indices
@ -7009,7 +7008,7 @@ PIXI.WebGLSpriteBatch = function()
* @property indices * @property indices
* @type Uint16Array * @type Uint16Array
*/ */
this.indices = new Uint16Array(numIndices); this.indices = new PIXI.Uint16Array(numIndices);
/** /**
* @property lastIndexCount * @property lastIndexCount
@ -7610,14 +7609,14 @@ PIXI.WebGLFastSpriteBatch = function(gl)
* @property vertices * @property vertices
* @type Float32Array * @type Float32Array
*/ */
this.vertices = new Float32Array(numVerts); this.vertices = new PIXI.Float32Array(numVerts);
/** /**
* Index data * Index data
* @property indices * @property indices
* @type Uint16Array * @type Uint16Array
*/ */
this.indices = new Uint16Array(numIndices); this.indices = new PIXI.Uint16Array(numIndices);
/** /**
* @property vertexBuffer * @property vertexBuffer
@ -8386,7 +8385,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
// bind and upload the vertexs.. // bind and upload the vertexs..
// keep a reference to the vertexFloatData.. // 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, 1.0, 0.0,
0.0, 1.0, 0.0, 1.0,
1.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); gl.bufferData(gl.ARRAY_BUFFER, this.vertexArray, gl.STATIC_DRAW);
// bind and upload the uv buffer // 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, 1.0, 0.0,
0.0, 1.0, 0.0, 1.0,
1.0, 1.0]); 1.0, 1.0]);
@ -8403,7 +8402,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer); gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer);
gl.bufferData(gl.ARRAY_BUFFER, this.uvArray, gl.STATIC_DRAW); 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, 1.0, 0xFFFFFF,
1.0, 0xFFFFFF]); 1.0, 0xFFFFFF]);
@ -10724,19 +10723,7 @@ PIXI.BaseTexture.prototype.destroy = function()
} }
this.source = null; this.source = null;
// delete the webGL textures if any. this.unloadFromGPU();
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;
}; };
/** /**
@ -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. * 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. * If the image is not in the base texture cache it will be created and loaded.
@ -11414,6 +11429,9 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, matrix, clea
wt.identity(); wt.identity();
if(matrix)wt.append(matrix); 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.. // Time to update all the children of the displayObject with the new matrix..
var children = displayObject.children; var children = displayObject.children;
@ -11606,7 +11624,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
* *
* Phaser - http://phaser.io * 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 * By Richard Davey http://www.photonstorm.com @photonstorm
* *
@ -11649,7 +11667,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*/ */
var Phaser = Phaser || { var Phaser = Phaser || {
VERSION: '2.1.4-dev', VERSION: '2.2.0-dev',
GAMES: [], GAMES: [],
AUTO: 0, AUTO: 0,
@ -16319,7 +16337,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
this.dirty = false; this.dirty = false;
} }
this._cachedSprite.alpha = this.alpha; this._cachedSprite.worldAlpha = this.worldAlpha;
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession); PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
return; return;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
* *
* Phaser - http://phaser.io * 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 * By Richard Davey http://www.photonstorm.com @photonstorm
* *
@ -50,7 +50,7 @@
*/ */
var Phaser = Phaser || { var Phaser = Phaser || {
VERSION: '2.1.4-dev', VERSION: '2.2.0-dev',
GAMES: [], GAMES: [],
AUTO: 0, AUTO: 0,
@ -4720,7 +4720,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
this.dirty = false; this.dirty = false;
} }
this._cachedSprite.alpha = this.alpha; this._cachedSprite.worldAlpha = this.worldAlpha;
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession); PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
return; return;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
* *
* Phaser - http://phaser.io * 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 * 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 = newPos || new PIXI.Point();
newPos.x = this.a * pos.x + this.b * pos.y + this.tx; newPos.x = this.a * pos.x + this.c * pos.y + this.tx;
newPos.y = this.c * pos.x + this.d * pos.y + this.ty; newPos.y = this.b * pos.x + this.d * pos.y + this.ty;
return newPos; return newPos;
}; };
@ -1882,8 +1882,7 @@ PIXI.Sprite = function(texture)
} }
else else
{ {
this.onTextureUpdateBind = this.onTextureUpdate.bind(this); this.texture.on( 'update', this.onTextureUpdate.bind(this) );
this.texture.on( 'update', this.onTextureUpdateBind );
} }
this.renderable = true; this.renderable = true;
@ -2662,7 +2661,7 @@ PIXI.Text.prototype.updateText = function()
this.context.strokeStyle = this.style.stroke; this.context.strokeStyle = this.style.stroke;
this.context.lineWidth = this.style.strokeThickness; this.context.lineWidth = this.style.strokeThickness;
this.context.textBaseline = 'alphabetic'; this.context.textBaseline = 'alphabetic';
this.context.lineJoin = 'round'; //this.context.lineJoin = 'round';
var linePositionX; var linePositionX;
var linePositionY; var linePositionY;
@ -3598,7 +3597,7 @@ PIXI.EventTarget = {
//iterate the listeners //iterate the listeners
if(this._listeners && this._listeners[eventName]) { if(this._listeners && this._listeners[eventName]) {
var listeners = this._listeners[eventName], var listeners = this._listeners[eventName].slice(0),
length = listeners.length, length = listeners.length,
fn = listeners[0], fn = listeners[0],
i; i;
@ -4655,7 +4654,7 @@ PIXI.StripShader = function(gl)
'uniform sampler2D uSampler;', 'uniform sampler2D uSampler;',
'void main(void) {', '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;', // ' 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; var gl = this.gl;
// this.lastIndex = graphics.graphicsData.length; // 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.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
gl.bufferData(gl.ARRAY_BUFFER, this.glPoints, gl.STATIC_DRAW); 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.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.glIndicies, gl.STATIC_DRAW); 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() PIXI.WebGLRenderer.prototype.destroy = function()
{ {
// remove listeners // remove listeners
this.view.off('webglcontextlost', this.contextLostBound); this.view.removeEventListener('webglcontextlost', this.contextLostBound);
this.view.off('webglcontextrestored', this.contextRestoredBound); this.view.removeEventListener('webglcontextrestored', this.contextRestoredBound);
PIXI.glContexts[this.glContextId] = null; PIXI.glContexts[this.glContextId] = null;
@ -7001,7 +7000,7 @@ PIXI.WebGLSpriteBatch = function()
* @property vertices * @property vertices
* @type Float32Array * @type Float32Array
*/ */
this.vertices = new Float32Array(numVerts); this.vertices = new PIXI.Float32Array(numVerts);
/** /**
* Holds the indices * Holds the indices
@ -7009,7 +7008,7 @@ PIXI.WebGLSpriteBatch = function()
* @property indices * @property indices
* @type Uint16Array * @type Uint16Array
*/ */
this.indices = new Uint16Array(numIndices); this.indices = new PIXI.Uint16Array(numIndices);
/** /**
* @property lastIndexCount * @property lastIndexCount
@ -7610,14 +7609,14 @@ PIXI.WebGLFastSpriteBatch = function(gl)
* @property vertices * @property vertices
* @type Float32Array * @type Float32Array
*/ */
this.vertices = new Float32Array(numVerts); this.vertices = new PIXI.Float32Array(numVerts);
/** /**
* Index data * Index data
* @property indices * @property indices
* @type Uint16Array * @type Uint16Array
*/ */
this.indices = new Uint16Array(numIndices); this.indices = new PIXI.Uint16Array(numIndices);
/** /**
* @property vertexBuffer * @property vertexBuffer
@ -8386,7 +8385,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
// bind and upload the vertexs.. // bind and upload the vertexs..
// keep a reference to the vertexFloatData.. // 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, 1.0, 0.0,
0.0, 1.0, 0.0, 1.0,
1.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); gl.bufferData(gl.ARRAY_BUFFER, this.vertexArray, gl.STATIC_DRAW);
// bind and upload the uv buffer // 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, 1.0, 0.0,
0.0, 1.0, 0.0, 1.0,
1.0, 1.0]); 1.0, 1.0]);
@ -8403,7 +8402,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer); gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer);
gl.bufferData(gl.ARRAY_BUFFER, this.uvArray, gl.STATIC_DRAW); 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, 1.0, 0xFFFFFF,
1.0, 0xFFFFFF]); 1.0, 0xFFFFFF]);
@ -10724,19 +10723,7 @@ PIXI.BaseTexture.prototype.destroy = function()
} }
this.source = null; this.source = null;
// delete the webGL textures if any. this.unloadFromGPU();
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;
}; };
/** /**
@ -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. * 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. * If the image is not in the base texture cache it will be created and loaded.
@ -11414,6 +11429,9 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, matrix, clea
wt.identity(); wt.identity();
if(matrix)wt.append(matrix); 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.. // Time to update all the children of the displayObject with the new matrix..
var children = displayObject.children; var children = displayObject.children;
@ -11619,7 +11637,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*/ */
var Phaser = Phaser || { var Phaser = Phaser || {
VERSION: '2.1.4-dev', VERSION: '2.2.0-dev',
GAMES: [], GAMES: [],
AUTO: 0, AUTO: 0,
@ -16289,7 +16307,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
this.dirty = false; this.dirty = false;
} }
this._cachedSprite.alpha = this.alpha; this._cachedSprite.worldAlpha = this.worldAlpha;
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession); PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
return; 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 = newPos || new PIXI.Point();
newPos.x = this.a * pos.x + this.b * pos.y + this.tx; newPos.x = this.a * pos.x + this.c * pos.y + this.tx;
newPos.y = this.c * pos.x + this.d * pos.y + this.ty; newPos.y = this.b * pos.x + this.d * pos.y + this.ty;
return newPos; return newPos;
}; };
@ -1852,8 +1852,7 @@ PIXI.Sprite = function(texture)
} }
else else
{ {
this.onTextureUpdateBind = this.onTextureUpdate.bind(this); this.texture.on( 'update', this.onTextureUpdate.bind(this) );
this.texture.on( 'update', this.onTextureUpdateBind );
} }
this.renderable = true; this.renderable = true;
@ -2632,7 +2631,7 @@ PIXI.Text.prototype.updateText = function()
this.context.strokeStyle = this.style.stroke; this.context.strokeStyle = this.style.stroke;
this.context.lineWidth = this.style.strokeThickness; this.context.lineWidth = this.style.strokeThickness;
this.context.textBaseline = 'alphabetic'; this.context.textBaseline = 'alphabetic';
this.context.lineJoin = 'round'; //this.context.lineJoin = 'round';
var linePositionX; var linePositionX;
var linePositionY; var linePositionY;
@ -3568,7 +3567,7 @@ PIXI.EventTarget = {
//iterate the listeners //iterate the listeners
if(this._listeners && this._listeners[eventName]) { if(this._listeners && this._listeners[eventName]) {
var listeners = this._listeners[eventName], var listeners = this._listeners[eventName].slice(0),
length = listeners.length, length = listeners.length,
fn = listeners[0], fn = listeners[0],
i; i;
@ -4625,7 +4624,7 @@ PIXI.StripShader = function(gl)
'uniform sampler2D uSampler;', 'uniform sampler2D uSampler;',
'void main(void) {', '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;', // ' 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; var gl = this.gl;
// this.lastIndex = graphics.graphicsData.length; // 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.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
gl.bufferData(gl.ARRAY_BUFFER, this.glPoints, gl.STATIC_DRAW); 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.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.glIndicies, gl.STATIC_DRAW); 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() PIXI.WebGLRenderer.prototype.destroy = function()
{ {
// remove listeners // remove listeners
this.view.off('webglcontextlost', this.contextLostBound); this.view.removeEventListener('webglcontextlost', this.contextLostBound);
this.view.off('webglcontextrestored', this.contextRestoredBound); this.view.removeEventListener('webglcontextrestored', this.contextRestoredBound);
PIXI.glContexts[this.glContextId] = null; PIXI.glContexts[this.glContextId] = null;
@ -6971,7 +6970,7 @@ PIXI.WebGLSpriteBatch = function()
* @property vertices * @property vertices
* @type Float32Array * @type Float32Array
*/ */
this.vertices = new Float32Array(numVerts); this.vertices = new PIXI.Float32Array(numVerts);
/** /**
* Holds the indices * Holds the indices
@ -6979,7 +6978,7 @@ PIXI.WebGLSpriteBatch = function()
* @property indices * @property indices
* @type Uint16Array * @type Uint16Array
*/ */
this.indices = new Uint16Array(numIndices); this.indices = new PIXI.Uint16Array(numIndices);
/** /**
* @property lastIndexCount * @property lastIndexCount
@ -7580,14 +7579,14 @@ PIXI.WebGLFastSpriteBatch = function(gl)
* @property vertices * @property vertices
* @type Float32Array * @type Float32Array
*/ */
this.vertices = new Float32Array(numVerts); this.vertices = new PIXI.Float32Array(numVerts);
/** /**
* Index data * Index data
* @property indices * @property indices
* @type Uint16Array * @type Uint16Array
*/ */
this.indices = new Uint16Array(numIndices); this.indices = new PIXI.Uint16Array(numIndices);
/** /**
* @property vertexBuffer * @property vertexBuffer
@ -8356,7 +8355,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
// bind and upload the vertexs.. // bind and upload the vertexs..
// keep a reference to the vertexFloatData.. // 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, 1.0, 0.0,
0.0, 1.0, 0.0, 1.0,
1.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); gl.bufferData(gl.ARRAY_BUFFER, this.vertexArray, gl.STATIC_DRAW);
// bind and upload the uv buffer // 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, 1.0, 0.0,
0.0, 1.0, 0.0, 1.0,
1.0, 1.0]); 1.0, 1.0]);
@ -8373,7 +8372,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer); gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer);
gl.bufferData(gl.ARRAY_BUFFER, this.uvArray, gl.STATIC_DRAW); 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, 1.0, 0xFFFFFF,
1.0, 0xFFFFFF]); 1.0, 0xFFFFFF]);
@ -10694,19 +10693,7 @@ PIXI.BaseTexture.prototype.destroy = function()
} }
this.source = null; this.source = null;
// delete the webGL textures if any. this.unloadFromGPU();
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;
}; };
/** /**
@ -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. * 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. * If the image is not in the base texture cache it will be created and loaded.
@ -11384,6 +11399,9 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, matrix, clea
wt.identity(); wt.identity();
if(matrix)wt.append(matrix); 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.. // Time to update all the children of the displayObject with the new matrix..
var children = displayObject.children; 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 * 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 * 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 = newPos || new PIXI.Point();
newPos.x = this.a * pos.x + this.b * pos.y + this.tx; newPos.x = this.a * pos.x + this.c * pos.y + this.tx;
newPos.y = this.c * pos.x + this.d * pos.y + this.ty; newPos.y = this.b * pos.x + this.d * pos.y + this.ty;
return newPos; return newPos;
}; };
@ -1882,8 +1882,7 @@ PIXI.Sprite = function(texture)
} }
else else
{ {
this.onTextureUpdateBind = this.onTextureUpdate.bind(this); this.texture.on( 'update', this.onTextureUpdate.bind(this) );
this.texture.on( 'update', this.onTextureUpdateBind );
} }
this.renderable = true; this.renderable = true;
@ -2662,7 +2661,7 @@ PIXI.Text.prototype.updateText = function()
this.context.strokeStyle = this.style.stroke; this.context.strokeStyle = this.style.stroke;
this.context.lineWidth = this.style.strokeThickness; this.context.lineWidth = this.style.strokeThickness;
this.context.textBaseline = 'alphabetic'; this.context.textBaseline = 'alphabetic';
this.context.lineJoin = 'round'; //this.context.lineJoin = 'round';
var linePositionX; var linePositionX;
var linePositionY; var linePositionY;
@ -3598,7 +3597,7 @@ PIXI.EventTarget = {
//iterate the listeners //iterate the listeners
if(this._listeners && this._listeners[eventName]) { if(this._listeners && this._listeners[eventName]) {
var listeners = this._listeners[eventName], var listeners = this._listeners[eventName].slice(0),
length = listeners.length, length = listeners.length,
fn = listeners[0], fn = listeners[0],
i; i;
@ -4655,7 +4654,7 @@ PIXI.StripShader = function(gl)
'uniform sampler2D uSampler;', 'uniform sampler2D uSampler;',
'void main(void) {', '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;', // ' 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; var gl = this.gl;
// this.lastIndex = graphics.graphicsData.length; // 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.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
gl.bufferData(gl.ARRAY_BUFFER, this.glPoints, gl.STATIC_DRAW); 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.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.glIndicies, gl.STATIC_DRAW); 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() PIXI.WebGLRenderer.prototype.destroy = function()
{ {
// remove listeners // remove listeners
this.view.off('webglcontextlost', this.contextLostBound); this.view.removeEventListener('webglcontextlost', this.contextLostBound);
this.view.off('webglcontextrestored', this.contextRestoredBound); this.view.removeEventListener('webglcontextrestored', this.contextRestoredBound);
PIXI.glContexts[this.glContextId] = null; PIXI.glContexts[this.glContextId] = null;
@ -7001,7 +7000,7 @@ PIXI.WebGLSpriteBatch = function()
* @property vertices * @property vertices
* @type Float32Array * @type Float32Array
*/ */
this.vertices = new Float32Array(numVerts); this.vertices = new PIXI.Float32Array(numVerts);
/** /**
* Holds the indices * Holds the indices
@ -7009,7 +7008,7 @@ PIXI.WebGLSpriteBatch = function()
* @property indices * @property indices
* @type Uint16Array * @type Uint16Array
*/ */
this.indices = new Uint16Array(numIndices); this.indices = new PIXI.Uint16Array(numIndices);
/** /**
* @property lastIndexCount * @property lastIndexCount
@ -7610,14 +7609,14 @@ PIXI.WebGLFastSpriteBatch = function(gl)
* @property vertices * @property vertices
* @type Float32Array * @type Float32Array
*/ */
this.vertices = new Float32Array(numVerts); this.vertices = new PIXI.Float32Array(numVerts);
/** /**
* Index data * Index data
* @property indices * @property indices
* @type Uint16Array * @type Uint16Array
*/ */
this.indices = new Uint16Array(numIndices); this.indices = new PIXI.Uint16Array(numIndices);
/** /**
* @property vertexBuffer * @property vertexBuffer
@ -8386,7 +8385,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
// bind and upload the vertexs.. // bind and upload the vertexs..
// keep a reference to the vertexFloatData.. // 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, 1.0, 0.0,
0.0, 1.0, 0.0, 1.0,
1.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); gl.bufferData(gl.ARRAY_BUFFER, this.vertexArray, gl.STATIC_DRAW);
// bind and upload the uv buffer // 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, 1.0, 0.0,
0.0, 1.0, 0.0, 1.0,
1.0, 1.0]); 1.0, 1.0]);
@ -8403,7 +8402,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer); gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer);
gl.bufferData(gl.ARRAY_BUFFER, this.uvArray, gl.STATIC_DRAW); 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, 1.0, 0xFFFFFF,
1.0, 0xFFFFFF]); 1.0, 0xFFFFFF]);
@ -10724,19 +10723,7 @@ PIXI.BaseTexture.prototype.destroy = function()
} }
this.source = null; this.source = null;
// delete the webGL textures if any. this.unloadFromGPU();
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;
}; };
/** /**
@ -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. * 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. * If the image is not in the base texture cache it will be created and loaded.
@ -11414,6 +11429,9 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, matrix, clea
wt.identity(); wt.identity();
if(matrix)wt.append(matrix); 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.. // Time to update all the children of the displayObject with the new matrix..
var children = displayObject.children; var children = displayObject.children;
@ -11606,7 +11624,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
* *
* Phaser - http://phaser.io * 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 * By Richard Davey http://www.photonstorm.com @photonstorm
* *
@ -11649,7 +11667,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*/ */
var Phaser = Phaser || { var Phaser = Phaser || {
VERSION: '2.1.4-dev', VERSION: '2.2.0-dev',
GAMES: [], GAMES: [],
AUTO: 0, AUTO: 0,
@ -16319,7 +16337,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
this.dirty = false; this.dirty = false;
} }
this._cachedSprite.alpha = this.alpha; this._cachedSprite.worldAlpha = this.worldAlpha;
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession); PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
return; 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