CGPdocs

camera_first_person

Camera with a free position and orientation (first person view).

Derives from: camera_generic_base

module 10_camera_modelsource: camera_first_person.hpp

Fields and methods

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

Fields

rotation_transform orientation_cameraOrientation of the camera frame (identity by default, the camera then looks toward -z).
vec3 position_cameraPosition of the camera in world space, (0,0,0) by default.

Methods

Builds a first person camera at the origin with identity orientation (looking toward -z). src
Returns position_camera. src
Returns orientation_camera. src
Rotates the camera around its own position by an incremental rotation, expressed in the current camera frame, of angles roll (around the view direction), pitch (around the right axis) and yaw (around the up axis), in radians. src
Translates the camera by tr.x * right() + tr.y * up(). src
Translates the camera by magnitude * front(). src
Places the camera at eye looking toward center with the given up vector. 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

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

None.

Operators

None.

CGP - Computer Graphics Programming.