-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TextureAtlasLoader
#11873
base: main
Are you sure you want to change the base?
Add TextureAtlasLoader
#11873
Conversation
I think this would go a lot better if there was an example showing how to use it. For example, imagine a novice user who wants to spawn an My original PR assumed that you could spawn an
However, that no longer works due to the changes in the way texture atlases work. |
There already are some examples demonstrating how to use I have added an example like that now, but I would appreciate someone reading over that since my English is not that good. |
The generated |
Looks like there are some problems with the dependencies. Otherwise looks good. |
(min: (0, 8), max: (16, 24)), | ||
(min: (16, 8), max: (32, 24)), | ||
(min: (32, 8), max: (48, 24)), | ||
(min: (48, 8), max: (64, 24)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a name for each packed sprite here might be useful too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, this is out of scope for this PR.
Objective
Solution
TextureAtlasLayout
The loader has three extensions:TextureAtlasLayout
with the specified size and texture rectangles.TextureAtlasLayout
with the specified grid, similar toTextureAtlasLayout::from_grid
.TextureAtlasLayout
from the specified source textures by composing them usingTextureAtlasBuilder
. The composed image returned by theTextureAtlasBuilder
is added as a labeled asset: composed_texture .The
AssetLoader
implementation is based on @viridia's code as posted in the original issue