Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
AeonGames::Resource Class Referenceabstract

Base class for loadable engine resources. More...

#include <aeongames/Resource.hpp>

Inheritance diagram for AeonGames::Resource:
Inheritance graph
Collaboration diagram for AeonGames::Resource:
Collaboration graph

Public Member Functions

virtual ~Resource ()
 Virtual destructor.
virtual void LoadFromMemory (const void *aBuffer, size_t aBufferSize)=0
 Load the resource from a raw memory buffer.
virtual void Unload ()=0
 Release all data held by this resource.
DLL void LoadFromId (uint32_t aId)
 Load the resource identified by a numeric id.
DLL void LoadFromFile (const std::string &aFilename)
 Load the resource from a file on disk.
DLL size_t GetConsecutiveId () const
 Get the Consecutive Id for the resource object.

Detailed Description

Base class for loadable engine resources.

Provides a common interface for loading resource data from files, memory buffers, or numeric identifiers, and assigns each instance a unique consecutive id for runtime tracking.

Definition at line 32 of file Resource.hpp.

Constructor & Destructor Documentation

◆ ~Resource()

virtual AeonGames::Resource::~Resource ( )
inlinevirtual

Virtual destructor.

Definition at line 36 of file Resource.hpp.

Member Function Documentation

◆ GetConsecutiveId()

size_t AeonGames::Resource::GetConsecutiveId ( ) const

Get the Consecutive Id for the resource object.

The consecutive Id is different from the resource Id, it is a unique number per resource that increments as each object is created, as such it is a runtime value that will most likely change each run and cannot be relied on for serialization purposes, it is intended as an identifier for other classes who need to cache their own resource data linked to the original resource such as renderers.

Returns
Unique Consecutive Id of the object.

Definition at line 42 of file Resource.cpp.

◆ LoadFromFile()

void AeonGames::Resource::LoadFromFile ( const std::string & aFilename)

Load the resource from a file on disk.

Parameters
aFilenamePath to the resource file.

Definition at line 37 of file Resource.cpp.

◆ LoadFromId()

void AeonGames::Resource::LoadFromId ( uint32_t aId)

Load the resource identified by a numeric id.

Parameters
aIdResource identifier.

Definition at line 30 of file Resource.cpp.

◆ LoadFromMemory()

virtual void AeonGames::Resource::LoadFromMemory ( const void * aBuffer,
size_t aBufferSize )
pure virtual

Load the resource from a raw memory buffer.

Parameters
aBufferPointer to the data buffer.
aBufferSizeSize of the data buffer in bytes.

Implemented in AeonGames::Animation, AeonGames::Material, AeonGames::Mesh, AeonGames::Model, AeonGames::Pipeline, AeonGames::Skeleton, and AeonGames::Texture.

◆ Unload()

virtual void AeonGames::Resource::Unload ( )
pure virtual

The documentation for this class was generated from the following files: