ngfx::Camera
Inherits from ngfx::InputListener
Public Functions
Name | |
---|---|
virtual | ~Camera() |
virtual void | onKey(KeyCode keyCode, InputAction keyAction) override |
virtual void | onScroll(double xoffset, double yoffset) override |
virtual void | onCursorPos(double x, double y) override |
virtual void | onMouseButton(MouseButton button, InputAction action) override |
void | update() |
Public Attributes
Name | |
---|---|
float | panX |
float | panY |
float | zoom |
float | yaw |
float | pitch |
float | roll |
mat4 | viewMat |
uint32_t | state |
double | x |
double | y |
Public Functions Documentation
function ~Camera
inline virtual ~Camera()
Destroy the camera
function onKey
virtual void onKey(
KeyCode keyCode,
InputAction keyAction
) override
Parameters:
- keyCode The key code
- keyAction The key action
Reimplements: ngfx::InputListener::onKey
Handle key press input event
function onScroll
virtual void onScroll(
double xoffset,
double yoffset
) override
Parameters:
- xoffset The relative x offset
- yoffset The relative y offset
Reimplements: ngfx::InputListener::onScroll
Handle scroll input event
function onCursorPos
virtual void onCursorPos(
double x,
double y
) override
Parameters:
- x The relative x movement
- y The relative y movement
Reimplements: ngfx::InputListener::onCursorPos
Handle cursor move event
function onMouseButton
virtual void onMouseButton(
MouseButton button,
InputAction action
) override
Parameters:
- button The mouse button
- action The mouse button event
Reimplements: ngfx::InputListener::onMouseButton
Handle mouse button event
function update
void update()
Update camera parameters This function is called once per frame
Public Attributes Documentation
variable panX
float panX = 0.0f;
The camera pan along the x axis
variable panY
float panY = 0.0f;
The camera pan along the y axis
variable zoom
float zoom = 0.0f;
The camera zoom
variable yaw
float yaw = 0.0f;
The camera yaw (radians)
variable pitch
float pitch = 0.0f;
The camera pitch (radians)
variable roll
float roll = 0.0f;
The camera roll (radians) The camera view matrix
variable viewMat
mat4 viewMat;
variable state
uint32_t state = 0;
variable x
double x = -1.0;
variable y
double y = -1.0;
Updated on 3 April 2021 at 20:21:51 PDT