CoriEngine
Loading...
Searching...
No Matches
CameraController.hpp
Go to the documentation of this file.
1#pragma once
2#include "CameraComponent.hpp"
4
5namespace Cori {
6 namespace World {
7 class Scene;
8 }
9
10 namespace Graphics {
14 class CameraController {
15 public:
16 ~CameraController() = default;
17
26 void CreateOrthoCamera(const float left, float right, const float bottom, const float top, const uint8_t depth = 50);
27
32 void SetPosition(const glm::vec2 newPos);
33
34
39 void SetRotation(const float angle);
40
45 void SetScale(const glm::vec2 scale);
46
47
52 glm::vec2 GetPosition() const;
53
58 float GetRotation() const;
59
64 glm::vec2 GetScale() const;
65
70 glm::vec2 GetSize() const;
71
76 void RecalculateVP();
77
78 private:
79 friend World::Scene;
80 CameraController() = default;
81 void BindCameraComponent(World::Components::Scene::Camera* camera) {
82 m_CurrentCameraComponent = camera;
83 }
84
85 World::Components::Scene::Camera* m_CurrentCameraComponent{ nullptr };
86
87 };
88 }
89}
void SetPosition(const glm::vec2 newPos)
Sets the position of the camera.
void SetRotation(const float angle)
Sets the rotational angle of the camera.
void CreateOrthoCamera(const float left, float right, const float bottom, const float top, const uint8_t depth=50)
Creates or recreate an orthographic camera.
glm::vec2 GetPosition() const
Gets the current camera position.
float GetRotation() const
Gets the current camera rotation.
glm::vec2 GetSize() const
Gets the current camera size.
glm::vec2 GetScale() const
Gets the current camera scale.
void RecalculateVP()
Recalculates the view projection matrix.
void SetScale(const glm::vec2 scale)
Changes camera scale to the requested value.
A scene in a game world.
Definition Scene.hpp:20
Almost everything connected to graphics is in this namespace.
Definition Window.hpp:7
Anything connected to WorldSystem (ECS) is in this namespace.
Global engine namespace.
A Scene context component with all the graphical camera data.