forked from vixorien/D3D11Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamera.h
More file actions
59 lines (48 loc) · 1.14 KB
/
Copy pathCamera.h
File metadata and controls
59 lines (48 loc) · 1.14 KB
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
#pragma once
#include <DirectXMath.h>
#include <memory>
#include "Transform.h"
class Camera
{
private:
DirectX::XMFLOAT4X4 view;
DirectX::XMFLOAT4X4 projection;
std::shared_ptr<Transform> transform;
float aspectRatio;
float fov;
float nearPlane;
float farPlane;
float movementSpeed;
float lookSpeed;
bool isPerspective;
public:
Camera(
float aspectRatio,
DirectX::XMFLOAT3 pos,
DirectX::XMFLOAT3 rot = DirectX::XMFLOAT3(0, 0, 0),
float movementSpeed = 1.0f,
float lookSpeed = 0.01f,
bool isPerspective = true,
float fov = DirectX::XM_PIDIV2,
float nearPlane = 0.1f,
float farPlane = 100.0f
);
// Getters
DirectX::XMFLOAT4X4 GetView();
DirectX::XMFLOAT4X4 GetProjection();
std::shared_ptr<Transform> GetTransform();
float GetFov();
float GetNearPlane();
float GetFarPlane();
float GetMovementSpeed();
float GetLookSpeed();
// Setters
void SetFov(float fov);
void SetNearPlane(float nearPlane);
void SetFarPlane(float farPlane);
void SetMovementSpeed(float movementSpeed);
void SetLookSpeed(float lookSpeed);
void UpdateViewMatrix();
void UpdateProjectionMatrix(float aspectRatio);
void Update(float dt);
};