Book Image

Direct3D Rendering Cookbook

Book Image

Direct3D Rendering Cookbook

Overview of this book

Table of Contents (19 chapters)
Direct3D Rendering Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Further Reading
Index

Loading a static mesh from a file


In this recipe, we will create a mesh renderer that renders meshes loaded from a compiled mesh object (.CMO) file. We will use the Visual Studio graphics content pipeline to compile an Autodesk FBX model that has been exported from the open source 3D modeling and animation software, Blender (blender.org).

The class Common.Mesh within the provided sample framework will be used to load the .CMO file format and to store the loaded mesh. The loaded mesh will contain the vertex and index buffers along with material and lighting parameters and can also include the name of textures and pixel shaders to use.

Getting ready

This recipe assumes that a right-handed coordinate system is being used; see the previous recipe, Using a right-handed coordinate system.

Before we get started, there are a few files we need from the downloaded package and a class within the Common project we will review.

  1. The Common.Mesh class is a C# implementation for deserializing the compiled mesh...