|
Brenta Engine 1.0
|
#include <camera.hpp>
Data Structures | |
| class | Builder |
| Builder pattern for the Camera class. More... | |
Public Member Functions | |
| Camera ()=default | |
| Default constructor. | |
| Camera (Enums::CameraType camera_type, Enums::ProjectionType projection_type, glm::vec3 position, glm::vec3 worldUp, glm::vec3 center, float movementSpeed, float mouseSensitivity, float zoom, Types::SphericalCoordinates sphericalCoordinates, Types::EulerAngles eulerAngles, glm::vec3 front, glm::vec3 up, glm::vec3 right) | |
| Constructor. | |
| Enums::CameraType | GetCameraType () |
| Get the camera type. | |
| Enums::ProjectionType | GetProjectionType () |
| Get the projection type. | |
| glm::vec3 | GetPosition () |
| Get the position of the camera. | |
| glm::vec3 | GetWorldUp () |
| Get the world up vector. | |
| glm::vec3 | GetCenter () |
| Get the center of the sphere. | |
| float | GetMovementSpeed () |
| Get the movement speed. | |
| float | GetMouseSensitivity () |
| Get the mouse sensitivity. | |
| float | GetZoom () |
| Get the zoom level. | |
| Types::SphericalCoordinates | GetSphericalCoordinates () |
| Get the spherical coordinates of the camera. | |
| Types::EulerAngles | GetEulerAngles () |
| Get the euler angles of the camera. | |
| glm::mat4 | GetViewMatrix () |
| Get the view matrix. | |
| glm::mat4 | GetProjectionMatrix () |
| Get the projection matrix. | |
| glm::vec3 | GetFront () |
| Get the front vector. | |
| glm::vec3 | GetUp () |
| Get the up vector. | |
| glm::vec3 | GetRight () |
| Get the right vector. | |
| bool | GetFirstMouse () |
| Get the first mouse flag. | |
| float | GetLastX () |
| Get the last x position of the mouse. | |
| float | GetLastY () |
| Get the last y position of the mouse. | |
| void | SetCameraType (Enums::CameraType camera_type) |
| Set the camera type. | |
| void | SetProjectionType (Enums::ProjectionType projection_type) |
| Set the projection type. | |
| void | SetWorldUp (glm::vec3 worldUp) |
| Set the world up vector. | |
| void | SetCenter (glm::vec3 center) |
| Set the center of the sphere. | |
| void | SetMovementSpeed (float movementSpeed) |
| Set the movement speed. | |
| void | SetMouseSensitivity (float mouseSensitivity) |
| Set the mouse sensitivity. | |
| void | SetZoom (float zoom) |
| Set the zoom level. | |
| void | SetSphericalCoordinates (Types::SphericalCoordinates sphericalCoordinates) |
| Set the spherical coordinates of the camera. | |
| void | SetEulerAngles (Types::EulerAngles eulerAngles) |
| Set the euler angles of the camera. | |
| void | SetFront (glm::vec3 front) |
| Set the front vector. | |
| void | SetUp (glm::vec3 up) |
| Set the up vector. | |
| void | SetRight (glm::vec3 right) |
| Set the right vector. | |
| void | SetPosition (glm::vec3 position) |
| Set the position of the camera. | |
| void | SetFirstMouse (bool firstMouse) |
| Set the first mouse flag. | |
| void | SetLastX (float lastX) |
| Set the last x position of the mouse. | |
| void | SetLastY (float lastY) |
| Set the last y position of the mouse. | |
| void | updateCameraEuler () |
| Update the camera euler angles. | |
| void | SphericalToCartesian () |
| Update the camera spherical coordinates. | |
Data Fields | |
| Enums::ProjectionType | ProjectionType |
| Projection type. | |
| Enums::CameraType | CameraType |
| Camera type. | |
| glm::vec3 | Position |
| Camera position. | |
| glm::vec3 | WorldUp |
| The world up vector. | |
| glm::vec3 | center |
| The center of the spehere. | |
| float | MovementSpeed |
| Space translational movement speed. | |
| float | MouseSensitivity |
| Mouse sensitivity. | |
| float | Zoom |
| Zoom level (field of view) | |
| Types::SphericalCoordinates | sphericalCoordinates |
| Spherical coordinates. | |
| Types::EulerAngles | eulerAngles |
| Euler angles. | |
| glm::vec3 | Front |
| Front vector. | |
| glm::vec3 | Up |
| Up vector. | |
| glm::vec3 | Right |
| Right vector. | |
| bool | firstMouse = true |
| Is the first mouse movement? | |
| float | lastX |
| Last x position of the mouse. | |
| float | lastY |
| 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 ORTHOGRAPHIC.
Definition at line 119 of file camera.hpp.
|
default |
Default constructor.
This constructor initializes the camera with default values.
| Camera::Camera | ( | Enums::CameraType | camera_type, |
| Enums::ProjectionType | projection_type, | ||
| glm::vec3 | position, | ||
| glm::vec3 | worldUp, | ||
| glm::vec3 | center, | ||
| float | movementSpeed, | ||
| float | mouseSensitivity, | ||
| float | zoom, | ||
| Types::SphericalCoordinates | sphericalCoordinates, | ||
| Types::EulerAngles | eulerAngles, | ||
| glm::vec3 | front, | ||
| glm::vec3 | up, | ||
| glm::vec3 | right ) |
Constructor.
Full constructor that initializes the camera with the specified values.
Definition at line 37 of file camera.cpp.
| Enums::CameraType Camera::GetCameraType | ( | ) |
| glm::vec3 Camera::GetCenter | ( | ) |
Get the center of the sphere.
Definition at line 175 of file camera.cpp.
| Types::EulerAngles Camera::GetEulerAngles | ( | ) |
Get the euler angles of the camera.
Definition at line 226 of file camera.cpp.
| bool Camera::GetFirstMouse | ( | ) |
| glm::vec3 Camera::GetFront | ( | ) |
| float Camera::GetLastX | ( | ) |
Get the last x position of the mouse.
Definition at line 276 of file camera.cpp.
| float Camera::GetLastY | ( | ) |
Get the last y position of the mouse.
Definition at line 286 of file camera.cpp.
| float Camera::GetMouseSensitivity | ( | ) |
| float Camera::GetMovementSpeed | ( | ) |
| glm::vec3 Camera::GetPosition | ( | ) |
Get the position of the camera.
Definition at line 155 of file camera.cpp.
| glm::mat4 Camera::GetProjectionMatrix | ( | ) |
| Enums::ProjectionType Camera::GetProjectionType | ( | ) |
| glm::vec3 Camera::GetRight | ( | ) |
| Types::SphericalCoordinates Camera::GetSphericalCoordinates | ( | ) |
Get the spherical coordinates of the camera.
Definition at line 215 of file camera.cpp.
| glm::vec3 Camera::GetUp | ( | ) |
| glm::mat4 Camera::GetViewMatrix | ( | ) |
| glm::vec3 Camera::GetWorldUp | ( | ) |
| float Camera::GetZoom | ( | ) |
| void Camera::SetCameraType | ( | Enums::CameraType | camera_type | ) |
Set the camera type.
| camera_type | The camera type |
Definition at line 140 of file camera.cpp.
| void Camera::SetCenter | ( | glm::vec3 | center | ) |
Set the center of the sphere.
| center | The center of the sphere |
Definition at line 180 of file camera.cpp.
| void Camera::SetEulerAngles | ( | Types::EulerAngles | eulerAngles | ) |
Set the euler angles of the camera.
| eulerAngles | The euler angles of the camera |
Definition at line 231 of file camera.cpp.
| void Camera::SetFirstMouse | ( | bool | firstMouse | ) |
Set the first mouse flag.
| firstMouse | The first mouse flag |
Definition at line 271 of file camera.cpp.
| void Camera::SetFront | ( | glm::vec3 | front | ) |
| void Camera::SetLastX | ( | float | lastX | ) |
Set the last x position of the mouse.
| lastX | The last x position of the mouse |
Definition at line 281 of file camera.cpp.
| void Camera::SetLastY | ( | float | lastY | ) |
Set the last y position of the mouse.
| lastY | The last y position of the mouse |
Definition at line 291 of file camera.cpp.
| void Camera::SetMouseSensitivity | ( | float | mouseSensitivity | ) |
Set the mouse sensitivity.
| mouseSensitivity | The mouse sensitivity |
Definition at line 200 of file camera.cpp.
| void Camera::SetMovementSpeed | ( | float | movementSpeed | ) |
Set the movement speed.
| movementSpeed | The movement speed |
Definition at line 190 of file camera.cpp.
| void Camera::SetPosition | ( | glm::vec3 | position | ) |
Set the position of the camera.
| position | The position of the camera |
Definition at line 160 of file camera.cpp.
| void Camera::SetProjectionType | ( | Enums::ProjectionType | projection_type | ) |
Set the projection type.
| projection_type | The projection type |
Definition at line 150 of file camera.cpp.
| void Camera::SetRight | ( | glm::vec3 | right | ) |
| void Camera::SetSphericalCoordinates | ( | Types::SphericalCoordinates | sphericalCoordinates | ) |
Set the spherical coordinates of the camera.
| sphericalCoordinates | The spherical coordinates of the camera |
Definition at line 220 of file camera.cpp.
| void Camera::SetUp | ( | glm::vec3 | up | ) |
| void Camera::SetWorldUp | ( | glm::vec3 | worldUp | ) |
Set the world up vector.
| worldUp | The world up vector |
Definition at line 170 of file camera.cpp.
| void Camera::SetZoom | ( | float | zoom | ) |
| void Camera::SphericalToCartesian | ( | ) |
Update the camera spherical coordinates.
This function needs to be called every time the camera spherical coordinates are updated. It the correct position of the camera from the spherical coordinates.
Definition at line 107 of file camera.cpp.
| void Camera::updateCameraEuler | ( | ) |
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 120 of file camera.cpp.
| Enums::CameraType Brenta::Camera::CameraType |
Camera type.
Definition at line 129 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 146 of file camera.hpp.
| Types::EulerAngles Brenta::Camera::eulerAngles |
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 175 of file camera.hpp.
| bool Brenta::Camera::firstMouse = 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 200 of file camera.hpp.
| glm::vec3 Brenta::Camera::Front |
Front vector.
This vector represents the front direction of the camera.
Definition at line 181 of file camera.hpp.
| float Brenta::Camera::lastX |
Last x position of the mouse.
Definition at line 204 of file camera.hpp.
| float Brenta::Camera::lastY |
Last y position of the mouse.
Definition at line 208 of file camera.hpp.
| float Brenta::Camera::MouseSensitivity |
Mouse sensitivity.
Definition at line 154 of file camera.hpp.
| float Brenta::Camera::MovementSpeed |
Space translational movement speed.
Definition at line 150 of file camera.hpp.
| glm::vec3 Brenta::Camera::Position |
Camera position.
Definition at line 133 of file camera.hpp.
| Enums::ProjectionType Brenta::Camera::ProjectionType |
Projection type.
Definition at line 125 of file camera.hpp.
| glm::vec3 Brenta::Camera::Right |
Right vector.
This vector represents the right direction of the camera.
Definition at line 193 of file camera.hpp.
| Types::SphericalCoordinates Brenta::Camera::sphericalCoordinates |
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 167 of file camera.hpp.
| glm::vec3 Brenta::Camera::Up |
Up vector.
This vector represents the up direction of the camera.
Definition at line 187 of file camera.hpp.
| glm::vec3 Brenta::Camera::WorldUp |
The world up vector.
This vector defines the up direction in the world space.
Definition at line 139 of file camera.hpp.
| float Brenta::Camera::Zoom |
Zoom level (field of view)
Definition at line 158 of file camera.hpp.