-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCamera.h
87 lines (67 loc) · 1.67 KB
/
Camera.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#pragma once
#include <DirectXMath.h>
#include "Transform.h"
enum class CameraProjectionType
{
Perspective,
Orthographic
};
class Camera
{
public:
Camera(
DirectX::XMFLOAT3 position,
float moveSpeed,
float mouseLookSpeed,
float fieldOfView,
float aspectRatio,
float nearClip = 0.01f,
float farClip = 100.0f,
CameraProjectionType projType = CameraProjectionType::Perspective);
Camera(
float x, float y, float z,
float moveSpeed,
float mouseLookSpeed,
float fieldOfView,
float aspectRatio,
float nearClip = 0.01f,
float farClip = 100.0f,
CameraProjectionType projType = CameraProjectionType::Perspective);
~Camera();
// Updating methods
void Update(float dt);
void UpdateViewMatrix();
void UpdateProjectionMatrix(float aspectRatio);
// Getters
DirectX::XMFLOAT4X4 GetView();
DirectX::XMFLOAT4X4 GetProjection();
Transform* GetTransform();
float GetAspectRatio();
float GetFieldOfView();
void SetFieldOfView(float fov);
float GetMovementSpeed();
void SetMovementSpeed(float speed);
float GetMouseLookSpeed();
void SetMouseLookSpeed(float speed);
float GetNearClip();
void SetNearClip(float distance);
float GetFarClip();
void SetFarClip(float distance);
float GetOrthographicWidth();
void SetOrthographicWidth(float width);
CameraProjectionType GetProjectionType();
void SetProjectionType(CameraProjectionType type);
private:
// Camera matrices
DirectX::XMFLOAT4X4 viewMatrix;
DirectX::XMFLOAT4X4 projMatrix;
Transform transform;
float movementSpeed;
float mouseLookSpeed;
float fieldOfView;
float aspectRatio;
float nearClip;
float farClip;
float orthographicWidth;
CameraProjectionType projectionType;
};