56 lines
1.5 KiB
C
56 lines
1.5 KiB
C
|
#ifndef __CAMERA_H__
|
||
|
#define __CAMERA_H__
|
||
|
|
||
|
#include "util/Common.h"
|
||
|
|
||
|
// Defines several possible options for camera movement. Used as abstraction to stay away from window-system specific input methods
|
||
|
enum Camera_Movement {
|
||
|
FORWARD,
|
||
|
BACKWARD,
|
||
|
LEFT,
|
||
|
RIGHT
|
||
|
};
|
||
|
|
||
|
// Default camera values
|
||
|
const GLfloat YAW = -90.0f;
|
||
|
const GLfloat PITCH = 0.0f;
|
||
|
const GLfloat ROLL = 0.0f;
|
||
|
const GLfloat SPEED = 3.0f;
|
||
|
const GLfloat SENSITIVTY = 0.25f;
|
||
|
const GLfloat ZOOM = 45.0f;
|
||
|
|
||
|
class Camera
|
||
|
{
|
||
|
public:
|
||
|
Camera(glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f), GLfloat yaw = YAW, GLfloat pitch = PITCH, GLfloat roll = ROLL);
|
||
|
Camera(GLfloat posX, GLfloat posY, GLfloat posZ, GLfloat upX, GLfloat upY, GLfloat upZ, GLfloat yaw, GLfloat pitch, GLfloat roll);
|
||
|
~Camera();
|
||
|
|
||
|
glm::mat4 getViewMatrix();
|
||
|
glm::vec3 getPosition() const { return m_position; }
|
||
|
void ProcessKeyboard(Camera_Movement direction, GLfloat deltaTime);
|
||
|
void ProcessMouseMovement(GLfloat xoffset, GLfloat yoffset, GLboolean constrainPitch);
|
||
|
void ProcessMouseScroll(GLfloat yoffset);
|
||
|
|
||
|
GLfloat getFOV() const { return m_zoom; }
|
||
|
private:
|
||
|
glm::vec3 m_position;
|
||
|
glm::vec3 m_front;
|
||
|
glm::vec3 m_up;
|
||
|
glm::vec3 m_right;
|
||
|
glm::vec3 m_worldUp;
|
||
|
|
||
|
// Eular Angles
|
||
|
GLfloat m_yaw;
|
||
|
GLfloat m_pitch;
|
||
|
GLfloat m_roll;
|
||
|
|
||
|
// Camera options
|
||
|
GLfloat m_movementSpeed;
|
||
|
GLfloat m_mouseSensitivity;
|
||
|
GLfloat m_zoom;
|
||
|
|
||
|
void updateCameraVectors();
|
||
|
};
|
||
|
#endif // __CAMERA_H__
|