-
Notifications
You must be signed in to change notification settings - Fork 0
/
Camera.cpp
29 lines (21 loc) · 871 Bytes
/
Camera.cpp
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
#include "stdafx.h"
Camera::Camera()
{
}
Camera::~Camera()
{
}
void Camera::SetupMatrices(float deltatime)
{
D3DXMatrixLookAtLH(&matView, &vEyePt, &vLookatPt, &vUpVec);
CDirect3D::GetInstance()->g_pd3dDevice->SetTransform(D3DTS_VIEW, &matView);
DWORD halfX = CDirect3D::GetInstance()->dScnX / 2;
DWORD halfY = CDirect3D::GetInstance()->dScnY / 2;
RECT rect;
rect.left = (long)(halfX - halfX / fScale) + (450.f * m_iAtt * deltatime);
rect.right = (long)(halfX + halfX / fScale) - (450.f * m_iAtt * deltatime);
rect.top = (long)(halfY - halfY / fScale) + (450.f * m_iAtt * deltatime);
rect.bottom = (long)(halfY + halfY / fScale) - (450.f * m_iAtt * deltatime);
D3DXMatrixOrthoOffCenterLH(&matProj, rect.left , rect.right , rect.bottom, rect.top, 0.1f, 100.0f);
CDirect3D::GetInstance()->g_pd3dDevice->SetTransform(D3DTS_PROJECTION, &matProj);
}