add D3D11 project
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#include "Camera.h"
|
||||
|
||||
UINT Camera::init(UINT width, UINT height)
|
||||
{
|
||||
// view matrix
|
||||
XMVECTOR position = XMVectorSet(0.0f, 0.0f, -1.0f, 0.0f);
|
||||
XMVECTOR forward = XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f);
|
||||
XMVECTOR up = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
XMStoreFloat4x4(&_viewMatrix, XMMatrixLookToLH(position, forward, up));
|
||||
|
||||
// projection matrix
|
||||
XMMATRIX perspectiveMatrix = XMMatrixPerspectiveFovLH(
|
||||
XM_PI * 0.3333333f, // field of view in radians, here 60 degrees
|
||||
static_cast<FLOAT>(width) / static_cast<FLOAT>(height), // aspect ratio
|
||||
0.3f, 10.0f // near & far clipping planes
|
||||
);
|
||||
XMStoreFloat4x4(&_projectionMatrix, perspectiveMatrix);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Camera::update(FLOAT dt)
|
||||
{
|
||||
}
|
||||
|
||||
void Camera::deInit()
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user