GraphicHandler

GraphicHandler interface.

Overview

Typical use cases:

  • Defining a common interface for graphic batch handling

Header

<RaeptorCogs/GAPI/Common/Core/GraphicHandler.hpp>

Metadata

Author

Estorc

Version

v1.0

Copyright

Copyright (c) 2025 Estorc MIT License.

Structs

Structures

Struct

Description

RaeptorCogs::BatchKey

Batch key structure.

RaeptorCogs::GAPI::Common::GraphicBatchHandler

Graphic batch handler structure.

struct BatchKey

Batch key structure.

Represents a unique key for graphic batching based on rendering parameters.

Public Functions

inline bool operator<(const BatchKey &other) const noexcept

Less-than operator for ordering.

Note

Used for sorting BatchKeys in collections.

Parameters:

other – The other BatchKey to compare with.

Returns:

true if this BatchKey is less than the other, false otherwise.

inline bool operator>(const BatchKey &other) const noexcept

Greater-than operator for ordering.

Note

Used for sorting BatchKeys in collections.

Parameters:

other – The other BatchKey to compare with.

Returns:

true if this BatchKey is greater than the other, false otherwise.

inline bool operator!=(const BatchKey &other) const noexcept

Not-equal operator.

Note

Used for comparing BatchKeys in collections.

Parameters:

other – The other BatchKey to compare with.

Returns:

true if this BatchKey is not equal to the other, false otherwise.

inline bool operator==(const BatchKey &other) const noexcept

Equality operator.

Note

Used for comparing BatchKeys in collections.

Parameters:

other – The other BatchKey to compare with.

Returns:

true if this BatchKey is equal to the other, false otherwise.

Public Members

int writingMask

Writing mask.

Indicates which buffers are written to during rendering.

Note

Used for batching graphics with similar write operations.

int readingMask

Reading mask.

Indicates which buffers are read from during rendering.

Note

Used for batching graphics with similar read operations.

int zindex

Z-index for rendering order.

Determines the rendering order of graphics, with lower values rendered first.

Note

Used for batching graphics with similar depth.

bool isOpaque

Opaqueness flag.

Indicates whether the graphic is opaque or transparent.

Note

Used for batching graphics with similar transparency.

uint32_t programID

Shader program ID.

Identifier for the shader program used for rendering.

Note

Used for batching graphics using the same shader.

uint32_t textureID

Texture ID.

Identifier for the texture used for rendering.

Note

Used for batching graphics using the same texture.

struct GraphicBatchHandler

Graphic batch handler structure.

Manages batching information for a graphic during rendering.

Public Functions

inline GraphicBatchHandler(const BatchKey &key, Graphic2D *graphic)

Constructor for GraphicBatchHandler.

Note

Initializes cursors and dirty flag.

Parameters:
  • key – The BatchKey for this handler.

  • graphic – Pointer to the associated Graphic2D.

Public Members

unsigned int staticDataCursor

Static data cursor.

Indicates the position in the static instance data buffer.

Note

Not size_t to replicate GL buffer offset limitations.

unsigned int dynamicDataCursor

Dynamic data cursor.

Indicates the position in the dynamic instance data buffer.

Note

Not size_t to replicate GL buffer offset limitations.

unsigned int dynamicDataSize

Dynamic data size.

Indicates the size of the dynamic instance data for this graphic.

Note

Not size_t to replicate GL buffer size limitations.

BatchKey rendererKey

Renderer key.

Unique key for batching based on rendering parameters.

Graphic2D *graphic

Pointer to the associated graphic.

The graphic being managed by this batch handler.

bool isDirty

Dirty flag.

Indicates whether the graphic’s data has changed and needs to be re-uploaded.

Functions

Functions

Function

Description

std::operator<<(std::ostream &os, const RaeptorCogs::BatchKey &key)

Stream output operator for BatchKey.

std::operator<<(std::ostream &os, const RaeptorCogs::GAPI::Common::GraphicBatchHandler &handler)

Stream output operator for GraphicBatchHandler.

inline std::ostream &std::operator<<(std::ostream &os, const RaeptorCogs::BatchKey &key)

Stream output operator for BatchKey.

Note

Outputs the BatchKey in a human-readable format.

Parameters:
  • os – Output stream.

  • key – BatchKey instance to output.

Returns:

Reference to the output stream.

inline std::ostream &std::operator<<(std::ostream &os, const RaeptorCogs::GAPI::Common::GraphicBatchHandler &handler)

Stream output operator for GraphicBatchHandler.

Note

Outputs the GraphicBatchHandler in a human-readable format.

Parameters:
  • os – Output stream.

  • handler – GraphicBatchHandler instance to output.

Returns:

Reference to the output stream.