Class CameraBase

Inheritance Relationships

Derived Types

Class Documentation

class CameraBase

Tracks projection and view changes by revision.

The game or a render pass chooses when to use these matrices; the camera does not set render policy. Mutable state is unsynchronized: use one owner and copy matrices into frames. Matrix references borrow this camera and must not race with its setters.

Subclassed by CE::Rendering::Camera2D, CE::Rendering::Camera3D

Public Functions

virtual ~CameraBase()

Destroy camera state; published frame matrix copies are independent.

void set_framebuffer_size(::CE::Platform::FramebufferSize size)

Set pixel extent and recompute projection on this camera’s unsynchronized owner.

Parameters:

size – Nonnegative pixel width/height; zero is retained while projection uses at least one pixel per axis.

Throws:

CE::Exceptions::invalid_args – For negative dimensions, without mutation. Equal extents do nothing; a changed extent/projection advances the revision once.

void set_view_matrix(const glm::mat4 &view)

Copy the view matrix and increment revision when any component differs exactly.

Parameters:

view – Borrowed matrix; no finiteness or invertibility validation is added. Does not alter projection or native state; exclude concurrent mutation/read of this camera.

inline ::CE::Platform::FramebufferSize framebuffer_size() const

Declaration: [[nodiscard]]

Returns:

Copied stored pixel extent, including zero dimensions; access is unsynchronized.

inline const glm::mat4 &projection_matrix() const

Declaration: [[nodiscard]]

Returns:

Borrowed projection; keep this camera alive and exclude setters while reading/copying it.

inline const glm::mat4 &view_matrix() const

Declaration: [[nodiscard]]

Returns:

Borrowed view; keep this camera alive and exclude setters while reading/copying it.

inline std::uint64_t revision() const

Declaration: [[nodiscard]]

Returns:

Current change counter, not a publication barrier or synchronization primitive.

Protected Functions

virtual void recalculate_projection() = 0

Derived-camera hook recomputing projection from the stored configuration.

Called by setters before their revision increment; no native rendering policy is selected.

Protected Attributes

::CE::Platform::FramebufferSize framebuffer_size_ = {}

Stored pixel extent, including a minimized zero extent.

glm::mat4 projection_matrix_ = {1.0f}

Derived projection copied into retained render passes.

glm::mat4 view_matrix_ = {1.0f}

Caller-supplied world-to-view matrix.

std::uint64_t revision_ = 0

Advances once per changed public camera configuration.