XPMP2
X-Plane multiplayer library 2 - using instancing
Classes | Namespaces | Enumerations | Functions | Variables
XPMPAircraft.h File Reference

XPMP2::Aircraft represent an aircraft as managed by XPMP2. More...

#include "XPMPMultiplayer.h"
#include "XPLMInstance.h"
#include "XPLMCamera.h"
#include "XPLMMap.h"
#include <cstdint>
#include <cmath>
#include <stdexcept>
#include <string>
#include <vector>
#include <list>

Go to the source code of this file.

Classes

struct  XPMP2::CSLModelInfo_t
 Collates some information on the CSL model. More...
 
struct  XPMP2::CSLModelInfo_t::MatchCrit_t
 Any number of airline codes and/or liveries can be assigned to a model for matching purpose. More...
 
class  XPMP2::Aircraft
 Actual representation of all aircraft in XPMP2. More...
 
struct  XPMP2::Aircraft::wakeTy
 Wake dataRef support. More...
 
struct  XPMP2::Aircraft::SndChTy
 Operational values per sound channel, that is triggered by a standard sound event. More...
 
class  XPMP2::XPMP2Error
 XPMP2 Exception class, e.g. thrown if there are no CSL models or duplicate modeS_ids when creating an Aircraft. More...
 

Namespaces

 XPMP2
 

Enumerations

enum  XPMP2::DR_VALS : std::uint8_t {
  XPMP2::V_CONTROLS_GEAR_RATIO = 0 , XPMP2::V_CONTROLS_NWS_RATIO , XPMP2::V_CONTROLS_FLAP_RATIO , XPMP2::V_CONTROLS_SPOILER_RATIO ,
  XPMP2::V_CONTROLS_SPEED_BRAKE_RATIO , XPMP2::V_CONTROLS_SLAT_RATIO , XPMP2::V_CONTROLS_WING_SWEEP_RATIO , XPMP2::V_CONTROLS_THRUST_RATIO ,
  XPMP2::V_CONTROLS_YOKE_PITCH_RATIO , XPMP2::V_CONTROLS_YOKE_HEADING_RATIO , XPMP2::V_CONTROLS_YOKE_ROLL_RATIO , XPMP2::V_CONTROLS_THRUST_REVERS ,
  XPMP2::V_CONTROLS_TAXI_LITES_ON , XPMP2::V_CONTROLS_LANDING_LITES_ON , XPMP2::V_CONTROLS_BEACON_LITES_ON , XPMP2::V_CONTROLS_STROBE_LITES_ON ,
  XPMP2::V_CONTROLS_NAV_LITES_ON , XPMP2::V_GEAR_NOSE_GEAR_DEFLECTION_MTR , XPMP2::V_GEAR_TIRE_VERTICAL_DEFLECTION_MTR , XPMP2::V_GEAR_TIRE_ROTATION_ANGLE_DEG ,
  XPMP2::V_GEAR_TIRE_ROTATION_SPEED_RPM , XPMP2::V_GEAR_TIRE_ROTATION_SPEED_RAD_SEC , XPMP2::V_ENGINES_ENGINE_ROTATION_ANGLE_DEG , XPMP2::V_ENGINES_ENGINE_ROTATION_SPEED_RPM ,
  XPMP2::V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC , XPMP2::V_ENGINES_PROP_ROTATION_ANGLE_DEG , XPMP2::V_ENGINES_PROP_ROTATION_SPEED_RPM , XPMP2::V_ENGINES_PROP_ROTATION_SPEED_RAD_SEC ,
  XPMP2::V_ENGINES_THRUST_REVERSER_DEPLOY_RATIO , XPMP2::V_ENGINES_ENGINE_ROTATION_ANGLE_DEG1 , XPMP2::V_ENGINES_ENGINE_ROTATION_ANGLE_DEG2 , XPMP2::V_ENGINES_ENGINE_ROTATION_ANGLE_DEG3 ,
  XPMP2::V_ENGINES_ENGINE_ROTATION_ANGLE_DEG4 , XPMP2::V_ENGINES_ENGINE_ROTATION_SPEED_RPM1 , XPMP2::V_ENGINES_ENGINE_ROTATION_SPEED_RPM2 , XPMP2::V_ENGINES_ENGINE_ROTATION_SPEED_RPM3 ,
  XPMP2::V_ENGINES_ENGINE_ROTATION_SPEED_RPM4 , XPMP2::V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC1 , XPMP2::V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC2 , XPMP2::V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC3 ,
  XPMP2::V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC4 , XPMP2::V_MISC_TOUCH_DOWN , XPMP2::V_COUNT
}
 The dataRefs provided by XPMP2 to the CSL models. More...
 

