# `Cauldron3D.Mesh`
[🔗](https://github.com/jaman/cauldron/blob/v0.2.2/cauldron_3d/lib/cauldron_3d/mesh.ex#L1)

A model made of textured triangles, posed by keyframes.

  * `frames` — a tuple of `%{vertices: tuple of Vec, normals: tuple of Vec}`, every
    frame with the same vertices in the same order
  * `triangles` — a list of `{{i0, i1, i2}, {uv0, uv1, uv2}}`: three vertex indices and
    where each corner lies on the skin, in its pixels
  * `skins` — a list of `Cauldron3D.Texture`

The model's own axes are `x` forward, `y` left and `z` up; placed in the world it is
turned by `yaw`, `pitch` and `roll` as `Cauldron3D.Camera` turns.

    Cauldron3D.Mesh.polygons(mesh, frame: 3, origin: {64.0, 0.0, 24.0}, yaw: 1.2)

# `frame`

```elixir
@type frame() :: %{vertices: tuple(), normals: tuple()}
```

# `t`

```elixir
@type t() :: %Cauldron3D.Mesh{
  frames: tuple(),
  skins: [Cauldron3D.Texture.t()],
  triangles: [
    {{non_neg_integer(), non_neg_integer(), non_neg_integer()}, tuple()}
  ]
}
```

# `polygons`

```elixir
@spec polygons(t(), keyword()) :: [Cauldron3D.Polygon.t()]
```

The mesh's triangles as polygons in the world.

## Options

  * `:frame` — the frame index, or `{from, to, t}` to blend `t` of the way between two
    frames; default 0
  * `:origin`, `:yaw`, `:pitch`, `:roll` — where it stands and how it is turned
  * `:scale` — a number, default 1.0
  * `:skin` — the skin index, default 0
  * `:light` — a number (0 to 255) for even light, or `{ambient, directional, toward}`:
    each vertex lit `ambient` plus `directional` times how squarely its normal faces
    the direction `toward`; default 128
  * `:cull`, `:clear`, `:depth` — as `Cauldron3D.Polygon`'s, default `:none`, `nil`
    and `:test`

---

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