# `Cauldron3D.Bsp.Face`
[🔗](https://github.com/jaman/cauldron/blob/v0.2.2/cauldron_3d/lib/cauldron_3d/bsp/face.ex#L1)

One face of a BSP world: a convex polygon on a plane, painted with a texture and lit
by a lightmap.

  * `plane` — the plane index; `back?` true when the face looks along the plane's back
  * `points` — the corners, in order
  * `texture` — the texture index
  * `s`, `t` — `{axis, offset}`: a point's place on the texture is
    `Vec.dot(point, axis) + offset` across and down
  * `mins`, `extents` — `{s, t}`: where the lightmap starts on the texture and how far
    it reaches, multiples of `luxel`
  * `lightmap` — the byte offset of the face's samples in the world's lightmaps, or
    `nil` for an unlit face
  * `styles` — up to four light style numbers, one lightmap of
    `(div(s_extent, luxel) + 1) * (div(t_extent, luxel) + 1)` samples each, in order
  * `luxel` — how many texture pixels one lightmap sample covers, 16 by default

# `t`

```elixir
@type t() :: %Cauldron3D.Bsp.Face{
  back?: boolean(),
  extents: {non_neg_integer(), non_neg_integer()},
  lightmap: non_neg_integer() | nil,
  luxel: pos_integer(),
  mins: {integer(), integer()},
  plane: non_neg_integer(),
  points: [Cauldron3D.Vec.t()],
  s: {Cauldron3D.Vec.t(), float()},
  styles: [non_neg_integer()],
  t: {Cauldron3D.Vec.t(), float()},
  texture: non_neg_integer()
}
```

# `centre`

```elixir
@spec centre(t()) :: Cauldron3D.Vec.t()
```

The middle of the face's corners.

# `lightmap_size`

```elixir
@spec lightmap_size(t()) :: {pos_integer(), pos_integer()}
```

The lightmap's size in samples, `{across, down}`.

# `measured`

```elixir
@spec measured(t()) :: t()
```

The face with `mins` and `extents` worked out from its points: the smallest and largest
texture place, out to whole luxels.

# `st`

```elixir
@spec st(t(), Cauldron3D.Vec.t()) :: {float(), float()}
```

Where a point lies on the face's texture, `{s, t}`.

---

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