diff --git a/GDP/D3D9/Mesh.cpp b/GDP/D3D9/Mesh.cpp index a40bc28..0d979f6 100644 --- a/GDP/D3D9/Mesh.cpp +++ b/GDP/D3D9/Mesh.cpp @@ -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(&_worldMatrix), scaleMatrix * rotationMatrix * translationMatrix); } void Mesh::render(IDirect3DDevice9* pD3DDevice) diff --git a/GDP/D3D9/main.cpp b/GDP/D3D9/main.cpp index 3900a51..0c09926 100644 --- a/GDP/D3D9/main.cpp +++ b/GDP/D3D9/main.cpp @@ -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