SlimDX - DX11 - C# - Meshes

Started by
2 comments, last by Pyrogame 14 years, 2 months ago
I want to load a mesh in DX11 using SlimDX in C#. I've created a simple mesh using the KHED editor and exported it as an .obj file. It is simple and I know, how to fetch the vertices and create the triangles from. But this is not simple enought. ^^ I read this topic http://www.gamedev.net/community/forums/topic.asp?topic_id=549927. There is a post mentioning that there is no mesh loader in DX11. (???) How do you load your meshes? What format are you using? What editor are you using for that format? Is there simple free software (lib, function, whatever) which appends to SlimDX? My points: I do not need mesh animation. I need texture names for each triangle/patch, or I need a simple "renderMesh()" function to call, which cares about the textures itself.
Advertisement
Quote:
There is a post mentioning that there is no mesh loader in DX11. (???)

D3D10 and 11 do not have mesh loader interfaces. It wouldn't help you anyhow; the 9 mesh loader loaded .X, not .obj (although you can use meshconvert.exe to change formats).

The SlimDX samples (in SVN) contain an example that shows how to load a SMD mesh from a file. SMD is a good interop format, but it's verbose and text-based so probably not suitable for a real-world model format. However it will show you how to load the data into the Mesh interface, so all you need to write is a loader for the .obj format, which is well-documented.
Yeah .obj is really easy. If you wanted to see some C# code for parsing the format, you could have a look at XNA custom model importer sample. Obviously that code puts the data into XNA-specific constructs, but the importing is the same.
Thank you for your replies. Hmm... OK. I will take the .obj and parse it into my own ManagedMesh class. I think, this will be the best way (and maybe the one and only).

For this mesh I will store the vertex buffer, the index buffer and the textures. Then I will provide a method to render it.

This topic is closed to new replies.

Advertisement