You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, we are generating texture atlases on-the-fly. While this works great in some cases (unicode fonts, for example, where we don't want to instantly load 2048x2048x18 pixels into video memory), we will likely want pre-processed atlases in the near future.
We are already using the BMFont format for fonts, but will likely want a slight variant of this format for arbitrary texture resources. These would likely be referred to by a string identifier rather than integer id.
Things to be done:
GlyphStore should be subclassed so we can support loading non-font atlases.
TextureAtlas needs more functionality so we can pre-populate it with data rather than adding textures one-by-one. May require moving current implementation to a subclass.
A new store (providing Textures) should be made which handles the loading of the full sprite-sheet texture(s) into GL memory and keeps one or more TextureAtlas local to itself.
So for fonts, we will (or rather, already) have:
TextureStore store = new TextureStore(new GlyphStore(Game.Resources, Font));
Texture = store.Get(@"F");
//TextureStore will request the texture from GlyphStore as it hasn't already been cached to the TextureStore atlas.
Texture = store.Get(@"F");
//TextureStore will return the already cached (and dynamically atlased texture).
For arbitrary textures, we need something like this:
AtlasTextureStore store = new AtlasTextureStore(Game.Resources.Get(@"Textures/main"));
//will load Textures/main.layout Textures/main_0.png ... Textures/main_n.png into many TextureAtlases (and thus GL memory) at load time.
Texture = store.Get(@"menu-osu");
//return Texture with TextureGlSub from the assigned atlas.
Open for feedback or implementations.
The text was updated successfully, but these errors were encountered:
So what is main.layout? do the other files i.e. main_n.png ,etc... correspond to whole sprite sheets or individual textures?
Also make GlyphStore a subclass of what? It is already derived from IResourceStore. I'm not sure what you want the potential superclass of GlyphStore to provide, or precisely what else derives from it.
Are there any constraints on the size of the texture atlas? Your TextureStore makes atlases of size 2048x2048, why that size?
main.layout would define the sprites in main_0 .. main_n.
a class other than GlyphStore will be required to do non-character-based lookups. Functionality can be moved there which is shared between GlyphStore and the new store.
2048x2048 is chosen because all GPUs supporting our GL target version support it. In the future, it could potentially be set to the gl_max_texture_size where that becomes an optimisation.
Right now, we are generating texture atlases on-the-fly. While this works great in some cases (unicode fonts, for example, where we don't want to instantly load 2048x2048x18 pixels into video memory), we will likely want pre-processed atlases in the near future.
We are already using the BMFont format for fonts, but will likely want a slight variant of this format for arbitrary texture resources. These would likely be referred to by a string identifier rather than integer id.
Things to be done:
GlyphStore
should be subclassed so we can support loading non-font atlases.TextureAtlas
needs more functionality so we can pre-populate it with data rather than adding textures one-by-one. May require moving current implementation to a subclass.Texture
s) should be made which handles the loading of the full sprite-sheet texture(s) into GL memory and keeps one or moreTextureAtlas
local to itself.So for fonts, we will (or rather, already) have:
For arbitrary textures, we need something like this:
Open for feedback or implementations.
The text was updated successfully, but these errors were encountered: