Load .x File in Direct3D10

Started by
3 comments, last by Geometrian 12 years, 10 months ago
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

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

Advertisement
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.
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.
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).
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

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

Works perfectly :)
Doesn't use the mesh Direct3D10 mesh class, but I suppose that's manageable. Looks kinda unwieldy though.
Unfortunately, it's very 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

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

This topic is closed to new replies.

Advertisement