CGPdocs

camera_controller_first_person

Mouse and keyboard control of a camera_first_person.

Derives from: camera_controller_generic_base

Fields and methods

Members of the struct camera_controller_first_person. Most of what you do with a CGP type goes through the free functions listed below.

Fields

camera_first_person camera_modelFirst person camera (free rotation) driven by the controller.
float translation_speed = 1Multiplier of the translation speed for keyboard moves and right mouse drag, 1 by default.
float rotation_speed = 1Multiplier of the rotation speed for mouse drags and Q/E twists, 1 by default.

Methods

Returns camera_model as a read-only camera_generic_base. src
Updates the camera from the mouse displacement when the cursor is not on the GUI; left drag (or any move in cursor-captured mode) rotates in yaw and pitch, Ctrl + left drag rolls, right drag moves forward/backward. src
Toggles the cursor-captured mode with Shift+C (Escape releases the cursor). src
Moves the camera while keys are held, at 2 * translation_speed units per second; up/W and down/S forward/backward, left/A and right/D sideways, R/F up/down, and Q/E roll at 2 * rotation_speed radians per second. src
Places the camera at eye looking toward center with the given up vector. src
Returns a text describing the mouse and keyboard controls of the first person camera. src
Inherited from camera_controller_generic_base (5 members)

Fields

bool is_active = trueEnables the controller, true by default; when false the mouse and idle actions return without moving the camera.
input_devices* inputs = nullptrPointer to the global keyboard/mouse state, nullptr until initialize() is called.
window_structure* window = nullptrPointer to the global window state, nullptr until initialize() is called.

Methods

Stores pointers to the global inputs and window; must be called before any action function. src
Handles a mouse button press or release event; does nothing in the base class. src

Functions taking a camera_controller_first_person

None.

Functions returning a camera_controller_first_person

None.

Operators

None.

CGP - Computer Graphics Programming.