Skip to content

Commit c47d9ea

Browse files
committed
Integrated latest development build of Pixi (lots of v2 specific bugs fixed)
1 parent 71507c5 commit c47d9ea

17 files changed

Lines changed: 210 additions & 46 deletions

src/pixi/display/Sprite.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
* @extends DisplayObjectContainer
1010
* @constructor
1111
* @param texture {Texture} The texture for this sprite
12-
*
13-
* A sprite can be created directly from an image like this :
12+
*
13+
* A sprite can be created directly from an image like this :
1414
* var sprite = new PIXI.Sprite.fromImage('assets/image.png');
1515
* yourStage.addChild(sprite);
1616
* then obviously don't forget to add it to the stage you have already created
@@ -64,7 +64,7 @@ PIXI.Sprite = function(texture)
6464
* @default 0xFFFFFF
6565
*/
6666
this.tint = 0xFFFFFF;
67-
67+
6868
/**
6969
* The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode.
7070
*
@@ -89,8 +89,7 @@ PIXI.Sprite = function(texture)
8989
}
9090
else
9191
{
92-
this.onTextureUpdateBind = this.onTextureUpdate.bind(this);
93-
this.texture.on( 'update', this.onTextureUpdateBind );
92+
this.texture.on( 'update', this.onTextureUpdate.bind(this) );
9493
}
9594

9695
this.renderable = true;
@@ -244,14 +243,14 @@ PIXI.Sprite.prototype.getBounds = function(matrix)
244243
* Renders the object using the WebGL renderer
245244
*
246245
* @method _renderWebGL
247-
* @param renderSession {RenderSession}
246+
* @param renderSession {RenderSession}
248247
* @private
249248
*/
250249
PIXI.Sprite.prototype._renderWebGL = function(renderSession)
251250
{
252251
// if the sprite is not visible or the alpha is 0 then no need to render this element
253252
if(!this.visible || this.alpha <= 0)return;
254-
253+
255254
var i,j;
256255

257256
// do a quick check to see if this element has a mask or a filter.
@@ -287,7 +286,7 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
287286

288287
if(this._mask)renderSession.maskManager.popMask(this._mask, renderSession);
289288
if(this._filters)renderSession.filterManager.popFilter();
290-
289+
291290
spriteBatch.start();
292291
}
293292
else
@@ -299,22 +298,22 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession)
299298
{
300299
this.children[i]._renderWebGL(renderSession);
301300
}
302-
301+
303302
}
304303
};
305304

306305
/**
307306
* Renders the object using the Canvas renderer
308307
*
309308
* @method _renderCanvas
310-
* @param renderSession {RenderSession}
309+
* @param renderSession {RenderSession}
311310
* @private
312311
*/
313312
PIXI.Sprite.prototype._renderCanvas = function(renderSession)
314313
{
315314
// If the sprite is not visible or the alpha is 0 then no need to render this element
316315
if (this.visible === false || this.alpha === 0 || this.texture.crop.width <= 0 || this.texture.crop.height <= 0) return;
317-
316+
318317
if (this.blendMode !== renderSession.currentBlendMode)
319318
{
320319
renderSession.currentBlendMode = this.blendMode;
@@ -371,7 +370,7 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession)
371370
if (this.cachedTint !== this.tint)
372371
{
373372
this.cachedTint = this.tint;
374-
373+
375374
// TODO clean up caching - how to clean up the caches?
376375
this.tintedTexture = PIXI.CanvasTinter.getTintedTexture(this, this.tint);
377376
}

src/pixi/filters/AsciiFilter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ PIXI.AsciiFilter = function()
1818

1919
// set the uniforms
2020
this.uniforms = {
21-
dimensions: {type: '4fv', value:new Float32Array([10000, 100, 10, 10])},
21+
dimensions: {type: '4fv', value:new PIXI.Float32Array([10000, 100, 10, 10])},
2222
pixelSize: {type: '1f', value:8}
2323
};
2424

src/pixi/filters/ConvolutionFilter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PIXI.ConvolutionFilter = function(matrix, width, height)
1919

2020
// set the uniforms
2121
this.uniforms = {
22-
m : {type: '1fv', value: new Float32Array(matrix)},
22+
m : {type: '1fv', value: new PIXI.Float32Array(matrix)},
2323
texelSizeX: {type: '1f', value: 1 / width},
2424
texelSizeY: {type: '1f', value: 1 / height}
2525
};
@@ -71,7 +71,7 @@ Object.defineProperty(PIXI.ConvolutionFilter.prototype, 'matrix', {
7171
return this.uniforms.m.value;
7272
},
7373
set: function(value) {
74-
this.uniforms.m.value = new Float32Array(value);
74+
this.uniforms.m.value = new PIXI.Float32Array(value);
7575
}
7676
});
7777

