Struct amethyst_renderer::SpriteRenderData [−][src]
pub struct SpriteRenderData<'a> { pub meshes: WriteStorage<'a, MeshHandle>, pub materials: WriteStorage<'a, Material>, pub material_defaults: ReadExpect<'a, MaterialDefaults>, pub loader: ReadExpect<'a, Loader>, pub asset_storage: Read<'a, AssetStorage<Mesh>>, }
SystemData containing the data necessary to handle new rendered sprites
Fields
meshes: WriteStorage<'a, MeshHandle>
Storage containing the meshes
materials: WriteStorage<'a, Material>
Storage containing the materials
material_defaults: ReadExpect<'a, MaterialDefaults>
Material defaults
loader: ReadExpect<'a, Loader>
Asset loader
asset_storage: Read<'a, AssetStorage<Mesh>>
Mesh asset storage
Methods
impl<'a> SpriteRenderData<'a>
[src]
impl<'a> SpriteRenderData<'a>
pub fn build_mesh_and_material(
&mut self,
sprite: &Sprite,
texture: TextureHandle,
size: (f32, f32)
) -> (MeshHandle, Material)
[src]
pub fn build_mesh_and_material(
&mut self,
sprite: &Sprite,
texture: TextureHandle,
size: (f32, f32)
) -> (MeshHandle, Material)
Creates a MeshHandle and Material from the sprite and texture data. Useful if you plan on re-using the same sprite a lot and don't want to load the assets each time.
pub fn add(
&mut self,
entity: Entity,
sprite: &Sprite,
texture: TextureHandle,
texture_size: (f32, f32)
) -> Result<()>
[src]
pub fn add(
&mut self,
entity: Entity,
sprite: &Sprite,
texture: TextureHandle,
texture_size: (f32, f32)
) -> Result<()>
Adds a mesh and a material to an entity corresponding to the sprite and texture given.
Note that is you need to insert the same sprite and texture, using add_multiple
allows for better performances.
pub fn add_multiple(
&mut self,
entities: Vec<Entity>,
sprite: &Sprite,
texture: TextureHandle,
texture_size: (f32, f32)
) -> Result<()>
[src]
pub fn add_multiple(
&mut self,
entities: Vec<Entity>,
sprite: &Sprite,
texture: TextureHandle,
texture_size: (f32, f32)
) -> Result<()>
Adds the same mesh and material to multiple entities corresponding to the sprite and texture given.
Trait Implementations
impl<'a> SystemData<'a> for SpriteRenderData<'a> where
WriteStorage<'a, MeshHandle>: SystemData<'a>,
WriteStorage<'a, Material>: SystemData<'a>,
ReadExpect<'a, MaterialDefaults>: SystemData<'a>,
ReadExpect<'a, Loader>: SystemData<'a>,
Read<'a, AssetStorage<Mesh>>: SystemData<'a>,
[src]
impl<'a> SystemData<'a> for SpriteRenderData<'a> where
WriteStorage<'a, MeshHandle>: SystemData<'a>,
WriteStorage<'a, Material>: SystemData<'a>,
ReadExpect<'a, MaterialDefaults>: SystemData<'a>,
ReadExpect<'a, Loader>: SystemData<'a>,
Read<'a, AssetStorage<Mesh>>: SystemData<'a>,
fn setup(res: &mut Resources)
[src]
fn setup(res: &mut Resources)
Sets up the system data for fetching it from the Resources
.
fn fetch(res: &'a Resources) -> Self
[src]
fn fetch(res: &'a Resources) -> Self
Fetches the system data from Resources
. Note that this is only specified for one concrete lifetime 'a
, you need to implement the SystemData
trait for every possible lifetime. Read more
fn reads() -> Vec<ResourceId>
[src]
fn reads() -> Vec<ResourceId>
Returns all read dependencies as fetched from Self::fetch
. Read more
fn writes() -> Vec<ResourceId>
[src]
fn writes() -> Vec<ResourceId>
Returns all write dependencies as fetched from Self::fetch
. Read more
Auto Trait Implementations
impl<'a> Send for SpriteRenderData<'a>
impl<'a> Send for SpriteRenderData<'a>
impl<'a> Sync for SpriteRenderData<'a>
impl<'a> Sync for SpriteRenderData<'a>