Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
Flint::Drawable Class Referenceabstract

Interface for objects that contribute ordered work to a rendered frame. More...

#include <flint/graphics/drawable.h>

+ Inheritance diagram for Flint::Drawable:
+ Collaboration diagram for Flint::Drawable:

Public Member Functions

virtual void emit (RenderQueue &queue) const =0
 Emit this drawable's rendering work for the current frame.
 
void setGPUTexture (GPUTexture *texture)
 Associate a texture with this drawable.
 
GPUTexture * getGPUTexture () const
 Get the associated GPU texture.
 

Protected Attributes

GPUTexture * m_gpuTexture = nullptr
 Non-owning reference to the GPU texture asset.
 

Detailed Description

Interface for objects that contribute ordered work to a rendered frame.

Concrete drawables implement emit() to describe their geometry or custom rendering through RenderQueue.

See also
RenderQueue

Definition at line 21 of file drawable.h.

Member Function Documentation

◆ emit()

virtual void Flint::Drawable::emit ( RenderQueue & queue) const
pure virtual

Emit this drawable's rendering work for the current frame.

Called once after submitted drawables have been sorted by DrawLayer. Implementations must enqueue work through queue rather than issuing immediate GPU commands.

Parameters
queueQueue receiving this drawable's rendering work.

Implemented in Flint::CircleShape, Flint::PrimitiveArray, Flint::RectangleShape, and Flint::Sprite.

◆ getGPUTexture()

GPUTexture * Flint::Drawable::getGPUTexture ( ) const
inlinenodiscard

Get the associated GPU texture.

Returns
GPUTexture* Non-owning pointer to the GPU texture, or nullptr if unbound.

Definition at line 51 of file drawable.h.

◆ setGPUTexture()

void Flint::Drawable::setGPUTexture ( GPUTexture * texture)
inline

Associate a texture with this drawable.

Parameters
textureNon-owning pointer. It must remain valid while the drawable may be submitted.

Definition at line 42 of file drawable.h.

Member Data Documentation

◆ m_gpuTexture

GPUTexture* Flint::Drawable::m_gpuTexture = nullptr
protected

Non-owning reference to the GPU texture asset.

Definition at line 56 of file drawable.h.


The documentation for this class was generated from the following file: