Class SceneLoader¶
Defined in File scene_loader.h
Inheritance Relationships¶
Base Type¶
public portal::resources::ResourceLoader(Class ResourceLoader)
Class Documentation¶
-
class SceneLoader : public portal::resources::ResourceLoader¶
Public Functions
-
explicit SceneLoader(ResourceRegistry ®istry)¶
-
virtual ResourceData load(const SourceMetadata &meta, Reference<ResourceSource> source) override¶
Load a resource from source data.
This method blocks the calling thread (job system worker) until the resource is fully loaded and ready for use. It reads bytes from the source, decodes the format, creates GPU resources if needed, and returns a Reference to the loaded resource.
If the resource depends on other resources, the loader can request them from the registry. The registry will handle scheduling those loads appropriately.
Error Handling: If loading fails (corrupt data, unsupported format, out of memory, etc.), the loader should log the error and return nullptr. The registry will move the resource to ResourceState::Error.
Note
The returned resource is managed by Reference (std::shared_ptr)
Note
Implementations should be thread-safe for reading from the source
- Parameters:
meta – Metadata about the resource (type, format, dependencies, etc.)
source – Abstraction for reading the source bytes (file, memory, etc.)
- Returns:
ResourceData if successful, nullptr on error
-
virtual void save(ResourceData &resource_data) override¶
Saves a resource to a source.
This method blocks the calling thread until the save operation is complete.
This method will fetch the resource’s dirty state and will update the source (if supported) based on it.
- Parameters:
resource_data – The resource to save
-
virtual void load_snapshot(const ResourceData &resource_data, Reference<ResourceSource> snapshot_source) override¶
-
virtual void snapshot(const ResourceData &resource_data, Reference<ResourceSource> snapshot_source) override¶
Protected Functions
-
void dearchive_scene(const Reference<Scene> &scene, ArchiveObject &archive) const¶
-
void deserialize_scene(const Reference<Scene> &scene, Deserializer &deserializer) const¶
-
void load_portal_scene(const Reference<Scene> &scene, const ResourceSource &source) const¶
-
void load_binary_portal_scene(const Reference<Scene> &scene, const ResourceSource &source) const¶
Protected Static Functions
-
static void archive_scene(const Reference<Scene> &scene, ArchiveObject &archive)¶
-
static void serialize_scene(const Reference<Scene> &scene, Serializer &serializer)¶
-
explicit SceneLoader(ResourceRegistry ®istry)¶