D3DXLoadMeshHierarchyFromX returns E_FAIL  
Author Message
edenxiii





PostPosted: Game Technologies: Graphics, D3DXLoadMeshHierarchyFromX returns E_FAIL Top

Hi all,

I'm having some trouble loading a skinned mesh from file using D3DXLoadMeshHierarchyFromX(). The function returns E_FAIL, but according to the documentation the return value should be either E_OUTOFMEMORY or E_INVALIDCALL. I thought the problem might have been due to an error in my derived ID3DXAllocateHierarchy interface, but I've traced through the code and both CreateFrame() and CreateMeshContainer() allocate memory as they should and return successfully.

What other factors could cause D3DXLoadMeshFromHierarchy() to return E_FAIL aside from an error in the derived ID3DXAllocateHierarchy interface I thought that perhaps the mesh I was trying to load might be faulty, but it loads fine in the DXViewer. Any help is appreciated.

T.I.A.

Rob Meridy



Game Technologies: DirectX, XNA, XACT, etc.9  
 
 
edenxiii





PostPosted: Game Technologies: Graphics, D3DXLoadMeshHierarchyFromX returns E_FAIL Top

Haha,

It turns out it was because I had neglected to assign the final parameter of CreateFrame to the new MeshContainer the function generated...simple human error. However, this does raise an interesting point: you can not unit test D3DXLoadMeshFromHierarchy() or any of the functions in ID3DXAllocateHierarchy, because D3DXLoadMeshFromHierarchy() checks the data pointed to by the individual parameters for validity.

In my case, by neglecting to assign data to the MeshContainer pointer, D3DXLoadMeshFromHierarchy interpreted the null value as failure (despite the S_OK result my interface code path returned). I suspect that may have something to do with the final step of generating the AnimationController object.

In any case, I guess the lesson here is: unit testing is not a panacea.

thanks,

Rob Meridy