Struct SourceMetadata¶
Defined in File resource_database.h
Struct Documentation¶
-
struct SourceMetadata¶
Complete metadata for a resource, used by loaders and the registry.
SourceMetadata contains everything a loader needs to load a resource:
Resource identity (resource_id, type)
Source location (source path, format)
Dependencies (other resources this depends on)
Format-specific metadata (texture dimensions, composite children, etc.)
The database populates this during filesystem scanning and loaders can enrich it with additional metadata (e.g., GltfLoader adds CompositeMetadata with children).
Usage Example:
// Database provides metadata auto meta = database.find(STRING_ID("textures/albedo.png")).value(); // meta.type == ResourceType::Texture // meta.format == SourceFormat::Image // meta.source == STRING_ID("textures/albedo.png") // std::get<TextureMetadata>(meta.meta) contains dimensions and format // Loader uses metadata to load auto source = database.create_source(meta.resource_id, meta); auto resource = loader.load(meta, *source);
See also
ResourceDatabase::find() for querying metadata
See also
ResourceLoader::load() for how loaders consume metadata
See also
LoaderFactory::enrich_metadata() for metadata enrichment
Public Functions
-
void archive(ArchiveObject &archive) const¶
Public Members
-
StringId resource_id = INVALID_STRING_ID¶
-
ResourceType type = ResourceType::Unknown¶
-
StringId source = INVALID_STRING_ID¶
-
SourceFormat format = SourceFormat::Unknown¶
-
StringId full_source_path = INVALID_STRING_ID¶
-
std::variant<TextureMetadata, CompositeMetadata, MaterialMetadata, EmptyMeta, FontMetadata> meta = EmptyMeta{}¶
Format-specific metadata variant.
Contains additional metadata specific to the resource type:
TextureMetadata: HDR flag, dimensions, format
CompositeMetadata: Child resources for GLTF files
MaterialMetadata: Shader reference
EmptyMeta: No additional metadata needed
Public Static Functions
-
static SourceMetadata dearchive(ArchiveObject &archive)¶