API

Function addToScene

  • 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.

    Parameters

    Returns void

    When entity is a mesh that was already disposed — removeFromScene (or disposeScene) releases a mesh's claim on its GPU resources when it leaves its LAST scene, and calling the public disposeMeshGpu(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.