Skip to content

Commit eff9759

Browse files
committed
Updated to Pixi 2.2.0 release.
1 parent c6c5856 commit eff9759

14 files changed

Lines changed: 119 additions & 47 deletions

src/pixi/Pixi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ PIXI.CANVAS_RENDERER = 1;
3939
PIXI.VERSION = "v2.2.0";
4040

4141
/**
42-
* Various blend modes supported by pixi.
42+
* Various blend modes supported by pixi. IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.
4343
* @property {Object} blendModes
4444
* @property {Number} blendModes.NORMAL
4545
* @property {Number} blendModes.ADD

src/pixi/geom/Circle.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ PIXI.Circle = function(x, y, radius)
3333
* @default 0
3434
*/
3535
this.radius = radius || 0;
36+
37+
/**
38+
* The type of the object, should be one of the Graphics type consts, PIXI.Graphics.CIRC in this case
39+
* @property type
40+
* @type Number
41+
* @default 0
42+
*/
3643
};
3744

3845
/**

src/pixi/geom/Ellipse.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ PIXI.Ellipse = function(x, y, width, height)
4141
* @default 0
4242
*/
4343
this.height = height || 0;
44+
45+
46+
/**
47+
* The type of the object, should be one of the Graphics type consts, PIXI.Graphics.ELIP in this case
48+
* @property type
49+
* @type Number
50+
* @default 0
51+
*/
4452
};
4553

4654
/**

src/pixi/geom/Polygon.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,21 @@ PIXI.Polygon = function(points)
2929
}
3030

3131
this.closed = true;
32+
33+
/**
34+
* An array of the points of this polygon
35+
* @property points
36+
* @type Array(Point)|Array(Number)
37+
*
38+
*/
3239
this.points = points;
40+
41+
/**
42+
* The type of the object, should be one of the Graphics type consts, PIXI.Graphics.POLY in this case
43+
* @property type
44+
* @type Number
45+
* @default 0
46+
*/
3347
};
3448

3549
/**

src/pixi/geom/Rectangle.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ PIXI.Rectangle = function(x, y, width, height)
4141
* @default 0
4242
*/
4343
this.height = height || 0;
44+
45+
/**
46+
* The type of the object, should be one of the Graphics type consts, PIXI.Graphics.RECT in this case
47+
* @property type
48+
* @type Number
49+
* @default 0
50+
*/
4451
};
4552

4653
/**

src/pixi/geom/RoundedRectangle.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @param y {Number} The Y coordinate of the upper-left corner of the rounded rectangle
1212
* @param width {Number} The overall width of this rounded rectangle
1313
* @param height {Number} The overall height of this rounded rectangle
14-
* @param radius {Number} The overall radius of this corners of this rounded rectangle
14+
* @param radius {Number} Controls the radius of the rounded corners
1515
*/
1616
PIXI.RoundedRectangle = function(x, y, width, height, radius)
1717
{
@@ -49,6 +49,13 @@ PIXI.RoundedRectangle = function(x, y, width, height, radius)
4949
* @default 20
5050
*/
5151
this.radius = radius || 20;
52+
53+
/**
54+
* The type of the object, should be one of the Graphics type consts, PIXI.Graphics.RRECT in this case
55+
* @property type
56+
* @type Number
57+
* @default 0
58+
*/
5259
};
5360

