pub struct Material {
pub alpha: u8,
pub mode: BlendMode,
}Expand description
One material: an opacity and a blend mode, indexed out of a
MaterialTable by a per-voxel material id.
Fields§
§alpha: u8Opacity for BlendMode::AlphaBlend / intensity scale for
BlendMode::Additive; ignored for BlendMode::Opaque.
0 = fully transparent, 255 = fully opaque / full intensity.
mode: BlendModeHow the voxel composites with what is behind it.
Implementations§
Source§impl Material
impl Material
Sourcepub const OPAQUE: Self
pub const OPAQUE: Self
The reserved, fully-opaque material at table id 0 — the
back-compat default for every voxel without explicit material data.
Sourcepub fn alpha_blend(alpha: u8) -> Self
pub fn alpha_blend(alpha: u8) -> Self
An BlendMode::AlphaBlend material with opacity alpha.
Sourcepub fn additive(alpha: u8) -> Self
pub fn additive(alpha: u8) -> Self
An BlendMode::Additive glow material scaled by alpha.
Sourcepub fn is_opaque(self) -> bool
pub fn is_opaque(self) -> bool
True for BlendMode::Opaque — the first-hit, fully-occluding path.
Trait Implementations§
impl Copy for Material
impl Eq for Material
impl StructuralPartialEq for Material
Auto Trait Implementations§
impl Freeze for Material
impl RefUnwindSafe for Material
impl Send for Material
impl Sync for Material
impl Unpin for Material
impl UnsafeUnpin for Material
impl UnwindSafe for Material
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
Mutably borrows from an owned value. Read more