# `CauldronGPU.Bsp.Atlas`
[🔗](https://github.com/jaman/cauldron/blob/v0.3.3/cauldron_gpu/lib/cauldron_gpu/bsp/atlas.ex#L2)

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.

# `place`

```elixir
@type place() ::
  {page :: non_neg_integer(), x :: non_neg_integer(), y :: non_neg_integer(),
   pos_integer(), pos_integer()}
```

# `t`

```elixir
@type t() :: %CauldronGPU.Bsp.Atlas{
  heights: tuple(),
  page_size: pos_integer(),
  places: %{required(non_neg_integer()) =&gt; place()},
  slots: 1..4
}
```

# `pack`

```elixir
@spec pack(Cauldron3D.Bsp.t(), pos_integer()) :: t()
```

Packs every lit face of `bsp`.

# `page`

```elixir
@spec page(t(), non_neg_integer()) :: non_neg_integer() | nil
```

The page face `index` is on, or `nil` for an unlit face.

# `styles`

```elixir
@spec styles(Cauldron3D.Bsp.Face.t()) :: [0..255]
```

Face `face`'s light styles as four numbers, 255 where it has none.

# `textures`

```elixir
@spec textures(t(), Cauldron3D.Bsp.t()) :: [CauldronGPU.Texture.t()]
```

One RGBA texture per page, filled from `bsp`'s lightmap samples.

# `uv`

```elixir
@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`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
