A BSP world's face lightmaps packed into pages of luxels, row by row, tallest first. A
face's place is page_size luxels wide per slot; a page holds slots slots side by
side (the most light styles any face has, at most four), slot k holding each face's
lightmap for its k-th style, so a page is page_size * slots luxels wide and as tall
as its rows need.
Summary
Functions
Packs every lit face of bsp.
The page face index is on, or nil for an unlit face.
Face face's light styles as four numbers, 255 where it has none.
One RGBA texture per page, filled from bsp's lightmap samples.
Lightmap coordinates on its page for texture place {s, t} of face index.
Types
@type place() :: {page :: non_neg_integer(), x :: non_neg_integer(), y :: non_neg_integer(), pos_integer(), pos_integer()}
@type t() :: %CauldronGPU.Bsp.Atlas{ heights: tuple(), page_size: pos_integer(), places: %{required(non_neg_integer()) => place()}, slots: 1..4 }
Functions
@spec pack(Cauldron3D.Bsp.t(), pos_integer()) :: t()
Packs every lit face of bsp.
@spec page(t(), non_neg_integer()) :: non_neg_integer() | nil
The page face index is on, or nil for an unlit face.
@spec styles(Cauldron3D.Bsp.Face.t()) :: [0..255]
Face face's light styles as four numbers, 255 where it has none.
@spec textures(t(), Cauldron3D.Bsp.t()) :: [CauldronGPU.Texture.t()]
One RGBA texture per page, filled from bsp's lightmap samples.
@spec uv(t(), non_neg_integer(), Cauldron3D.Bsp.Face.t(), number(), number()) :: {float(), float()}
Lightmap coordinates on its page for texture place {s, t} of face index.