forked from AmigurumiShaders/DX11Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamera.h
More file actions
46 lines (35 loc) · 1.05 KB
/
Camera.h
File metadata and controls
46 lines (35 loc) · 1.05 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
#pragma once
#include <DirectXMath.h>
#include <Windows.h>
#include "Transform.h"
class Camera
{
public:
Camera(float x, float y, float z, float moveSpeed, float mouseLookSpeed, float aspectRatio);
~Camera();
// Updating
void Update(float dt);
void UpdateViewMatrix();
void UpdateProjectionMatrix(float aspectRatio);
// Getters
DirectX::XMFLOAT4X4 GetView() { return viewMatrix; }
DirectX::XMFLOAT4X4 GetProjection() { return projMatrix; }
void CalculateFrustumCorners();
//https://stackoverflow.com/questions/21467225/how-do-you-determine-the-view-up-vector
DirectX::XMVECTOR GetForward() const noexcept;
DirectX::XMVECTOR GetDirection() noexcept;
DirectX::XMVECTOR GetRight() const noexcept;
DirectX::XMVECTOR GetUp() const noexcept;
Transform* GetTransform();
DirectX::XMFLOAT3 m_FrustumCorners[4];
private:
// Camera matrices
DirectX::XMFLOAT4X4 viewMatrix;
DirectX::XMFLOAT4X4 projMatrix;
DirectX::XMVECTOR direction;
//XMVECTOR up;
float m_AspectRatio = 16 / 9.0f;
Transform transform;
float movementSpeed;
float mouseLookSpeed;
};