Infinity Engine v0.6.20
C++ API Documentation
Loading...
Searching...
No Matches
Infinity::Assets::AssetPlugin Class Referenceabstract

Abstract base class for source-specific asset loading plugins. More...

#include <AssetPlugin.hpp>

Public Member Functions

 AssetPlugin ()
 Default constructor.
 
virtual ~AssetPlugin ()
 Virtual destructor.
 
Asset load (const AssetLoadInfo &loadInfo)
 Loads an asset using the provided load information.
 
Asset load (const Infinity::Types::TypeID &type, const std::string &path)
 Convenience function to load an asset with a full path.
 
virtual AssetPluginAPIVer getPluginAPIVersion ()=0
 Gets the plugin API version this plugin implements.
 
virtual std::string getPluginName ()=0
 Gets the name of this plugin.
 
virtual std::string getPluginVendor ()=0
 Gets the vendor/author of this plugin.
 

Protected Member Functions

virtual Asset load_Text (const AssetLoadInfo &loadInfo)
 Loads a text asset from this plugin's source.
 
virtual Asset load_Array2D_ubyte (const AssetLoadInfo &loadInfo)
 Loads a 2D array of unsigned bytes from this plugin's source.
 
virtual Asset load_Array2D_float (const AssetLoadInfo &loadInfo)
 Loads a 2D array of floats from this plugin's source.
 
virtual Asset load_Array2D_Vector3ub (const AssetLoadInfo &loadInfo)
 Loads a 2D array of 3-component unsigned byte vectors from this plugin's source.
 
virtual Asset load_Array2D_Vector3 (const AssetLoadInfo &loadInfo)
 Loads a 2D array of 3-component float vectors from this plugin's source.
 
virtual Asset load_Array2D_Vector4ub (const AssetLoadInfo &loadInfo)
 Loads a 2D array of 4-component unsigned byte vectors from this plugin's source.
 
virtual Asset load_Array2D_Vector4 (const AssetLoadInfo &loadInfo)
 Loads a 2D array of 4-component float vectors from this plugin's source.
 
virtual Asset load_Array3D_ubyte (const AssetLoadInfo &loadInfo)
 Loads a 3D array of unsigned bytes from this plugin's source.
 
virtual Asset load_Array3D_float (const AssetLoadInfo &loadInfo)
 Loads a 3D array of floats from this plugin's source.
 
virtual Asset load_Array3D_Vector3ub (const AssetLoadInfo &loadInfo)
 Loads a 3D array of 3-component unsigned byte vectors from this plugin's source.
 
virtual Asset load_Array3D_Vector3 (const AssetLoadInfo &loadInfo)
 Loads a 3D array of 3-component float vectors from this plugin's source.
 
virtual Asset load_Array3D_Vector4ub (const AssetLoadInfo &loadInfo)
 Loads a 3D array of 4-component unsigned byte vectors from this plugin's source.
 
virtual Asset load_Array3D_Vector4 (const AssetLoadInfo &loadInfo)
 Loads a 3D array of 4-component float vectors from this plugin's source.
 
virtual Asset load_Mesh (const AssetLoadInfo &loadInfo)
 Loads a mesh asset from this plugin's source.
 
virtual Asset load_Material (const AssetLoadInfo &loadInfo)
 Loads a material asset from this plugin's source.
 
virtual Asset load_RenderObject (const AssetLoadInfo &loadInfo)
 Loads a render object asset from this plugin's source.
 

Detailed Description

Abstract base class for source-specific asset loading plugins.

AssetPlugin provides an extensible architecture for loading assets from different sources in the Infinity engine. Each plugin represents a specific asset source, such as the filesystem, a remote server, a database, or even another abstraction layer above the library.

Derived classes implement loading functions for the asset types they support by overriding the corresponding protected virtual load_* methods. Not all asset types need to be supported by every plugin - plugins only implement loaders for the types that make sense for their source.

