Game Development Reference
In-Depth Information
Next up, we need to add a few matrix variables:
Matrix m_ViewMatrix; // This is our view
matrix.
Matrix m_ProjectionMatrix; // The projection
matrix.
Matrix m_CubeWorldMatrix;
Matrix m_CubeRotationMatrix;
The first two variables will hold our view and projection matrices. We will look at
these matrices in more detail in a moment. The other two variables hold two matrices
for our cube object. The world matrix is used to convert the coordinates of a model
into world space , which is the coordinate system of our 3D world.
A model is a 3D geometrical representation of an object. In other words, it holds all
of the geometry for the object it represents. Models often have their own coordinate
system known as model space , which is why we need to convert it.
Lastly, the rotation matrix you see there for our cube controls the pitch, yaw, and roll
of our cube. It is known as a transformation matrix , because it transforms the ob-
ject we use it on in some way, such as moving it, scaling it, or rotating it. The projec-
tion and view matrices are, of course, also transformation matrices. Transformation
matrices are a very central concept in 3D graphics.
Now, we also need to add a few depth stencil and sampler member variables:
// Depth stencil vars
Texture2D m_DepthStencilTexture = null;
DepthStencilView m_DepthStencilView = null;
// Sampler vars.
ShaderResourceView m_CubeTexture;
SamplerState m_CubeTexSamplerState;
The first variable holds the depth stencil's texture. The depth stencil is basically a
texture. Each pixel in it holds a depth value representing the nearest object that has
Search WWH ::




Custom Search