pub struct SurfaceStyle3d { /* private fields */ }Expand description
Validated surface tint, alpha policy and projected face visibility.
Blend objects are sorted back-to-front by transformed model-bounds-center
camera-forward distance, with insertion-order ties. This does not solve
intersecting/cyclic overlap or triangle ordering inside one mesh. Blend
surfaces do not occlude mathematical hidden-line edges; edges render last.
Positive-scale transforms preserve source orientation; reflections are not
accepted by Transform3d. Lighting and fog are explicit opt-ins; no physically
based glass, shadows or automatic normals are implied.
Implementations§
Source§impl SurfaceStyle3d
impl SurfaceStyle3d
Sourcepub fn opaque(color: Color) -> Result<Self, Mesh3dStyleError>
pub fn opaque(color: Color) -> Result<Self, Mesh3dStyleError>
Creates the legacy normalized opaque tint, rejecting alpha other than one. Vertex/texture alpha is ignored by this surface mode, with depth writes.
Sourcepub fn mask(color: Color, cutoff: f32) -> Result<Self, Mesh3dStyleError>
pub fn mask(color: Color, cutoff: f32) -> Result<Self, Mesh3dStyleError>
Creates alpha-cutout coverage with a cutoff that is zero or a normal finite value in 0..=1.
Combined surface/vertex/texture/material alpha below cutoff is discarded;
equality survives and writes alpha one/depth. Filtering happens before
the comparison; no alpha-to-coverage or automatic coverage preservation.
Sourcepub fn blend(color: Color) -> Result<Self, Mesh3dStyleError>
pub fn blend(color: Color) -> Result<Self, Mesh3dStyleError>
Creates normalized straight-linear RGBA blending with depth-test/no-write. Combined alpha zero produces no color coverage and never writes depth.
Sourcepub const fn with_sidedness(self, sidedness: SurfaceSidedness3d) -> Self
pub const fn with_sidedness(self, sidedness: SurfaceSidedness3d) -> Self
Selects projected face culling without changing mathematical display edges.
Sourcepub const fn with_lighting(self, lighting: SurfaceLighting3d) -> Self
pub const fn with_lighting(self, lighting: SurfaceLighting3d) -> Self
Selects RGB illumination. Lambert requires application-supplied model normals. Two-sided back-facing fragments reverse the interpolated shading normal.
Sourcepub const fn lighting(self) -> SurfaceLighting3d
pub const fn lighting(self) -> SurfaceLighting3d
Returns illumination policy; Unlit is the default and bypasses normal math.
Sourcepub const fn with_fog(self, enabled: bool) -> Self
pub const fn with_fog(self, enabled: bool) -> Self
Selects scene fog participation independently of lighting; disabled by default.
Sourcepub const fn fog_enabled(self) -> bool
pub const fn fog_enabled(self) -> bool
Returns explicit participation in optional scene fog.
Sourcepub const fn color(self) -> Color
pub const fn color(self) -> Color
Returns the normalized straight-linear multiplicative RGBA tint.
Sourcepub const fn alpha_mode(self) -> SurfaceAlphaMode3d
pub const fn alpha_mode(self) -> SurfaceAlphaMode3d
Returns the surface coverage/depth mode.
Sourcepub const fn mask_cutoff(self) -> Option<f32>
pub const fn mask_cutoff(self) -> Option<f32>
Returns the alpha cutoff only for masked surfaces.
Sourcepub const fn sidedness(self) -> SurfaceSidedness3d
pub const fn sidedness(self) -> SurfaceSidedness3d
Returns viewer-relative face visibility; defaults to both sides.