Expand description
Allocation-free convex clipping shared by the PS1 renderers.
This module owns Sutherland-Hodgman traversal and buffer order. Each renderer supplies a monomorphized plane adapter for its distance domain, fixed-point interpolation and attribute rounding. The adapters are an A/B bridge: once baseline equivalence is proven, all three games can be moved deliberately to one measured numeric policy.
Structs§
- Clip
Overflow destinationfilled before the clip finished. The vertices written so far are not a usable polygon.
Enums§
- Clip
Traversal - Cyclic traversal order for one clip plane.
Traits§
- Attributed
Clip Plane - Renderer-specific policy for one attributed clip plane.
Functions§
- clip_
convex_ ⚠plane Deprecated - Clip one convex attributed polygon against one half-space.
- clip_
convex_ ⚠plane_ uninit Deprecated clip_convex_planeinto uninitialised scratch. The first returned-count entries ofdestinationare initialised on return.- clip_
to_ plane - Clip one attributed polygon against one half-space into
destination, returning how many vertices it wrote. - clip_
to_ ⚠plane_ unchecked clip_to_planewithout the bounds check on each write, for fixed scratch whose size is proven.- clip_
to_ plane_ uninit clip_to_planeinto uninitialised scratch, so console renderers can keep stack or scratchpad scratch asMaybeUninitand pay only for the vertices clipping emits. OnOk(n)the firstnentries are initialised.- clip_
to_ ⚠plane_ uninit_ unchecked clip_to_plane_uninitwithout the bounds check on each write. The first returned-count entries ofdestinationare initialised.- crossing_
fraction_ q12_ i32 - Q12 fraction for a crossing whose signed endpoint distances straddle zero.
- crossing_
fraction_ q16_ i32 - Exact Q16 crossing fraction of an edge from its two signed plane distances.
- lerp_
q12_ i32 - Bounded Q12 interpolation with truncation toward the lower fixed point.
- lerp_
q12_ i32_ rounded - Bounded Q12 interpolation rounded to nearest, matching Quake-PSX’s cached-depth near clip.
- lerp_
q12_ i32_ wide - Overflow-safe form of
lerp_q12_i32for large screen-space coordinates. - lerp_
q16_ i32_ exact - Exact
first + (second - first) * fraction / 65536, truncating toward negative infinity like a shift, in 32-bit operations. - ratio_
q12_ i32 - Overflow-safe non-negative Q12 ratio, clamped to one.