CauldronGPU.Sectors.Live.Lightmap (CauldronGPU v0.3.3)

Copy Markdown View Source

Every sector's light level as a lightmap, for a CauldronGPU.Sectors.Live.LightTable to turn into light: a texture three texels wide and one row per sector, the row's texels the sector's light level with -16, 0 and 16 added (a wall's contrast), each written as (level + 0.5) / 256 with the level clamped to 0..255, the column of the light table that level reads.

texture = CauldronGPU.Sectors.Live.Lightmap.texture([160, 255], 0, nil)
CauldronGPU.Sectors.Live.Lightmap.uv({1, 16}, 2)

extra is light added to every level; a fixed light table other than nil writes every texel as full light, 1.0.

Summary

Functions

The value light level is written as: the light table column it reads.

The lightmap of sectors whose light levels are levels, in sector order.

The lightmap coordinates of {sector, contrast} in a lightmap of count sectors.

Functions

code(level, fixed)

@spec code(integer(), non_neg_integer() | nil) :: float()

The value light level is written as: the light table column it reads.

texture(levels, extra, fixed)

@spec texture([integer()], integer(), non_neg_integer() | nil) ::
  CauldronGPU.Texture.t()

The lightmap of sectors whose light levels are levels, in sector order.

uv(arg, count)

@spec uv({non_neg_integer(), integer()}, pos_integer()) :: {float(), float()}

The lightmap coordinates of {sector, contrast} in a lightmap of count sectors.