pub trait Material: Asset + AsAny {
// Provided methods
fn base_color(&self) -> LinearRgba { ... }
fn emissive_color(&self) -> LinearRgba { ... }
fn specular_power(&self) -> f32 { ... }
fn ambient_color(&self) -> LinearRgba { ... }
}Expand description
A trait for types that can be used as a material.
A material defines the surface properties of an object being rendered,
influencing how it interacts with light and determining which shader
(RenderPipeline) is used to draw it.
Provided Methods§
Sourcefn base_color(&self) -> LinearRgba
fn base_color(&self) -> LinearRgba
Returns the base color (albedo or diffuse) of the material. Default implementation is White.
Sourcefn emissive_color(&self) -> LinearRgba
fn emissive_color(&self) -> LinearRgba
Returns the emissive color of the material. Default implementation is Black.
Sourcefn specular_power(&self) -> f32
fn specular_power(&self) -> f32
Returns the specular power or roughness conversion for the material. Default implementation is 32.0.
Sourcefn ambient_color(&self) -> LinearRgba
fn ambient_color(&self) -> LinearRgba
Returns the ambient color modifier for the material. Default implementation is (0.1, 0.1, 0.1, 0.0).
Trait Implementations§
impl Asset for Box<dyn Material>
This is the key to our type-erased material handle system. We explicitly tell the compiler that a boxed, dynamic Material trait object can itself be treated as a valid Asset. This allows it to be stored inside an AssetHandle.