|
Infinity Engine v0.6.20
C++ API Documentation
|
Type-erased container for loaded asset data. More...
#include <Asset.hpp>
Public Member Functions | |
| Asset () | |
| Default constructor - creates an empty/invalid asset. | |
| Asset (const std::string &text) | |
| Constructs an asset containing text data. | |
| Asset (const Infinity::Types::Containers::GrayscaleTexture &tex) | |
| Constructs an asset from a grayscale texture. | |
| Asset (const Infinity::Types::Containers::Array2D< float > &tex) | |
| Constructs an asset from a 2D array of floats. | |
| Asset (const Infinity::Types::Containers::Array2D< Infinity::Types::Math::Vector3ub > &tex) | |
| Constructs an asset from a 2D array of unsigned byte RGB vectors. | |
| Asset (const Infinity::Types::Containers::Array2D< Infinity::Types::Math::Vector3 > &tex) | |
| Constructs an asset from a 2D array of float RGB vectors. | |
| Asset (const Infinity::Types::Containers::Texture &tex) | |
| Constructs an asset from a standard texture. | |
| Asset (const Infinity::Types::Containers::Array2D< Infinity::Types::Math::Vector4 > &tex) | |
| Constructs an asset from a 2D array of RGBA vectors. | |
| Asset (const Infinity::Types::Containers::Array3D< uint8_t > &tex) | |
| Constructs an asset from a 3D array of unsigned bytes. | |
| Asset (const Infinity::Types::Containers::Array3D< float > &tex) | |
| Constructs an asset from a 3D array of floats. | |
| Asset (const Infinity::Types::Containers::Array3D< Infinity::Types::Math::Vector3ub > &tex) | |
| Constructs an asset from a 3D array of unsigned byte RGB vectors. | |
| Asset (const Infinity::Types::Containers::Array3D< Infinity::Types::Math::Vector3 > &tex) | |
| Constructs an asset from a 3D array of float RGB vectors. | |
| Asset (const Infinity::Types::Containers::Texture3D &tex) | |
| Constructs an asset from a 3D texture. | |
| Asset (const Infinity::Types::Containers::Array3D< Infinity::Types::Math::Vector4 > &tex) | |
| Constructs an asset from a 3D array of RGBA vectors. | |
| Asset (const Infinity::Types::Rendering::Mesh &mesh) | |
| Constructs an asset from mesh data. | |
| Asset (const Infinity::Types::Rendering::Material &mat) | |
| Constructs an asset from material data. | |
| Asset (const Infinity::Types::Rendering::RenderObject &ro) | |
| Constructs an asset from a render object. | |
| Asset (Asset &&other) | |
| Move constructor - transfers ownership of asset data. | |
| Asset (std::unique_ptr< Infinity::Types::Core::Base > &&data) | |
| Constructs an asset from a polymorphic base pointer. | |
| ~Asset () | |
| Destructor - releases owned asset data. | |
| Asset & | operator= (Asset &&other) |
| Move assignment operator - transfers ownership of asset data. | |
| template<typename T > | |
| const T & | get () |
| Retrieves the stored asset data as the specified type. | |
| Infinity::Types::Core::Base * | release () |
| Releases ownership of the underlying asset data. | |
| operator bool () | |
| Checks if the asset contains valid data. | |
Type-erased container for loaded asset data.
Asset is a polymorphic wrapper that provides a uniform interface for storing and accessing different types of loaded assets (textures, meshes, materials, etc.).
Assets represent read-only data that has been loaded from external sources (files, network, etc.) rather than generated at runtime. They can be loaded through built-in asset loader plugins or user-provided custom loaders.
Example usage:
| Infinity::Assets::Asset::Asset | ( | ) |
Default constructor - creates an empty/invalid asset.
| Infinity::Assets::Asset::Asset | ( | const std::string & | text | ) |
Constructs an asset containing text data.
| text | The text string to store in the asset. |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Containers::GrayscaleTexture & | tex | ) |
Constructs an asset from a grayscale texture.
| tex | The grayscale texture data (single-channel). |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Containers::Array2D< float > & | tex | ) |
Constructs an asset from a 2D array of floats.
| tex | The 2D float array (e.g., heightmap, single-channel data). |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Containers::Array2D< Infinity::Types::Math::Vector3ub > & | tex | ) |
Constructs an asset from a 2D array of unsigned byte RGB vectors.
| tex | The 2D RGB texture with 8-bit channels (0-255 per channel). |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Containers::Array2D< Infinity::Types::Math::Vector3 > & | tex | ) |
Constructs an asset from a 2D array of float RGB vectors.
| tex | The 2D RGB texture with floating-point channels. |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Containers::Texture & | tex | ) |
Constructs an asset from a standard texture.
| tex | The texture data (typically RGBA format). |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Containers::Array2D< Infinity::Types::Math::Vector4 > & | tex | ) |
Constructs an asset from a 2D array of RGBA vectors.
| tex | The 2D RGBA texture with floating-point channels. |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Containers::Array3D< uint8_t > & | tex | ) |
Constructs an asset from a 3D array of unsigned bytes.
| tex | The 3D volumetric data with 8-bit values (e.g., voxel data). |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Containers::Array3D< float > & | tex | ) |
Constructs an asset from a 3D array of floats.
| tex | The 3D volumetric data with floating-point values. |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Containers::Array3D< Infinity::Types::Math::Vector3ub > & | tex | ) |
Constructs an asset from a 3D array of unsigned byte RGB vectors.
| tex | The 3D volumetric RGB data with 8-bit channels. |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Containers::Array3D< Infinity::Types::Math::Vector3 > & | tex | ) |
Constructs an asset from a 3D array of float RGB vectors.
| tex | The 3D volumetric RGB data with floating-point channels. |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Containers::Texture3D & | tex | ) |
Constructs an asset from a 3D texture.
| tex | The 3D/volumetric texture data (typically RGBA format). |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Containers::Array3D< Infinity::Types::Math::Vector4 > & | tex | ) |
Constructs an asset from a 3D array of RGBA vectors.
| tex | The 3D volumetric RGBA data with floating-point channels. |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Rendering::Mesh & | mesh | ) |
Constructs an asset from mesh data.
| mesh | The 3D mesh containing vertices, normals, UVs, etc. |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Rendering::Material & | mat | ) |
Constructs an asset from material data.
| mat | The material containing shading properties and texture references. |
| Infinity::Assets::Asset::Asset | ( | const Infinity::Types::Rendering::RenderObject & | ro | ) |
Constructs an asset from a render object.
| ro | The complete renderable object (mesh + material + transform). |
| Infinity::Assets::Asset::Asset | ( | Asset && | other | ) |
Move constructor - transfers ownership of asset data.
| other | The asset to move from (left in valid but unspecified state). |
| Infinity::Assets::Asset::Asset | ( | std::unique_ptr< Infinity::Types::Core::Base > && | data | ) |
Constructs an asset from a polymorphic base pointer.
| data | Unique pointer to asset data (ownership is transferred). |
| Infinity::Assets::Asset::~Asset | ( | ) |
Destructor - releases owned asset data.
|
inline |
Retrieves the stored asset data as the specified type.
This template method performs runtime type checking and returns a reference to the underlying data. The behavior depends on whether T derives from Infinity::Types::Core::Data or is wrapped in a Value<T>.
| T | The expected type of the asset data. |
Example usage:
|
inline |
Checks if the asset contains valid data.
Example usage:
Move assignment operator - transfers ownership of asset data.
| other | The asset to move from (left in valid but unspecified state). |
| Infinity::Types::Core::Base * Infinity::Assets::Asset::release | ( | ) |
Releases ownership of the underlying asset data.
After calling this method, the Asset object will be in an empty state (equivalent to default-constructed). The caller assumes ownership of the returned pointer and is responsible for its deletion.