Nodes Overview
Nodes Overview
In Flowscape, nodes are the core scene entities.
A node is not just a draw command. It is a stable object with:
- identity (
id,type) - transform state
- hierarchy links (parent/children)
- bounds and hit-test methods
- serialization behavior
Why nodes (and not raw draw calls)
Node model is better for editor products because it gives:
- stable references for selection/history/tools
- reusable hierarchy math (parent-child transforms)
- predictable querying (
hitTest, bounds methods) - persistence (
toJSON) without rebuilding whole state manually
Methods that are often confusing
| Method | What it means in practice |
|---|---|
setDirty() | Rebuild transform cache for node + descendants, and hierarchy bounds upward. Use after transform/size changes. |
setHierarchyBoundsDirty() | Rebuild only hierarchy bounds cache. Use when geometry/visibility changed but transform did not. |
getWorldMatrix() | Final matrix after parent chain composition. |
getWorldCorners() | 4 transformed corners (clockwise from top-left), base for OBB/AABB computations. |
getWorldOBB() | Rotated world bounds preserving object orientation. |
getWorldAABB() | Axis-aligned world bounds enclosing node. |
getPivot() | Returns local normalized transform anchor (0..1 range per axis). |
getHierarchyWorldOBB() | Rotated bounds for node + all descendants. |
getHierarchyWorldAABB() | Axis-aligned bounds for node + all descendants. |
hitTest(worldPoint) | World-space pick test against node geometry. |
traverse(callback) | Recursive hierarchy walk from this node downward. |
toJSON() | Serialize node state into JSON-compatible object. |
Live Preview
Deep Dives
What Is OBB01
Oriented bounds: rotated box in world space, built from node world corners.
What Is AABB02
Axis-aligned bounds: fast spatial box for selection, culling, and queries.
What Is Pivot03
Transform anchor: point used as the center for rotation and scale behavior.