GraphicCore¶
Graphic core interface.
Overview¶
Typical use cases:
Providing core graphics functionality and resource management
Header¶
<RaeptorCogs/GAPI/Common/Core/Internal/GraphicCore.hpp>
Metadata¶
- Author
Estorc
- Version
v1.0
- Copyright
Copyright (c) 2025 Estorc MIT License.
Classes¶
Class |
Description |
|---|---|
|
Graphic core interface. |
-
class GraphicCore¶
Graphic core interface.
Provides core graphics functionality and resource management.
Subclassed by RaeptorCogs::GAPI::GL::GraphicCore, RaeptorCogs::GAPI::Vulkan::GraphicCore
Public Functions
-
inline GraphicCore(RendererBackend &renderer)¶
Default constructor.
Initializes the GraphicCore.
-
virtual ~GraphicCore() = default¶
Virtual destructor.
Cleans up resources used by the GraphicCore.
-
void updateGraphicGPUData()¶
Update the GPU data for graphics.
Note
Uploads instance data and order indices to the GPU.
-
inline InstanceData &getInstanceData()¶
Get the instance data.
- Returns:
Reference to the instance data.
-
inline InstanceAllocator &getInstanceAllocator()¶
Get the instance allocator.
- Returns:
Reference to the instance allocator.
-
inline InstanceUploader &getInstanceUploader()¶
Get the instance uploader.
- Returns:
Reference to the instance uploader.
-
ObjectHandler<SSBO> &getStaticInstanceDataSSBO()¶
Get the static instance data SSBO.
- Returns:
Reference to the static instance data SSBO.
-
ObjectHandler<SSBO> &getDynamicInstanceDataSSBO()¶
Get the dynamic instance data SSBO.
- Returns:
Reference to the dynamic instance data SSBO.
-
ObjectHandler<VBO> &getQuadVBO()¶
Get the quad VBO.
- Returns:
Reference to the quad VBO.
-
ObjectHandler<EBO> &getQuadEBO()¶
Get the quad EBO.
- Returns:
Reference to the quad EBO.
-
virtual void setViewport(int x, int y, int width, int height) = 0¶
Set the viewport dimensions.
Note
Configures the rendering viewport.
- Parameters:
x – X position of the viewport.
y – Y position of the viewport.
width – Width of the viewport.
height – Height of the viewport.
-
virtual void clearSwapchainBuffers() = 0¶
Clear the swapchain buffers.
Note
Clears color, depth, and stencil buffers.
-
virtual void useBlend() = 0¶
Use blending for rendering.
Note
Enables blending state in the graphics pipeline.
-
virtual void bindMaskTexture() = 0¶
Bind the mask texture.
Note
Binds the mask texture to the appropriate texture unit.
-
virtual void setTextureUniform(ObjectHandler<Common::Shader> shader) = 0¶
Set the texture uniform in shaders.
Note
Updates the shader uniform for the main texture.
-
virtual void setMaskTextureUniform(ObjectHandler<Common::Shader> shader) = 0¶
Set the mask texture uniform in shaders.
Note
Updates the shader uniform for the mask texture.
-
virtual void drawElementsInstancedBaseVertexBaseInstance(size_t count, size_t instanceCount, size_t first, int baseVertex, unsigned int baseInstance) = 0¶
Draw elements with instancing, base vertex, and base instance.
Note
Issues a draw call with advanced parameters.
- Parameters:
count – Number of elements to draw.
instanceCount – Number of instances to draw.
first – Index of the first element to draw.
baseVertex – Base vertex offset.
baseInstance – Base instance offset.
-
virtual void bindGraphicTexture(Graphic2D &graphic) = 0¶
Bind a graphic texture for rendering.
Note
Binds the specified texture for use in rendering.
- Parameters:
graphic – Graphic to bind.
-
virtual void enableStencilGuarding() = 0¶
Enable stencil guarding.
Note
Activates stencil buffer operations for guarding.
Protected Functions
-
inline RendererBackend &getRenderer() const¶
Get the renderer pointer.
- Returns:
Reference to the renderer backend singleton.
Private Members
-
RendererBackend &renderer¶
Reference to the renderer backend.
Holds a reference to the renderer backend singleton.
-
ObjectHandler<SSBO> staticInstanceDataSSBO¶
SSBO for static instance data.
Holds static instance data for rendering.
-
ObjectHandler<SSBO> dynamicInstanceDataSSBO¶
SSBO for dynamic instance data.
Holds dynamic instance data for rendering.
-
InstanceData instanceData¶
Instance data structure.
Holds static and dynamic instance data for rendering.
-
InstanceAllocator instanceAllocator = {instanceData}¶
Instance allocator.
Manages allocation of instance data.
-
InstanceUploader instanceUploader = {instanceData}¶
Instance uploader.
Handles uploading of instance data to the GPU.
-
inline GraphicCore(RendererBackend &renderer)¶