3#include "structure/engine/2d/spk_component_2d.hpp"
4#include "structure/engine/2d/spk_transform_2d.hpp"
5#include "structure/engine/spk_camera.hpp"
6#include "structure/graphics/spk_extend_2d.hpp"
7#include "structure/math/spk_vector2.hpp"
8#include "structure/opengl/spk_uniform_buffer_object.hpp"
19 static spk::OpenGL::UBO &_cameraUBO();
23 spk::ContractProvider::Contract _onTransformEditContract;
24 spk::ContractProvider::Contract _onCameraProjectionEditContract;
27 bool _hasGeometry =
false;
29 struct ProjectionPolicy
32 float nearPlane = 0.1f;
33 float farPlane = 1000.0f;
36 ProjectionPolicy _policy;
38 void _applyProjection();
39 void _onGeometryChange(
const spk::Extend2D &p_geometry)
override;
49 void start()
override;
66 void setNearFar(
float p_nearPlane,
float p_farPlane);
Stores projection matrices and converts screen coordinates.
Definition spk_camera.hpp:16
Component2D(const std::wstring &p_name)
Builds a 2D component with a name.
Definition spk_component_2d.cpp:9
const spk::Vector2 & pixelsPerUnit() const
Returns the pixels-per-unit scale.
Definition spk_orthographic_camera_component_2d.cpp:88
void setNearFar(float p_nearPlane, float p_farPlane)
Sets the near and far clipping planes.
Definition spk_orthographic_camera_component_2d.cpp:93
void setPixelsPerUnit(const spk::Vector2 &p_pixelsPerUnit)
Sets the pixels-per-unit scale.
Definition spk_orthographic_camera_component_2d.cpp:82
void start() override
Initializes camera resources and registers update hooks.
Definition spk_orthographic_camera_component_2d.cpp:62
OrthographicCameraComponent2D(const std::wstring &p_name)
Creates an orthographic camera component.
Definition spk_orthographic_camera_component_2d.cpp:53
void setAsActive() const
Marks this camera as the active camera.
Definition spk_orthographic_camera_component_2d.cpp:100
Axis-aligned rectangle defined by an anchor point and size.
Definition spk_extend_2d.hpp:24