Adding a camera to the renderer
To start with a free view in the renderer, we need these two additional variables:
- Azimuth: To store the view angle around the camera location in the virtual world, also known as yaw
- Elevation: For the up/down view of the camera, also called pitch
To visualize the two variables, let us use Figure 6.3:
Figure 6.3: Elevation and azimuth of an object
The azimuth is the clockwise rotation around an imaginary vertical line pointing upward from the center of our coordinate system, and the elevation is the angle of the height of the object, as seen from the center of the coordinate system.
These two new variables go into the OGLRenderData
struct of the OGLRenderData.h
file in the opengl
folder:
float rdViewAzimuth = 320.0f;
float rdViewElevation = -15.0f;
The initialization values are hand-picked to have the textured box placed in the middle of the screen when running the program...