[Merged by Bors] - Add sprite atlases into the new renderer.#2560
[Merged by Bors] - Add sprite atlases into the new renderer.#2560StarArawn wants to merge 8 commits intobevyengine:pipelined-renderingfrom
Conversation
| size: sprite.size, | ||
| rect: Rect { | ||
| min: Vec2::ZERO, | ||
| max: sprite.size, |
There was a problem hiding this comment.
It's worth pointing out that this actually changes existing behavior for sprite.size in the fact that it now indicates a pixel texel size instead of a sprite dimension size. Instead it might be better to make Rect optional here?
cart
left a comment
There was a problem hiding this comment.
Love how simple this impl ended up being / how well it slots into the existing impl.
| } | ||
| } | ||
|
|
||
| if let Some(mut extracted_sprites_res) = render_world.get_resource_mut::<ExtractedSprites>() { |
There was a problem hiding this comment.
If you do app.init_resource::<ExtractedSprites>() in the sprite plugin, you can skip this check and just assume it exists (same goes for the other extract system).
| if let Some(mut extracted_sprites_res) = render_world.get_resource_mut::<ExtractedSprites>() { | ||
| extracted_sprites_res.sprites.extend(extracted_sprites); | ||
| } else { | ||
| render_world.insert_resource(ExtractedSprites { |
There was a problem hiding this comment.
Unless we clear ExtractedSprites somewhere, this will collect sprites every frame. The commands.insert_resource approach used elsewhere overwrites the old value, which does the clearing "automatically".
There was a problem hiding this comment.
The downside being that we don't reuse allocations across frames.
|
|
||
| #[derive(Debug, Clone, TypeUuid, Reflect)] | ||
| #[uuid = "7233c597-ccfa-411f-bd59-9af349432ada"] | ||
| #[repr(C)] |
There was a problem hiding this comment.
this no longer needs repr(C) because it doesn't need to be byteable
|
Looks good to me! |
|
bors r+ |
# Objective Restore the functionality of sprite atlases in the new renderer. ### **Note:** This PR relies on #2555 ## Solution Mostly just a copy paste of the existing sprite atlas implementation, however I unified the rendering between sprites and atlases. Co-authored-by: Carter Anderson <[email protected]>
|
Pull request successfully merged into pipelined-rendering. Build succeeded: |
Objective
Restore the functionality of sprite atlases in the new renderer.
Note: This PR relies on #2555
Solution
Mostly just a copy paste of the existing sprite atlas implementation, however I unified the rendering between sprites and atlases.