|
CeresEngine 0.2.0
A game development framework
|
A base class that all resources must extend from. More...
#include <CeresEngine/Resource/Resource.hpp>
Public Member Functions | |
| virtual CE_DISABLE_WARNING_MISSING_OVERRIDE ::CeresEngine::ClassInfo | getClassInfo () noexcept |
| virtual ::CeresEngine::ClassInfo | getClassInfo () const noexcept |
| Resource () | |
Default constructor for the Resource class. | |
| Resource (ResourceData &data) | |
Creates a new Resource instance by passing a ResourceData instance. | |
| virtual | ~Resource () noexcept=default |
Resource virtual destructor. | |
| ResourceManager * | getResourceManager () const noexcept |
| HResource | getResourceHandle () const noexcept |
| Generates a hash for the provided type. | |
| UUID | getResourceID () const noexcept |
| HResource | getParentResource () const noexcept |
| A parent resource to which this resource is attached to. | |
| SPtr< ResourceMetadata > | getResourceMetadata () const noexcept |
| A pointer to the user-defined resource metadata. | |
| const PackagePtr & | getPackage () const noexcept |
| The package from which the resource was loaded from. | |
| template<typename T = Resource> | |
| SPtr< T > | getShared () noexcept |
| Gets a shared pointer to the resource. | |
| template<typename T = Resource> | |
| SPtr< const T > | getShared () const noexcept |
| Gets a shared pointer to the resource. | |
| virtual const ResourceTypeInfo & | getResourceType () const noexcept=0 |
| Returns the resource type information descriptor. | |
| Resource (ResourceData &data, InputStream &dataStream) | |
Creates a new resource by reading data from dataStream. | |
| virtual void | serialize (OutputStream &dataStream) const =0 |
Serializes a resource by writing data to dataStream. | |
Public Member Functions inherited from CeresEngine::IReflectable | |
| virtual | ~IReflectable () noexcept=default |
Static Public Member Functions | |
| template<typename Processor > | |
| static constexpr void | reflect (Processor &&RTTI) |
| Executes the given processor for every field of the struct. | |
Protected Member Functions | |
| HResourceStream | createStream (const ResourceStreamFlags &flags=ResourceStreamFlag::Default) |
| Creates a new resource stream. | |
| void | destroyStream (HResourceStream &stream) |
| Destroys a stream. | |
| void | markAsDirty () |
| Marks the resource as dirty. | |
Private Attributes | |
| ResourceDataPtr | mData = nullptr |
A pointer to the ResourceData object provided by the manager. | |
Friends | |
| class | ResourceManager |
A base class that all resources must extend from.
| CeresEngine::Resource::Resource | ( | ) |
Default constructor for the Resource class.
|
inlineexplicit |
Creates a new Resource instance by passing a ResourceData instance.
This is usually done when constructing the resource using ResourceManager::create.
|
inlineexplicit |
Creates a new resource by reading data from dataStream.
|
protected |
Creates a new resource stream.
| streamID | The ID of the stream to be created or replaced. |
|
protected |
Destroys a stream.
|
virtualnoexcept |
Implements CeresEngine::IReflectable.
Reimplemented in CeresEngine::ResourceObject< T, false >, CeresEngine::ResourceObject< T, true >, CeresEngine::TResource< T, Base >, CeresEngine::TResource< AudioClip >, CeresEngine::TResource< CESLShader, Shader >, CeresEngine::TResource< Font >, CeresEngine::TResource< GLSLShader, Shader >, CeresEngine::TResource< GPUMesh, Mesh >, CeresEngine::TResource< GPUTexture, Texture >, CeresEngine::TResource< HLSLShader, Shader >, CeresEngine::TResource< Material >, CeresEngine::TResource< MemoryMesh, Mesh >, CeresEngine::TResource< MemoryTexture, Texture >, CeresEngine::TResource< Mesh >, CeresEngine::TResource< PBRMaterial, Material >, CeresEngine::TResource< ResourceObject< T > >, CeresEngine::TResource< Scene >, CeresEngine::TResource< Shader >, CeresEngine::TResource< ShaderMaterial, Material >, CeresEngine::TResource< SPIRVShader, Shader >, CeresEngine::TResource< StreamingMesh, Mesh >, CeresEngine::TResource< StreamingTexture, Texture >, CeresEngine::TResource< Terrain >, CeresEngine::TResource< Text >, and CeresEngine::TResource< Texture >.
|
virtualnoexcept |
Implements CeresEngine::IReflectable.
Reimplemented in CeresEngine::ResourceObject< T, false >, CeresEngine::ResourceObject< T, true >, CeresEngine::TResource< T, Base >, CeresEngine::TResource< AudioClip >, CeresEngine::TResource< CESLShader, Shader >, CeresEngine::TResource< Font >, CeresEngine::TResource< GLSLShader, Shader >, CeresEngine::TResource< GPUMesh, Mesh >, CeresEngine::TResource< GPUTexture, Texture >, CeresEngine::TResource< HLSLShader, Shader >, CeresEngine::TResource< Material >, CeresEngine::TResource< MemoryMesh, Mesh >, CeresEngine::TResource< MemoryTexture, Texture >, CeresEngine::TResource< Mesh >, CeresEngine::TResource< PBRMaterial, Material >, CeresEngine::TResource< ResourceObject< T > >, CeresEngine::TResource< Scene >, CeresEngine::TResource< Shader >, CeresEngine::TResource< ShaderMaterial, Material >, CeresEngine::TResource< SPIRVShader, Shader >, CeresEngine::TResource< StreamingMesh, Mesh >, CeresEngine::TResource< StreamingTexture, Texture >, CeresEngine::TResource< Terrain >, CeresEngine::TResource< Text >, and CeresEngine::TResource< Texture >.
|
inlinenoexcept |
The package from which the resource was loaded from.
Can be nullptr if the resource is not contained in a package.
|
inlinenoexcept |
A parent resource to which this resource is attached to.
This will ensure that the parent resource remains alive for as long as the children is referenced somewhere.
|
inlinenoexcept |
Generates a hash for the provided type.
Type must have a std::hash specialization.
| T | the type to be hashed |
| v | The value to be hashed |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
A pointer to the user-defined resource metadata.
Can be freely changed by the user to store metadata for the package. The metadata will be serialized alongside the resource and can be loaded separatedly from the resource. This allows quickly fetching data from the resource and let the user determine if it needs to be loaded or not.
|
pure virtualnoexcept |
Returns the resource type information descriptor.
Implemented in CeresEngine::TResource< T, Base >, CeresEngine::TResource< AudioClip >, CeresEngine::TResource< CESLShader, Shader >, CeresEngine::TResource< Font >, CeresEngine::TResource< GLSLShader, Shader >, CeresEngine::TResource< GPUMesh, Mesh >, CeresEngine::TResource< GPUTexture, Texture >, CeresEngine::TResource< HLSLShader, Shader >, CeresEngine::TResource< Material >, CeresEngine::TResource< MemoryMesh, Mesh >, CeresEngine::TResource< MemoryTexture, Texture >, CeresEngine::TResource< Mesh >, CeresEngine::TResource< PBRMaterial, Material >, CeresEngine::TResource< ResourceObject< T > >, CeresEngine::TResource< Scene >, CeresEngine::TResource< Shader >, CeresEngine::TResource< ShaderMaterial, Material >, CeresEngine::TResource< SPIRVShader, Shader >, CeresEngine::TResource< StreamingMesh, Mesh >, CeresEngine::TResource< StreamingTexture, Texture >, CeresEngine::TResource< Terrain >, CeresEngine::TResource< Text >, and CeresEngine::TResource< Texture >.
Gets a shared pointer to the resource.
Gets a shared pointer to the resource.
|
protected |
Marks the resource as dirty.
Executes the given processor for every field of the struct.
| RTTI | The processor to be ran for every field. |
|
pure virtual |
Serializes a resource by writing data to dataStream.
Implemented in CeresEngine::TResource< T, Base >, CeresEngine::TResource< AudioClip >, CeresEngine::TResource< CESLShader, Shader >, CeresEngine::TResource< Font >, CeresEngine::TResource< GLSLShader, Shader >, CeresEngine::TResource< GPUMesh, Mesh >, CeresEngine::TResource< GPUTexture, Texture >, CeresEngine::TResource< HLSLShader, Shader >, CeresEngine::TResource< Material >, CeresEngine::TResource< MemoryMesh, Mesh >, CeresEngine::TResource< MemoryTexture, Texture >, CeresEngine::TResource< Mesh >, CeresEngine::TResource< PBRMaterial, Material >, CeresEngine::TResource< ResourceObject< T > >, CeresEngine::TResource< Scene >, CeresEngine::TResource< Shader >, CeresEngine::TResource< ShaderMaterial, Material >, CeresEngine::TResource< SPIRVShader, Shader >, CeresEngine::TResource< StreamingMesh, Mesh >, CeresEngine::TResource< StreamingTexture, Texture >, CeresEngine::TResource< Terrain >, CeresEngine::TResource< Text >, and CeresEngine::TResource< Texture >.
|
friend |
|
private |
A pointer to the ResourceData object provided by the manager.
This object contains metadata and allow the stream to access information about itself.
The resource data is the main entry point to resource data streams and sub- resources.