Function addToScene
-
addToScene(
scene: SceneContext,
entity:
| Camera
| Mesh
| SceneNode
| LightBase
| ShadowGenerator
| AssetContainer,
): voidParameters
- scene: SceneContext
The owning scene (pillar 4b: entities never reference the scene themselves).
- entity: Camera | Mesh | SceneNode | LightBase | ShadowGenerator | AssetContainer
The entity (or asset container) to add.
Returns void
Throws
When
entityis a mesh that was already disposed —removeFromScene(ordisposeScene) releases a mesh's claim on its GPU resources when it leaves its LAST scene, and calling the publicdisposeMeshGpu(mesh)yourself does the same. A disposed mesh is retired for good; create a new mesh instead of re-adding it. The mesh itself is rejected before any scene state is touched; when adding a hierarchy or asset container, entities processed before the offending mesh stay added. - scene: SceneContext
Adds an entity (mesh, light, camera, transform node, shadow generator, or asset container) to the scene, dispatching on its type. Asset containers are unpacked and each contained entity added recursively. Optional scene-hosted systems such as depth-hosted sprites expose their own opt-in add functions so mesh-only scenes do not pay feature-specific routing bytes here.