# `ExRatatui.ThreeD.Light`
[🔗](https://github.com/mcass19/ex_ratatui/blob/v0.13.0/lib/ex_ratatui/three_d/light.ex#L1)

A light source: ambient, directional, or point.

## Fields

  * `:type` - `:ambient`, `:directional`, or `:point`
  * `:color` - `{r, g, b}` color, channels 0-255
  * `:intensity` - scalar brightness (defaults to `1.0`)
  * `:direction` - `{x, y, z}` direction toward the light (only for `:directional`)
  * `:position` - `{x, y, z}` world position (only for `:point`)

Prefer the constructors over building the struct by hand.

## Examples

    iex> light = ExRatatui.ThreeD.Light.ambient({255, 255, 255}, 0.15)
    iex> {light.type, light.color, light.intensity}
    {:ambient, {255, 255, 255}, 0.15}

    iex> light = ExRatatui.ThreeD.Light.directional({-1.0, -1.0, -1.0}, {255, 255, 255})
    iex> {light.type, light.direction, light.intensity}
    {:directional, {-1.0, -1.0, -1.0}, 1.0}

    iex> light = ExRatatui.ThreeD.Light.point({2.0, 3.0, 2.0}, {255, 220, 180})
    iex> {light.type, light.position}
    {:point, {2.0, 3.0, 2.0}}

# `kind`

```elixir
@type kind() :: :ambient | :directional | :point
```

# `rgb`

```elixir
@type rgb() :: {0..255, 0..255, 0..255}
```

# `t`

```elixir
@type t() :: %ExRatatui.ThreeD.Light{
  color: rgb(),
  direction: vec3() | nil,
  intensity: float(),
  position: vec3() | nil,
  type: kind()
}
```

# `vec3`

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

# `ambient`

```elixir
@spec ambient(rgb(), number()) :: t()
```

Constant ambient illumination.

# `directional`

```elixir
@spec directional(vec3(), rgb(), keyword()) :: t()
```

A directional light. `direction` points toward the light source.

Options: `:intensity` (defaults to `1.0`).

# `point`

```elixir
@spec point(vec3(), rgb(), keyword()) :: t()
```

A point light at `position`.

Options: `:intensity` (defaults to `1.0`).

---

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