Mario: Thanks for the tip on the sprite packer. I will look into using this. The way I got triangle meshes to work is to draw points over each other. The vertices really take up about the same amount of space as though they were separate meshes. They are arranged like this:
- Code: Select all
2 4,5 6
_________
|\ | /|
| \ | / |
|__\|/__|
1 3,7 8
Since triangle meshes are drawn as (D = degenerate triangle):
1,2,3 -> 3,2,4 -> 3,4,5 (D) -> 5,4,6 (D) -> 5,6,7 -> 7,6,8 . . .
the triangles remain drawn in a clockwise direction all the time. I disabled GL_CULL_FACE but only because I noticed that it was disabled in SpriteBatch. I will also be performance testing this myself though.
Consiliens: Slick 2D's implementation appears to be similar to mine. It looks a little overcomplicated as well. I was worried about using arraylists as that does to store the data. There are so many warnings against using them on android. I'd rather implement my own code then force fit someone else's code into gdx.
BurningHand: As for the partial rendering, I was a little worried about it myself. From what I hear, OpenGL ES does a good job of not drawing any unseen points around the edges of the screen. I was going to test this though. To remove this limitation what I would do is index the tile vertices and then use render(ShaderProgram shader, int primitiveType, int offset, int count) to draw just a section at a time.
The actual rendering of the maps is not my focus at this point. As far as I'm concerned, render it any way you see fit but for what I am making what I have works well so far. I'm keeping the rendering class separated well enough that you don't need to use it if you don't like how it is implemented.
Again, this is fairly early and I haven't done too much in the way of optimizing.