Skip to content

Commit

Permalink
Counter-clockwise vertex order for sprites (front facing)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultraq committed Jul 26, 2024
1 parent ec6bccb commit f626e43
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ class Map extends Node<Map> {
mapTiles.each { mapTile ->
allVertices.addAll(new Rectanglef(0, 0, TILE_WIDTH, TILE_HEIGHT).translate(mapTile.position()) as Vector2f[])
allTextureUVs.addAll(tileSet.spriteSheet[mapTile.frameInTileSet()] as Vector2f[])
allIndices.addAll([0, 1, 3, 1, 2, 3].collect { index -> index + indexOffset })
allIndices.addAll([0, 1, 2, 0, 2, 3].collect { index -> index + indexOffset })
indexOffset += 4
}
return new Tuple3<Vector2f[], Vector2f[], int[]>(allVertices as Vector2f[], allTextureUVs as Vector2f[], allIndices as int[])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class JomlExtensions {
if (clazz == Vector2f[]) {
return new Vector2f[]{
new Vector2f(self.minX, self.minY),
new Vector2f(self.minX, self.maxY),
new Vector2f(self.maxX, self.minY),
new Vector2f(self.maxX, self.maxY),
new Vector2f(self.maxX, self.minY)
new Vector2f(self.minX, self.maxY)
}
}
throw new IllegalArgumentException("Cannot convert Rectanglef to type ${clazz}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class OpenGLRenderer implements GraphicsRenderer {
surface as Vector2f[],
Colour.WHITE,
textureUVs as Vector2f[],
[0, 1, 3, 1, 2, 3] as int[],
[0, 1, 2, 0, 2, 3] as int[],
false
)
}
Expand Down

0 comments on commit f626e43

Please sign in to comment.