Functions

AircraftXPMP2::AcFindByID (XPMPPlaneID _id)
 Find aircraft by its plane ID, can return nullptr. More...
 
bool XPMP2::AcSetDefaultWakeData (const std::string &_wtc, const Aircraft::wakeTy &_wake)
 (Re)Define default wake turbulence values per WTC More...
 

Variables

constexpr float XPMP2::RPM_to_RADs = 0.10471975511966f
 Defined by XPMP2 internally. More...
 
constexpr double XPMP2::M_per_FT = 0.3048
 Convert feet to meters, e.g. for altitude calculations. More...
 
constexpr int XPMP2::M_per_NM = 1852
 Convert nautical miles to meters. More...
 
constexpr double XPMP2::KT_per_M_per_S = 1.94384
 Convert m/s to knots. More...
 
constexpr float XPMP2::G_EARTH = 9.80665f
 standard gravitational acceleration [m/s²] More...
 

Detailed Description

XPMP2::Aircraft represent an aircraft as managed by XPMP2.

New implementations should derive directly from XPMP2::Aircraft.

This is one of two main header files for using XPMP2. (The other is XPMPMultiplayer.h). XPMP2 is a library allowing an X-Plane plugin to have planes rendered in X-Plane's 3D world based on OBJ8 CSL models, which need to be installed separately. The plugin shall subclass XPMP2::Aircraft and override the abstract virtual function XPMP2::Aircraft::UpdatePosition() to provide updated position and attitude information. XPMP2 takes care of reading and initializaing CSL models, instanciating and updating the aircraft objects in X-Plane, display in a map layer, provisioning information via X-Plane's TCAS targets and AI/multiplayer (and more) dataRefs.

See also
For more developer's information see https://twinfan.github.io/XPMP2/
Sample and "How to" available, see https://twinfan.github.io/XPMP2/HowTo.html
For TCAS Override approach see https://developer.x-plane.com/article/overriding-tcas-and-providing-traffic-information/
For a definition of ICAO aircraft type designators see https://www.icao.int/publications/DOC8643/Pages/Search.aspx
For a list of ICAO airline/operator codes see https://en.wikipedia.org/wiki/List_of_airline_codes
Author
Birger Hoppe

Class Documentation

◆ XPMP2::CSLModelInfo_t::MatchCrit_t

struct XPMP2::CSLModelInfo_t::MatchCrit_t

Any number of airline codes and/or liveries can be assigned to a model for matching purpose.

Class Members
string icaoAirline ICAO airine/operator code.
string livery special livery (not often used)

◆ XPMP2::Aircraft::SndChTy

struct XPMP2::Aircraft::SndChTy

Operational values per sound channel, that is triggered by a standard sound event.

Class Members
bool bAuto Shall this sound event be handled automatically? (Set to false in your constructor or in Aircraft::SoundSetup() if you want to control that event type yourself)
uint64_t chnId id of channel playing the sound currently
float lastDRVal last observed dataRef value to see if sound is to be triggered
float volAdj Volume adjustment, fed from Aircraft::SoundGetName()