Added: matrix buffer

Added: world, view & projection matrices
Added: delta time calculation
Added: quad mesh
This commit is contained in:
2026-10-12 18:47:53 +02:00
parent daa04be788
commit d2a487a4f6
10 changed files with 139 additions and 12 deletions
+20 -3
View File
@@ -12,6 +12,8 @@ UINT Mesh::init(ID3D11Device* pD3DDevice)
error = createIndexBuffer(pD3DDevice);
CheckError(error);
XMStoreFloat4x4(&_worldMatrix, XMMatrixIdentity());
return 0;
}
@@ -56,11 +58,21 @@ void Mesh::deInit()
UINT Mesh::createVertexBuffer(ID3D11Device* pD3DDevice)
{
// TODO: create a quad (square)
// TODO: create a cube
// 1. define the structure (vertices)
Vertex vertices[] = {
Vertex(0.0f, 1.0f, 0.0f), // 0
Vertex(1.0f, -1.0f, 0.0f), // 1
Vertex(-1.0f, -1.0f, 0.0f) // 2
// triangle
Vertex(0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f), // 0
Vertex(1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f), // 1
Vertex(-1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f) // 2
// quad
//Vertex(-0.5f, 0.5f, 0.0f),
//Vertex(0.5f, 0.5f, 0.0f),
//Vertex(0.5f, -0.5f, 0.0f),
//Vertex(-0.5f, -0.5f, 0.0f)
};
_vertexCount = std::size(vertices);
@@ -85,7 +97,12 @@ UINT Mesh::createVertexBuffer(ID3D11Device* pD3DDevice)
UINT Mesh::createIndexBuffer(ID3D11Device* pD3DDevice)
{
USHORT indices[] = {
// triangles
0, 1, 2
// quad
//0, 1, 2,
//0, 2, 3
};
_indexCount = std::size(indices);