Vivid
Loading...
Searching...
No Matches
EditorCamera.h
1#pragma once
2
3#include "editor/camera/movable/MovableCamera.h"
4#include "common/maths/Vec.h"
5
14{
15private:
16 float m_FOV = 60.0f;
17 float m_NearCip = 0.1f;
18 float m_FarClip = 5000.0f;
19 float m_AspectRatio = 1.7778f; // 16:9 = m_ViewportWidth / m_ViewportHeight
20
21 Vivid::Maths::Vec3 m_Front = Vivid::Maths::Vec3(0.0f, 0.0f, -1.0f);
22 Vivid::Maths::Vec3 m_Up = Vivid::Maths::Vec3(0.0f, 1.0f, 0.0f);
23 Vivid::Maths::Vec3 m_Right = Vivid::Maths::Vec3(1.0f, 0.0f, 0.0f);
24
25 // We'll never roll the camera. https://sidvind.com/wiki/Yaw,_pitch,_roll_camera
26 float m_Yaw = 0.0f;
27 float m_Pitch = 0.0f;
28
29 float m_MovementSpeed = 15.0f;
30 float m_MouseSensitivity = 0.08f;
31 float m_ZoomSensitivity = 0.08f;
32
33 glm::vec2 m_MousePosition = glm::vec2(0.0f, 0.0f);
34
35 void updateCameraVectors();
36 void updateProjectionMatrix();
37 void updateViewMatrix();
38
39public:
40 EditorCamera() = default;
41 EditorCamera(float fov, float aspect, float near, float far);
42
43 float GetYaw() { return m_Yaw; }
44 float GetPitch() { return m_Pitch; }
45 float GetMovementSpeed() { return m_MovementSpeed; }
46 float GetMouseSensitivity() { return m_MouseSensitivity; }
47 float GetZoom() { return m_ZoomSensitivity; }
48
49 void SetPerspective(float fov, float aspect, float near, float far);
50 void SetViewportSize(int width, int height) override;
51
52 void MoveForward() override;
53 void MoveBackward() override;
54 void MoveLeft() override;
55 void MoveRight() override;
56 void ProcessMouseScroll(float scrollOffset) override;
57 void ProcessMouseMovement(float xOffset, float yOffset, bool constrainPitch) override;
58};
A class for the EditorCamera.
Definition: EditorCamera.h:14
A class for the MovableCamera's.
Definition: MovableCamera.h:15
Contains a 3D vector.
Definition: Vec.h:51