![]() |
Lysa Nodes
0.0
Lysa Nodes — Scene Graph for the Lysa Engine
|
Loader::load lysa::nodes::Loader is the centralized asset loading gateway for Lysa Nodes.
For a .assets file the call is a single line:
Loader::load internally calls AssetsPack::load<Node, MeshInstance, AnimationPlayer> with the library's own concrete types. The function returns a std::shared_ptr<Node> pointing to the synthetic root that wraps the entire imported hierarchy.
addChild(assetRoot) attaches the entire subtree to the scene tree. Every MeshInstance descendant is registered with the renderer immediately (because the scene tree is already attached to a render target by the time addChild is called for the asset; see the constructor order in Scene tree).
Loader::loadAsync runs the load on a background thread and invokes a callback on the main thread at the start of the next frame:
For assets that take perceptible time to load (large mesh packs, high-res textures), loadAsync is the recommended approach: the application remains responsive while the GPU upload happens in the background.
Both load and loadAsync accept a useCache = true flag. When caching is enabled the loaded root is stored in a global map keyed by URI, and subsequent calls with the same URI return the cached instance without re-reading the file. Loader::clearCache() drops all cached roots.
Node::duplicate() before mutating it when independent instances are needed.Next : Lights and environment