Hi.
I'm converting my GDI+ isometric tile engine to managed Direct3D due to performance issues. This is my first programming expirience in Direct3D.
For every tile I use two triangle strips made of 4 vertices. The vertices are of Transformed.Textured Format:
int vertexCounter = 0;
for(int x = 0; x <= 13; x++)
{
for(int y = 0; y <= 13; y++)
{
int positionX = 390 - y * 30 + x * 30;
int positionY = y * 15 + x * 15;
customVertex[vertexCounter++] = new CustomVertex.TransformedTextured(positionX, positionY, 0.5F, 1, 1, -1);
customVertex[vertexCounter++] = new CustomVertex.TransformedTextured(positionX + 60, positionY, 0.5F, 1, 0, -1);
customVertex[vertexCounter++] = new CustomVertex.TransformedTextured(positionX, positionY + 29, 0.5F, 1, 1, 0);
customVertex[vertexCounter++] = new CustomVertex.TransformedTextured(positionX + 60, positionY + 29, 0.5F, 1, 0, 0);
}
}
I load the texture with the TextureLoader.FromFile method and attach a color key to it:
public void CreateOverlayTexture(string file)
{
Texture texture = TextureLoader.FromFile(device, file, 60, 29, 0, 0, 0, Pool.Default, Filter.None, Filter.None, Color.FromArgb(255,0,255).ToArgb());
arrayListTexture.Add(texture);
}
The problem is, that the textures aren't mapped properly as you can see in the attached GIF.
All the tiles should have 60x29 pixels. But they all have a different size.
What do I do wrong?
THX and C ya
gdp2000
I'm converting my GDI+ isometric tile engine to managed Direct3D due to performance issues. This is my first programming expirience in Direct3D.
For every tile I use two triangle strips made of 4 vertices. The vertices are of Transformed.Textured Format:
int vertexCounter = 0;
for(int x = 0; x <= 13; x++)
{
for(int y = 0; y <= 13; y++)
{
int positionX = 390 - y * 30 + x * 30;
int positionY = y * 15 + x * 15;
customVertex[vertexCounter++] = new CustomVertex.TransformedTextured(positionX, positionY, 0.5F, 1, 1, -1);
customVertex[vertexCounter++] = new CustomVertex.TransformedTextured(positionX + 60, positionY, 0.5F, 1, 0, -1);
customVertex[vertexCounter++] = new CustomVertex.TransformedTextured(positionX, positionY + 29, 0.5F, 1, 1, 0);
customVertex[vertexCounter++] = new CustomVertex.TransformedTextured(positionX + 60, positionY + 29, 0.5F, 1, 0, 0);
}
}
I load the texture with the TextureLoader.FromFile method and attach a color key to it:
public void CreateOverlayTexture(string file)
{
Texture texture = TextureLoader.FromFile(device, file, 60, 29, 0, 0, 0, Pool.Default, Filter.None, Filter.None, Color.FromArgb(255,0,255).ToArgb());
arrayListTexture.Add(texture);
}
The problem is, that the textures aren't mapped properly as you can see in the attached GIF.
All the tiles should have 60x29 pixels. But they all have a different size.
What do I do wrong?
THX and C ya
gdp2000