Recently I followed this tutorial: http://vodacek.zvb.cz/archiv/525.html to learn how to do terrain. It worked really well if you wanted to draw a texture across many vertices. It also shows how to automate the process of creating vertices and indices.
I was less interested in making complex terrain and more interested in using vertices and indices to make tiles for a board game.
So for this process, for example: one tile would need 4 vertices and 6 indices, while two tiles would need 6 vertices and 12 indices. (The tutorial has images to make this easier to follow)
The problem I’m having is that the texture I’m using for my board is a sprite sheet, and I want to use texture coordinates to specify different parts of the sprite sheet for my individual tiles:
vertices[i].TextureCoordinate.X = (float)x / tilesWide; vertices[i].TextureCoordinate.Y = (float)y / tilesHigh;
For a single texture stretched across my board this code would be fine. However, since a single vertex can be shared between 1-4 different tiles, that means the texture coordinates are too. This means when I specify texture coordinates, it affects the coordinates of a shared vertex.
Is there a way to do this with my current setup, or do I need to have 6 vertices per tile? Or maybe there’s another way to make this work?