I have filled out the frame structure completely and I have filled out the animation controller.
But GetAttributeTable gives me 0 as the number of attributes from m_pMesh2?
pOrigMesh is the mesh who is loaded from assimp.
I use the D3DXCreateMesh method to do it...
Filling out with vertexes, indices, textures, materials
I also filled out the skininfo,
I just retrieve all the skininfo from assimp
and use
D3DXCreateSkinInfo....
Any ideas why the attribute table has no attributes/or basically no attribute table at all?
Thanks
Jack
bool meshLoader::GenerateSkinnedMesh(GameNode* pCurFrame)
{
if (pCurFrame == NULL)
return true;
// init skinned mesh
mesh *pCurMeshContainer = (mesh*)pCurFrame->m_mesh;
while (pCurMeshContainer != NULL)
{
// check if skinned mesh
if (pCurMeshContainer->m_skininfo != NULL)
{
//if (!pCurMeshContainer->pAdjacency)
//{
// pCurMeshContainer->pAdjacency = new DWORD[ pCurMeshContainer->pOrigMesh->GetNumFaces() * 3 ];
// pCurMeshContainer->pOrigMesh->GenerateAdjacency(1e-6f, pCurMeshContainer->pAdjacency);
//pCurMeshContainer->MeshData.pMesh->OptimizeInplace(D3DXMESHOPT_VERTEXCACHE|D3DXMESHOPT_ATTRSORT,
// pCurMeshContainer->pAdjacency, 0, 0, 0);
//}
pCurMeshContainer->pOrigMesh->CloneMeshFVF(
D3DXMESH_MANAGED, pCurMeshContainer->pOrigMesh->GetFVF(),
m_pDevice, &pCurMeshContainer->m_pMesh2);
pCurMeshContainer->m_pMesh2->GetAttributeTable(NULL, &pCurMeshContainer->dwNumAttributeGroups);
pCurMeshContainer->pAttributeTable.resize(pCurMeshContainer->dwNumAttributeGroups);
pCurMeshContainer->m_pMesh2->GetAttributeTable(&pCurMeshContainer->pAttributeTable[0], NULL);
pCurMeshContainer->dwNumBones = pCurMeshContainer->m_skininfo->GetNumBones();
// Allocate space for blend matrices
pCurMeshContainer->pBoneMatrices.resize(pCurMeshContainer->dwNumBones);
}
//m_dwNumMeshes++;
pCurMeshContainer = (mesh*)pCurMeshContainer->m_pNextChild;
}
if (pCurFrame->pFrameFirstChild != NULL)
if (!GenerateSkinnedMesh(pCurFrame->pFrameFirstChild))
return false;
if (pCurFrame->pFrameSibling != NULL)
if (!GenerateSkinnedMesh(pCurFrame->pFrameSibling))
return false;
return true;
}