MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mbgl::FreeCameraOptions Struct Reference

#include <camera.hpp>

Public Member Functions

void setLocation (const LatLngAltitude &location)
 
std::optional< LatLngAltitudegetLocation () const
 
void lookAtPoint (const LatLng &location, const std::optional< vec3 > &upVector=std::nullopt)
 
void setPitchBearing (double pitch, double bearing)
 

Public Attributes

std::optional< vec3position = std::nullopt
 
std::optional< vec4orientation = std::nullopt
 

Detailed Description

Various options for accessing physical properties of the underlying camera entity. A direct access to these properties allows more flexible and precise controlling of the camera while also being fully compatible and interchangeable with CameraOptions. All fields are optional.

Definition at line 104 of file camera.hpp.

Member Function Documentation

◆ getLocation()

std::optional<LatLngAltitude> mbgl::FreeCameraOptions::getLocation ( ) const

Helper function for converting mercator position into Lat&Lng and altitude in meters. This function fails to return a value if position is invalid or is not set

◆ lookAtPoint()

void mbgl::FreeCameraOptions::lookAtPoint ( const LatLng location,
const std::optional< vec3 > &  upVector = std::nullopt 
)

Helper function for setting orientation of the camera by defining a focus point on the map. Up vector is required in certain scenarios where bearing can't be deduced from the viewing direction

◆ setLocation()

void mbgl::FreeCameraOptions::setLocation ( const LatLngAltitude location)

Helper function for setting the mercator position as Lat&Lng and altitude in meters

◆ setPitchBearing()

void mbgl::FreeCameraOptions::setPitchBearing ( double  pitch,
double  bearing 
)

Helper function for setting the orientation of the camera as a pitch and a bearing. Both values are in degrees

Member Data Documentation

◆ orientation

std::optional<vec4> mbgl::FreeCameraOptions::orientation = std::nullopt

Orientation of the camera represented as a unit quaternion [x, y, z, w]. The default pose of the camera is such that the forward vector is looking up the -Z axis and the up vector is aligned with north orientation of the map: forward: [0, 0, -1] up: [0, -1, 0] right [1, 0, 0]

Orientation can be set freely but certain constraints still apply

  • Orientation must be representable with only pitch and bearing.
  • Pitch has an upper limit

Definition at line 123 of file camera.hpp.

◆ position

std::optional<vec3> mbgl::FreeCameraOptions::position = std::nullopt

Position of the camera in slightly modified web mercator coordinates

  • The size of 1 unit is the width of the projected world instead of the "mercator meter". Coordinate [0, 0, 0] is the north-west corner and [1, 1, 0] is the south-east corner.
  • Z coordinate is conformal and must respect minimum and maximum zoom values.
  • Zoom is automatically computed from the altitude (z)

Definition at line 111 of file camera.hpp.


The documentation for this struct was generated from the following file: