Hey all
So this is a bit of a wierd one that I haven't got my head around. I've created myself a heightmap for my terrain in Paint Shop Pro. It's 2064x2064 so that it can be seperated into a 16x16 grid of 129x129 TerrainPages. The part of my code that is stitching these together is working just fine. However, I get tears at the joins in the textures because the texture has to be 128x128.
So, what gives ?
Thanks all
Mak
The texture coordinates are independent of texture size so you should have no problem applying your texture (it will just get stretched to the correct size). Maybe the problem is in your stiching algorithm?
Ok, thanks. I'll go check it now.
Mak
Edit: Yes, it's my "stitching". When I say "stitching" I'm simply arranging 9 TerrainPage "tiles" in a grid. Where the grid blocks join up, they don't match correctly. The code is from Cosmo's TerrainContinuous classes and looks like this:
private void displacePages(float offset) {
for(int i = 0; i < PAGECOUNT; i++) {
switch(i) {
case 0 : terrainPages.setLocalTranslation(
new Vector3f(offset * -1, 0.f, offset * -1)); break;
case 1 : terrainPages.setLocalTranslation(
new Vector3f(0.f , 0.f, offset * -1)); break;
case 2 : terrainPages.setLocalTranslation(
new Vector3f(offset , 0.f, offset * -1)); break;
case 3 : terrainPages.setLocalTranslation(
new Vector3f(offset * -1, 0.f, 0.f )); break;
case 4 : terrainPages.setLocalTranslation(
new Vector3f(0.f , 0.f, 0.f )); break;
case 5 : terrainPages.setLocalTranslation(
new Vector3f(offset , 0.f, 0.f )); break;
case 6 : terrainPages.setLocalTranslation(
new Vector3f(offset * -1, 0.f, offset )); break;
case 7 : terrainPages.setLocalTranslation(
new Vector3f(0.f , 0.f, offset )); break;
case 8 : terrainPages.setLocalTranslation(
new Vector3f(offset , 0.f, offset )); break;
}
}
}
offset is calculated from the tile size multiplied by the scaling. eg. terrainscale.x * (ib.getSize()-1);
Any idea why that wouldn't line up correctly ?
Thanks
Mak