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

A node in a transform hierarchy that flattens to a flat `ExRatatui.ThreeD.Scene`.

`ExRatatui.ThreeD.Scene` has no scene graph — every object carries its own
world-space transform. `Node` lets an application express an articulated model
as a tree of local transforms and bake it into world-space objects each frame.

## Fields

  * `:transform` - the node's local frame, relative to its parent
  * `:visual` - an optional `ExRatatui.ThreeD.Object` rendered at this node; the
    object's own transform is treated as a local offset/scale within the frame
  * `:children` - child nodes

## Composition contract

Frames compose via `ExRatatui.ThreeD.Transform.compose/2`. Keep intermediate
nodes **rigid** (`scale: {1.0, 1.0, 1.0}`) and put scale only on leaf `visual`
objects; then every baked object is exactly one `Transform` (no shear).

## Examples

    iex> alias ExRatatui.ThreeD.{Node, Object, Mesh}
    iex> tree = %Node{visual: %Object{mesh: Mesh.cube()}}
    iex> length(ExRatatui.ThreeD.Node.flatten(tree))
    1

# `t`

```elixir
@type t() :: %ExRatatui.ThreeD.Node{
  children: [t()],
  transform: ExRatatui.ThreeD.Transform.t(),
  visual: ExRatatui.ThreeD.Object.t() | nil
}
```

# `flatten`

```elixir
@spec flatten(t()) :: [ExRatatui.ThreeD.Object.t()]
```

Flatten the tree into a list of world-space `ExRatatui.ThreeD.Object`s.

# `to_scene`

```elixir
@spec to_scene(
  t(),
  keyword()
) :: ExRatatui.ThreeD.Scene.t()
```

Flatten the tree and wrap it in a `Scene`.

Options: `:lights`, `:background`, `:sky` (passed straight to the `Scene`).

---

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