Parse DirectX mesh file (.x) in C#

2.2k Views Asked by At

I have a requirement in which I have to save my 3D mesh figure in .x format. I am making my figures using WPF with C# (as DirectX support not present in Visual Studio 2010 - C#).

After making 3D figures (sphere, cone etc), I have to store the vertex, normals etc in .x file. Can't use any other format as the need is to keep it supported with DirectX.

I am not able to find a parser which can allow me to read and write in .x file (in C#) without using DirectX APIs. I only found one in C++ here: http://www.xbdev.net/3dformats/x/x_binary/index.php. But this is regular read/write parsing and I was looking for some library or APIs.

Can someone please help on this?

1

There are 1 best solutions below

0
Colin Smith On

You've got the X model spec described on MSDN here:

Another point of view from Paul Bourke:

And you could look at MonoGame:

Not sure how far along they have got in actually fully implementing support for the different DirectX asset formats, but there's a stack of code you could look at in MonoGame.Framework.Content.Pipeline\Graphics and MonoGame.Framework\Graphics for inspiration.