Sign in to follow this  
niazware

x file problem

Recommended Posts

hi everybody I'm trying to open & render a skin mesh X file, but I suppose I've a problem concerning Allocator I give an error in the following line: hr = D3DXLoadMeshHierarchyFromX(strMeshPath , D3DXMESH_MANAGED , m_d3dDevice , &Alloc , NULL , &m_KeyFrameRoot , &m_pAnimController ); after finishing this line, I see that both m_keyFrameRoot and m_pAnimController are null (0x00000000), and I get a negative number for the HRESULT, please help me, I suppose there should be something wrong about my allocator, should I only use the class D3DMyApplication which is provided but SDK? I've my own engine, which only lacks Skin Mesh, and I have my own memory management and my own device, please help me: thanks in advance

Share this post


Link to post
Share on other sites
You need to implement both a frame allocator and a mesh allocator. Passing NULL for either is an error (and probably causes your negative result).

In the simplest case, you can just return "new D3DXFRAME" and "new D3DXMESHCONTAINER" and worry about things you might want to add later (caching transforms, storing parents, sharing material state etc).

In general, I don't particularly like the X file format or, especially, the D3DX interface to it, as it's poorly documented and poorly structured. Anyone with experience in performance would allocate all the matrices in one big array, and would store parents per node instead of children per node (and sort breadth-first). You can re-arrange things to be like that post-load, but the resulting shuffling is just a lot more work, and a lot more confusing to people new to the API, than it has to be.

Btw: the RayCar demo, which mostly is written to show ODE simulation of an arcade race car, actually uses .X loading and uses the frame allocation functions. You might want to check it out for reference.

Share this post


Link to post
Share on other sites
hi

thanks for your reply, it helped me a lot, but the line below:

D3DXLoadMeshHierarchyFromX(strMeshPath , D3DXMESH_MANAGED , m_d3dDevice , &Alloc , NULL , &m_KeyFrameRoot , &m_pAnimController );

is used in DirectX SDK 9 sample/skin mesh, I never use X files, as I'm an exprienced D3D programmer (since DX 2) and I even have my own 3d file format, but due to lack of time I can't implement a skin animation for myself, the line above is working properly in Microsoft sample but I can't use it in my own engine, of course the program you'd suggested helped me and I should try to analyze it, although it's written in .NET which I personally don't like at all, anyway thank again for your help, I'm still looking for more explanation about this topic, and I'd be happy to here more from you dear friends..

thanks

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