Sign in to follow this  
Geometrian

Load .x File in Direct3D10

Recommended Posts

Geometrian    1810
Hi,

So, after much dredging the internet, I have been unable to find any code to load .x files into Direct3D10. I just need something simple--meshes with vertex, normal, and material data--no animations or anything fancy. I hear of a fabled journal entry by a Jack Hoxley, but it appears to not exist. Can someone point me to any relevant resource here? Just a snippet of code is all I need . . .

Thanks!
-G

Share this post


Link to post
Share on other sites
MJP    19786
Well I can't really give you a "snippet" of code, since it's not that simple. The D3DX9 Mesh class can load .X files, and you can ask them for their vertex/index/material data so that you can convert/load the data into D3D10 equivalents. This isn't too complicated, but there are some parts that take a little work. For instance, converting the D3D9 vertex declaration into a D3D10 input layout. If you download any of the samples on my blog, there's a "Model" class that does this. It can also load .sdkmesh files from the newer samples.

Another alternative is that you can use the MeshConvert utility to convert from .x to .sdkmesh, after which you can load the file using the SDKMesh class in DXUT.

Share this post


Link to post
Share on other sites
katsh    140
i wish i could say to you "just buy my book then the answer is all there".
but i cant since the book is japanese.
but i can give you 1 of my sample project that load a static mesh from X file.
im not sure its work for your PC (maybe it work).
comment is all japanese so its useless for you :P

there are more sample in the book,
like load Hierarchy(animation) mesh,Skinned mesh,bump skined mesh
from X file,FBX,COLLADA,OBJ.

Share this post


Link to post
Share on other sites
Geometrian    1810
[quote name='katsh' timestamp='1307083863' post='4818957']but i can give you 1 of my sample project that load a static mesh from X file.
im not sure its work for your PC (maybe it work).[/quote]Works perfectly :)
Doesn't use the mesh Direct3D10 mesh class, but I suppose that's manageable. Looks kinda unwieldy though.

MJP: download links seem to be broken.

Thanks all,
-G

Share this post


Link to post
Share on other sites
Geometrian    1810
[quote name='Geometrian' timestamp='1307122789' post='4819146']Works perfectly :)
Doesn't use the mesh Direct3D10 mesh class, but I suppose that's manageable. Looks kinda unwieldy though.[/quote]Unfortunately, it's [i]very[/i] unwieldy indeed. Although the example runs fine (some problems on exit), I can't isolate the critical code without breaking it. In all honesty, I have no idea why it works at all. Like, dwNumMaterial isn't ever initialized (not even with ZeroMemory). I even used the same .x file in the example, but to no avail.

I'm basically looking for an object class--with load and draw methods. Any help?

Thanks,
G

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