Currently TextureAtlas has a hard requirement on Texture2DArray (and an OpenGL context because of max_array_texture_layers and max_3d_texture_size). The generation of the tiles should not have this requirement. This will also improve testability.
Idea on how to split this dependency out:
Rename current TextureAtlas to TextureAtlasTiles and get rid of the dependency on Texture2DArray.
Remove dependency on context to query max_array_texture_layers and max_3d_texture_size.
Pass them to the constructor instead.
Rename generateTexture to updateTexture and modify it in conjunction with TextureAtlas::Layer::drawTile(s).
Pass along a std::function with the same signature as Texture2DArray::modify.
Add new TextureAtlas class that aggregates this TextureAtlasTiles together with an actual Texture2DArray.
Expose all necessary TextureAtlasTiles functions and forward the textures modify function to update.
Default values for max_array_texture_layers and max_3d_texture_size can be queried from the context again.
Currently
TextureAtlas
has a hard requirement onTexture2DArray
(and an OpenGL context because ofmax_array_texture_layers
andmax_3d_texture_size
). The generation of the tiles should not have this requirement. This will also improve testability.Idea on how to split this dependency out:
TextureAtlas
toTextureAtlasTiles
and get rid of the dependency onTexture2DArray
.context
to querymax_array_texture_layers
andmax_3d_texture_size
.generateTexture
toupdateTexture
and modify it in conjunction withTextureAtlas::Layer::drawTile(s)
.std::function
with the same signature asTexture2DArray::modify
.TextureAtlas
class that aggregates thisTextureAtlasTiles
together with an actualTexture2DArray
.TextureAtlasTiles
functions and forward the textures modify function toupdate
.max_array_texture_layers
andmax_3d_texture_size
can be queried from the context again.