Camera class for managing camera properties and transformations in a 3D scene.
More...
#include <Camera.h>
|
MANDRILL_API | Camera (ptr< Device > pDevice, GLFWwindow *pWindow, ptr< Swapchain > pSwapchain) |
| Create a new camera.
|
|
MANDRILL_API | ~Camera () |
| Destructor of camera.
|
|
MANDRILL_API void | updateAspectRatio () |
| Update the aspect ratio that is used for the camera matrix. Call this if the window size changes.
|
|
MANDRILL_API void | update (float delta, glm::vec2 cursorDelta) |
| Update function to handle camera movements. Call this each app update.
|
|
MANDRILL_API bool | isMouseCaptured () const |
| Check if camera has captured the mouse movements.
|
|
MANDRILL_API void | captureMouse (bool capture) |
| Set the capture state of the mouse.
|
|
MANDRILL_API bool | toggleMouseCapture () |
| Toggle mouse capture state, without specifying the new state.
|
|
MANDRILL_API glm::vec3 | getPosition () const |
| Get the position of the camera.
|
|
MANDRILL_API void | setPosition (glm::vec3 pos) |
| Set the position of the camera.
|
|
MANDRILL_API glm::vec3 | getDirection () const |
| Get the direction of the camera.
|
|
MANDRILL_API void | setDirection (glm::vec3 dir) |
| Set the direction of the camera.
|
|
MANDRILL_API void | setTarget (glm::vec3 target) |
| Set the target the camera should look towards.
|
|
MANDRILL_API void | setUp (glm::vec3 up) |
| Set the up direction of the camera.
|
|
MANDRILL_API void | setFov (float fov) |
| Set the field of view of the camera.
|
|
MANDRILL_API void | setMoveSpeed (float speed) |
| Set the movement speed of the camera.
|
|
MANDRILL_API glm::mat4 | getViewMatrix () const |
| Get the view matrix of the camera.
|
|
MANDRILL_API glm::mat4 | getProjectionMatrix () const |
| Get the projection matrix of the camera.
|
|
MANDRILL_API ptr< Descriptor > | getDescriptor () const |
| Get the descriptor of the camera, containing the view and projection matrices, and their invertations.
|
|
VkWriteDescriptorSet | getWriteDescriptor (uint32_t binding) const |
| Get the write descriptor of the camera. Use this with when using push descriptors.
|
|
Camera class for managing camera properties and transformations in a 3D scene.
◆ Camera()
Camera::Camera |
( |
ptr< Device > |
pDevice, |
|
|
GLFWwindow * |
pWindow, |
|
|
ptr< Swapchain > |
pSwapchain |
|
) |
| |
Create a new camera.
- Parameters
-
◆ captureMouse()
MANDRILL_API void Mandrill::Camera::captureMouse |
( |
bool |
capture | ) |
|
|
inline |
Set the capture state of the mouse.
- Parameters
-
- Returns
◆ getDescriptor()
MANDRILL_API ptr< Descriptor > Mandrill::Camera::getDescriptor |
( |
| ) |
const |
|
inline |
Get the descriptor of the camera, containing the view and projection matrices, and their invertations.
- Returns
- Descriptor
◆ getDirection()
MANDRILL_API glm::vec3 Mandrill::Camera::getDirection |
( |
| ) |
const |
|
inline |
Get the direction of the camera.
- Returns
◆ getPosition()
MANDRILL_API glm::vec3 Mandrill::Camera::getPosition |
( |
| ) |
const |
|
inline |
Get the position of the camera.
- Returns
◆ getProjectionMatrix()
MANDRILL_API glm::mat4 Mandrill::Camera::getProjectionMatrix |
( |
| ) |
const |
|
inline |
Get the projection matrix of the camera.
- Returns
- Projection matrix
◆ getViewMatrix()
MANDRILL_API glm::mat4 Mandrill::Camera::getViewMatrix |
( |
| ) |
const |
|
inline |
Get the view matrix of the camera.
- Returns
- View matrix
◆ getWriteDescriptor()
VkWriteDescriptorSet Mandrill::Camera::getWriteDescriptor |
( |
uint32_t |
binding | ) |
const |
|
inline |
Get the write descriptor of the camera. Use this with when using push descriptors.
- Parameters
-
binding | Binding where the descriptor will be placed |
- Returns
- Write descriptor
◆ isMouseCaptured()
MANDRILL_API bool Mandrill::Camera::isMouseCaptured |
( |
| ) |
const |
|
inline |
Check if camera has captured the mouse movements.
- Returns
- True if captured, otherwise false
◆ setDirection()
MANDRILL_API void Mandrill::Camera::setDirection |
( |
glm::vec3 |
dir | ) |
|
|
inline |
Set the direction of the camera.
- Parameters
-
- Returns
◆ setFov()
MANDRILL_API void Mandrill::Camera::setFov |
( |
float |
fov | ) |
|
|
inline |
Set the field of view of the camera.
- Parameters
-
- Returns
◆ setMoveSpeed()
MANDRILL_API void Mandrill::Camera::setMoveSpeed |
( |
float |
speed | ) |
|
|
inline |
Set the movement speed of the camera.
- Parameters
-
- Returns
◆ setPosition()
MANDRILL_API void Mandrill::Camera::setPosition |
( |
glm::vec3 |
pos | ) |
|
|
inline |
Set the position of the camera.
- Parameters
-
- Returns
◆ setTarget()
MANDRILL_API void Mandrill::Camera::setTarget |
( |
glm::vec3 |
target | ) |
|
|
inline |
Set the target the camera should look towards.
- Parameters
-
- Returns
◆ setUp()
MANDRILL_API void Mandrill::Camera::setUp |
( |
glm::vec3 |
up | ) |
|
|
inline |
Set the up direction of the camera.
- Parameters
-
- Returns
◆ toggleMouseCapture()
MANDRILL_API bool Mandrill::Camera::toggleMouseCapture |
( |
| ) |
|
|
inline |
Toggle mouse capture state, without specifying the new state.
- Returns
◆ update()
void Camera::update |
( |
float |
delta, |
|
|
glm::vec2 |
cursorDelta |
|
) |
| |
Update function to handle camera movements. Call this each app update.
- Parameters
-
delta | Time since last update |
cursorDelta | Mouse cursor movement |
- Returns
◆ updateAspectRatio()
void Camera::updateAspectRatio |
( |
| ) |
|
Update the aspect ratio that is used for the camera matrix. Call this if the window size changes.
- Returns
The documentation for this class was generated from the following files:
- /home/runner/work/Mandrill/Mandrill/src/Camera.h
- /home/runner/work/Mandrill/Mandrill/src/Camera.cpp