# `CauldronGPU.Instance`
[🔗](https://github.com/jaman/cauldron/blob/v0.3.3/cauldron_gpu/lib/cauldron_gpu/instance.ex#L1)

A mesh placed in the scene with one material per mesh part (the last material serves
any further parts). `hidden` instances are kept but not drawn; `shadows: false` keeps
an instance out of the shadow map; `snap: true` places it without interpolating from
its previous tick.

`in_front: true` draws the instance over the rest of the scene, as a held weapon is: it
is hidden only by itself and by surfaces closer than about the camera's near distance,
casts no shadow and is not seen by rays.

`shading` lights the instance by a fixed rule in place of the scene's lights and its
materials' lightmaps: `{ambient, directional, direction}`, two `{r, g, b}` and a unit
direction towards the light, give `ambient + directional * dot(normal, direction)`,
never below zero, as baked light.

`depth_test: false` draws the instance over everything before it, after the opaque scene,
farthest instance first, and hides nothing. `swell`, `{width, height, speed}`, pushes
each vertex out along its normal by `height * sin(u * width + seconds * speed)`, `u` its
texture coordinate (a bulging shell).

`standing`, `{floor, ceiling}` heights in the renderer's frame, is for a thing standing
in a room: floors seen from above at or below `floor` and ceilings seen from below at or
above `ceiling` (surfaces within 45 degrees of level) do not hide it, so it shows whole
where it sinks into its own floor or reaches into its own ceiling; every other nearer
surface hides it as usual. It
is drawn after the opaque scene, farthest instance first, and casts no shadow.

# `rgb`

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

# `t`

```elixir
@type t() :: %CauldronGPU.Instance{
  depth_test: boolean(),
  hidden: boolean(),
  in_front: boolean(),
  materials: [CauldronGPU.Handle.t()],
  mesh: CauldronGPU.Handle.t(),
  shading: {rgb(), rgb(), {number(), number(), number()}} | nil,
  shadows: boolean(),
  snap: boolean(),
  standing: {number(), number()} | nil,
  swell: {number(), number(), number()} | nil,
  transform: CauldronGPU.Transform.t()
}
```

---

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