camera parameters and MVP matrices are calculated More...
#include <Camera.h>
Public Member Functions | |
Camera (const glm::vec3 &cameraPosition, int width, int height) | |
void | updateCameraPosition (const glm::vec3 &cameraPosition) |
Moves the camera matrix matrix. | |
void | initMouse (int x, int y) |
Initializes the mouse coordinates. | |
void | updateMouse (int x, int y, float dt) |
Updates the camera based on the mouse movement. | |
std::vector< glm::vec4 > | getPlanes () const |
void | bindMatrices (Program &shaderProgram) |
Binds the matrices to the given shader program. | |
glm::vec3 | getCameraDirection () const |
Returns the direction of the camera. | |
glm::vec3 | getNormalizedXZPlaneDirection () const |
Returns the normalized direction of the camera in the XZ plane. | |
glm::mat4 | getViewMatrix () const |
Returns the view Matrix. | |
glm::mat4 | getInverseViewMatrix () const |
Returns the inverse view matrix. | |
glm::mat4 | getProjectionMatrix () const |
Returns the projection matrix. | |
glm::vec3 | getCameraLocation () const |
Returns the camera location. | |
void | setViewMatrix (const glm::mat4 &viewMat) |
Sets the view matrix. | |
void | setProjectionMatrix (const glm::mat4 &projMat) |
Sets the projection matrix. | |
void | recalculateClippingPlanes () |
Recalculates the clipping planes. | |
bool | canClipPoint (const glm::vec4 &point, float threshold=0.0f) const |
Returns true if the given point can be clipped. | |
bool | canClipBox (const glm::vec3 &mi, const glm::vec3 &ma) const |
Returns true if the given box can be clipped. | |
void | setCulling (bool c) |
bool | isShadow () const |
void | setShadow (bool f) |
glm::quat | getRotation () const |
camera parameters and MVP matrices are calculated
This class handles all the calculations for the camera. When the user moves around with the keys or the mouse the camera parameters are recalculated. The model-, view- and projection-matrices are also calculated in this class.
Camera::Camera | ( | const glm::vec3 & | cameraPosition, |
int | width, | ||
int | height | ||
) |
Initializes the camera
cameraPosition | is the position of the camera in world coordinates |
width | is the width of the window |
height | is the height of the window |