-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamera.cpp
More file actions
74 lines (58 loc) · 1.05 KB
/
Copy pathCamera.cpp
File metadata and controls
74 lines (58 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
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
#include "Camera.h"
using namespace std;
using namespace DirectX;
using namespace DirectX::SimpleMath;
Camera::Camera(int width, int height)
:m_eyepos(0,3.0f,4.0f)
,m_refpos(0,0,0)
,m_upvec(0,1.0f,0)
,m_fovY(XMConvertToRadians(60.0f))
,m_aspect((float)width / height)
,m_nearClip(0.1f)
,m_farClip(1000.0f)
{
}
Camera::~Camera()
{
}
void Camera::Update()
{
m_view = Matrix::CreateLookAt(m_eyepos, m_refpos, m_upvec);
m_proj = Matrix::CreatePerspectiveFieldOfView(m_fovY, m_aspect, m_nearClip, m_farClip);
}
Matrix Camera::GetViewMatrix()
{
return m_view;
}
Matrix Camera::GetProjectionMatrix()
{
return m_proj;
}
void Camera::Seteyepos(Vector3 eyepos)
{
m_eyepos = eyepos;
}
void Camera::Setrefpos(Vector3 refpos)
{
m_refpos = refpos;
}
void Camera::Setupvec(Vector3 upvec)
{
m_upvec = upvec;
}
void Camera::SetfovY(float fovY)
{
m_fovY = fovY;
}
void Camera::Setaspect(float aspect)
{
m_aspect = aspect;
}
void Camera::SetnearClip(float nearClip)
{
m_nearClip = nearClip;
}
void Camera::SetfarClip(float farClip)
{
m_farClip = farClip;
}