|
libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
|
Non-templated base interface for all resources managed by the ResourceManager. More...
#include <Resource.h>
Public Member Functions | |
| IResource (std::shared_ptr< ResourceInitData > initData) | |
| Constructs an IResource with the given initialization data. | |
| virtual | ~IResource () |
| virtual void * | GetRawPointer ()=0 |
| Returns a type-erased raw pointer to the underlying resource data. | |
| virtual size_t | GetPointerSize ()=0 |
| Returns the size (in bytes) of the type pointed to by GetRawPointer(). | |
| bool | IsDirty () |
| Returns true if the resource has been marked dirty. | |
| void | Dirty () |
| Marks the resource as dirty. | |
| std::shared_ptr< ResourceInitData > | GetInitData () |
| Returns the initialization data used to load this resource. | |
Static Public Attributes | |
| static const std::string | gAltAssetPrefix = "alt/" |
| Path prefix that identifies an "alt asset" override. | |
Non-templated base interface for all resources managed by the ResourceManager.
IResource stores the initialization metadata that was used to load the underlying data and exposes a type-erased pointer to that data. The dirty flag is used to signal that the resource needs to be reloaded or regenerated (e.g. when the source archive changes).
| Ship::IResource::IResource | ( | std::shared_ptr< ResourceInitData > | initData | ) |
Constructs an IResource with the given initialization data.
| initData | Metadata describing how this resource was loaded (path, type, version, …). |
|
virtual |
| void Ship::IResource::Dirty | ( | ) |
Marks the resource as dirty.
Callers (e.g. the ResourceManager) use this to signal that the cached data is no longer up-to-date and should be reloaded before next use.
| std::shared_ptr< ResourceInitData > Ship::IResource::GetInitData | ( | ) |
Returns the initialization data used to load this resource.
|
pure virtual |
Returns the size (in bytes) of the type pointed to by GetRawPointer().
Implemented in Fast::Light, Fast::DisplayList, Fast::Matrix, Fast::Texture, Fast::Vertex, Ship::Blob, Ship::Json, Ship::Shader, Ship::Font, and Ship::GuiTexture.
|
pure virtual |
Returns a type-erased raw pointer to the underlying resource data.
Implemented in Ship::Resource< T >, Ship::Resource< Gfx >, Ship::Resource< LightEntry >, Ship::Resource< Mtx >, Ship::Resource< uint8_t >, Ship::Resource< void >, and Ship::Resource< Vtx >.
| bool Ship::IResource::IsDirty | ( | ) |
Returns true if the resource has been marked dirty.
A dirty resource should be considered stale and may need to be reloaded.
|
inlinestatic |
Path prefix that identifies an "alt asset" override.