Struct bevy::sprite::ColorMaterial [−]
Expand description
A 2d material that renders 2d meshes with a texture tinted by a uniform color
Fields
color: Color
texture: Option<Handle<Image>>
Trait Implementations
impl Clone for ColorMaterial
impl Clone for ColorMaterial
pub fn clone(&self) -> ColorMaterial
pub fn clone(&self) -> ColorMaterial
Returns a copy of the value. Read more
Performs copy-assignment from source
. Read more
impl Debug for ColorMaterial
impl Debug for ColorMaterial
impl Default for ColorMaterial
impl Default for ColorMaterial
pub fn default() -> ColorMaterial
pub fn default() -> ColorMaterial
Returns the “default value” for a type. Read more
impl From<Color> for ColorMaterial
impl From<Color> for ColorMaterial
pub fn from(color: Color) -> ColorMaterial
pub fn from(color: Color) -> ColorMaterial
Performs the conversion.
impl From<Handle<Image>> for ColorMaterial
impl From<Handle<Image>> for ColorMaterial
pub fn from(texture: Handle<Image>) -> ColorMaterial
pub fn from(texture: Handle<Image>) -> ColorMaterial
Performs the conversion.
impl Material2d for ColorMaterial
impl Material2d for ColorMaterial
pub fn fragment_shader(_asset_server: &AssetServer) -> Option<Handle<Shader>>
pub fn fragment_shader(_asset_server: &AssetServer) -> Option<Handle<Shader>>
pub fn bind_group(
render_asset: &<ColorMaterial as RenderAsset>::PreparedAsset
) -> &BindGroup
pub fn bind_group(
render_asset: &<ColorMaterial as RenderAsset>::PreparedAsset
) -> &BindGroup
Returns this material’s BindGroup
. This should match the layout returned by Material2d::bind_group_layout
.
pub fn bind_group_layout(render_device: &RenderDevice) -> BindGroupLayout
pub fn bind_group_layout(render_device: &RenderDevice) -> BindGroupLayout
Returns this material’s BindGroupLayout
. This should match the BindGroup
returned by Material2d::bind_group
.
fn vertex_shader(asset_server: &AssetServer) -> Option<Handle<Shader>>
fn vertex_shader(asset_server: &AssetServer) -> Option<Handle<Shader>>
fn dynamic_uniform_indices(material: &Self::PreparedAsset) -> &[u32]
fn dynamic_uniform_indices(material: &Self::PreparedAsset) -> &[u32]
impl RenderAsset for ColorMaterial
impl RenderAsset for ColorMaterial
type ExtractedAsset = ColorMaterial
type ExtractedAsset = ColorMaterial
The representation of the the asset in the “render world”.
type PreparedAsset = GpuColorMaterial
type PreparedAsset = GpuColorMaterial
The GPU-representation of the the asset.
type Param = (Res<'static, RenderDevice>, Res<'static, Material2dPipeline<ColorMaterial>>, Res<'static, HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState>>)
type Param = (Res<'static, RenderDevice>, Res<'static, Material2dPipeline<ColorMaterial>>, Res<'static, HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState>>)
Specifies all ECS data required by RenderAsset::prepare_asset
.
For convenience use the lifetimeless
SystemParams. Read more
pub fn extract_asset(&self) -> <ColorMaterial as RenderAsset>::ExtractedAsset
pub fn extract_asset(&self) -> <ColorMaterial as RenderAsset>::ExtractedAsset
Converts the asset into a RenderAsset::ExtractedAsset
.
pub fn prepare_asset(
material: <ColorMaterial as RenderAsset>::ExtractedAsset,
&mut <<<ColorMaterial as RenderAsset>::Param as SystemParam>::Fetch as SystemParamFetch<'_, '_>>::Item
) -> Result<<ColorMaterial as RenderAsset>::PreparedAsset, PrepareAssetError<<ColorMaterial as RenderAsset>::ExtractedAsset>>
pub fn prepare_asset(
material: <ColorMaterial as RenderAsset>::ExtractedAsset,
&mut <<<ColorMaterial as RenderAsset>::Param as SystemParam>::Fetch as SystemParamFetch<'_, '_>>::Item
) -> Result<<ColorMaterial as RenderAsset>::PreparedAsset, PrepareAssetError<<ColorMaterial as RenderAsset>::ExtractedAsset>>
Prepares the extracted asset
for the GPU by transforming it into
a RenderAsset::PreparedAsset
. Therefore ECS data may be accessed via the param
. Read more
impl TypeUuid for ColorMaterial
impl TypeUuid for ColorMaterial
Auto Trait Implementations
impl RefUnwindSafe for ColorMaterial
impl Send for ColorMaterial
impl Sync for ColorMaterial
impl Unpin for ColorMaterial
impl UnwindSafe for ColorMaterial
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
pub fn from_world(_world: &mut World) -> T
pub fn from_world(_world: &mut World) -> T
Creates Self
using data from the given World
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
impl<M> SpecializedMaterial2d for M where
M: Material2d,
impl<M> SpecializedMaterial2d for M where
M: Material2d,
The key used to specialize this material’s RenderPipelineDescriptor
.
pub fn key(
_material: &<M as RenderAsset>::PreparedAsset
) -> <M as SpecializedMaterial2d>::Key
pub fn key(
_material: &<M as RenderAsset>::PreparedAsset
) -> <M as SpecializedMaterial2d>::Key
Extract the SpecializedMaterial2d::Key
for the “prepared” version of this material. This key will be
passed in to the SpecializedMaterial2d::specialize
function when compiling the RenderPipeline
for a given entity’s material. Read more
pub fn specialize(
_key: <M as SpecializedMaterial2d>::Key,
_descriptor: &mut RenderPipelineDescriptor
)
pub fn specialize(
_key: <M as SpecializedMaterial2d>::Key,
_descriptor: &mut RenderPipelineDescriptor
)
Specializes the given descriptor
according to the given key
.
pub fn bind_group(material: &<M as RenderAsset>::PreparedAsset) -> &BindGroup
pub fn bind_group(material: &<M as RenderAsset>::PreparedAsset) -> &BindGroup
Returns this material’s BindGroup
. This should match the layout returned by SpecializedMaterial2d::bind_group_layout
.
pub fn bind_group_layout(render_device: &RenderDevice) -> BindGroupLayout
pub fn bind_group_layout(render_device: &RenderDevice) -> BindGroupLayout
Returns this material’s BindGroupLayout
. This should match the BindGroup
returned by SpecializedMaterial2d::bind_group
.
pub fn vertex_shader(asset_server: &AssetServer) -> Option<Handle<Shader>>
pub fn vertex_shader(asset_server: &AssetServer) -> Option<Handle<Shader>>
pub fn fragment_shader(asset_server: &AssetServer) -> Option<Handle<Shader>>
pub fn fragment_shader(asset_server: &AssetServer) -> Option<Handle<Shader>>
pub fn dynamic_uniform_indices(
material: &<M as RenderAsset>::PreparedAsset
) -> &[u32]
pub fn dynamic_uniform_indices(
material: &<M as RenderAsset>::PreparedAsset
) -> &[u32]
pub fn clone_type_data(&self) -> Box<dyn TypeData + 'static, Global>ⓘ
impl<T> TypeUuidDynamic for T where
T: TypeUuid,
impl<T> TypeUuidDynamic for T where
T: TypeUuid,
pub fn vzip(self) -> V
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more