add world matrix
add view matrix add projection matrix
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
#include "Utilities.h"
|
||||
#include "Vertex.h"
|
||||
|
||||
#include <DirectXMath.h>
|
||||
|
||||
using namespace DirectX;
|
||||
|
||||
UINT Mesh::init(IDirect3DDevice9* pD3DDevice)
|
||||
{
|
||||
UINT error = 0;
|
||||
@@ -12,6 +16,13 @@ UINT Mesh::init(IDirect3DDevice9* pD3DDevice)
|
||||
error = createIndexBuffer(pD3DDevice);
|
||||
CheckError(error);
|
||||
|
||||
// identity matrix
|
||||
XMMATRIX identityMatrix = XMMatrixIdentity();
|
||||
XMFLOAT4X4 worldMatrix;
|
||||
XMStoreFloat4x4(&worldMatrix, identityMatrix);
|
||||
D3DMATRIX* pWorldMatrix = reinterpret_cast<D3DMATRIX*>(&worldMatrix);
|
||||
_worldMatrix = *pWorldMatrix;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -25,6 +36,7 @@ void Mesh::render(IDirect3DDevice9* pD3DDevice)
|
||||
pD3DDevice->SetStreamSource(0, _pVertexBuffer, 0, _vertexStride);
|
||||
pD3DDevice->SetFVF(FVF);
|
||||
pD3DDevice->SetIndices(_pIndexBuffer);
|
||||
pD3DDevice->SetTransform(D3DTS_WORLD, &_worldMatrix);
|
||||
|
||||
// 2. draw call
|
||||
//pD3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, _vertexCount / 3);
|
||||
|
||||
Reference in New Issue
Block a user