src/pixi/filters/PixelateFilter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ PIXI.PixelateFilter = function()
1818
// set the uniforms
1919
this.uniforms = {
2020
invert: {type: '1f', value: 0},
21-
dimensions: {type: '4fv', value:new Float32Array([10000, 100, 10, 10])},
21+
dimensions: {type: '4fv', value:new PIXI.Float32Array([10000, 100, 10, 10])},
2222
pixelSize: {type: '2f', value:{x:10, y:10}}
2323
};
2424

src/pixi/geom/Matrix.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ PIXI.Matrix.prototype.apply = function(pos, newPos)
133133
{
134134
newPos = newPos || new PIXI.Point();
135135

136-
newPos.x = this.a * pos.x + this.b * pos.y + this.tx;
137-
newPos.y = this.c * pos.x + this.d * pos.y + this.ty;
136+
newPos.x = this.a * pos.x + this.c * pos.y + this.tx;
137+
newPos.y = this.b * pos.x + this.d * pos.y + this.ty;
138138

139139
return newPos;
140140
};

src/pixi/primitives/Graphics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
669669
this.dirty = false;
670670
}
671671

672-
this._cachedSprite.alpha = this.alpha;
672+
this._cachedSprite.worldAlpha = this.worldAlpha;
673673
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
674674

675675
return;

src/pixi/renderers/webgl/WebGLRenderer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ PIXI.WebGLRenderer.prototype.handleContextRestored = function()
465465
PIXI.WebGLRenderer.prototype.destroy = function()
466466
{
467467
// remove listeners
468-
this.view.off('webglcontextlost', this.contextLostBound);
469-
this.view.off('webglcontextrestored', this.contextRestoredBound);
468+
this.view.removeEventListener('webglcontextlost', this.contextLostBound);
469+
this.view.removeEventListener('webglcontextrestored', this.contextRestoredBound);
470470

471471
PIXI.glContexts[this.glContextId] = null;
472472

src/pixi/renderers/webgl/shaders/StripShader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ PIXI.StripShader = function(gl)
4242
'uniform sampler2D uSampler;',
4343

4444
'void main(void) {',
45-
' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));',
45+
' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * alpha;',
4646
// ' gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);',//gl_FragColor * alpha;',
4747
'}'
4848
];

src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ PIXI.WebGLFastSpriteBatch = function(gl)
4343
* @property vertices
4444
* @type Float32Array
4545
*/
46-
this.vertices = new Float32Array(numVerts);
46+
this.vertices = new PIXI.Float32Array(numVerts);
4747

4848
/**
4949
* Index data
5050
* @property indices
5151
* @type Uint16Array
5252
*/
53-
this.indices = new Uint16Array(numIndices);
53+
this.indices = new PIXI.Uint16Array(numIndices);
5454

5555
/**
5656
* @property vertexBuffer

src/pixi/renderers/webgl/utils/WebGLFilterManager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
390390

391391
// bind and upload the vertexs..
392392
// keep a reference to the vertexFloatData..
393-
this.vertexArray = new Float32Array([0.0, 0.0,
393+
this.vertexArray = new PIXI.Float32Array([0.0, 0.0,
394394
1.0, 0.0,
395395
0.0, 1.0,
396396
1.0, 1.0]);
@@ -399,15 +399,15 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
399399
gl.bufferData(gl.ARRAY_BUFFER, this.vertexArray, gl.STATIC_DRAW);
400400

401401
// bind and upload the uv buffer
402-
this.uvArray = new Float32Array([0.0, 0.0,
402+
this.uvArray = new PIXI.Float32Array([0.0, 0.0,
403403
1.0, 0.0,
404404
0.0, 1.0,
405405
1.0, 1.0]);
406406

407407
gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer);
408408
gl.bufferData(gl.ARRAY_BUFFER, this.uvArray, gl.STATIC_DRAW);
409409

410-
this.colorArray = new Float32Array([1.0, 0xFFFFFF,
410+
this.colorArray = new PIXI.Float32Array([1.0, 0xFFFFFF,
411411
1.0, 0xFFFFFF,
412412
1.0, 0xFFFFFF,
413413
1.0, 0xFFFFFF]);

0 commit comments

Comments
 (0)