Using a right-handed coordinate system
Up to this point, we have used a left-handed coordinate system, where the z axis points away from the view. The Visual Studio graphics content pipeline assumes a right-handed coordinate system when producing .cmo
files. For the resulting 3D models we use for the remainder of this book, use a clockwise vertex winding order. The difference between left-handed and right-handed coordinates can be seen in the following figure:
In this recipe, we will look at the changes necessary to use a right-handed coordinate system and what this means for our 3D assets. This recipe can be applied to any SharpDX Direct3D application.
How to do it…
We will first step through the changes to the view and projection setup and then look at the changes necessary to the vertices within the simple QuadRenderer
class.
When creating the view matrix, use
SharpDX.Matrix.LookAtRH
instead ofSharpDX...