pub struct Occluder {
pub kind: OccluderKind,
pub center: Vector3D,
pub extent: Vector3D,
pub vertices: [Vector3D; 3],
/* private fields */
}Expand description
A ray-traceable geometric surface with an attached material.
Fields§
§kind: OccluderKindThe geometric shape represented by this occluder.
center: Vector3DFor spheres: the center. For AABBs: the minimum corner. Unused by
triangles, whose vertices live in vertices.
extent: Vector3DFor spheres: .x is the radius. For AABBs: the maximum corner.
Unused by triangles, whose vertices live in vertices.
vertices: [Vector3D; 3]For triangles: the three corners in winding order. Unused by spheres
and AABBs, which are fully described by center and extent.
Implementations§
Source§impl Occluder
Implements factory constructors for Occluder.
impl Occluder
Implements factory constructors for Occluder.
Sourcepub fn triangle(
v0: Vector3D,
v1: Vector3D,
v2: Vector3D,
material: Material,
) -> Occluder
pub fn triangle( v0: Vector3D, v1: Vector3D, v2: Vector3D, material: Material, ) -> Occluder
Creates a triangular occluder from its three vertices.
The vertex order fixes the geometric winding; because the intersection test is two-sided the winding does not affect which faces produce hits, only the raw cross-product normal before it is oriented against the incoming ray.
§Arguments
Vector3D- The first triangle vertex.Vector3D- The second triangle vertex.Vector3D- The third triangle vertex.Material- The surface material.
§Returns
Occluder- The new triangle occluder.
Sourcepub fn occluder_points(&self) -> Vec<(Vector3D, f64)>
pub fn occluder_points(&self) -> Vec<(Vector3D, f64)>
Returns a list of (center, radius) sphere tuples approximating
this occluder, suitable for soft_shadow_factor.
For sphere occluders this returns (center, radius). For AABB
occluders the bounding sphere is computed conservatively from the
AABB extents.
§Returns
Vec<(Vector3D, f64)>- One bounding sphere per occluder.