TokisanGames/Terrain3D

Update TextureArray indices instead of regenerating the whole array

Closed this issue · 3 comments

Description

Currently, every time the terrain is modified, the entire texture data is repacked and sent to the Rendering Server. It should be able to modify individual indices of texture arrays instead, to avoid new allocations.
We discussed this in the discord, but I thought it would be good to make an issue to keep track of it.

I believe we were discussing using RenderingServer::texture_2d_update(texture: RID, image: Image, layer: int) to replace one layer. However, the array will still have to be recreated if the size has changed.

That's true. We could do an ArrayList style and preemptively allocate a larger array when a lot of regions are added in quick succession, and then shrink it to an appropriate size during some idle time.

@Xtarsia didn't you mention you wanted to do this? If you comment, I can assign you.