Skip to content

Commit fc752f8

Browse files
authored
Merge pull request phaserjs#5416 from rexrainbow/generate-grid-verts-modify
Add flipY optional argument
2 parents 41a0c19 + e7fd7d6 commit fc752f8

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/geom/mesh/GenerateGridVerts.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ var GenerateGridVerts = function (config)
6363
var colors = GetFastValue(config, 'colors', [ 0xffffff ]);
6464
var alphas = GetFastValue(config, 'alphas', [ 1 ]);
6565
var tile = GetFastValue(config, 'tile', false);
66+
var flipY = GetFastValue(config, 'flipY', false);
6667

6768
var widthSet = GetFastValue(config, 'width', null);
6869

@@ -125,8 +126,17 @@ var GenerateGridVerts = function (config)
125126
{
126127
frameU0 = textureFrame.u0;
127128
frameU1 = textureFrame.u1;
128-
frameV0 = textureFrame.v0;
129-
frameV1 = textureFrame.v1;
129+
130+
if (!flipY)
131+
{
132+
frameV0 = textureFrame.v0;
133+
frameV1 = textureFrame.v1;
134+
}
135+
else
136+
{
137+
frameV0 = textureFrame.v1;
138+
frameV1 = textureFrame.v0;
139+
}
130140
}
131141

132142
var frameU = frameU1 - frameU0;

src/geom/mesh/typedefs/GenerateGridConfig.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
* @property {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices.
1616
* @property {boolean} [tile=false] - Should the texture tile (repeat) across the grid segments, or display as a single texture?
1717
* @property {boolean} [isOrtho=false] - If set and using a texture with an ortho Mesh, the `width` and `height` parameters will be calculated based on the frame size for you.
18+
* @property {boolean} [flipY=false] - If set and using a texture, vertically flipping render result.
1819
*/

0 commit comments

Comments
 (0)