The third transformation that can be performed on a 3D model is scaling. This allows us to change an object's size.
Preparing a scaling matrix
How to do it...
- Prepare three variables of type float named x, y, and z that will hold the scaling factor applied to a model in x (width), y (height), and z (depth) dimensions, respectively.
- Create a variable of type std::array<float, 16> named scaling_matrix, in which a matrix representing the desired operation will be stored. Initialize elements of the scaling_matrix array with the following values:
- All elements initialize with a 0.0f value
- 0th element with a value stored in the x variable
- 5th element with a value stored in the y variable
- 10th element with a value stored in the z variable
- 15th element with a...