Game Development Reference

In-Depth Information

And finally we will use both the quad's normal and the newly computed right vector to re-

calculate the up vector to ensure it is orthonormal.

The procedure is illustrated in Figure 43.

Figure
43
- Creating a world oriented orthonormal basis.

The final transformation matrix will be given by the orthonormal basis we just calculated

with the translation given by the quad's world space position.

This will be the transformation that we will pass down to the graphics device as the quad's

world space transformation.

// forward is the unit vector that holds the quad's world orientation.

vector3 right = forward.Cross(vector3::UnitY);

vector3 up = right.Cross(forward);

up.Normalize();

matrix transform = matrix::Create(right, up, forward, m_position);