Added: matrix buffer
Added: world, view & projection matrices Added: delta time calculation Added: quad mesh
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user