|
Brenta Engine 1.2
|
The Camera class. More...
#include <camera.hpp>
Data Structures | |
| class | builder |
| Builder pattern for the Camera class. More... | |
| struct | config |
Public Types | |
| enum class | camera_type { aircraft , spherical } |
| enum class | projection_type { perspective , orthographic } |
| enum class | camera_movement { forward , backward , left , right } |
| Camera movement directions. More... | |
Public Member Functions | |
| camera ()=default | |
| Default constructor. | |
| camera (config conf) | |
| Constructor. | |
| camera::camera_type | get_camera_type () |
| camera::projection_type | get_projection_type () |
| glm::vec3 | get_position () |
| glm::vec3 | get_world_up () |
| glm::vec3 | get_center () |
| float | get_movement_speed () |
| float | get_mouse_sensitivity () |
| float | get_zoom () |
| types::spherical_coordinates | get_spherical_coordinates () |
| types::euler_angles | get_euler_angles () |
| glm::mat4 | get_view_matrix () |
| glm::mat4 | get_projection_matrix (int window_width, int window_height) |
| glm::vec3 | get_front () |
| glm::vec3 | get_up () |
| glm::vec3 | get_right () |
| bool | get_first_mouse () |
| Get the first mouse flag. | |
| float | get_last_x () |
| Get the last x position of the mouse. | |
| float | get_last_y () |
| Get the last y position of the mouse. | |
| void | set_camera_type (camera::camera_type camera_type) |
| void | set_projection_type (camera::projection_type projection_type) |
| void | set_world_up (glm::vec3 world_up) |
| void | set_center (glm::vec3 center) |
| void | set_movement_speed (float movement_speed) |
| void | set_mouse_sensitivity (float mouse_sensitivity) |
| void | set_zoom (float zoom) |
| void | set_spherical_coordinates (types::spherical_coordinates spherical_coordinates) |
| void | set_euler_angles (types::euler_angles euler_angles) |
| void | set_front (glm::vec3 front) |
| void | set_up (glm::vec3 up) |
| void | set_right (glm::vec3 right) |
| void | set_position (glm::vec3 position) |
| void | set_first_mouse (bool first_mouse) |
| void | set_last_x (float last_x) |
| Set the last x position of the mouse. | |
| void | set_last_y (float last_y) |
| Set the last y position of the mouse. | |
| void | update_camera_euler () |
| Update the camera euler angles. | |
| void | spherical_to_cartesian () |
| Update the camera spherical coordinates. | |
Data Fields | |
| projection_type | proj_type |
| camera_type | cam_type |
| glm::vec3 | position |
| glm::vec3 | world_up |
| The world up vector. | |
| glm::vec3 | center |
| The center of the spehere. | |
| float | movement_speed |
| Space translational movement speed. | |
| float | mouse_sensitivity |
| float | zoom |
| Zoom level (field of view) | |
| types::spherical_coordinates | spherical_coordinates |
| Spherical coordinates. | |
| types::euler_angles | euler_angles |
| Euler angles. | |
| glm::vec3 | front |
| Front vector. | |
| glm::vec3 | up |
| Up vector. | |
| glm::vec3 | right |
| Right vector. | |
| bool | first_mouse = true |
| Is the first mouse movement? | |
| float | last_x |
| Last x position of the mouse. | |
| float | last_y |
| Last y position of the mouse. | |
The Camera class.
This class represents a camera in the 3D world. It is used to define the position, orientation and projection of the camera. The class provides a builder pattern to create a camera object, and it export a default global camera called "camera" that needs to be defined somewhere in the Brenta namespace.
The camera can be of two types: aircraft or spherical. The aircraft type is used to represent a camera that moves in the world space, while the spherical type is used to represent a camera that rotates around a center point. They use respectively euler angles and spherical coordinates to represent the position of the camera.
The camera can have two types of projection: perspective or prthographic.
Definition at line 96 of file camera.hpp.
|
strong |
Camera movement directions.
Used to store the direction of the camera movement when reacting to keyboard input.
Definition at line 118 of file camera.hpp.
|
strong |
Definition at line 100 of file camera.hpp.
|
strong |
Definition at line 106 of file camera.hpp.
|
default |
Default constructor.
This constructor initializes the camera with default values.
| camera::camera | ( | config | conf | ) |
Constructor.
Full constructor that initializes the camera with the specified values.
Definition at line 12 of file camera.cpp.
| camera::camera_type camera::get_camera_type | ( | ) |
Definition at line 105 of file camera.cpp.
| glm::vec3 camera::get_center | ( | ) |
Definition at line 145 of file camera.cpp.
| types::euler_angles camera::get_euler_angles | ( | ) |
Definition at line 196 of file camera.cpp.
| bool camera::get_first_mouse | ( | ) |
| glm::vec3 camera::get_front | ( | ) |
Definition at line 206 of file camera.cpp.
| float camera::get_last_x | ( | ) |
Get the last x position of the mouse.
Definition at line 246 of file camera.cpp.
| float camera::get_last_y | ( | ) |
Get the last y position of the mouse.
Definition at line 256 of file camera.cpp.
| float camera::get_mouse_sensitivity | ( | ) |
Definition at line 165 of file camera.cpp.
| float camera::get_movement_speed | ( | ) |
Definition at line 155 of file camera.cpp.
| glm::vec3 camera::get_position | ( | ) |
Definition at line 125 of file camera.cpp.
| glm::mat4 camera::get_projection_matrix | ( | int | window_width, |
| int | window_height ) |
Definition at line 55 of file camera.cpp.
| camera::projection_type camera::get_projection_type | ( | ) |
Definition at line 115 of file camera.cpp.
| glm::vec3 camera::get_right | ( | ) |
Definition at line 226 of file camera.cpp.
| types::spherical_coordinates camera::get_spherical_coordinates | ( | ) |
Definition at line 185 of file camera.cpp.
| glm::vec3 camera::get_up | ( | ) |
Definition at line 216 of file camera.cpp.
| glm::mat4 camera::get_view_matrix | ( | ) |
Definition at line 42 of file camera.cpp.
| glm::vec3 camera::get_world_up | ( | ) |
Definition at line 135 of file camera.cpp.
| float camera::get_zoom | ( | ) |
Definition at line 175 of file camera.cpp.
| void camera::set_camera_type | ( | camera::camera_type | camera_type | ) |
Definition at line 110 of file camera.cpp.
| void camera::set_center | ( | glm::vec3 | center | ) |
Definition at line 150 of file camera.cpp.
| void camera::set_euler_angles | ( | types::euler_angles | euler_angles | ) |
Definition at line 201 of file camera.cpp.
| void camera::set_first_mouse | ( | bool | first_mouse | ) |
Definition at line 241 of file camera.cpp.
| void camera::set_front | ( | glm::vec3 | front | ) |
Definition at line 211 of file camera.cpp.
| void camera::set_last_x | ( | float | last_x | ) |
Set the last x position of the mouse.
| lastX | The last x position of the mouse |
Definition at line 251 of file camera.cpp.
| void camera::set_last_y | ( | float | last_y | ) |
Set the last y position of the mouse.
| lastY | The last y position of the mouse |
Definition at line 261 of file camera.cpp.
| void camera::set_mouse_sensitivity | ( | float | mouse_sensitivity | ) |
Definition at line 170 of file camera.cpp.
| void camera::set_movement_speed | ( | float | movement_speed | ) |
Definition at line 160 of file camera.cpp.
| void camera::set_position | ( | glm::vec3 | position | ) |
Definition at line 130 of file camera.cpp.
| void camera::set_projection_type | ( | camera::projection_type | projection_type | ) |
Definition at line 120 of file camera.cpp.
| void camera::set_right | ( | glm::vec3 | right | ) |
Definition at line 231 of file camera.cpp.
| void camera::set_spherical_coordinates | ( | types::spherical_coordinates | spherical_coordinates | ) |
Definition at line 190 of file camera.cpp.
| void camera::set_up | ( | glm::vec3 | up | ) |
Definition at line 221 of file camera.cpp.
| void camera::set_world_up | ( | glm::vec3 | world_up | ) |
Definition at line 140 of file camera.cpp.
| void camera::set_zoom | ( | float | zoom | ) |
Definition at line 180 of file camera.cpp.
| void camera::spherical_to_cartesian | ( | ) |
Update the camera spherical coordinates.
This function needs to be called every time the camera spherical coordinates are updated. It sets the correct position of the camera from the spherical coordinates.
Definition at line 74 of file camera.cpp.
| void camera::update_camera_euler | ( | ) |
Update the camera euler angles.
This function needs to be called every time the camera euler angles are updated. It calculates the correct front, up and right vectors from the euler angles.
Definition at line 90 of file camera.cpp.
| camera_type brenta::camera::cam_type |
Definition at line 127 of file camera.hpp.
| glm::vec3 brenta::camera::center |
The center of the spehere.
When using a spherical camera, this is the center of the sphere the camera is rotating around.
Definition at line 141 of file camera.hpp.
| types::euler_angles brenta::camera::euler_angles |
Euler angles.
If the camera is of type AIRCRAFT, these are the euler angles of the camera. Euler angles are used to represent the orientation of a rigid body in 3D space, those are yaw, pitch and roll.
Definition at line 167 of file camera.hpp.
| bool brenta::camera::first_mouse = true |
Is the first mouse movement?
This flag is used to check if the mouse movement is the first movement of the camera.
Definition at line 192 of file camera.hpp.
| glm::vec3 brenta::camera::front |
Front vector.
This vector represents the front direction of the camera.
Definition at line 173 of file camera.hpp.
| float brenta::camera::last_x |
Last x position of the mouse.
Definition at line 196 of file camera.hpp.
| float brenta::camera::last_y |
Last y position of the mouse.
Definition at line 200 of file camera.hpp.
| float brenta::camera::mouse_sensitivity |
Definition at line 146 of file camera.hpp.
| float brenta::camera::movement_speed |
Space translational movement speed.
Definition at line 145 of file camera.hpp.
| glm::vec3 brenta::camera::position |
Definition at line 128 of file camera.hpp.
| projection_type brenta::camera::proj_type |
Definition at line 126 of file camera.hpp.
| glm::vec3 brenta::camera::right |
Right vector.
This vector represents the right direction of the camera.
Definition at line 185 of file camera.hpp.
| types::spherical_coordinates brenta::camera::spherical_coordinates |
Spherical coordinates.
If the camera is of type SPHERICAL, these are the spherical coordinates of the camera. Spherical coordinates are used to represent the position of a point in 3D space, those are theta, phi and radius.
Definition at line 159 of file camera.hpp.
| glm::vec3 brenta::camera::up |
Up vector.
This vector represents the up direction of the camera.
Definition at line 179 of file camera.hpp.
| glm::vec3 brenta::camera::world_up |
The world up vector.
This vector defines the up direction in the world space.
Definition at line 134 of file camera.hpp.
| float brenta::camera::zoom |
Zoom level (field of view)
Definition at line 150 of file camera.hpp.