CGPdocs

camera_first_person_euler

First person camera oriented by yaw and pitch angles (keeps the up direction).

Derives from: camera_generic_base

Fields and methods

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

Fields

float rollTwist angle in radians around the view direction, 0 by default.
float pitchUp/down rotation angle in radians around the local x axis, 0 by default.
float yawLeft/right rotation angle in radians around axis_of_rotation, 0 by default.
vec3 axis_of_rotationUp direction of the camera when pitch = 0, around which yaw rotates, (0,1,0) by default.
vec3 position_cameraPosition of the camera in world space, (0,0,0) by default.

Methods

Rotates axis_of_rotation by the angle magnitude (radians) around R_axis * (0,0,1), the front direction of the frame when yaw = pitch = 0. src
Adds d_roll, d_pitch and d_yaw (radians) to the angles roll, pitch and yaw. src
Translates the camera by tr.x * right() + tr.y * up(). src
Translates the camera by magnitude * front(). src
Sets axis_of_rotation to axis without changing the angles (the axis is used as given, it is not normalized). src
Places the camera at eye looking toward center by setting position_camera, pitch and yaw; roll and axis_of_rotation are kept, so the up vector is not a free parameter. src
Builds an Euler first person camera at the origin with zero angles and axis_of_rotation (0,1,0). src
Returns position_camera. src
Returns the rotation R_axis * R_yaw * R_pitch * R_roll, where R_axis maps (0,1,0) to axis_of_rotation, yaw is around y, pitch around x and roll around -z. src
Inherited from camera_generic_base (6 members)

Methods

Returns the camera frame built from orientation() and position(). src
Returns the 4x4 view matrix (world to camera), the inverse of the camera frame matrix. src
Returns the 4x4 matrix of the camera frame (camera to world), the inverse of matrix_view(). src
Returns the viewing direction, the opposite of the third column (local z axis) of orientation(). src
Returns the up direction of the camera, the second column (local y axis) of orientation(). src
Returns the right direction of the camera, the first column (local x axis) of orientation(). src

Functions taking a camera_first_person_euler

Compute 3

Documented on another page

  • picking_mesh_vertex_as_sphereCasts the camera ray through the screen position and returns the closest vertex whose sphere of radius picking_distance it hits, with the hit point, the vertex normal and the vertex index (active is false if none).on vec2
  • picking_plane_orthogonal_to_cameraIntersects the camera ray through the screen position (relative coordinates) with the plane through plane_position orthogonal to the front direction of the camera.on vec2
  • picking_spheresCast a ray through a screen position (normalized device coordinates) and return the closest hit among spheres of common radius, with its index, position and normal.on vec2

Functions returning a camera_first_person_euler

None.

Operators

None.

CGP - Computer Graphics Programming.