Object¶
Object interface.
Overview¶
Typical use cases:
Defining a common interface for different graphics objects
Header¶
<RaeptorCogs/GAPI/Common/Ressources/Object.hpp>
Metadata¶
- Author
Estorc
- Version
v1.0
- Copyright
Copyright (c) 2025 Estorc MIT License.
Classes¶
Class |
Description |
|---|---|
|
Object interface. |
|
Template class for handling graphics objects. |
-
class ObjectData¶
Object interface.
Provides a common interface for different graphics objects.
Note
This is an abstract base class and should be inherited by specific object implementations.
Subclassed by RaeptorCogs::GAPI::Common::Buffer, RaeptorCogs::GAPI::Common::Shader, RaeptorCogs::GAPI::Common::TextureData, RaeptorCogs::GAPI::Common::VertexArray
Public Functions
-
virtual ~ObjectData() = default¶
Virtual destructor.
-
virtual void initialize() = 0¶
Initialize the object.
Pure virtual method to be implemented by derived classes for object initialization.
Note
Must be implemented by derived classes.
-
virtual void bind() = 0¶
Bind the object for use.
Pure virtual method to be implemented by derived classes for binding the object.
Note
Must be implemented by derived classes.
-
virtual void unbind() const = 0¶
Unbind the object.
Pure virtual method to be implemented by derived classes for unbinding the object.
Note
Must be implemented by derived classes.
-
inline virtual unsigned int getID() const¶
Get the unique identifier of the object.
Note
Returns 0 if the object is not initialized.
- Returns:
Unique identifier of the object.
-
inline virtual bool isValid() const¶
Check if the object is valid.
Note
An object is considered valid if it has been initialized and has a valid ID.
- Returns:
true if the object is valid, false otherwise.
Protected Functions
-
ObjectData() = default¶
Default constructor.
Prevents direct instantiation of ObjectData.
Protected Attributes
-
std::shared_ptr<unsigned int> id = nullptr¶
Unique identifier for the object.
Used by the graphics API to reference the object.
-
virtual ~ObjectData() = default¶
-
template<typename DataType>
class ObjectHandler¶ Template class for handling graphics objects.
Note
Provides lazy initialization and access to the underlying object data.
- Template Parameters:
DataType – Type of the object data, must derive from ObjectData.
Public Functions
-
ObjectHandler() = default¶
Default constructor for ObjectHandler.
-
virtual ~ObjectHandler() = default¶
Virtual destructor for ObjectHandler.
-
inline void initialize()¶
Initialize the object data.
Note
Initializes the object data if the renderer backend is initialized and the data is not already set.
-
inline DataType *operator->()¶
Overloaded arrow operator to access object data members.
- Returns:
Pointer to the object data.
-
inline DataType *get() const¶
Get the object data (const version).
- Returns:
Pointer to the object data.
Private Members
-
std::shared_ptr<DataType> data = nullptr¶
Shared pointer to the object data.
Holds the instance of the object data.
Functions¶
Function |
Description |
|---|---|
|
Get the object data of the specified type. |
|
Check if the renderer backend is initialized. |
-
std::shared_ptr<RaeptorCogs::GAPI::Common::ObjectData> RaeptorCogs::GAPI::GetObjectData(std::type_index type)¶
Get the object data of the specified type.
Note
Used internally to manage object data instances.
- Parameters:
type – Type index of the object data to retrieve.
- Returns:
Shared pointer to the object data.
-
bool RaeptorCogs::GAPI::IsRendererBackendInitialized()¶
Check if the renderer backend is initialized.
Note
Used internally to verify renderer backend state.
- Returns:
true if the renderer backend is initialized, false otherwise.