When an asset is requested, the default loader is tried first. If it cannot provide a valid asset (either because the asset doesn't exist in that source or the loader doesn't support that asset type), the secondary loader is automatically tried as a fallback.

Note
This class is designed to be loaded dynamically as a plugin through the CreateAssetPlugin and DestroyAssetPlugin functions.

Constructor & Destructor Documentation

◆ AssetPlugin()

Infinity::Assets::AssetPlugin::AssetPlugin ( )

Default constructor.

Initializes the asset plugin and sets up the internal loader map.

◆ ~AssetPlugin()

virtual Infinity::Assets::AssetPlugin::~AssetPlugin ( )
virtual

Virtual destructor.

Ensures proper cleanup of derived plugin classes.

Member Function Documentation

◆ getPluginAPIVersion()

virtual AssetPluginAPIVer Infinity::Assets::AssetPlugin::getPluginAPIVersion ( )
pure virtual

Gets the plugin API version this plugin implements.

Returns
The AssetPluginAPIVer version number

◆ getPluginName()

virtual std::string Infinity::Assets::AssetPlugin::getPluginName ( )
pure virtual

Gets the name of this plugin.

Should return a unique identifier for this plugin that describes its source or purpose (e.g., "FilesystemLoader", "RemoteAssetLoader").

Returns
A string containing the plugin name

◆ getPluginVendor()

virtual std::string Infinity::Assets::AssetPlugin::getPluginVendor ( )
pure virtual

Gets the vendor/author of this plugin.

Returns
A string containing the plugin vendor information

◆ load() [1/2]

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

Loads an asset using the provided load information.

Dispatches to the appropriate type-specific loader based on the asset type specified in the loadInfo. If this plugin doesn't support the requested asset type or cannot load the asset from its source, it should return an invalid Asset to allow fallback to other loaders.

Parameters
loadInfoComplete information about the asset to load
Returns
The loaded Asset object, or an invalid Asset if loading fails

◆ load() [2/2]

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

Convenience function to load an asset with a full path.

Simplified loading interface that constructs an AssetLoadInfo internally with just the type and path.

Parameters
typeThe type identifier for the asset
pathThe full path to the asset file
Returns
The loaded Asset object, or an invalid Asset if loading fails

◆ load_Array2D_float()

virtual Asset Infinity::Assets::AssetPlugin::load_Array2D_float ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a 2D array of floats from this plugin's source.

Parameters
loadInfoInformation about the asset to load
Returns
The loaded Asset containing a 2D array of float values, or an invalid Asset

◆ load_Array2D_ubyte()

virtual Asset Infinity::Assets::AssetPlugin::load_Array2D_ubyte ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a 2D array of unsigned bytes from this plugin's source.

Parameters
loadInfoInformation about the asset to load
Returns
The loaded Asset containing a 2D array of ubyte values, or an invalid Asset

◆ load_Array2D_Vector3()

virtual Asset Infinity::Assets::AssetPlugin::load_Array2D_Vector3 ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a 2D array of 3-component float vectors from this plugin's source.

Parameters
loadInfoInformation about the asset to load
Returns
The loaded Asset containing a 2D array of Vector3 values, or an invalid Asset

◆ load_Array2D_Vector3ub()

virtual Asset Infinity::Assets::AssetPlugin::load_Array2D_Vector3ub ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a 2D array of 3-component unsigned byte vectors from this plugin's source.

Parameters
loadInfoInformation about the asset to load
Returns
The loaded Asset containing a 2D array of Vector3ub values, or an invalid Asset

◆ load_Array2D_Vector4()

virtual Asset Infinity::Assets::AssetPlugin::load_Array2D_Vector4 ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a 2D array of 4-component float vectors from this plugin's source.

Parameters
loadInfoInformation about the asset to load
Returns
The loaded Asset containing a 2D array of Vector4 values, or an invalid Asset

◆ load_Array2D_Vector4ub()

virtual Asset Infinity::Assets::AssetPlugin::load_Array2D_Vector4ub ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a 2D array of 4-component unsigned byte vectors from this plugin's source.

Parameters
loadInfoInformation about the asset to load
Returns
The loaded Asset containing a 2D array of Vector4ub values, or an invalid Asset

◆ load_Array3D_float()

virtual Asset Infinity::Assets::AssetPlugin::load_Array3D_float ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a 3D array of floats from this plugin's source.

Parameters
loadInfoInformation about the asset to load
Returns
The loaded Asset containing a 3D array of float values, or an invalid Asset

◆ load_Array3D_ubyte()

virtual Asset Infinity::Assets::AssetPlugin::load_Array3D_ubyte ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a 3D array of unsigned bytes from this plugin's source.

Parameters
loadInfoInformation about the asset to load
Returns
The loaded Asset containing a 3D array of ubyte values, or an invalid Asset

◆ load_Array3D_Vector3()

virtual Asset Infinity::Assets::AssetPlugin::load_Array3D_Vector3 ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a 3D array of 3-component float vectors from this plugin's source.

Parameters
loadInfoInformation about the asset to load
Returns
The loaded Asset containing a 3D array of Vector3 values, or an invalid Asset

◆ load_Array3D_Vector3ub()

virtual Asset Infinity::Assets::AssetPlugin::load_Array3D_Vector3ub ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a 3D array of 3-component unsigned byte vectors from this plugin's source.

Parameters
loadInfoInformation about the asset to load
Returns
The loaded Asset containing a 3D array of Vector3ub values, or an invalid Asset

◆ load_Array3D_Vector4()

virtual Asset Infinity::Assets::AssetPlugin::load_Array3D_Vector4 ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a 3D array of 4-component float vectors from this plugin's source.

Parameters
loadInfoInformation about the asset to load
Returns
The loaded Asset containing a 3D array of Vector4 values, or an invalid Asset

◆ load_Array3D_Vector4ub()

virtual Asset Infinity::Assets::AssetPlugin::load_Array3D_Vector4ub ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a 3D array of 4-component unsigned byte vectors from this plugin's source.

Parameters
loadInfoInformation about the asset to load
Returns
The loaded Asset containing a 3D array of Vector4ub values, or an invalid Asset

◆ load_Material()

virtual Asset Infinity::Assets::AssetPlugin::load_Material ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a material asset from this plugin's source.

Override this method to implement material loading from your specific source. Return an invalid Asset if this plugin doesn't support material assets or if the asset cannot be loaded.

Parameters
loadInfoInformation about the material asset to load
Returns
The loaded Asset containing material data, or an invalid Asset

◆ load_Mesh()

virtual Asset Infinity::Assets::AssetPlugin::load_Mesh ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a mesh asset from this plugin's source.

Override this method to implement mesh loading from your specific source. Return an invalid Asset if this plugin doesn't support mesh assets or if the asset cannot be loaded.

Parameters
loadInfoInformation about the mesh asset to load
Returns
The loaded Asset containing mesh data, or an invalid Asset

◆ load_RenderObject()

virtual Asset Infinity::Assets::AssetPlugin::load_RenderObject ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a render object asset from this plugin's source.

Override this method to implement render object loading from your specific source. Return an invalid Asset if this plugin doesn't support render object assets or if the asset cannot be loaded.

Parameters
loadInfoInformation about the render object asset to load
Returns
The loaded Asset containing render object data, or an invalid Asset

◆ load_Text()

virtual Asset Infinity::Assets::AssetPlugin::load_Text ( const AssetLoadInfo loadInfo)
protectedvirtual

Loads a text asset from this plugin's source.

Override this method to implement text file loading from your specific source. Return an invalid Asset if this plugin doesn't support text assets or if the asset cannot be loaded from this source.

Parameters
loadInfoInformation about the text asset to load
Returns
The loaded Asset containing text data, or an invalid Asset