Graphics Reference
In-Depth Information
How to do it…
We will begin by adding the additional build targets and then including the FBX model
and checking that it correctly compiles.
1. First we need to install the additional build targets in to our project file.
Unload your project by right-clicking on the project in the Solution Explorer
and selecting Unload Project.
2. Next, right-click on the project again and select Edit ProjectName.csproj.
3. We need to insert the following code into the project file just before the closing </
Project> tag. Here we are assuming that the additional build target files are
located in the directory above this project.
<Import Project="..\MeshContentTask.targets" />
4. Right-click on the project and select Reload Project.
5. Now, add the Male_base_mesh.fbx file into the project directory and include
it in the project.
6. Select the FBX file within the Solution Explorer and then within the Build Action
in the Properties window, select MeshContentTask.
7.
Build the project ( F6 ) and confirm that in the build output directory, there is the
compiled mesh file: bin\Debug\Male_base_mesh.cmo (or the bin\Debug\AppX
directory for Windows Store apps). Any messages from the content pipeline will also
appear in the build output window.
The modified MeshContentTask.* files are based upon the Visual
Studio 2012 Update 2 and Visual Studio 2013 releases. If for some reason
they are not working correctly for you, a copy of the compiled mesh object
is included in Ch03_03LoadMesh\Male_base_mesh.cmo . This can
then be included in the project. Once this is done, select Copy if newer as
the copy for the output directory option.
Mesh Renderer
Now that we have our compiled mesh, we need to create a mesh renderer.
1. Follow the steps given in the Creating a Direct3D renderer class recipe in Chapter 2 ,
Rendering with Direct3D , to create our MeshRenderer class.
2. Add the following private member fields and public property:
// The vertex buffer
List<Buffer> vertexBuffers = new List<Buffer>();
// The index buffer
 
Search WWH ::




Custom Search