問題描述
將 3d 模型導入 Direct3D 11 示例 (Importing 3d model to Direct3D 11 Example)
I'm building an WP8 app with Direct3D 11, and need to load 3dModel.
I know how to load it in XNA, but XNA is not valid for WP8 :|
I need an example of how to load a 3d model in Direct3D 11.
‑‑‑‑‑
參考解法
方法 1:
Wavefront OBJ is a very simple and widely supported format for static 3D models. Writing a cusom importer is not difficult.
I have written a Wavefront Importer for C#. It covers the most basic features of OBJ files (sub meshes; vertex positions, normals and texture coordinates). I do not guarantee that any of this works, it should just serve as an example on how to implement a custom mesh importer. I am using SlimDX's Vector
types. You can replace them with vectors from your framework of choice.
方法 2:
Visual Studio 2012 is able to load FBX and OBJ files itself and compiles them to CMO format.
For reading CMO format and every other things you can use the sample below.
http://code.msdn.microsoft.com/windowsapps/Visual‑Studio‑3D‑Starter‑455a15f1
(by Mostafa El‑Abady、Lucius、Gökhan Şengün)