0
\$\begingroup\$

I am using Love2D and want to create tiled terrain with a single mesh (to reduce the number of draw calls). I want to change a position of some tiles at runtime and do not want any gap to appear, i. e. each tile must be connected to each other. And I also want to change the texture of some tiles.

Currently, I am using triangle strip and degenerate triangles and a texture atlas. I have four vertices for each tile and using vertex map to reuse vertices to form degenerate triangles.

But when I want to change the position of a tile, I'd also need to update adjacent tiles' positions to avoid gaps (because, due to degenerate triangles, those tiles a not "connected" anymore).

I. e. the problem is that: I want tiles being connected to avoid manual adjustment of neighbors tiles, but I need them to be disconnected to be able to set different texture from atlas for each tile (i. e. change texture coordinates).

Currently, my approach seems to work, but I'd like to know - maybe there is a better way to solve that? Something which will keep tiles connected but still let me change the texture dynamically? Maybe I can some shader or something like that?

Thank you!

\$\endgroup\$

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.