pub struct PbrMaterial {Show 40 fields
pub name: String,
pub albedo: [f32; 3],
pub alpha: f32,
pub metallic: f32,
pub roughness: f32,
pub emission: [f32; 3],
pub emission_intensity: f32,
pub normal_map_index: i32,
pub normal_map_strength: f32,
pub ior: f32,
pub anisotropy: f32,
pub anisotropy_rotation: f32,
pub clearcoat: f32,
pub clearcoat_roughness: f32,
pub subsurface: f32,
pub subsurface_color: [f32; 3],
pub subsurface_radius: f32,
pub sheen: f32,
pub sheen_tint: f32,
pub specular: f32,
pub specular_tint: f32,
pub transmission: f32,
pub absorption_color: [f32; 3],
pub absorption_distance: f32,
pub albedo_texture: u64,
pub roughness_texture: u64,
pub metallic_texture: u64,
pub normal_texture: u64,
pub emission_texture: u64,
pub ao_texture: u64,
pub material_id: u8,
pub is_transparent: bool,
pub alpha_test: bool,
pub alpha_threshold: f32,
pub double_sided: bool,
pub uv_scale: [f32; 2],
pub uv_offset: [f32; 2],
pub receive_shadows: bool,
pub cast_shadows: bool,
pub priority: i32,
}Expand description
A physically-based rendering material with full parameter set.
Fields§
§name: StringHuman-readable name.
albedo: [f32; 3]Base color / albedo (linear RGB).
alpha: f32Alpha / opacity (0..1). 1.0 = fully opaque.
metallic: f32Metallic factor (0..1). 0 = dielectric, 1 = metal.
roughness: f32Roughness factor (0..1). 0 = mirror, 1 = fully rough.
emission: [f32; 3]Emission color (linear RGB, can be HDR).
emission_intensity: f32Emission intensity multiplier.
normal_map_index: i32Normal map texture index (-1 = no normal map).
normal_map_strength: f32Normal map strength (0..1).
ior: f32Index of refraction (glass ~1.5, water ~1.33, air ~1.0).
anisotropy: f32Anisotropy (-1..1). 0 = isotropic. Positive = stretched along tangent.
anisotropy_rotation: f32Anisotropy rotation in radians.
clearcoat: f32Clearcoat strength (0..1). Simulates a clear lacquer layer.
clearcoat_roughness: f32Clearcoat roughness (0..1).
subsurface: f32Subsurface scattering factor (0..1).
subsurface_color: [f32; 3]Subsurface scattering color (linear RGB).
subsurface_radius: f32Subsurface scattering radius.
sheen: f32Sheen strength (for fabric-like materials).
sheen_tint: f32Sheen tint (0 = white sheen, 1 = tinted by albedo).
specular: f32Specular intensity override (0..1, default 0.5 for 4% F0).
specular_tint: f32Specular tint (0 = white specular, 1 = tinted by albedo).
transmission: f32Transmission factor (0..1). 1 = fully transmissive (glass).
absorption_color: [f32; 3]Absorption color for transmissive materials (linear RGB).
absorption_distance: f32Absorption distance (how deep before color is fully absorbed).
albedo_texture: u64Texture handles (opaque IDs).
roughness_texture: u64§metallic_texture: u64§normal_texture: u64§emission_texture: u64§ao_texture: u64§material_id: u8Material ID (for G-Buffer material ID channel).
is_transparent: boolWhether this material is transparent.
alpha_test: boolWhether this material uses alpha testing (cutout).
alpha_threshold: f32Alpha test threshold.
double_sided: boolWhether this material is double-sided.
uv_scale: [f32; 2]UV tiling factor.
uv_offset: [f32; 2]UV offset.
receive_shadows: boolWhether this material receives shadows.
cast_shadows: boolWhether this material casts shadows.
priority: i32Render priority (lower = rendered first).
Implementations§
Source§impl PbrMaterial
impl PbrMaterial
pub fn with_albedo(self, r: f32, g: f32, b: f32) -> Self
pub fn with_metallic(self, m: f32) -> Self
pub fn with_roughness(self, r: f32) -> Self
pub fn with_emission(self, r: f32, g: f32, b: f32) -> Self
pub fn with_emission_intensity(self, i: f32) -> Self
pub fn with_ior(self, ior: f32) -> Self
pub fn with_anisotropy(self, a: f32) -> Self
pub fn with_clearcoat(self, strength: f32, roughness: f32) -> Self
pub fn with_subsurface(self, strength: f32, color: [f32; 3]) -> Self
pub fn with_sheen(self, strength: f32, tint: f32) -> Self
pub fn with_transmission(self, t: f32) -> Self
pub fn with_alpha(self, a: f32) -> Self
pub fn with_alpha_test(self, threshold: f32) -> Self
pub fn with_material_id(self, id: u8) -> Self
pub fn with_uv_transform(self, scale: [f32; 2], offset: [f32; 2]) -> Self
pub fn with_double_sided(self, ds: bool) -> Self
Sourcepub fn f0(&self) -> [f32; 3]
pub fn f0(&self) -> [f32; 3]
Compute the Fresnel F0 (reflectance at normal incidence) for this material.
Sourcepub fn diffuse_color(&self) -> [f32; 3]
pub fn diffuse_color(&self) -> [f32; 3]
Compute the diffuse color (metals have no diffuse contribution).
Sourcepub fn total_emission(&self) -> [f32; 3]
pub fn total_emission(&self) -> [f32; 3]
Get the total emission (color * intensity).
Sourcepub fn sort_key(&self) -> MaterialSortKey
pub fn sort_key(&self) -> MaterialSortKey
Compute a sort key for batching draw calls.
Sourcepub fn has_textures(&self) -> bool
pub fn has_textures(&self) -> bool
Whether this material has any textures bound.
Sourcepub fn albedo_luminance(&self) -> f32
pub fn albedo_luminance(&self) -> f32
Compute the perceptual brightness of the albedo.
Sourcepub fn glsl_uniforms() -> &'static str
pub fn glsl_uniforms() -> &'static str
Generate GLSL uniform declarations for this material’s properties.
Trait Implementations§
Source§impl Clone for PbrMaterial
impl Clone for PbrMaterial
Source§fn clone(&self) -> PbrMaterial
fn clone(&self) -> PbrMaterial
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PbrMaterial
impl Debug for PbrMaterial
Source§impl Default for PbrMaterial
impl Default for PbrMaterial
Auto Trait Implementations§
impl Freeze for PbrMaterial
impl RefUnwindSafe for PbrMaterial
impl Send for PbrMaterial
impl Sync for PbrMaterial
impl Unpin for PbrMaterial
impl UnsafeUnpin for PbrMaterial
impl UnwindSafe for PbrMaterial
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.