add transformation

This commit is contained in:
2025-09-24 13:35:00 +02:00
parent 5322f857d3
commit 10d4f9fd1b
2 changed files with 16 additions and 0 deletions
+15
View File
@@ -28,6 +28,21 @@ UINT Mesh::init(IDirect3DDevice9* pD3DDevice)
void Mesh::update(FLOAT dt)
{
static FLOAT x = 0.0f;
static FLOAT y = 0.0f;
static FLOAT z = 0.0f;
static FLOAT pitch = 0.0f;
static FLOAT yaw = 0.0f;
static FLOAT roll = 0.0f;
static FLOAT scale = 1.0f;
yaw += 0.01f;
XMMATRIX translationMatrix = XMMatrixTranslation(x, y, z);
XMMATRIX rotationMatrix = XMMatrixRotationRollPitchYaw(pitch, yaw, roll);
XMMATRIX scaleMatrix = XMMatrixScaling(scale, scale, scale);
XMStoreFloat4x4(reinterpret_cast<XMFLOAT4X4*>(&_worldMatrix), scaleMatrix * rotationMatrix * translationMatrix);
}
void Mesh::render(IDirect3DDevice9* pD3DDevice)
+1
View File
@@ -32,6 +32,7 @@ int WINAPI WinMain(
error = d3d.init(window.getWindowHandle(), width, height, isFullscreen);
CheckError(error);
// set render states
d3d.getDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
// 3. create a mesh