-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCamera.h
47 lines (33 loc) · 1 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
#pragma once
#include <DirectXMath.h>
#include <Windows.h>
using namespace DirectX;
class Camera
{
public:
Camera(XMFLOAT3 pos, UINT windowWidth, UINT windowHeight, float nearDepth, float farDepth);
~Camera();
virtual void Update();
void RotateEulerAngles(XMFLOAT3 rotationAxes);
void Move(XMFLOAT3 velocity);
void LookAt(XMFLOAT3 newCameraPos, XMFLOAT3 targetWorldPos, XMFLOAT3 newUp);
void SetPosition(XMFLOAT3 newPos) { _pos = newPos; }
XMFLOAT3 GetPosition() { return _pos; }
XMFLOAT4X4 GetView() { return _view; }
XMMATRIX GetViewMatrix() { return XMLoadFloat4x4(&_view); }
XMFLOAT4X4 GetProjection() { return _projection; }
XMMATRIX GetProjectionMatrix() { return XMLoadFloat4x4(&_projection); }
FLOAT GetNear() { return _nearDepth; }
FLOAT GetFar() { return _farDepth; }
protected:
XMFLOAT3 _pos;
XMFLOAT3 _forward;
XMFLOAT3 _up;
XMFLOAT3 _right;
unsigned int _windowHeight;
unsigned int _windowWidth;
float _nearDepth;
float _farDepth;
XMFLOAT4X4 _view;
XMFLOAT4X4 _projection;
};