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

Incorporate AtlasSprite rework for upcoming Bevy 1.13 #15

Merged
merged 11 commits into from
Feb 26, 2024

Conversation

vertesians
Copy link
Contributor

AtlasSprite got reworked in the upcoming Bevy 0.13, so here's my attempt to incorporate those changes into bevy_sprite3d. (Hopefully I'm not rushing by submitting a PR before the release is even out.) In summary:

  • AtlasSprite3d is gone and replaced by a method on Sprite3d, bundle_with_atlas that takes a Sprite3dParams and an AtlasSprite and returns a reworked AtlasSprite3dBundle.
  • A new component TextureAtlas3dData replaces AtlasSprite3dComponent -- the only thing it does is hold the mesh keys associated with the atlas.
  • The only distinction between an atlas and non-atlas Sprite3d is the presence of the TextureAtlas and TextureAtlas3dData components.
  • All Assets<AtlasSprite> have been replaced with Assets<Image> and Assets<AtlasSpriteLayout>, including in Sprite3dParams, with variables and properties appropriately renamed.

Not directly related to the PR, but the signature of Mesh::new got changed to require a RenderAssetPersistencePolicy argument — I put in a safe default for now, but you might want to change that.

The examples have been updated except for the ones using bevy_asset_loader — I don't know how bevy_asset_loader plans to handle the new texture atlases, so I've left them alone for now. The dungeon example also looks different because of lighting system changes in 0.13, but I'll leave that for another PR to fix.

- Removed `AtlasSprite3d`.
- Removed and partially replaced `AtlasSprite3dComponent` with
  `TextureAtlas3dData`.
- Added a `bundle_with_atlas` method to `Sprite3d`.
- Switched `Assets<TextureAtlas>` with `Assets<TextureAtlasLayout>`.
- Reworked AtlasSprite3dBundle.
- Added (placeholder?) `RenderAssetPersistencePolicy` since `Mesh::new`
  now requires it.
- Updated sprite3d_system.
And make TextureAtlas3dData.keys public.
@FraserLee
Copy link
Owner

Just commenting to let you know I've not forgotten this, thanks so much for the contribution! All looks good after briefly glancing the changes, but given the size of the PR I plan to review things in a lot more depth before merging - will do so as soon as I have some time free from school.

Until then, I'd recommend people who need it to use your branch directly.

... should've run cargo check before pushing that last commit.
@vertesians
Copy link
Contributor Author

No worries, take your time. I've updated the PR, it should work with the final 0.13 release now.

lighting still needs to be adjusted, though
@janhohenheim
Copy link
Contributor

@vertesians thanks for having a branch ready! :)

@FraserLee
Copy link
Owner

it seems like the lighting has broken on the dungeon example in the update..

@FraserLee
Copy link
Owner

Ah nevermind, just the new exposure defaults bevyengine/bevy#11868

@FraserLee
Copy link
Owner

FraserLee commented Feb 26, 2024

The rest of the changes all look good to me! I'll merge, then bump the versioning. @vertesians thanks so much for all the work!

@FraserLee FraserLee merged commit f9a0915 into FraserLee:main Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants