RendererBackend¶
Renderer backend interface.
Overview¶
Typical use cases:
Defining a common interface for different graphics API backends
Header¶
<RaeptorCogs/GAPI/Common/RendererBackend.hpp>
Metadata¶
- Author
Estorc
- Version
v1.0
- Copyright
Copyright (c) 2025 Estorc MIT License.
Enums¶
Enum |
Description |
|---|---|
|
Graphics backend enumeration. |
-
enum class RaeptorCogs::GraphicsBackend¶
Graphics backend enumeration.
Defines supported graphics backends.
Values:
-
enumerator GL¶
OpenGL graphics backend
-
enumerator Vulkan¶
Vulkan graphics backend
-
enumerator GL¶
Classes¶
Class |
Description |
|---|---|
|
No description. |
-
class RendererBackend¶
Subclassed by RaeptorCogs::GAPI::GL::RendererBackend, RaeptorCogs::GAPI::Vulkan::RendererBackend
Public Functions
-
virtual ~RendererBackend() = default¶
Virtual destructor for RendererBackend.
-
virtual void initialize() = 0¶
Initialize the renderer backend.
Note
Sets up necessary resources and state for rendering.
-
virtual bool isInitialized() const = 0¶
Check if the renderer backend is initialized.
- Returns:
true if initialized, false otherwise.
-
virtual GraphicsBackend getBackendType() const = 0¶
Get the graphics backend type.
- Returns:
GraphicsBackend enumeration value.
-
virtual std::shared_ptr<Common::ObjectData> Create(std::type_index type) = 0¶
Create an object of the specified type.
Note
This is a pure virtual function and must be implemented by derived classes.
- Parameters:
type – Type index of the object to be created.
- Returns:
Shared pointer to the created object data.
-
virtual void render(Window *window, int x, int y, int width, int height) = 0¶
Backend implementation for rendering to a window.
Note
Renders the scene to the specified window or default framebuffer.
- Parameters:
window – Pointer to the target window. If nullptr, renders to the default framebuffer.
x – X coordinate of the rendering area.
y – Y coordinate of the rendering area.
width – Width of the rendering area.
height – Height of the rendering area.
-
virtual void render(Texture &texture, int x, int y, int width, int height) = 0¶
Backend implementation for rendering to a texture.
Note
Renders the scene directly into the provided texture.
- Parameters:
texture – Reference to the target texture.
x – X coordinate of the rendering area.
y – Y coordinate of the rendering area.
width – Width of the rendering area.
height – Height of the rendering area.
-
virtual Common::WindowContext *createWindowContext() = 0¶
Create a window context.
- Returns:
Pointer to the created window context.
-
inline void setPlatform(Singletons::Platform *platform)¶
Set the platform singleton.
- Parameters:
platform – Pointer to the platform singleton.
-
inline Singletons::Platform &getPlatform() const¶
Get the platform singleton.
- Returns:
Reference to the platform singleton.
-
virtual ImGuiModule &getImGuiModule() = 0¶
Get the ImGui implementation.
- Returns:
Reference to the ImGui implementation.
-
virtual GraphicCore &getGraphicCore() = 0¶
Get the GraphicCore implementation.
- Returns:
Reference to the GraphicCore implementation.
-
virtual RenderPipeline &getRenderPipeline() = 0¶
Get the RenderPipeline implementation.
- Returns:
Reference to the RenderPipeline implementation.
Private Members
-
Singletons::Platform *platform = nullptr¶
Platform pointer.
Holds a pointer to the platform singleton.
-
virtual ~RendererBackend() = default¶