Files
2025-11-19 09:43:09 +01:00

29 lines
771 B
C++

#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()
{
}