Ion
|
ResourceBase is an internal abstract base class for managed resources. More...
#include "resourcebase.h"
Public Member Functions | |
ResourceBase (const ResourceHolder *holder, ResourceKey key) | |
The constructor accepts a holder parameter to simplify control flow during construction. More... | |
virtual | ~ResourceBase () |
const ResourceHolder * | GetHolder () const |
Retrieve the holder for which this resource was created. More... | |
ResourceKey | GetKey () const |
Retrieve a key that disambiguates between multiple resources created for the same holder by the same resource manager. More... | |
virtual void | OnDestroyed ()=0 |
Each derived class must define these to acquire and release its resource. More... | |
virtual void | OnChanged (const int bit)=0 |
Informs the resource that something has changed and that it needs to update itself. More... | |
virtual size_t | GetGpuMemoryUsed () const =0 |
Returns the amount of GPU memory in bytes that this resource uses. More... | |
Friends | |
class | ResourceHolder |
ResourceBase is an internal abstract base class for managed resources.
For example, it allows scene graph objects to contain managed OpenGL resources without having to know anything about them.
Definition at line 36 of file resourcebase.h.
|
inlineexplicit |
The constructor accepts a holder parameter to simplify control flow during construction.
However, the value returned by GetHolder() is managed by the ResourceHolder, not by the ResourceManager.
Definition at line 41 of file resourcebase.h.
|
inlinevirtual |
Definition at line 44 of file resourcebase.h.
|
pure virtual |
Returns the amount of GPU memory in bytes that this resource uses.
Note that this may be zero, in particular if the Resource has never been drawn. The count does not include the memory used to hold simple state (e.g., the OpenGL id) only memory used by objects such as textures, framebuffers, and buffer objects.
|
inline |
Retrieve the holder for which this resource was created.
Definition at line 47 of file resourcebase.h.
|
inline |
Retrieve a key that disambiguates between multiple resources created for the same holder by the same resource manager.
Definition at line 51 of file resourcebase.h.
Referenced by ion::gfx::ResourceHolder::SetResource().
|
pure virtual |
Informs the resource that something has changed and that it needs to update itself.
Referenced by ion::gfx::ResourceHolder::SetResource().
|
pure virtual |
Each derived class must define these to acquire and release its resource.
It must be safe to call these multiple times. Invoked before a resource is released. If this is called when holder_ is null, it means this resource's holder is being destroyed. If holder_ is non-null, it means the resource is destroyed for another reason and should remove itself from the holder.
|
friend |
Definition at line 77 of file resourcebase.h.