pub struct Material {
pub name: Option<Cow<'static, str>>,
pub data: MaterialType,
/* private fields */
}Fields§
§name: Option<Cow<'static, str>>§data: MaterialTypeImplementations§
Source§impl Material
impl Material
pub fn new(data: MaterialType) -> Material
Sourcepub fn new_custom<T>(custom_material: T) -> Materialwhere
T: RenderableMaterialTrait + 'static,
pub fn new_custom<T>(custom_material: T) -> Materialwhere
T: RenderableMaterialTrait + 'static,
Creates a Material from a custom material
pub fn new_unlit(color: Vec4) -> Material
pub fn new_phong(color: Vec4) -> Material
pub fn new_physical(color: Vec4) -> Material
Sourcepub fn as_renderable(&self) -> &(dyn RenderableMaterialTrait + 'static)
pub fn as_renderable(&self) -> &(dyn RenderableMaterialTrait + 'static)
Exposes the rendering behavior interface
Sourcepub fn as_custom<T>(&self) -> Option<&T>where
T: MaterialTrait + 'static,
pub fn as_custom<T>(&self) -> Option<&T>where
T: MaterialTrait + 'static,
Gets a reference to the custom material
Sourcepub fn as_custom_mut<T>(&mut self) -> Option<&mut T>where
T: MaterialTrait + 'static,
pub fn as_custom_mut<T>(&mut self) -> Option<&mut T>where
T: MaterialTrait + 'static,
Gets a mutable reference to the custom material
pub fn as_unlit(&self) -> Option<&UnlitMaterial>
pub fn as_unlit_mut(&mut self) -> Option<&mut UnlitMaterial>
pub fn as_phong(&self) -> Option<&PhongMaterial>
pub fn as_phong_mut(&mut self) -> Option<&mut PhongMaterial>
pub fn as_physical(&self) -> Option<&PhysicalMaterial>
pub fn as_physical_mut(&mut self) -> Option<&mut PhysicalMaterial>
pub fn uniforms(&self) -> &(dyn Any + 'static)
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn shader_name(&self) -> &'static str
pub fn shader_defines(&self) -> ShaderDefines
pub fn settings(&self) -> MaterialSettings
pub fn alpha_mode(&self) -> AlphaMode
pub fn alpha_to_coverage(&self) -> bool
pub fn is_transparent(&self) -> bool
pub fn depth_write(&self) -> bool
pub fn depth_test(&self) -> bool
pub fn side(&self) -> Side
Sourcepub fn define_bindings<'a>(&'a self, builder: &mut ResourceBuilder<'a>)
pub fn define_bindings<'a>(&'a self, builder: &mut ResourceBuilder<'a>)
Defines GPU resource bindings (delegates to internal data)
pub fn auto_sync_texture_to_uniforms(&self) -> bool
pub fn visit_textures(&self, visitor: &mut dyn FnMut(&TextureSource))
pub fn uniform_buffer(&self) -> BufferRef
pub fn with_uniform_bytes(&self, f: &mut dyn FnMut(&[u8]))
pub fn use_transmission(&self) -> bool
Methods from Deref<Target = MaterialType>§
Sourcepub fn as_custom<T>(&self) -> Option<&T>where
T: MaterialTrait + 'static,
pub fn as_custom<T>(&self) -> Option<&T>where
T: MaterialTrait + 'static,
Tries to downcast to a concrete type (for Custom materials)
Trait Implementations§
Source§impl Bindings for Material
impl Bindings for Material
fn define_bindings<'a>(&'a self, builder: &mut ResourceBuilder<'a>)
Source§impl From<PhongMaterial> for Material
impl From<PhongMaterial> for Material
Source§fn from(data: PhongMaterial) -> Material
fn from(data: PhongMaterial) -> Material
Converts to this type from the input type.
Source§impl From<PhysicalMaterial> for Material
impl From<PhysicalMaterial> for Material
Source§fn from(data: PhysicalMaterial) -> Material
fn from(data: PhysicalMaterial) -> Material
Converts to this type from the input type.
Source§impl From<UnlitMaterial> for Material
impl From<UnlitMaterial> for Material
Source§fn from(data: UnlitMaterial) -> Material
fn from(data: UnlitMaterial) -> Material
Converts to this type from the input type.
Source§impl ResolveMaterial for Material
impl ResolveMaterial for Material
fn resolve(self, assets: &AssetServer) -> MaterialHandle
Auto Trait Implementations§
impl !Freeze for Material
impl !RefUnwindSafe for Material
impl Send for Material
impl Sync for Material
impl Unpin for Material
impl UnsafeUnpin for Material
impl !UnwindSafe for Material
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn 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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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.