Sign in to follow this  
Michael1984

D3DXLoadMeshHierarchyFromX

Recommended Posts

Hello, first of all i want to apologize for my english. I try to load a morphed character. To do this i use the function D3DXLoadMeshHierarchyFromX and create a class CLoadUserData. class CLoadUserData: public ID3DXLoadUserData{ public: STDMETHOD(LoadFrameChildData)(THIS_ LPD3DXFRAME pFrame, LPD3DXFILEDATA pXofChildData); STDMETHOD(LoadMeshChildData)(THIS_ LPD3DXMESHCONTAINER pMeshContainer, LPD3DXFILEDATA pXofChildData); STDMETHOD(LoadTopLevelData)(THIS_ LPD3DXFILEDATA pXofChildData); CLoadUserData(){} }; But i have a problem. Can anybody tell me who i can read out my user defined data fropm the x-file? HRESULT CLoadUserData::LoadTopLevelData(LPD3DXFILEDATA pXofChildData){ hr=pXofChildData->GetId(&pId); if(FAILED(hr)) return hr; hr = pXofChildData->GetType(&type); if(FAILED(hr)) return hr; hr=pXofChildData->GetName(NULL, &cchName); if(FAILED(hr)) return hr; hr=pXofChildData->Lock(&dwSize, (LPCVOID*)&pData); if(FAILED(hr)) return hr; // read data? hr = pXofChildData->Unlock(); if(FAILED(hr)) return hr; return hr; } Thanks, Michael. Edit: This is an extract from the x-file: ... template MorphAnimationKey { <2746B58A-B375-4cc3-8D23-7D094D3C7C67> DWORD Time; // Key's time STRING MeshName; // Mesh to use (name reference) } template MorphAnimationSet { <0892DE81-915A-4f34-B503-F7C397CB9E06> DWORD NumKeys; // # keys in animation array MorphAnimationKey Keys[NumKeys]; } ... MorphAnimationSet Dance { 7; 0; "Figure1";, 500; "Figure2";, 1000; "Figure3";, 1500; "Figure4";, 2000; "Figure3";, 2500; "Figure2";, 3000; "Figure1";; }

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this