Lysa  0.0
Lysa 3D Engine
Loader Class Reference

Detailed Description

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:

  • JSON scene descriptions (engine-specific)
  • glTF scenes
  • ZRes packaged resources

The loader optionally caches root nodes to allow fast re-use across the application lifetime. Access is thread-safe via an internal mutex.

Notes:

  • All entry points are static; the class is used as a singleton-like utility (no instance needed).

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 ()
 

Member Function Documentation

static void clearCache ( )
static

Clears the global resources cache.

All previously cached root nodes become eligible for destruction once no other shared references exist.

static std::shared_ptr<T> findFirst ( const std::string &  nodename)
inlinestatic

Searches all cached resource trees and returns the first node that matches the provided name and type.

Template Parameters
TNode subtype used for the search and cast.
Parameters
nodenameName to match against children of cached roots.
Returns
First matching node, or nullptr if none was found.
static std::shared_ptr<T> load ( const std::string &  filepath,
bool  usecache = false 
)
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.

Template Parameters
TNode subtype to cast the root to (defaults to Node).
Parameters
filepathURI to the JSON/glTF/ZRes file
usecacheWhen true, store and re-use the loaded root from a global cache.
Returns
Shared pointer to the loaded root node (possibly from cache).