Skip to content
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

Tweaks to TextureAtlasBuilder.finish() #887

Merged

Conversation

4-rodrigo-salazar
Copy link
Contributor

@4-rodrigo-salazar 4-rodrigo-salazar commented Nov 18, 2020

This does a couple things:

  • We don't enforce that initial and max sizes are powers of 2, but when finding a size that fits we multiple by 2 in every iteration. This logic is updated so that we at least try the max_size value that the user provided, before this change it would just jump over it and exit early without trying the largest size the user specified. This means that previously we could return NotEnoughSpace even though the max size provided is actually greater than the space you need.
  • Minor: Move the Texture::new_fill() call so that we only call it if pack_rects returns successfully.
  • Minor: Remove unnecessary "rect_placements = None" on line 89.

Tested by tweaking our examples/2d/texture_atlas.rs with various initial/max sizes.

@Moxinilian Moxinilian added C-Feature A new feature, making something new possible A-Rendering Drawing game state to the screen labels Nov 19, 2020
@cart
Copy link
Member

cart commented Nov 21, 2020

Good improvements all around. Thanks!

@cart cart merged commit 85ecab8 into bevyengine:master Nov 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants