![]() |
Lysa
0.0
Lysa 3D Engine
|
Centralized loader for scene trees and external resources.
The Loader resolves a file path from an URI and builds a tree of Node instances from supported formats:
The loader optionally caches root nodes to allow fast re-use across the application lifetime. Access is thread-safe via an internal mutex.
Notes:
Classes | |
| struct | SceneNode |
Static Public Member Functions | |
| template<typename T = Node> | |
| static std::shared_ptr< T > | load (const std::string &filepath, bool usecache=false) |
| template<typename T = Node> | |
| static std::shared_ptr< T > | findFirst (const std::string &nodename) |
| static void | clearCache () |
|
static |
Clears the global resources cache.
All previously cached root nodes become eligible for destruction once no other shared references exist.
|
inlinestatic |
Searches all cached resource trees and returns the first node that matches the provided name and type.
| T | Node subtype used for the search and cast. |
| nodename | Name to match against children of cached roots. |
|
inlinestatic |
Loads a JSON, glTF or ZRes file and returns the constructed node tree.
The template parameter allows retrieving the result as a more specific Node-derived type when the file describes such a root. If usecache is true and the path was previously loaded, the cached root is returned.
| filepath | URI to the JSON/glTF/ZRes file |
| usecache | When true, store and re-use the loaded root from a global cache. |