# `CauldronGPU.Sectors.Surfaces`
[🔗](https://github.com/jaman/cauldron/blob/v0.3.3/cauldron_gpu/lib/cauldron_gpu/sectors/surfaces.ex#L2)

Convex polygons gathered into one `CauldronGPU.Mesh`, one part per material key.

A surface is `{key, corners}`: `key` names its material (any term), `corners` are at
least three `{position, normal, uv, light}` in counter-clockwise order seen from the
side they face, positions and normals in map coordinates (+Z up) and `light` a sector
light level `0..255`, read through `CauldronGPU.Sectors.Light.uv/1`.

    {mesh, keys} = CauldronGPU.Sectors.Surfaces.mesh(surfaces)

`keys` lists the material key of each part, in part order.

# `corner`

```elixir
@type corner() :: {vec3(), vec3(), {number(), number()}, integer()}
```

# `surface`

```elixir
@type surface() :: {term(), [corner()]}
```

# `vec3`

```elixir
@type vec3() :: {number(), number(), number()}
```

# `mesh`

```elixir
@spec mesh([surface()]) :: {CauldronGPU.Mesh.t(), [term()]}
```

The mesh holding `surfaces` and the material key of each of its parts.

---

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