pub struct UnlitMaterial {
pub auto_sync_texture_to_uniforms: bool,
/* private fields */
}Fields§
§auto_sync_texture_to_uniforms: boolImplementations§
Source§impl UnlitMaterial
impl UnlitMaterial
pub fn new(color: Vec4) -> UnlitMaterial
Sourcepub fn with_color(self, color: Vec4) -> UnlitMaterial
pub fn with_color(self, color: Vec4) -> UnlitMaterial
Sets the base color (builder).
Sourcepub fn with_opacity(self, opacity: f32) -> UnlitMaterial
pub fn with_opacity(self, opacity: f32) -> UnlitMaterial
Sets the opacity (builder).
Sourcepub fn with_map(self, handle: TextureHandle) -> UnlitMaterial
pub fn with_map(self, handle: TextureHandle) -> UnlitMaterial
Sets the color map texture (builder).
Sourcepub fn with_side(self, side: Side) -> UnlitMaterial
pub fn with_side(self, side: Side) -> UnlitMaterial
Sets the face culling side (builder).
Sourcepub fn with_alpha_mode(self, mode: AlphaMode) -> UnlitMaterial
pub fn with_alpha_mode(self, mode: AlphaMode) -> UnlitMaterial
Sets the alpha mode (builder).
Sourcepub fn with_depth_write(self, enabled: bool) -> UnlitMaterial
pub fn with_depth_write(self, enabled: bool) -> UnlitMaterial
Sets depth write (builder).
Source§impl UnlitMaterial
impl UnlitMaterial
pub fn settings_mut(&self) -> SettingsGuard<'_>
pub fn settings(&self) -> MaterialSettings
pub fn set_alpha_mode(&self, mode: AlphaMode)
pub fn alpha_mode(&self) -> AlphaMode
pub fn side(&self) -> Side
Sourcepub fn set_depth_test(&self, depth_test: bool)
pub fn set_depth_test(&self, depth_test: bool)
Enables or disables depth testing.
pub fn depth_test(&self) -> bool
Sourcepub fn set_depth_write(&self, depth_write: bool)
pub fn set_depth_write(&self, depth_write: bool)
Enables or disables depth writing. For transparent objects, it’s usually recommended to disable this.
pub fn depth_write(&self) -> bool
Sourcepub fn uniforms_mut(&self) -> BufferGuard<'_, UnlitUniforms>
pub fn uniforms_mut(&self) -> BufferGuard<'_, UnlitUniforms>
Gets a mutable accessor for all Uniform parameters (for batch modifications). The Guard will automatically mark data as Dirty when it goes out of scope.
Sourcepub fn uniforms(&self) -> BufferReadGuard<'_, UnlitUniforms>
pub fn uniforms(&self) -> BufferReadGuard<'_, UnlitUniforms>
Gets a read-only accessor for all Uniform parameters.
pub fn color(&self) -> Vec4
Sourcepub fn set_opacity(&self, value: f32)
pub fn set_opacity(&self, value: f32)
Opacity value.
pub fn opacity(&self) -> f32
Sourcepub fn set_alpha_test(&self, value: f32)
pub fn set_alpha_test(&self, value: f32)
Alpha test threshold.
pub fn alpha_test(&self) -> f32
Sourcepub fn set_map(&self, value: Option<TextureHandle>)
pub fn set_map(&self, value: Option<TextureHandle>)
The color map.
pub fn map(&self) -> Option<TextureHandle>
pub fn set_map_transform(&self, transform: TextureTransform)
pub fn configure_map<F>(&self, f: F)where
F: FnOnce(&mut TextureSlot),
Sourcepub fn flush_texture_transforms(&self) -> bool
pub fn flush_texture_transforms(&self) -> bool
Flushes texture transform matrices to Uniforms. Only writes when values actually change, avoiding unnecessary version bumps. Returns whether any data was updated.
pub fn configure<F>(&self, f: F)where
F: FnOnce(&UnlitUniforms),
Sourcepub fn notify_pipeline_dirty(&self)
pub fn notify_pipeline_dirty(&self)
Manually notifies that the material pipeline needs to be rebuilt.
Note: In most cases, you don’t need to call this method manually, as modifying texture slots through the standard API will automatically track version changes. This method is only for the following special scenarios:
- After directly modifying
pub(crate)fields (e.g., in loader internal code) - When you’re certain the material configuration has changed but the version hasn’t been updated
Trait Implementations§
Source§impl Clone for UnlitMaterial
impl Clone for UnlitMaterial
Source§fn clone(&self) -> UnlitMaterial
fn clone(&self) -> UnlitMaterial
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UnlitMaterial
impl Debug for UnlitMaterial
Source§impl Default for UnlitMaterial
impl Default for UnlitMaterial
Source§fn default() -> UnlitMaterial
fn default() -> UnlitMaterial
Source§impl From<UnlitMaterial> for Material
impl From<UnlitMaterial> for Material
Source§fn from(data: UnlitMaterial) -> Material
fn from(data: UnlitMaterial) -> Material
Source§impl MaterialTrait for UnlitMaterial
impl MaterialTrait for UnlitMaterial
Source§impl RenderableMaterialTrait for UnlitMaterial
impl RenderableMaterialTrait for UnlitMaterial
Source§fn shader_name(&self) -> &'static str
fn shader_name(&self) -> &'static str
Source§fn settings(&self) -> MaterialSettings
fn settings(&self) -> MaterialSettings
Source§fn uniform_buffer(&self) -> BufferRef
fn uniform_buffer(&self) -> BufferRef
Source§fn with_uniform_bytes(&self, visitor: &mut dyn FnMut(&[u8]))
fn with_uniform_bytes(&self, visitor: &mut dyn FnMut(&[u8]))
Source§fn shader_defines(&self) -> ShaderDefines
fn shader_defines(&self) -> ShaderDefines
Source§fn visit_textures(&self, visitor: &mut dyn FnMut(&TextureSource))
fn visit_textures(&self, visitor: &mut dyn FnMut(&TextureSource))
Source§fn define_bindings<'a>(&'a self, builder: &mut ResourceBuilder<'a>)
fn define_bindings<'a>(&'a self, builder: &mut ResourceBuilder<'a>)
fn extra_defines(&self, _defines: &mut ShaderDefines)
Source§impl ResolveMaterial for UnlitMaterial
impl ResolveMaterial for UnlitMaterial
fn resolve(self, assets: &AssetServer) -> MaterialHandle
Auto Trait Implementations§
impl !Freeze for UnlitMaterial
impl !RefUnwindSafe for UnlitMaterial
impl Send for UnlitMaterial
impl Sync for UnlitMaterial
impl Unpin for UnlitMaterial
impl UnsafeUnpin for UnlitMaterial
impl UnwindSafe for UnlitMaterial
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
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>
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>
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)
&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)
&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> 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<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>
ReadEndian::read_from_little_endian().