I am having a bit of trouble at the moment understanding how to get the seperate matrices for the nodes in an XFile. I am currently loading the file in a Mesh class like so:
CMesh::CMesh(const string &filename, LPDIRECT3DDEVICE9 d3dDevice)
string fullPath = MediaFolder+filename;
D3DXLoadMeshFromX(fullPath.c_str(), D3DXMESH_SYSTEMMEM, d3dDevice, NULL,
&materialBuffer, NULL, &m_numMaterials, &m_mesh );
D3DXMATERIAL* d3dxMaterials = (D3DXMATERIAL*)materialBuffer->GetBufferPointer();
m_meshMaterials = new D3DMATERIAL9[m_numMaterials];
m_meshTextures = new LPDIRECT3DTEXTURE9[m_numMaterials];
for (DWORD i=0; iGetVertexBuffer( &m_VertexBuffer );
m_mesh->GetIndexBuffer( &m_IndexBuffer );
However, using this way I cannot figure out any way to work out how many nodes the mesh contains and then how to get at their matrices.
I have just been playing around with D3DXLoadMeshHierarchyFromX(), and I thought I had found the solution as I assumed that by getting a D3DXFRAME* to the root node through the function I would be able traverse the roots child nodes and siblings to get the matrices I needed. However, when I began debugging, the root node did contain data, but it contained no information about children or siblings (and I know the mesh does contain more than one matrix).
The way I was using the D3DXLoadMeshHierarchyFromX() function was by calling D3DXLoadMeshFromX() first to get mesh data etc, then calling ..HierarchyFromX after this to get node data.
I'm stuck with this, a lot of the information on the web seems to deal with either loading a mesh with one matrix, or loading a mesh with animation and skinning (and all I want to do is maniupulate the child nodes' matrices in the mesh to get some simple transformations).
Any help and ideas would be greatly appreciated.