nCine::Camera class

Provides the projection and view matrices used by shaders.

Holds an orthographic projection and a 2D view transform (position, rotation, scale) together with the matrices they produce. A viewport uses the camera matrices when rendering its scene; the frame in which each matrix last changed is tracked so dependent uniforms can be refreshed only when needed.

Public types

struct ProjectionValues
Values describing the orthographic projection matrix.
struct ViewValues
Values describing the 2D view matrix.

Constructors, destructors, conversion operators

Camera()
Creates a camera with default (identity-like) matrices.

Public functions

auto GetProjectionValues() const -> const ProjectionValues&
auto GetViewValues() const -> const ViewValues&
auto GetProjection() const -> const Matrix4x4f&
auto GetView() const -> const Matrix4x4f&
void SetOrthoProjection(float left, float right, float top, float bottom)
void SetOrthoProjection(const ProjectionValues& values)
void SetView(Vector2f pos, float rotation, float scale)
void SetView(float x, float y, float rotation, float scale)
void SetView(const ViewValues& values)
auto UpdateFrameProjectionMatrix() const -> std::uint32_t
auto UpdateFrameViewMatrix() const -> std::uint32_t