I am trying to load the "bones_all.x" file (from http://toymaker.info/) into my application. When I use the SkinnedMeshDemo fromt the SDK, it loads fine.
But if use the code from Frank D. Luna's SkinnedMeshDemo (Introduction to 3D Game Programming with DirextX 9.0c - A Shader Approach), which I use for my game, it fails.
In his code you try to find a frame which contains the mesh data (recursively through the hierarchy), but apparently this .x file does not contain that info in a frame.
How can I find the mesh data? Or is there some way to generate it?
... // Load the skinned mesh and its texture. mSkinnedMesh = new SkinnedMesh("bones_all.x");...SkinnedMesh::SkinnedMesh(std::string XFilename){ AllocMeshHierarchy allocMeshHierarchy; HR(D3DXLoadMeshHierarchyFromX(XFilename.c_str(), D3DXMESH_SYSTEMMEM, gd3dDevice, &allocMeshHierarchy, 0, /* ignore user data */ &mRoot, &mAnimCtrl)); // In this demo we assume that the input .X file contains only one // mesh. So search for that one and only mesh. D3DXFRAME* f = findNodeWithMesh(mRoot); if( f == 0 ) HR(E_FAIL); D3DXMESHCONTAINER* meshContainer = f->pMeshContainer; mSkinInfo = meshContainer->pSkinInfo; mSkinInfo->AddRef(); mNumBones = meshContainer->pSkinInfo->GetNumBones(); mFinalXForms.resize(mNumBones); mToRootXFormPtrs.resize(mNumBones, 0); mAnimSet = 0; buildSkinnedMesh(meshContainer->MeshData.pMesh); buildToRootXFormPtrArray();}