Camera processes input and calculates the corresponding Euler Angles, Vectors and Matrices for use in OpenGL.
More...
#include <Camera.hpp>
|
| Camera (glm::vec3 position=glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3 up=glm::vec3(0.0f, 1.0f, 0.0f), float yaw=YAW, float pitch=PITCH) |
| constructor with vectors. More...
|
|
| Camera (float posX, float posY, float posZ, float upX, float upY, float upZ, float yaw, float pitch) |
| constructor with scalar values. More...
|
|
glm::mat4 | view_matrix () const |
|
void | move_camera (Movement direction, float deltaTime) |
| Processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems). More...
|
|
void | rotate_camera (float x_offset, float y_offset, bool constrainPitch=true) |
| Processes input received from a mouse input system. Expects the offset value in both the x and y direction. More...
|
|
void | zoom (float offset) |
| Processes input received from a mouse scroll-wheel event. Only requires to be input on the vertical wheel-axis. More...
|
|
|
static constexpr float | YAW = -90.0f |
| Default camera values. More...
|
|
static constexpr float | PITCH = 0.0f |
|
static constexpr float | SPEED = 2.5f |
|
static constexpr float | SENSITIVITY = 0.1f |
|
static constexpr float | ZOOM = 45.0f |
|
Camera processes input and calculates the corresponding Euler Angles, Vectors and Matrices for use in OpenGL.
◆ Movement
Defines several possible options for camera movement. Used as abstraction to stay away from window-system specific input methods.
Enumerator |
---|
None | |
FORWARD | |
BACKWARD | |
LEFT | |
RIGHT | |
UP | |
DOWN | |
◆ Camera() [1/2]
engine::graphics::Camera::Camera |
( |
glm::vec3 |
position = glm::vec3(0.0f, 0.0f, 0.0f) , |
|
|
glm::vec3 |
up = glm::vec3(0.0f, 1.0f, 0.0f) , |
|
|
float |
yaw = YAW , |
|
|
float |
pitch = PITCH |
|
) |
| |
|
explicit |
constructor with vectors.
◆ Camera() [2/2]
engine::graphics::Camera::Camera |
( |
float |
posX, |
|
|
float |
posY, |
|
|
float |
posZ, |
|
|
float |
upX, |
|
|
float |
upY, |
|
|
float |
upZ, |
|
|
float |
yaw, |
|
|
float |
pitch |
|
) |
| |
constructor with scalar values.
◆ view_matrix()
glm::mat4 engine::graphics::Camera::view_matrix |
( |
| ) |
const |
- Returns
- returns the view matrix calculated using Euler Angles and the LookAt Matrix.
◆ move_camera()
void engine::graphics::Camera::move_camera |
( |
Movement |
direction, |
|
|
float |
deltaTime |
|
) |
| |
Processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems).
◆ rotate_camera()
void engine::graphics::Camera::rotate_camera |
( |
float |
x_offset, |
|
|
float |
y_offset, |
|
|
bool |
constrainPitch = true |
|
) |
| |
Processes input received from a mouse input system. Expects the offset value in both the x and y direction.
◆ zoom()
void engine::graphics::Camera::zoom |
( |
float |
offset | ) |
|
Processes input received from a mouse scroll-wheel event. Only requires to be input on the vertical wheel-axis.
◆ update_camera_vectors()
void engine::graphics::Camera::update_camera_vectors |
( |
| ) |
|
|
private |
Calculates the front vector from the Camera's (updated) Euler Angles.
◆ YAW
constexpr float engine::graphics::Camera::YAW = -90.0f |
|
staticconstexpr |
◆ PITCH
constexpr float engine::graphics::Camera::PITCH = 0.0f |
|
staticconstexpr |
◆ SPEED
constexpr float engine::graphics::Camera::SPEED = 2.5f |
|
staticconstexpr |
◆ SENSITIVITY
constexpr float engine::graphics::Camera::SENSITIVITY = 0.1f |
|
staticconstexpr |
◆ ZOOM
constexpr float engine::graphics::Camera::ZOOM = 45.0f |
|
staticconstexpr |
◆ Position
glm::vec3 engine::graphics::Camera::Position {} |
Defines a position in World-Space of where the Camera is located.
◆ Front
glm::vec3 engine::graphics::Camera::Front {} |
Defines a vector in which the camera is pointed relative to the Camera::Position.
◆ Up
glm::vec3 engine::graphics::Camera::Up {} |
Defines the Up vector in the World-Space.
◆ Right
glm::vec3 engine::graphics::Camera::Right {} |
Defines the camera Right vector.
◆ WorldUp
glm::vec3 engine::graphics::Camera::WorldUp {} |
Defines the up orientation of the World-Space.
◆ Yaw
float engine::graphics::Camera::Yaw {} |
◆ Pitch
float engine::graphics::Camera::Pitch {} |
◆ MovementSpeed
float engine::graphics::Camera::MovementSpeed {} |
Used in Camera::move_camera. The higher the value the faster the camera will move on keyboard action.
◆ MouseSensitivity
float engine::graphics::Camera::MouseSensitivity {} |
◆ Zoom
float engine::graphics::Camera::Zoom {} |
The documentation for this class was generated from the following files: