You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

60 lines
2.8 KiB

#ifndef CAMERA_H
#define CAMERA_H
#include "ShaderProgram.h"
#include "ExternalLib/glm/glm.hpp"
#include "ExternalLib/glad.h"
#include "Mesh.h"
/**************************************************************
* Camera : Camera is sotring every information needed to *
* "create a camera", including its position, its *
* rotation, direction, view and projection matrices *
**************************************************************/
class Camera
{
public:
GLint viewLoc; // Location of view Matrix in sp
GLint projectionLoc; // Location of projection Matrix in sp
int* width; // width of the renderingWindow, pointer so we don't need to update it when resizing
int* height; // height of the renderingWindow, pointer so we don't need to update it when resizing
glm::vec3 cameraPos; // position of the camera in worldSpace coordinates
glm::vec3 cameraForward; // facing direction ...
glm::vec3 cameraUp; // up direction ...
GLfloat FOV = 80; // camera's FOV
float FOVScrollStep = 5.0f; // camera's FOV scroll step
glm::mat4 projection; // Projection Matrix for the Coordinate Conversion Pipeline
glm::mat4 view; // View Matrix for the Coordinate Conversion Pipeline
float cameraPitch; // camera's pitch
float cameraYaw; // camera's yaw
float cameraRoll; // camera's roll
float cameraRollStep; // Step used for roll
float cameraStep; // Step used for planar movements
// Player's configuration dependant // TODO serialize those informations
float minDistance = 0.1f; // camera's minimum rendering distance
float maxDistance = 10.0f; // camera's maximum rendering distance
float xAxisSensitivity = 0.1f; // mouse sensitivity for the X axis
float yAxisSensitivity = 0.2f; // mouse sensitivity for the X axis
bool invertXAxis = false; // invert X axis
bool invertYAxis = false; // invert Y axis for more "plane simulator"ish controls
/***** Constructors *****/
Camera(){} // TODO : just a glut to allow Cameras in RenderingWindow.h
Camera(int* width_, int* height_, float minDistance_, float maxDistance_);
/***** Methods *****/
void actualizeViewMatrix();
void actualizeProjectionMatrix();
void bindToShaderProgram(const ShaderProgram& sp);
void setPosition(const glm::vec3& cameraPosition_);
Camera mirrorCamera(const glm::mat4& mirrorModelMatrix, const glm::vec4& mirror, const glm::vec4& pointOnMirror) const;
};
#endif /* CAMERA_H */