Class Renderer

Inheritance Relationships

Derived Type

Class Documentation

class Renderer

Renders using a compatible graphics context.

Does not own the display, presentation surface, resource provider, or mutable game state. render() consumes ordered passes from a published frame on the graphics thread. The operations below are backend primitives for the frame renderer. Borrowed frame/matrix inputs must remain stable through each call. The caller brackets native use with backend initialization/teardown and retains its context. A backend failure may leave native state changed or part of a frame drawn.

Subclassed by CE::Rendering::OpenGL::Renderer

Public Functions

virtual ~Renderer() = default

Destroy the renderer adapter; backend-specific teardown requirements still apply to borrowed contexts.

virtual void initialize() = 0

Initialize native rendering on the graphics/context owner before uploads or draws.

Concrete backends define capability validation, repeat-call behavior and failure cleanup; this interface does not promise restart after deinitialize().

virtual void deinitialize() = 0

Stop native rendering and retire backend resources before the borrowed context/window is destroyed.

Call on the graphics/context owner after frame consumption and loading are quiescent. Concrete backend cleanup errors may propagate.

inline virtual GraphicsDomain graphics_domain() const noexcept

Declaration: [[nodiscard]]

Optional portable domain token; custom adapters may return an empty token.

void publish_events_to(CE::Events::EventBus::Publisher publisher, CE::Events::EventBus::Delivery terminal_delivery = CE::Events::EventBus::Delivery{}) noexcept

Select routing on the graphics owner before initialization.

Runtime supplies its Context bus. Optional terminal_delivery must queue without invoking inline, as EventBus::Delivery requires, and retain its targets through execution/cancellation. Destructors only submit owned terminal records; without this transport, inspect the retained token after destruction.

virtual void maintain_resources() = 0

Perform owner-thread maintenance even when no new frame is available.

Deferred-release backends collect retired resources here; other adapters may do nothing. Requires initialized live backend state as defined by the adapter.

virtual void render(const ::CE::Rendering::Frame &frame) = 0

Consume active passes and draw packets in authored order without accessing mutable game state.

Parameters:

frame – Published frame borrowed through the call; exclude writes/recycle until completion. Requires graphics owner/current context and retained compatible resource domains. A backend failure may leave partial rendering/native state changes; no rollback or presentation is implied.

virtual void clear() = 0

Clear the current rendering target on the graphics owner under backend-specific color/depth rules.

Does not present or publish a frame.

virtual void set_viewport(::CE::Platform::FramebufferSize size) = 0

Set backend viewport extent in framebuffer pixels.

Parameters:

size – Pixel dimensions; validity/minimized-window behavior belongs to the concrete backend. Requires its native graphics owner; does not mutate a camera or frame.

virtual void set_depth_test(bool enabled) = 0

Select a legacy backend depth-test primitive.

Parameters:

enabled – Requested comparison enable state. Retained pipeline draws apply their own fixed state; camera dimensionality does not choose this policy.

virtual void set_clear_colour(float r, float g, float b, float a) = 0

Set the backend clear color on its graphics owner.

Parameters:
  • r – Red component.

  • g – Green component.

  • b – Blue component.

  • a – Alpha component. Range/conversion behavior belongs to the backend; this operation does not issue a clear or alter draw-material alpha.

virtual void set_camera_matrices(const glm::mat4 &projection, const glm::mat4 &view) = 0

Supply copied legacy backend pass matrices without retaining a camera.

See also

Rendering guide

Parameters:
  • projection – Stable projection borrowed through the call.

  • view – Stable view borrowed through the call. Does not select depth policy or publish immutable pass storage.

Protected Functions

void publish_graphics_domain_changes(bool destroying = false) noexcept