I’ve pretty much got runtime terrain generation working by extending @jayfella’s code, but have come up against an issue setting textures on to terrain patches.
I am creating a TerrainChunk (which extends TerrainQuad) at tile size 17, block size 65, which gives 16 patches.
On each patch I want to set a map texture which has a raw image size of 256 pixels, but can see that only the first 64 pixels from the image is being displayed in one patch.
Is there away of resetting/ changing the texture coordinates on the quad or patch to accept the large® image. I don’t want to create patches of 256+1 as this will make an enormous mesh.
Apply this to each patch results in only one patch receiving a correctly sized texture; the others appear to be have a single line of pixels stretched across the patch.
The Material is set independently on each patch by getMaterial().clone(), so not sure why this would be happening.
Stretched pixels is either that the texture coordinates are getting messed up or that wrap mode is not set to repeat.
I don’t really know enough about the surrounding code but if multBy is more than 1 then it implies that you are shrinking the texture…and therefore it will need to repeat.