Struct Surface

Component owning one or more runtime-allocated surfaces (‘surface_t’).

struct Surface

Component owning one or more runtime-allocated surfaces (‘surface_t’).

These can be used as offscreen render-targets or CPU/RDP drawn textures.

With more than one buffer, the active surface cycles each frame, ‘getSurface()’ always returns the current frame’s surface.

Public Types

enum Flags

Values:

enumerator FLAG_CLEAR
enumerator FLAG_DEPTH

Public Functions

inline surface_t &getSurface()
Returns:

surface of the current frame

inline surface_t &getSurface(uint32_t idx)
Parameters:

idx – buffer index, must be < ‘getBufferCount()

Returns:

specific surface independent of the current frame

inline surface_t &getPrevSurface()
Returns:

surface of the previous frame, identical to ‘getSurface()’ if single-buffered

inline uint32_t getBufferCount() const
inline surface_t *getDepthBuffer()
Returns:

depth buffer of the surface, or nullptr if not enabled. Cameras targeting a surface without one re-use the main depth buffer.

inline void clear()

Clears the current surface with the clear-color, done automatically each frame if “Clear” is enabled in the editor.

inline void clear(const surface_t &surf) const

Clears a given surface with the clear-color.

Parameters:

surf – surface to clear, must be one of this component’s buffers

Public Members

surface_t buffers[MAX_BUFFERS] = {}
surface_t depthBuff = {}
uint64_t clearPattern = {}
uint8_t buffCount = {1}
uint8_t currIdx = {}
uint8_t flags = {}

Public Static Functions

static inline uint32_t getAllocSize(InitData *initData)
static void initDelete(Object &obj, Surface *data, InitData *initData)
static void update(Object &obj, Surface *data, float deltaTime)

Public Static Attributes

static constexpr uint32_t ID = 13
static constexpr uint32_t MAX_BUFFERS = 3
struct InitData

Public Members

uint16_t width
uint16_t height
uint32_t clearColor
uint8_t format
uint8_t buffCount
uint8_t flags