Skip to content

Commit

Permalink
Implement Sprite Instancing
Browse files Browse the repository at this point in the history
Sprites with the same texture will now be rendered with one draw call.
  • Loading branch information
zicklag committed Aug 19, 2021
1 parent 3faca93 commit cecaf76
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 122 deletions.
8 changes: 8 additions & 0 deletions crates/bevy_utils/src/slab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ pub struct SlabKey<V> {
marker: PhantomData<V>,
}

impl<V> PartialEq<SlabKey<V>> for SlabKey<V> {
fn eq(&self, other: &SlabKey<V>) -> bool {
self.index == other.index
}
}

impl<V> Eq for SlabKey<V> {}

impl<V> Copy for SlabKey<V> {}

impl<V> Clone for SlabKey<V> {
Expand Down
3 changes: 2 additions & 1 deletion pipelined/bevy_sprite2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ impl Plugin for SpritePlugin {
.add_system_to_stage(RenderStage::Prepare, render::prepare_sprites)
.add_system_to_stage(RenderStage::Queue, queue_sprites)
.init_resource::<SpriteShaders>()
.init_resource::<SpriteMeta>();
.init_resource::<SpriteMeta>()
.init_resource::<ExtractedSprites>();
let draw_sprite = DrawSprite::new(&mut render_app.world);
render_app
.world
Expand Down
Loading

0 comments on commit cecaf76

Please sign in to comment.