-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCameraControllers.h
More file actions
44 lines (35 loc) · 950 Bytes
/
CameraControllers.h
File metadata and controls
44 lines (35 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
namespace Framework
{
class Camera;
class Terrain;
class CameraController
{
public:
virtual void Tick(Camera* camera) = 0;
};
}
namespace RTS
{
class TopDownCameraController :
public Framework::CameraController
{
public:
TopDownCameraController(Framework::Terrain* terrain);
void Tick(Framework::Camera* camera) override;
struct CameraFocus
{
glm::vec3 mPoint{};
float mRotation{};
float mBezierT{};
static constexpr inline glm::vec2 sBezierP0 = { -20.0f, 100.0f };
static constexpr inline glm::vec2 sBezierP1 = { -50.0f, 30.0f };
static constexpr inline glm::vec2 sBezierP2 = { -25.0f, 30.0f };
};
CameraFocus mFocus{};
private:
static glm::vec3 CalculateCameraOffset(const CameraFocus& focus, const glm::vec2& cameraForward, std::optional<float> overrideTime = {});
// Needed for keeping the camera inside bounds and adjusting the height
Framework::Terrain* mTerrain{};
};
}