pub struct MaterialProperties { /* private fields */ }Expand description
Material properties for the mesh
Implementations§
Source§impl MaterialProperties
impl MaterialProperties
pub fn layout(rcx: &RenderContext) -> DescriptorSetLayout
Sourcepub fn get_descriptor(
&self,
rcx: &RenderContext,
assets: &AssetLibrary,
) -> Option<DescriptorSet>
pub fn get_descriptor( &self, rcx: &RenderContext, assets: &AssetLibrary, ) -> Option<DescriptorSet>
gets the material descriptor set (lazily allocated)
Sourcepub fn with_base_color_factor(
self,
base_color_factor: impl Into<Vec4>,
) -> MaterialProperties
pub fn with_base_color_factor( self, base_color_factor: impl Into<Vec4>, ) -> MaterialProperties
Base color factor (vec4)
pub fn base_color_factor(&self) -> Vec4
Sourcepub fn with_base_color_texture(
self,
texture: AssetHandle<LazyTexture>,
) -> MaterialProperties
pub fn with_base_color_texture( self, texture: AssetHandle<LazyTexture>, ) -> MaterialProperties
Base color texture
pub fn base_color_texture(&self) -> Option<AssetHandle<LazyTexture>>
Sourcepub fn with_metallic_factor(self, metallic_factor: f32) -> MaterialProperties
pub fn with_metallic_factor(self, metallic_factor: f32) -> MaterialProperties
Metallic factor
pub fn metallic_factor(&self) -> f32
Sourcepub fn with_roughness_factor(self, roughness_factor: f32) -> MaterialProperties
pub fn with_roughness_factor(self, roughness_factor: f32) -> MaterialProperties
Roughness factor
pub fn roughness_factor(&self) -> f32
Sourcepub fn with_metallic_roughness_texture(
self,
texture: AssetHandle<LazyTexture>,
) -> MaterialProperties
pub fn with_metallic_roughness_texture( self, texture: AssetHandle<LazyTexture>, ) -> MaterialProperties
Metallic/Roughness texture
pub fn metallic_roughness_texture(&self) -> Option<AssetHandle<LazyTexture>>
Sourcepub fn with_normal_scale(self, normal_scale: f32) -> MaterialProperties
pub fn with_normal_scale(self, normal_scale: f32) -> MaterialProperties
Normal scale
pub fn normal_scale(&self) -> f32
Sourcepub fn with_normal_texture(
self,
texture: AssetHandle<LazyTexture>,
) -> MaterialProperties
pub fn with_normal_texture( self, texture: AssetHandle<LazyTexture>, ) -> MaterialProperties
Normal texture
pub fn normal_texture(&self) -> Option<AssetHandle<LazyTexture>>
Sourcepub fn with_ambient_occlusion_strength(
self,
strength: f32,
) -> MaterialProperties
pub fn with_ambient_occlusion_strength( self, strength: f32, ) -> MaterialProperties
Ambient occlusion strength
pub fn ambient_occlusion_strength(&self) -> f32
Sourcepub fn with_occlusion_texture(
self,
texture: AssetHandle<LazyTexture>,
) -> MaterialProperties
pub fn with_occlusion_texture( self, texture: AssetHandle<LazyTexture>, ) -> MaterialProperties
Occlusion texture
pub fn occlusion_texture(&self) -> Option<AssetHandle<LazyTexture>>
Sourcepub fn with_emissive_factor(self, emissive_factor: Vec3) -> MaterialProperties
pub fn with_emissive_factor(self, emissive_factor: Vec3) -> MaterialProperties
Emissive factor
pub fn emissive_factor(&self) -> Vec3
Sourcepub fn with_emissive_texture(
self,
texture: AssetHandle<LazyTexture>,
) -> MaterialProperties
pub fn with_emissive_texture( self, texture: AssetHandle<LazyTexture>, ) -> MaterialProperties
Emissive texture
pub fn emissive_texture(&self) -> Option<AssetHandle<LazyTexture>>
pub fn with_parallax_texture( self, texture: AssetHandle<LazyTexture>, ) -> MaterialProperties
pub fn parallax_texture(&self) -> Option<AssetHandle<LazyTexture>>
Sourcepub fn with_double_sided(self, double_sided: bool) -> MaterialProperties
pub fn with_double_sided(self, double_sided: bool) -> MaterialProperties
Double sided
pub fn double_sided(&self) -> bool
Sourcepub fn with_alpha_mode(self, alpha_mode: AlphaMode) -> MaterialProperties
pub fn with_alpha_mode(self, alpha_mode: AlphaMode) -> MaterialProperties
Alpha mode
pub fn alpha_mode(&self) -> AlphaMode
Sourcepub fn with_alpha_cutoff(self, alpha_cutoff: f32) -> MaterialProperties
pub fn with_alpha_cutoff(self, alpha_cutoff: f32) -> MaterialProperties
Alpha cutoff
pub fn alpha_cutoff(&self) -> f32
Sourcepub fn with_unlit(self, unlit: bool) -> MaterialProperties
pub fn with_unlit(self, unlit: bool) -> MaterialProperties
Unlit (skip lighting calculations)
pub fn unlit(&self) -> bool
Sourcepub fn with_texture_scale(self, scale: impl Into<Vec2>) -> MaterialProperties
pub fn with_texture_scale(self, scale: impl Into<Vec2>) -> MaterialProperties
Sets the texture/UV scale for all textures.
This allows you to scale texture coordinates without modifying vertex data. Useful for tiling textures or adjusting texture density.
§Arguments
scale- The scale factor (Vec2). Default is (1.0, 1.0).
§Example
ⓘ
// Tile the texture 2x horizontally and 3x vertically
material.with_texture_scale(math::vec2(2.0, 3.0))pub fn texture_scale(&self) -> Vec2
Trait Implementations§
Source§impl Clone for MaterialProperties
impl Clone for MaterialProperties
Source§fn clone(&self) -> MaterialProperties
fn clone(&self) -> MaterialProperties
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for MaterialProperties
impl Default for MaterialProperties
Source§fn default() -> MaterialProperties
fn default() -> MaterialProperties
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for MaterialProperties
impl !UnwindSafe for MaterialProperties
impl Freeze for MaterialProperties
impl Send for MaterialProperties
impl Sync for MaterialProperties
impl Unpin for MaterialProperties
impl UnsafeUnpin for MaterialProperties
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().impl<T> SendSync for T
impl<T> SendSync for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.