Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

amish1234

Loading *.X files in DX 8

This topic is 6231 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am just starting D3D, and I want to load a mesh with animations. I have loaded a mesh with no animation using a LPD3DXMESH object. I have also seen code that loads a mesh using a LPDIRECTXFILE object. I then made a simple animated model in MilkShape 3D, and tried loading it. I just saw the first frame of animation, as I expected. Does anyone know how to access other frames of animation in the .X file, preferably using LPD3DXMESH? I will probably set up a doubly linked list of animation frames once I learn how to access the model''s different frames. Thank you. Have you gone on a rampage today?

Share this post


Link to post
Share on other sites
Advertisement
LPD3DXMESH will only load the first frame of a mesh. The only way to do animation with the LPD3DXMESH interface is to have each frame in a different subset, and then linear interpolate between each frame. The dolphin demo illustates this technique well. Also there is a 1/2 decent tutorial on MSDN that shows this.

But if you want skeletal animation (you probably know this already, but that is a way of connecting each polygon in your mesh to a certain bone, and then you move a bone and all the polys connected to that bone move, there is more to it than that, but you get the point), you have to use skinning via the LPD3DXSKINMESH interface. To use that, you have to parse the actual .x file data with the LPDIRECTXFILE interface you are trying to tackle. Then you load in the skeleton heirarcy (arm bone connected to the, wrist bone )
Its not a beginners topic although Jim Adams talks of it as though it is extremely easy. His book discusses this topic in detail. His site is http://home.att.net.~rpgbook
You can download his animation demo there but if you want the code you are going to have to buy the book

However if you just want to load in the mesh and dont animate it, which you probably have already done, check out the 6th tutorial in the dx sdk meshes. It will tell you how to do everything.

Share this post


Link to post
Share on other sites
Thanx for your help. Are there any disadvantages (such as low performance) to using LPD3DXMESH? Is D3DX the new name for D3D retained-mode? I know in DX7 and below, Immediate mode was harder to use, but had good performance and the opposite was true for retained mode.

Have you gone on a rampage today?

Share this post


Link to post
Share on other sites
On the front page of gamedev, there is a big thing that says:

"loading .X files tutorial"

I don''t know if it is DX or not.

"I''ve sparred with creatures from the nine hells themselves... I barely plan on breaking a sweat here, today."~Drizzt Do''Urden

Share this post


Link to post
Share on other sites
That is for parsing .X files. It is much easier to use the LPD3DXMESH to load models. Not much documentation on it though because of it''s limited use (Not able to have animations as far as I can see).

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!