26 lines
824 B
C
26 lines
824 B
C
#include "directxmath/directxmath.h"
|
|
|
|
extern "C" void rotate(float angle, float aspect, float * buffer);
|
|
|
|
void rotate(float angle, float aspect, float * buffer)
|
|
{
|
|
//XMMATRIX mat = XMMatrixRotationZ(angle);
|
|
//XMMATRIX mat2 = XMMatrixRotationX(angle);
|
|
//XMMATRIX mat2 = XMMatrixTranslation(0, 0, 1);
|
|
//XMStoreFloat4x4((XMFLOAT4X4*)buffer, mat * mat2);
|
|
|
|
|
|
XMVECTOR eye = XMVectorSet(3, 3, 3, 0);
|
|
XMVECTOR at = XMVectorSet(0, 0, 0, 0);
|
|
XMVECTOR up = XMVectorSet(0, 1, 0, 0);
|
|
XMMATRIX view = XMMatrixLookAtRH(eye, at, up);
|
|
|
|
float fov_angle_y = XMConvertToRadians(45);
|
|
float near_z = 0.01;
|
|
float far_z = 1000.0;
|
|
XMMATRIX projection = XMMatrixPerspectiveFovRH(fov_angle_y, aspect, near_z, far_z);
|
|
|
|
XMMATRIX rot = XMMatrixRotationY(angle);
|
|
XMStoreFloat4x4((XMFLOAT4X4*)buffer, rot * view * projection);
|
|
}
|