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 volumetric(alpha: u8) -> Self
pub fn volumetric(alpha: u8) -> Self
A BlendMode::Volumetric (Beer–Lambert) material whose alpha is
the per-voxel-unit absorption — opacity accrues with the ray’s path
length through filled volumes (smoke/fog/murky water).
Sourcepub fn is_opaque(self) -> bool
pub fn is_opaque(self) -> bool
True for BlendMode::Opaque — the first-hit, fully-occluding path.