Skip to main content

Module decal

Module decal 

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

DecalRecord
Per-decal data the renderer consumes each frame. Built once at GraphicsSystem init from the world’s Decal components.

Functions§

build_decal_records
Resolve a list of Decal components into DecalRecords 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 model matrix for a decal: T(position) * R_yxz * S(size). Column-major; the inner index is the row. Matches the rotation convention used by Prop::model_matrix.
invert_decal_model
Invert an affine TRS matrix of the form built by decal_model_matrix. The 3×3 linear part is R * diag(size); its inverse is diag(1/size) * R_transpose. The translation flips into the inverted frame: -inv_linear * translation.