Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

Module attributed_clip

Module attributed_clip 

Source
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§

ClipOverflow
destination filled before the clip finished. The vertices written so far are not a usable polygon.

Enums§

ClipTraversal
Cyclic traversal order for one clip plane.

Traits§

AttributedClipPlane
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_plane into uninitialised scratch. The first returned-count entries of destination are 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_plane without the bounds check on each write, for fixed scratch whose size is proven.
clip_to_plane_uninit
clip_to_plane into uninitialised scratch, so console renderers can keep stack or scratchpad scratch as MaybeUninit and pay only for the vertices clipping emits. On Ok(n) the first n entries are initialised.
clip_to_plane_uninit_unchecked⚠
clip_to_plane_uninit without the bounds check on each write. The first returned-count entries of destination are 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_i32 for 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.