-
Notifications
You must be signed in to change notification settings - Fork 0
/
Camera.h
48 lines (37 loc) · 868 Bytes
/
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
#pragma once
#include <memory>
#include "Types.h"
class Device;
struct Input;
class Camera {
struct PrevDragState {
float x = 0.0f;
float y = 0.0f;
float deltaX = 0.0f;
float deltaY = 0.0f;
bool inProgress = false;
};
public:
Camera(Device& device, Input& input);
~Camera();
void Update(Input& input, float deltaTime);
private:
void UpdateViewMatrix();
void UpdatePosition(Input& input, float deltaTime);
void CalculateMouseDelta(float deltaTime);
public:
std::unique_ptr<BufferResource> mConstantBuffer;
PrevDragState mPrevDragState{};
bool mRmbIsPressed = false;
private:
Device& mDevice;
Input& mInput;
CameraConstantBuffer mConstantBufferData;
DirectX::XMFLOAT4X4 mViewMatrix{};
DirectX::XMFLOAT3 mPosition{};
DirectX::XMFLOAT3 mRight{};
DirectX::XMFLOAT3 mUp{};
DirectX::XMFLOAT3 mForward{};
float mPitch;
float mYaw;
};