CGPdocs

camera_controller_fly_mode

Plane-like camera control moving forward continuously.

Derives from: camera_controller_first_person

module 19_camera_controllersource: camera_controller_fly_mode.hpp

Fields and methods

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

Fields

float speed = 0.05fCurrent forward speed in units per second, 0.05 by default, kept between speed_min and speed_max.
float roll = 0.8fRoll rate in radians per second applied while left/right (or A/D) is held, 0.8 by default.
float pitch = 0.5fPitch rate in radians per second applied while up/down (or W/S) is held, 0.5 by default.
float speed_increase = 1.02fFactor, 1.02 by default, by which speed is multiplied (or divided) per frame at 60 fps while +/R (or -/F) is held; the rate does not depend on the frame rate (factor speed_increase^(60 dt) per frame).
float speed_max = 0.5fUpper bound of speed, 0.5 by default.
float speed_min = 0.0001fLower bound of speed, 0.0001 by default.

Methods

Rolls the camera from the horizontal and pitches it from the vertical mouse displacement, during a left drag or for any move in cursor-captured mode, when the cursor is not on the GUI. src
Moves the camera forward by speed * time_interval at each frame, pitching with up/down (W/S), rolling with left/right (A/D) and changing speed with +/R and -/F. src
Returns a text describing the mouse and keyboard controls of the fly mode. src
Inherited from camera_controller_first_person (6 members)

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
Toggles the cursor-captured mode with Shift+C (Escape releases the cursor). src
Places the camera at eye looking toward center with the given up vector. 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_fly_mode

None.

Functions returning a camera_controller_fly_mode

None.

Operators

None.

CGP - Computer Graphics Programming.