Skip to content

Commit 735ada3

Browse files
committed
Implement Sprite Instancing
Sprites with the same texture will now be rendered with one draw call.
1 parent c833003 commit 735ada3

File tree

4 files changed

+201
-121
lines changed

4 files changed

+201
-121
lines changed

crates/bevy_utils/src/slab.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ pub struct SlabKey<V> {
1111
marker: PhantomData<V>,
1212
}
1313

14+
impl<V> PartialEq<SlabKey<V>> for SlabKey<V> {
15+
fn eq(&self, other: &SlabKey<V>) -> bool {
16+
self.index == other.index
17+
}
18+
}
19+
20+
impl<V> Eq for SlabKey<V> {}
21+
1422
impl<V> Copy for SlabKey<V> {}
1523

1624
impl<V> Clone for SlabKey<V> {

pipelined/bevy_sprite2/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ impl Plugin for SpritePlugin {
3434
.add_system_to_stage(RenderStage::Prepare, render::prepare_sprites)
3535
.add_system_to_stage(RenderStage::Queue, queue_sprites)
3636
.init_resource::<SpriteShaders>()
37-
.init_resource::<SpriteMeta>();
37+
.init_resource::<SpriteMeta>()
38+
.init_resource::<ExtractedSprites>();
3839
let draw_sprite = DrawSprite::new(&mut render_app.world);
3940
render_app
4041
.world

0 commit comments

Comments
 (0)