Expand description
Backend-agnostic decal helpers. Owns the per-decal model / inverse-model
matrix math the projected-decal pass needs at runtime, plus the DecalRecord
the backends consume. Decals are stamped onto the scene depth buffer by
drawing a unit-box volume per decal: the fragment shader reconstructs the
world-space point of each rasterised pixel from depth and tests whether it
lies inside the box.
Structs§
- Decal
Record - Per-decal data the renderer consumes each frame. Built once at
GraphicsSysteminit from the world’sDecalcomponents.
Functions§
- build_
decal_ records - Resolve a list of
Decalcomponents intoDecalRecords the backend can consume. Skips decals whose texture reference is missing, invisible decals, and decals whose size is degenerate (any non-positive component). - decal_
model_ matrix - Build the world-space
modelmatrix for a decal:T(position) * R_yxz * S(size). Column-major; the inner index is the row. Matches the rotation convention used byProp::model_matrix. - invert_
decal_ model - Invert an affine TRS matrix of the form built by
decal_model_matrix. The 3×3 linear part isR * diag(size); its inverse isdiag(1/size) * R_transpose. The translation flips into the inverted frame:-inv_linear * translation.