Infinity Engine v0.6.20
C++ API Documentation
Loading...
Searching...
No Matches
Infinity::Assets Namespace Reference

Classes

class  Asset
 Type-erased container for loaded asset data. More...
 
struct  AssetLoadInfo
 Encapsulates the information required to load an asset in the Infinity engine. More...
 
class  AssetPlugin
 Abstract base class for source-specific asset loading plugins. More...
 
class  AssetPluginStore
 Central registry and management system for source-specific AssetPlugin instances. More...
 

Typedefs

typedef AssetPlugin *() CreateAssetPluginFunction(void)
 Function signature for creating an AssetPlugin instance.
 
typedef void() DestroyAssetPluginFunction(AssetPlugin *)
 Function signature for destroying an AssetPlugin instance.
 

Enumerations

enum  AssetPluginAPIVer { V1 = 1 }
 Versioning for the AssetPlugin API. More...
 

Functions

INFINITY_API_PUBLIC Asset load (const AssetLoadInfo &loadInfo)
 Loads an asset using the configured loader chain.
 
INFINITY_API_PUBLIC Asset load (const std::string &loader, const AssetLoadInfo &loadInfo)
 Loads an asset using a specific named loader source.
 
INFINITY_API_PUBLIC Asset load (const Infinity::Types::TypeID &type, const std::string &path)
 Loads an asset using the configured loader chain with simplified parameters.
 
INFINITY_API_PUBLIC Asset load (const std::string &loader, const Infinity::Types::TypeID &type, const std::string &path)
 Loads an asset from a specific named source with simplified parameters.
 

Variables

INFINITY_API_PLUGIN CreateAssetPluginFunction CreateAssetPlugin
 Plugin entry point for creating an AssetPlugin instance.
 
INFINITY_API_PLUGIN DestroyAssetPluginFunction DestroyAssetPlugin
 Plugin entry point for destroying an AssetPlugin instance.
 

Typedef Documentation

◆ CreateAssetPluginFunction

Infinity::Assets::CreateAssetPluginFunction

Function signature for creating an AssetPlugin instance.

Plugins must export a function matching this signature to instantiate the plugin object. This allows the engine to dynamically load and create plugin instances at runtime.

Returns
Pointer to a newly created AssetPlugin instance

◆ DestroyAssetPluginFunction

Infinity::Assets::DestroyAssetPluginFunction

Function signature for destroying an AssetPlugin instance.

Plugins must export a function matching this signature to properly clean up the plugin object and free any associated resources.

Parameters
pluginPointer to the AssetPlugin instance to destroy

Enumeration Type Documentation

◆ AssetPluginAPIVer

Versioning for the AssetPlugin API.

Allows plugins to specify which version of the plugin API they implement, enabling backward compatibility and version checking.

Enumerator
V1 

Version 1 of the AssetPlugin API.

Function Documentation

◆ load() [1/4]

INFINITY_API_PUBLIC Asset Infinity::Assets::load ( const AssetLoadInfo loadInfo)

Loads an asset using the configured loader chain.

Loads an asset by first attempting to use the default loader configured in AssetPluginStore. If the default loader cannot provide a valid asset (either because it doesn't support the asset type or the asset doesn't exist in that source), the secondary loader is automatically tried as a fallback.

Parameters
loadInfoComplete information about the asset to load
Returns
The loaded Asset object
Exceptions
std::runtime_errorif no loaders are configured or all loaders fail
AssetLoadInfo info(TextureTypeID, "/assets", "textures/", "hero.png");
Asset texture = Infinity::Assets::load(info);
Type-erased container for loaded asset data.
Definition Asset.hpp:40
INFINITY_API_PUBLIC Asset load(const AssetLoadInfo &loadInfo)
Loads an asset using the configured loader chain.
Encapsulates the information required to load an asset in the Infinity engine.
Definition AssetLoadInfo.hpp:23

◆ load() [2/4]

INFINITY_API_PUBLIC Asset Infinity::Assets::load ( const Infinity::Types::TypeID type,
const std::string &  path 
)

Loads an asset using the configured loader chain with simplified parameters.

Convenience function that loads an asset using the default/secondary loader chain with just the asset type and path. Internally constructs an AssetLoadInfo with default corePath and loadPrefix values.

The default loader is tried first, with automatic fallback to the secondary loader if needed.

Parameters
typeThe type identifier for the asset being loaded
pathThe path to the asset file
Returns
The loaded Asset object
Exceptions
std::runtime_errorif no loaders are configured or all loaders fail
Asset audio = Infinity::Assets::load(AudioTypeID, "sounds/explosion.wav");

◆ load() [3/4]

INFINITY_API_PUBLIC Asset Infinity::Assets::load ( const std::string &  loader,
const AssetLoadInfo loadInfo 
)

Loads an asset using a specific named loader source.

Loads an asset using the AssetPlugin identified by the given loader name, bypassing the default loader chain. This allows explicit control over which asset source is used, useful when you need to load from a specific source regardless of the configured defaults.

Parameters
loaderThe name of the AssetPlugin source to use for loading
loadInfoComplete information about the asset to load
Returns
The loaded Asset object
Exceptions
std::runtime_errorif the specified loader doesn't exist or loading fails
AssetLoadInfo info(ModelTypeID, "/models", "", "character.fbx");
Asset model = Infinity::Assets::load("RemoteAssetLoader", info);

◆ load() [4/4]

INFINITY_API_PUBLIC Asset Infinity::Assets::load ( const std::string &  loader,
const Infinity::Types::TypeID type,
const std::string &  path 
)

Loads an asset from a specific named source with simplified parameters.

Convenience function that loads an asset using the specified loader source with just the asset type and path. Internally constructs an AssetLoadInfo with default corePath and loadPrefix values.

Bypasses the loader chain to load directly from the named source.

Parameters
loaderThe name of the AssetPlugin source to use for loading
typeThe type identifier for the asset being loaded
pathThe path to the asset file
Returns
The loaded Asset object
Exceptions
std::runtime_errorif the specified loader doesn't exist or loading fails
Asset texture = Infinity::Assets::load("FilesystemLoader", TextureTypeID, "ui/button.png");

Variable Documentation

◆ CreateAssetPlugin

INFINITY_API_PLUGIN CreateAssetPluginFunction Infinity::Assets::CreateAssetPlugin

Plugin entry point for creating an AssetPlugin instance.

All asset plugins must export this function to allow the engine to instantiate the plugin. This function should return a pointer to a newly allocated plugin object.

◆ DestroyAssetPlugin

INFINITY_API_PLUGIN DestroyAssetPluginFunction Infinity::Assets::DestroyAssetPlugin

Plugin entry point for destroying an AssetPlugin instance.

All asset plugins must export this function to allow the engine to properly cleanup the plugin. This function should delete the plugin object and free any associated resources.