Engine
camera.h
1  #pragma once
2 #ifndef CAMERA_H
3 #define CAMERA_H
4 // Std. Includes
5 #include <vector>
6 #include <GL/glew.h>
7 #include <Eigen/Core>
8 #include <Eigen/Geometry>
9 #include <look_at.h>
10 #include <vector3G.h>
11 
12 // Defines several possible options for camera movement. Used as abstraction to stay away from window-system specific input methods
13 enum Camera_Movement {
14  FORWARD,
15  BACKWARD,
16  LEFT,
17  RIGHT
18 };
19 
20 
21 // An abstract camera class that processes input and calculates the corresponding Eular Angles, Vectors and Matrices for use in OpenGL
28 class Camera
29 {
30 public:
31  // Camera Attributes
32  Vector3Gf m_position;
33  Vector3Gf m_front;
34  Vector3Gf m_up;
35  Vector3Gf m_right;
36  Vector3Gf m_world_up;
37  // Eular Angles
38  GLfloat m_yaw;
39  GLfloat m_pitch;
40  // Camera options
41  GLfloat m_movement_speed;
42  GLfloat m_mouse_sensitivity;
43  GLfloat m_zoom;
44 
52  Camera(Vector3Gf position = Vector3Gf(0.0f, 0.0f, 0.0f), Vector3Gf up = Vector3Gf(0.0f, 1.0f, 0.0f), GLfloat yaw = -90.0f, GLfloat pitch = 0.0f);
53 
57  Eigen::Matrix<GLfloat,4,4> GetViewMatrix();
58 
64  void ProcessKeyboard(Camera_Movement direction, GLfloat deltaTime);
65 
72  void ProcessMouseMovement(GLfloat xoffset, GLfloat yoffset, GLboolean constrainPitch = true);
73 
78  void ProcessMouseScroll(GLfloat yoffset);
79 
80 private:
84  void UpdateCameraVectors();
85 };
86 #endif
Camera(Vector3Gf position=Vector3Gf(0.0f, 0.0f, 0.0f), Vector3Gf up=Vector3Gf(0.0f, 1.0f, 0.0f), GLfloat yaw=-90.0f, GLfloat pitch=0.0f)
Definition: camera.cpp:18
Eigen::Matrix< GLfloat, 4, 4 > GetViewMatrix()
Definition: camera.cpp:27
void ProcessMouseMovement(GLfloat xoffset, GLfloat yoffset, GLboolean constrainPitch=true)
Definition: camera.cpp:46
void ProcessMouseScroll(GLfloat yoffset)
Definition: camera.cpp:67
A Camera is used to view a scene from a particular vantage point.
Definition: camera.h:28
void ProcessKeyboard(Camera_Movement direction, GLfloat deltaTime)
Definition: camera.cpp:33