#include <Camera.h>
|
| | Camera (Vec3 position, float moveSpeed=0.015f, float mouseSens=0.15f, Vec3 worldUp=Vec3(0.0f, 1.0f, 0.0f)) |
| | Construct a camera at position with speeds/sensitivity and an up axis.
|
| void | updatePosition () |
| | Integrate position one step based on active movement flags.
|
| Mat4 | viewMatrix () |
| | Compute the view (camera) matrix.
|
| void | moveFront (bool b) |
| | Toggle forward motion along the view direction.
|
| void | moveBack (bool b) |
| | Toggle backward motion along the view direction.
|
| void | moveRight (bool b) |
| | Toggle motion to the right (strafe).
|
| void | moveLeft (bool b) |
| | Toggle motion to the left (strafe).
|
| void | enableMouse () |
| | Enable mouse-look processing in mouseMove().
|
| void | disableMouse () |
| | Disable mouse-look and reset the internal cursor cache.
|
| void | mouseMove (float xPosition, float yPosition) |
| | Update yaw/pitch from a new cursor position.
|
◆ Camera()
| Camera::Camera |
( |
Vec3 | position, |
|
|
float | moveSpeed = 0.015f, |
|
|
float | mouseSens = 0.15f, |
|
|
Vec3 | worldUp = Vec3(0.0f, 1.0f, 0.0f) ) |
|
inline |
Construct a camera at position with speeds/sensitivity and an up axis.
- Parameters
-
| position | Initial world position. |
| moveSpeed | Linear speed per update (world units per frame). |
| mouseSens | Mouse sensitivity in degrees per pixel. |
| worldUp | World up vector used to build the orthonormal basis. |
◆ disableMouse()
| void Camera::disableMouse |
( |
| ) |
|
|
inline |
Disable mouse-look and reset the internal cursor cache.
Resets the cached mouse position so the next mouseMove() call establishes a new reference without producing a jump.
◆ enableMouse()
| void Camera::enableMouse |
( |
| ) |
|
|
inline |
◆ mouseMove()
| void Camera::mouseMove |
( |
float | xPosition, |
|
|
float | yPosition ) |
|
inline |
Update yaw/pitch from a new cursor position.
- Parameters
-
| xPosition | New cursor X in window coordinates (pixels). |
| yPosition | New cursor Y in window coordinates (pixels). |
When enabled, computes pixel deltas since the previous call, scales them by mouseSens, applies them to yaw/pitch, clamps pitch to [-89,89], and rebuilds the basis. The first call after enabling only seeds the cache.
◆ moveBack()
| void Camera::moveBack |
( |
bool | b | ) |
|
|
inline |
Toggle backward motion along the view direction.
◆ moveFront()
| void Camera::moveFront |
( |
bool | b | ) |
|
|
inline |
Toggle forward motion along the view direction.
◆ moveLeft()
| void Camera::moveLeft |
( |
bool | b | ) |
|
|
inline |
Toggle motion to the left (strafe).
◆ moveRight()
| void Camera::moveRight |
( |
bool | b | ) |
|
|
inline |
Toggle motion to the right (strafe).
◆ updatePosition()
| void Camera::updatePosition |
( |
| ) |
|
|
inline |
Integrate position one step based on active movement flags.
Applies moveSpeed along direction and right depending on which toggles are set. Call this once per frame.
◆ viewMatrix()
| Mat4 Camera::viewMatrix |
( |
| ) |
|
|
inline |
Compute the view (camera) matrix.
- Returns
- Right-handed look-at matrix from position toward forward direction.
The documentation for this class was generated from the following file: