CGVIS Utils
Loading...
Searching...
No Matches
Camera.h File Reference

Minimal FPS-style camera with yaw/pitch look and WASD-style motion. More...

#include "Vec3.h"
#include "Mat4.h"
Include dependency graph for Camera.h:

Go to the source code of this file.

Classes

class  Camera

Macros

#define LNC_PI   3.14159265358979323846
#define LNC_RADIANS(deg)

Detailed Description

Minimal FPS-style camera with yaw/pitch look and WASD-style motion.

Maintains position and an orthonormal basis (direction/right/up) derived from Euler yaw/pitch angles. The camera supports continuous motion toggled via boolean flags (front/back/left/right) and optional mouse-look. The view matrix is produced with a standard look-at helper.

Usage:

Camera cam({0,0,3});
// Per-event:
cam.mouseMove(x, y); // when mouse moves
cam.moveFront(true); // on key press; set to false on release
cam.updatePosition(); // once per frame
Mat4 V = cam.viewMatrix();
Mat4t< float > Mat4
Single-precision 4×4 matrix.
Definition Mat4.h:567
Definition Camera.h:29
void enableMouse()
Enable mouse-look processing in mouseMove().
Definition Camera.h:98

Macro Definition Documentation

◆ LNC_PI

#define LNC_PI   3.14159265358979323846

◆ LNC_RADIANS

#define LNC_RADIANS ( deg)
Value:
(deg * LNC_PI / 180.0)
#define LNC_PI
Definition Camera.h:3