Struct three_d::core::CpuMaterial
source · [−]pub struct CpuMaterial {Show 15 fields
pub name: String,
pub albedo: Color,
pub albedo_texture: Option<CpuTexture>,
pub metallic: f32,
pub roughness: f32,
pub occlusion_metallic_roughness_texture: Option<CpuTexture>,
pub metallic_roughness_texture: Option<CpuTexture>,
pub occlusion_strength: f32,
pub occlusion_texture: Option<CpuTexture>,
pub normal_scale: f32,
pub normal_texture: Option<CpuTexture>,
pub emissive: Color,
pub emissive_texture: Option<CpuTexture>,
pub alpha_cutout: Option<f32>,
pub lighting_model: LightingModel,
}Expand description
A CPU-side version of a material. Can be constructed manually or loaded via io.
Fields
name: StringName. Used for matching geometry and material.
albedo: ColorAlbedo base color, also called diffuse color. Assumed to be in linear color space.
albedo_texture: Option<CpuTexture>Texture with albedo base colors, also called diffuse color. Assumed to be in sRGB with or without an alpha channel.
metallic: f32A value in the range [0..1] specifying how metallic the material is.
roughness: f32A value in the range [0..1] specifying how rough the material surface is.
occlusion_metallic_roughness_texture: Option<CpuTexture>Texture containing the occlusion, metallic and roughness parameters. The occlusion values are sampled from the red channel, metallic from the blue channel and the roughness from the green channel. Is sometimes in two textures, see Self::occlusion_texture and Self::metallic_roughness_texture.
metallic_roughness_texture: Option<CpuTexture>Texture containing the metallic and roughness parameters which are multiplied with the Self::metallic and Self::roughness values in the shader. The metallic values are sampled from the blue channel and the roughness from the green channel. Can be combined with occlusion into one texture, see Self::occlusion_metallic_roughness_texture.
occlusion_strength: f32A scalar multiplier controlling the amount of occlusion applied from the Self::occlusion_texture. A value of 0.0 means no occlusion. A value of 1.0 means full occlusion.
occlusion_texture: Option<CpuTexture>An occlusion map. Higher values indicate areas that should receive full indirect lighting and lower values indicate no indirect lighting. The occlusion values are sampled from the red channel. Can be combined with metallic and roughness into one texture, see Self::occlusion_metallic_roughness_texture.
normal_scale: f32A scalar multiplier applied to each normal vector of the Self::normal_texture.
normal_texture: Option<CpuTexture>A tangent space normal map, also known as bump map.
emissive: ColorColor of light shining from an object.
emissive_texture: Option<CpuTexture>Texture with color of light shining from an object.
alpha_cutout: Option<f32>Alpha cutout value for transparency in deferred rendering pipeline.
lighting_model: LightingModelThe lighting model used when rendering this material
Trait Implementations
sourceimpl Clone for CpuMaterial
impl Clone for CpuMaterial
sourcefn clone(&self) -> CpuMaterial
fn clone(&self) -> CpuMaterial
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for CpuMaterial
impl Debug for CpuMaterial
Auto Trait Implementations
impl RefUnwindSafe for CpuMaterial
impl Send for CpuMaterial
impl Sync for CpuMaterial
impl Unpin for CpuMaterial
impl UnwindSafe for CpuMaterial
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more