# `Cauldron3D.Formats.Spr`
[🔗](https://github.com/jaman/cauldron/blob/v0.2.2/cauldron_3d_formats/lib/cauldron_3d/formats/spr.ex#L1)

A sprite, `.spr`: flat pictures that face the viewer, Quake's (version 1) or
Half-Life's (version 2, with its own palette and a `format` for how it is drawn).

    {:ok, sprite} = Cauldron3D.Formats.Spr.parse(bytes)

`frames` is a tuple of `{:single, picture}` or `{:group, [{picture, until}]}`, each
picture `%{texture: Cauldron3D.Texture.t(), origin: {x, y}}`, the origin being the
pixel that sits on the entity. Colour 255 is see-through.

# `t`

```elixir
@type t() :: %Cauldron3D.Formats.Spr{
  format: term(),
  frames: term(),
  kind: term(),
  maxs: term(),
  mins: term()
}
```

# `parse`

```elixir
@spec parse(binary()) :: {:ok, t()} | {:error, :not_a_sprite}
```

The sprite in `data`.

# `picture`

```elixir
@spec picture(t(), integer(), number()) :: map()
```

The picture of frame number `frame` at `time` seconds.

# `pictures`

```elixir
@spec pictures(t()) :: [map()]
```

Every frame's picture, groups opened up, in order.

# `rgba`

```elixir
@spec rgba(t(), Cauldron3D.Texture.t(), binary() | nil) :: Cauldron3D.Texture.t()
```

A frame's picture as an RGBA texture by the sprite's format: `:normal` and `:additive`
opaque, `:alpha_test` see-through at colour 255, `:index_alpha` the palette's last
colour with each pixel's index as its alpha.

---

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