pub struct PhongMaterial {
pub auto_sync_texture_to_uniforms: bool,
/* private fields */
}Fields§
§auto_sync_texture_to_uniforms: boolImplementations§
Source§impl PhongMaterial
impl PhongMaterial
pub fn new(color: Vec4) -> PhongMaterial
Sourcepub fn with_color(self, color: Vec4) -> PhongMaterial
pub fn with_color(self, color: Vec4) -> PhongMaterial
Sets the diffuse color (builder).
Sourcepub fn with_shininess(self, s: f32) -> PhongMaterial
pub fn with_shininess(self, s: f32) -> PhongMaterial
Sets the shininess factor (builder).
Sourcepub fn with_specular(self, specular: Vec3) -> PhongMaterial
pub fn with_specular(self, specular: Vec3) -> PhongMaterial
Sets the specular color (builder).
Sourcepub fn with_emissive(self, color: Vec3, intensity: f32) -> PhongMaterial
pub fn with_emissive(self, color: Vec3, intensity: f32) -> PhongMaterial
Sets the emissive color and intensity (builder).
Sourcepub fn with_normal_scale(self, scale: Vec2) -> PhongMaterial
pub fn with_normal_scale(self, scale: Vec2) -> PhongMaterial
Sets the normal map scale (builder).
Sourcepub fn with_opacity(self, opacity: f32) -> PhongMaterial
pub fn with_opacity(self, opacity: f32) -> PhongMaterial
Sets the opacity (builder).
Sourcepub fn with_map(self, handle: TextureHandle) -> PhongMaterial
pub fn with_map(self, handle: TextureHandle) -> PhongMaterial
Sets the color map texture (builder).
Sourcepub fn with_normal_map(self, handle: TextureHandle) -> PhongMaterial
pub fn with_normal_map(self, handle: TextureHandle) -> PhongMaterial
Sets the normal map texture (builder).
Sourcepub fn with_specular_map(self, handle: TextureHandle) -> PhongMaterial
pub fn with_specular_map(self, handle: TextureHandle) -> PhongMaterial
Sets the specular map texture (builder).
Sourcepub fn with_emissive_map(self, handle: TextureHandle) -> PhongMaterial
pub fn with_emissive_map(self, handle: TextureHandle) -> PhongMaterial
Sets the emissive map texture (builder).
Sourcepub fn with_side(self, side: Side) -> PhongMaterial
pub fn with_side(self, side: Side) -> PhongMaterial
Sets the face culling side (builder).
Sourcepub fn with_alpha_mode(self, mode: AlphaMode) -> PhongMaterial
pub fn with_alpha_mode(self, mode: AlphaMode) -> PhongMaterial
Sets the alpha mode (builder).
Sourcepub fn with_depth_write(self, enabled: bool) -> PhongMaterial
pub fn with_depth_write(self, enabled: bool) -> PhongMaterial
Sets depth write (builder).
Source§impl PhongMaterial
impl PhongMaterial
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<'_, PhongUniforms>
pub fn uniforms_mut(&self) -> BufferGuard<'_, PhongUniforms>
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<'_, PhongUniforms>
pub fn uniforms(&self) -> BufferReadGuard<'_, PhongUniforms>
Gets a read-only accessor for all Uniform parameters.
pub fn color(&self) -> Vec4
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_specular(&self, value: Vec3)
pub fn set_specular(&self, value: Vec3)
Specular color.
pub fn specular(&self) -> Vec3
Sourcepub fn set_opacity(&self, value: f32)
pub fn set_opacity(&self, value: f32)
Opacity value.
pub fn opacity(&self) -> f32
Sourcepub fn set_emissive(&self, value: Vec3)
pub fn set_emissive(&self, value: Vec3)
Emissive color.
pub fn emissive(&self) -> Vec3
Sourcepub fn set_emissive_intensity(&self, value: f32)
pub fn set_emissive_intensity(&self, value: f32)
Emissive intensity.
pub fn emissive_intensity(&self) -> f32
Sourcepub fn set_normal_scale(&self, value: Vec2)
pub fn set_normal_scale(&self, value: Vec2)
Normal map scale.
pub fn normal_scale(&self) -> Vec2
Sourcepub fn set_shininess(&self, value: f32)
pub fn set_shininess(&self, value: f32)
Shininess factor.
pub fn shininess(&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 set_normal_map(&self, value: Option<TextureHandle>)
pub fn set_normal_map(&self, value: Option<TextureHandle>)
The normal map.
pub fn normal_map(&self) -> Option<TextureHandle>
pub fn set_normal_map_transform(&self, transform: TextureTransform)
pub fn configure_normal_map<F>(&self, f: F)where
F: FnOnce(&mut TextureSlot),
Sourcepub fn set_specular_map(&self, value: Option<TextureHandle>)
pub fn set_specular_map(&self, value: Option<TextureHandle>)
The specular map.
pub fn specular_map(&self) -> Option<TextureHandle>
pub fn set_specular_map_transform(&self, transform: TextureTransform)
pub fn configure_specular_map<F>(&self, f: F)where
F: FnOnce(&mut TextureSlot),
Sourcepub fn set_emissive_map(&self, value: Option<TextureHandle>)
pub fn set_emissive_map(&self, value: Option<TextureHandle>)
The emissive map.
pub fn emissive_map(&self) -> Option<TextureHandle>
pub fn set_emissive_map_transform(&self, transform: TextureTransform)
pub fn configure_emissive_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(&PhongUniforms),
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 PhongMaterial
impl Clone for PhongMaterial
Source§fn clone(&self) -> PhongMaterial
fn clone(&self) -> PhongMaterial
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PhongMaterial
impl Debug for PhongMaterial
Source§impl Default for PhongMaterial
impl Default for PhongMaterial
Source§fn default() -> PhongMaterial
fn default() -> PhongMaterial
Source§impl From<PhongMaterial> for Material
impl From<PhongMaterial> for Material
Source§fn from(data: PhongMaterial) -> Material
fn from(data: PhongMaterial) -> Material
Source§impl MaterialTrait for PhongMaterial
impl MaterialTrait for PhongMaterial
Source§impl RenderableMaterialTrait for PhongMaterial
impl RenderableMaterialTrait for PhongMaterial
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 PhongMaterial
impl ResolveMaterial for PhongMaterial
fn resolve(self, assets: &AssetServer) -> MaterialHandle
Auto Trait Implementations§
impl !Freeze for PhongMaterial
impl !RefUnwindSafe for PhongMaterial
impl Send for PhongMaterial
impl Sync for PhongMaterial
impl Unpin for PhongMaterial
impl UnsafeUnpin for PhongMaterial
impl UnwindSafe for PhongMaterial
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<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
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().