Basic operations that can be performed on 3D models include moving the objects in a desired direction for a selected distance (number of units).
Preparing a translation matrix
How to do it...
- Prepare three variables of type float named x, y, and z, and initialize them with the amount of translation (movement distance) applied to the object along the x (right/left), y (up/down), and z (near/far) directions respectively.
- Create a variable of type std::array<float, 16> named translation_matrix that will hold a matrix representing the desired operation. Initialize elements of the translation_matrix array with the following values:
- All elements initialize with a 0.0f value
- 0th, 5th, 10th, and 15th elements (main diagonal) with a 1.0f value
- 12th element with a...