|
Rehti MMORPG
1.0.0
Rehti MMORPG is a free and open source MMORPG game.
|
#include <Camera.hpp>

Public Member Functions | |
| Camera (glm::vec3 targetPos, float width, float height, float fovRad=glm::quarter_pi< float >(), float near=0.1f, float far=100.f, float sensitivity=0.01f) | |
| Constructor for the camera. More... | |
| glm::mat4 | getViewMatrix () const |
| Returns the view matrix of the camera, which is the inverse of the model matrix of the camera. This matrix places objects in the space of the camera. More... | |
| glm::mat4 | getOrientation () const |
| Returns the orientation of the camera. More... | |
| glm::mat4 | getProjectionMatrix () const |
| Returns the projection matrix of the camera. More... | |
| glm::vec3 | getCameraRay (double x, double y) const |
| Returns the camera ray in world space. More... | |
| glm::mat4 | getWorldToScreenMatrix () const |
| Returns the world to screen matrix. More... | |
| uint32_t | getUboSize () |
| Returns the size of the camera's UBO. More... | |
| void | orbitRotate (glm::vec2 rotationVec) |
| rotates the camera around the target. More... | |
| void | zoom (float zoomAmount) |
| Zooms the camera by the given amount. More... | |
| void | registerCameraControls (GLFWwindow *window) |
| Registers the camera controls to the given window. More... | |
| void | setSensitivity (float newSensitivity, float newZoomSens) |
| sets the sensitivity of the camera. More... | |
| void | moveLocation (glm::vec3 movement) |
| Moves the camera by the given vector. More... | |
| void | move (glm::vec3 movement) |
| Moves both the camera and the camera target by the given vector. More... | |
| void | setLocation (glm::vec3 location) |
| Sets the camera location to the given location. More... | |
| void | setTargetAndCamera (glm::vec3 location) |
| Sets the camera target to the given location and moves camera by the same amount. More... | |
| glm::vec3 | getLocation () const |
| Returns the location of the camera. More... | |
| glm::vec3 | getForward () const |
| Returns the forward direction of the camera. More... | |
| glm::vec3 | getRight () const |
| Returns the right direction of the camera. More... | |
| glm::vec3 | getUp () const |
| Returns the up direction of the camera. More... | |
| glm::vec2 | getSensitivities () const |
| Returns the sensitivity of the camera. More... | |
Static Public Attributes | |
| static bool | canMove = false |
Private Member Functions | |
| glm::mat4 | getCameraMatrixOrigon () const |
| returns the camera matrix with the target as the origon. More... | |
Static Private Member Functions | |
| static void | cursorPosCallback (GLFWwindow *pWindow, double xpos, double ypos) |
| Callback for registering mouse movement. More... | |
| static void | scrollCallback (GLFWwindow *pWindow, double xOffSet, double yOffSet) |
| callback for registering mouse scroll More... | |
Private Attributes | |
| glm::mat4 | cameraMatrixM |
| glm::mat4 | projectionM |
| glm::vec3 | targetM |
| float | sensitivityM |
| float | zoomSensitivityM |
| float | zoomM |
| float | widthM |
| float | heightM |
Static Private Attributes | |
| static double | mouseX = 0 |
| static double | mouseY = 0 |
| static std::function< void(glm::vec2)> | cameraUpdateCallback = nullptr |
| Callback for updating the camera. More... | |
| static std::function< void(float)> | cameraZoomCallback = nullptr |
| Callback for updating the camera. More... | |
@ brief Camera class that enables orbiting around a target. This class allows querying for view and projection matrices or a combination of both.
| Camera::Camera | ( | glm::vec3 | targetPos, |
| float | width, | ||
| float | height, | ||
| float | fovRad = glm::quarter_pi<float>(), |
||
| float | near = 0.1f, |
||
| float | far = 100.f, |
||
| float | sensitivity = 0.01f |
||
| ) |
Constructor for the camera.
| target | Target to follow. TODO Changed later |
| width | Width of the screen |
| height | Height of the screen |
| fovRad | Field of view in radians, defaults to quarter pi = 45 degrees |
| near | Near plane distance |
| far | Far plane distance |
| sensitivity | Sensitivity of the camera |

|
staticprivate |
Callback for registering mouse movement.

|
private |
returns the camera matrix with the target as the origon.


| glm::vec3 Camera::getCameraRay | ( | double | x, |
| double | y | ||
| ) | const |
Returns the camera ray in world space.


| glm::vec3 Camera::getForward | ( | ) | const |
Returns the forward direction of the camera.

| glm::vec3 Camera::getLocation | ( | ) | const |
Returns the location of the camera.

| glm::mat4 Camera::getOrientation | ( | ) | const |
Returns the orientation of the camera.
| glm::mat4 Camera::getProjectionMatrix | ( | ) | const |
Returns the projection matrix of the camera.
| glm::vec3 Camera::getRight | ( | ) | const |
Returns the right direction of the camera.

| glm::vec2 Camera::getSensitivities | ( | ) | const |
Returns the sensitivity of the camera.
| uint32_t Camera::getUboSize | ( | ) |
Returns the size of the camera's UBO.

| glm::vec3 Camera::getUp | ( | ) | const |
Returns the up direction of the camera.
| glm::mat4 Camera::getViewMatrix | ( | ) | const |
Returns the view matrix of the camera, which is the inverse of the model matrix of the camera. This matrix places objects in the space of the camera.


| glm::mat4 Camera::getWorldToScreenMatrix | ( | ) | const |
Returns the world to screen matrix.


| void Camera::move | ( | glm::vec3 | movement | ) |
Moves both the camera and the camera target by the given vector.

| void Camera::moveLocation | ( | glm::vec3 | movement | ) |
Moves the camera by the given vector.
| movement |

| void Camera::orbitRotate | ( | glm::vec2 | rotationVec | ) |
rotates the camera around the target.
| rotationVec | to rotate the camera by. |


| void Camera::registerCameraControls | ( | GLFWwindow * | window | ) |
Registers the camera controls to the given window.
| window |

|
staticprivate |
callback for registering mouse scroll


| void Camera::setLocation | ( | glm::vec3 | location | ) |
Sets the camera location to the given location.
| location |

| void Camera::setSensitivity | ( | float | newSensitivity, |
| float | newZoomSens | ||
| ) |
sets the sensitivity of the camera.
| newSensitivity | of the camera movement |
| newZoomSens | is the zoom sensitivity |
| void Camera::setTargetAndCamera | ( | glm::vec3 | location | ) |
Sets the camera target to the given location and moves camera by the same amount.
| location |


| void Camera::zoom | ( | float | zoomAmount | ) |
Zooms the camera by the given amount.
| zoomAmount |


|
private |
|
staticprivate |
Callback for updating the camera.
|
staticprivate |
Callback for updating the camera.
|
static |
|
private |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |