Loading *.X files in DX 8

Started by
5 comments, last by amish1234 22 years, 6 months ago
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?
___________________________________________________________Where to find the intensity (Updated Dec 28, 2004)Member of UBAAG (Unban aftermath Association of Gamedev)
Advertisement
Help maybe easier to come by in the DirectX forum, so I''am moving it there.
" The fastest code is the code you don't call "
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.
"This is stupid. I can't believe this! Ok, this time, there really IS a bug in the compiler."... 20 mins pass ..."I'M AN IDIOT!!!"
I think you mean

http://home.att.net/~rpgbook/

*Naku
APE
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?
___________________________________________________________Where to find the intensity (Updated Dec 28, 2004)Member of UBAAG (Unban aftermath Association of Gamedev)
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
------------------------------Put THAT in your smoke and pipe it
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).

This topic is closed to new replies.

Advertisement