23 #ifndef __FREECAMERA__ 24 #define __FREECAMERA__ 27 #include <Eigen/Dense> 56 rotation_Z_axis = 0.0;
71 Eigen::AngleAxisf transfRotZ = Eigen::AngleAxisf(rotation_Z_axis, zAxis);
74 xAxis = transfRotZ * xAxis;
78 yAxis = transfRotZ * yAxis;
81 rotation_Z_axis = 0.0;
84 Eigen::AngleAxisf transfRotY = Eigen::AngleAxisf(
rotation_Y_axis, yAxis);
87 Eigen::Vector3f rotX = transfRotY * xAxis;
90 Eigen::AngleAxisf transfRotX = Eigen::AngleAxisf(
rotation_X_axis, rotX);
93 Eigen::Vector3f rotZ = transfRotY * zAxis;
94 rotZ = transfRotX * rotZ;
98 Eigen::Vector3f rotY = transfRotX * yAxis;
165 void rotate ( Eigen::Vector2f new_mouse_pos )
override 170 start_mouse_pos = new_position;
189 void rotateZ ( Eigen::Vector2f new_mouse_pos )
override 194 start_mouse_pos = new_position;
196 rotation_Z_axis = dir2d[1]*M_PI;
198 if (rotation_Z_axis > 2*M_PI)
199 rotation_Z_axis -= 2*M_PI;
200 if (rotation_Z_axis < 0)
float rotation_Y_axis
Rotation angles.
Definition: flycamera.hpp:65
void moveDown(void) override
Translates the view matrix down.
Definition: freecamera.hpp:148
float rotation_Z_axis
Definition: freecamera.hpp:41
Eigen::Vector2f normalizePosition(const Eigen::Vector2f &pos)
Nomalizes a screen position to range [-1,1].
Definition: flycamera.hpp:250
Eigen::Matrix3f rotation_matrix
Camera rotation (view direction)
Definition: flycamera.hpp:53
Eigen::Vector3f translation_vector
Camera position.
Definition: flycamera.hpp:59
Definition: bufferobject.hpp:34
void strideLeft(void) override
Translates the view matrix to the left.
Definition: freecamera.hpp:116
void updateViewMatrix() override
Compose rotation and translation.
Definition: freecamera.hpp:63
void rotate(Eigen::Vector2f new_mouse_pos) override
Rotates the camera view direction around X and Y axes.
Definition: freecamera.hpp:165
Flythrough camera class for manipulating a camera.
Definition: flycamera.hpp:41
void moveForward(void) override
Translates the view matrix forward.
Definition: freecamera.hpp:140
float speed
Global movement speed.
Definition: flycamera.hpp:47
void reset(void) override
Resets camera to initial position and orientation.
Definition: freecamera.hpp:48
float rotation_X_axis
Definition: flycamera.hpp:66
void moveUp(void) override
Translates the view matrix up.
Definition: freecamera.hpp:156
Eigen::Vector3f default_translation
Definition: flycamera.hpp:62
Free camera class for manipulating a camera.
Definition: freecamera.hpp:38
void strideRight(void) override
Translates the view matrix to the right.
Definition: freecamera.hpp:124
void moveBack(void) override
Translates the view matrix back.
Definition: freecamera.hpp:132
Eigen::Vector2f start_mouse_pos
Current mouse position.
Definition: flycamera.hpp:50
void rotateZ(Eigen::Vector2f new_mouse_pos) override
Rotates the camera view direction around Z axis.
Definition: freecamera.hpp:189
void resetViewMatrix(void)
Reset view matrix.
Definition: camera.hpp:88
Eigen::Affine3f view_matrix
View, or extrinsic, matrix.
Definition: camera.hpp:45