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 20, 2021
1 parent 3faca93 commit 031c7ab
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 132 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
5 changes: 3 additions & 2 deletions pipelined/bevy_sprite2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use bevy_asset::AddAsset;
pub use bundle::*;
pub use dynamic_texture_atlas_builder::*;
pub use rect::*;
pub use render::*;
use render::*;
pub use sprite::*;
pub use texture_atlas::*;
pub use texture_atlas_builder::*;
Expand All @@ -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 031c7ab

Please sign in to comment.