Graphics Reference
In-Depth Information
3
Rendering Meshes
In this chapter, we will cover the following topics:
F Rendering a cube and sphere
F Preparing the vertex and constant buffers for materials and lighting
F Adding material and lighting
F Using a right-handed coordinate system
F Loading a static mesh from a file
Introduction
A mesh is technically just a vertex and index buffer that represents a 3D object, and if we
look at what we have already covered, we can easily understand this. However, these objects
nearly always require a number of additional properties, such as material (surface and lighting
properties), textures, submeshes, bones, and animations. This is what Microsoft has done in
the past with their ID3DX10Mesh interface; however, this is not available for Direct3D 11
(along with a number of other utility classes), and it is now recommended that you roll your own.
There are other open source projects that provide the replacement
functionality, part of which is used in the SharpDX Toolkit and part of
which we will be using here. Most notable is the DirectX Tool Kit that
is available at https://directxtk.codeplex.com/ .
For our purpose, a mesh is the combination of submeshes, materials, object extent, bones,
animations, and references to common assets such as textures and shaders. We will begin by
working with these elements separately and then pulling them together within a mesh renderer.
Search WWH ::




Custom Search