Struct three_d::renderer::material::ColorMaterial
source · pub struct ColorMaterial {
pub color: Srgba,
pub texture: Option<Texture2DRef>,
pub render_states: RenderStates,
pub is_transparent: bool,
}
Expand description
A material that renders a Geometry in a color defined by multiplying a color with an optional texture and optional per vertex colors. This material is not affected by lights.
Fields§
§color: Srgba
Base surface color.
texture: Option<Texture2DRef>
An optional texture which is samples using uv coordinates (requires that the Geometry supports uv coordinates).
The colors are assumed to be in linear sRGB (RgbU8
), linear sRGB with an alpha channel (RgbaU8
) or HDR color space.
render_states: RenderStates
Render states.
is_transparent: bool
Whether this material should be treated as a transparent material (An object needs to be rendered differently depending on whether it is transparent or opaque).
Implementations§
source§impl ColorMaterial
impl ColorMaterial
sourcepub fn new(context: &Context, cpu_material: &CpuMaterial) -> Self
pub fn new(context: &Context, cpu_material: &CpuMaterial) -> Self
Constructs a new color material from a CpuMaterial. Tries to infer whether this material is transparent or opaque from the alpha value of the albedo color and the alpha values in the albedo texture. Since this is not always correct, it is preferred to use ColorMaterial::new_opaque or ColorMaterial::new_transparent.
sourcepub fn new_opaque(context: &Context, cpu_material: &CpuMaterial) -> Self
pub fn new_opaque(context: &Context, cpu_material: &CpuMaterial) -> Self
Constructs a new opaque color material from a CpuMaterial.
sourcepub fn new_transparent(context: &Context, cpu_material: &CpuMaterial) -> Self
pub fn new_transparent(context: &Context, cpu_material: &CpuMaterial) -> Self
Constructs a new transparent color material from a CpuMaterial.
sourcepub fn from_physical_material(physical_material: &PhysicalMaterial) -> Self
pub fn from_physical_material(physical_material: &PhysicalMaterial) -> Self
Creates a color material from a PhysicalMaterial.
Trait Implementations§
source§impl Clone for ColorMaterial
impl Clone for ColorMaterial
source§fn clone(&self) -> ColorMaterial
fn clone(&self) -> ColorMaterial
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more