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 bones in the mesh renderer


In this recipe, we will modify the mesh renderer to support transforming vertices based on the underlying bone structure. This necessitates the loading of the armature from the loaded mesh. This is required in order to implement mesh animations.

The Visual Studio graphics content pipeline includes bones and animations from Autodesk FBX models in the resulting CMO file. Bones are stored in the file as an array of bones, consisting of a parent index and the inverse bind pose, the bind pose, and bone local transform matrices. The root bone in a hierarchy of bones has a parent index of -1.

Getting ready

We will be using a new Autodesk FBX model along with a texture file that can be found in the downloaded content. The precompiled mesh file and texture are also included.

In this example, we will need the MeshRenderer class and the graphics content pipeline's build targets in place that were created in the Loading a static mesh from a file recipe in Chapter 3, Rendering...