5461
/**

src/pixi/renderers/webgl/WebGLRenderer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ PIXI.WebGLRenderer.prototype.renderDisplayObject = function(displayObject, proje
356356
// reset the render session data..
357357
this.renderSession.drawCount = 0;
358358

359+
// make sure to flip the Y if using a render texture..
360+
this.renderSession.flipY = buffer ? -1 : 1;
361+
359362
// set the default projection
360363
this.renderSession.projection = projection;
361364

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ PIXI.ComplexPrimitiveShader = function(gl)
6060
'uniform vec3 tint;',
6161
'uniform float alpha;',
6262
'uniform vec3 color;',
63-
63+
'uniform float flipY;',
6464
'varying vec4 vColor;',
6565

6666
'void main(void) {',
6767
' vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);',
6868
' v -= offsetVector.xyx;',
69-
' gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);',
69+
' gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);',
7070
' vColor = vec4(color * alpha * tint, alpha);',//" * vec4(tint * alpha, alpha);',
7171
'}'
7272
];
@@ -93,6 +93,7 @@ PIXI.ComplexPrimitiveShader.prototype.init = function()
9393
this.offsetVector = gl.getUniformLocation(program, 'offsetVector');
9494
this.tintColor = gl.getUniformLocation(program, 'tint');
9595
this.color = gl.getUniformLocation(program, 'color');
96+
this.flipY = gl.getUniformLocation(program, 'flipY');
9697

9798
// get and store the attributes
9899
this.aVertexPosition = gl.getAttribLocation(program, 'aVertexPosition');

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ PIXI.PrimitiveShader = function(gl)
5555
'uniform vec2 projectionVector;',
5656
'uniform vec2 offsetVector;',
5757
'uniform float alpha;',
58+
'uniform float flipY;',
5859
'uniform vec3 tint;',
5960
'varying vec4 vColor;',
6061

6162
'void main(void) {',
6263
' vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);',
6364
' v -= offsetVector.xyx;',
64-
' gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);',
65+
' gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);',
6566
' vColor = aColor * vec4(tint * alpha, alpha);',
6667
'}'
6768
];
@@ -87,6 +88,7 @@ PIXI.PrimitiveShader.prototype.init = function()
8788
this.projectionVector = gl.getUniformLocation(program, 'projectionVector');
8889
this.offsetVector = gl.getUniformLocation(program, 'offsetVector');
8990
this.tintColor = gl.getUniformLocation(program, 'tint');
91+
this.flipY = gl.getUniformLocation(program, 'flipY');
9092

9193
// get and store the attributes
9294
this.aVertexPosition = gl.getAttribLocation(program, 'aVertexPosition');

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

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ PIXI.WebGLFastSpriteBatch.prototype.renderSprite = function(sprite)
223223
if(!sprite.texture._uvs)return;
224224
}
225225

226-
var uvs, verticies = this.vertices, width, height, w0, w1, h0, h1, index;
226+
var uvs, vertices = this.vertices, width, height, w0, w1, h0, h1, index;
227227

228228
uvs = sprite.texture._uvs;
229229

@@ -253,89 +253,89 @@ PIXI.WebGLFastSpriteBatch.prototype.renderSprite = function(sprite)
253253
index = this.currentBatchSize * 4 * this.vertSize;
254254

255255
// xy
256-
verticies[index++] = w1;
257-
verticies[index++] = h1;
256+
vertices[index++] = w1;
257+
vertices[index++] = h1;
258258

259-
verticies[index++] = sprite.position.x;
260-
verticies[index++] = sprite.position.y;
259+
vertices[index++] = sprite.position.x;
260+
vertices[index++] = sprite.position.y;
261261

262262
//scale
263-
verticies[index++] = sprite.scale.x;
264-
verticies[index++] = sprite.scale.y;
263+
vertices[index++] = sprite.scale.x;
264+
vertices[index++] = sprite.scale.y;
265265

266266
//rotation
267-
verticies[index++] = sprite.rotation;
267+
vertices[index++] = sprite.rotation;
268268

269269
// uv
270-
verticies[index++] = uvs.x0;
271-
verticies[index++] = uvs.y1;
270+
vertices[index++] = uvs.x0;
271+
vertices[index++] = uvs.y1;
272272
// color
273-
verticies[index++] = sprite.alpha;
273+
vertices[index++] = sprite.alpha;
274274

275275

276276
// xy
277-
verticies[index++] = w0;
278-
verticies[index++] = h1;
277+
vertices[index++] = w0;
278+
vertices[index++] = h1;
279279

280-
verticies[index++] = sprite.position.x;
281-
verticies[index++] = sprite.position.y;
280+
vertices[index++] = sprite.position.x;
281+
vertices[index++] = sprite.position.y;
282282

283283
//scale
284-
verticies[index++] = sprite.scale.x;
285-
verticies[index++] = sprite.scale.y;
284+
vertices[index++] = sprite.scale.x;
285+
vertices[index++] = sprite.scale.y;
286286

287287
//rotation
288-
verticies[index++] = sprite.rotation;
288+
vertices[index++] = sprite.rotation;
289289

290290
// uv
291-
verticies[index++] = uvs.x1;
292-
verticies[index++] = uvs.y1;
291+
vertices[index++] = uvs.x1;
292+
vertices[index++] = uvs.y1;
293293
// color
294-
verticies[index++] = sprite.alpha;
294+
vertices[index++] = sprite.alpha;
295295

296296

297297
// xy
298-
verticies[index++] = w0;
299-
verticies[index++] = h0;
298+
vertices[index++] = w0;
299+
vertices[index++] = h0;
300300

301-
verticies[index++] = sprite.position.x;
302-
verticies[index++] = sprite.position.y;
301+
vertices[index++] = sprite.position.x;
302+
vertices[index++] = sprite.position.y;
303303

304304
//scale
305-
verticies[index++] = sprite.scale.x;
306-
verticies[index++] = sprite.scale.y;
305+
vertices[index++] = sprite.scale.x;
306+
vertices[index++] = sprite.scale.y;
307307

308308
//rotation
309-
verticies[index++] = sprite.rotation;
309+
vertices[index++] = sprite.rotation;
310310

311311
// uv
312-
verticies[index++] = uvs.x2;
313-
verticies[index++] = uvs.y2;
312+
vertices[index++] = uvs.x2;
313+
vertices[index++] = uvs.y2;
314314
// color
315-
verticies[index++] = sprite.alpha;
315+
vertices[index++] = sprite.alpha;
316316

317317

318318

319319

320320
// xy
321-
verticies[index++] = w1;
322-
verticies[index++] = h0;
321+
vertices[index++] = w1;
322+
vertices[index++] = h0;
323323

324-
verticies[index++] = sprite.position.x;
325-
verticies[index++] = sprite.position.y;
324+
vertices[index++] = sprite.position.x;
325+
vertices[index++] = sprite.position.y;
326326

327327
//scale
328-
verticies[index++] = sprite.scale.x;
329-
verticies[index++] = sprite.scale.y;
328+
vertices[index++] = sprite.scale.x;
329+
vertices[index++] = sprite.scale.y;
330330

331331
//rotation
332-
verticies[index++] = sprite.rotation;
332+
vertices[index++] = sprite.rotation;
333333

334334
// uv
335-
verticies[index++] = uvs.x3;
336-
verticies[index++] = uvs.y3;
335+
vertices[index++] = uvs.x3;
336+
vertices[index++] = uvs.y3;
337337
// color
338-
verticies[index++] = sprite.alpha;
338+
vertices[index++] = sprite.alpha;
339339

340340
// increment the batchs
341341
this.currentBatchSize++;

0 commit comments

Comments
 (0)