XPMP2
X-Plane multiplayer library 2 - using instancing
XPMPAircraft.h
Go to the documentation of this file.
1
50
51#ifndef _XPMPAircraft_h_
52#define _XPMPAircraft_h_
53
54#include "XPMPMultiplayer.h"
55#include "XPLMInstance.h"
56#include "XPLMCamera.h"
57#include "XPLMMap.h"
58
59#include <cstdint>
60#include <cmath>
61#include <stdexcept>
62#include <string>
63#include <vector>
64#include <list>
65
66// Suppress warnings on member attributes needing to have dll-interface
67#if _MSC_VER
68#pragma warning(push)
69#pragma warning(disable: 4251 4275)
70#endif
71
72//
73// MARK: XPMP2 New Definitions
74//
75
76namespace XPMP2 {
77
78class CSLModel;
79
81constexpr float RPM_to_RADs = 0.10471975511966f;
83constexpr double M_per_FT = 0.3048; // meter per 1 foot
85constexpr int M_per_NM = 1852; // meter per one nautical mile
87constexpr double KT_per_M_per_S = 1.94384; // 1m/s = 1.94384kt
90constexpr float G_EARTH = 9.80665f;
91
93enum DR_VALS : std::uint8_t {
106
112
118
126
139
140
142
143 V_COUNT
145
153 std::string cslId;
155 std::string modelName;
157 std::string xsbAircraftPath;
159 int xsbAircraftLn = 0;
161 std::string icaoType;
165 std::string doc8643WTC;
166
168 struct MatchCrit_t {
169 std::string icaoAirline;
170 std::string livery;
171 };
172 typedef std::vector<MatchCrit_t> vecMatchCrit_t;
173 // List of match criteria defined for the model, can be empty
175
180};
181
185
186public:
187
188protected:
193 XPMPPlaneID modeS_id = 0;
194
195public:
198 std::string acIcaoType;
199 std::string acIcaoAirline;
200 std::string acLivery;
201
206 XPLMDrawInfo_t drawInfo;
207
209 float v_x = 0.0f, v_y = 0.0f, v_z = 0.0f;
210
212 bool bOnGrnd = false;
213
221 std::vector<float> v;
222
224 std::string label;
225 float colLabel[4] = {1.0f,1.0f,0.0f,1.0f};
226 bool bDrawLabel = true;
227
229 float vertOfsRatio = 1.0f;
230
236 float gearDeflectRatio = 0.5f;
237
243 bool bClampToGround = false;
244
249 int aiPrio = 1;
250
255 XPMPPlaneRadar_t acRadar;
256
258 std::list<XPLMInstanceRef> listContrail;
259 unsigned contrailNum = 0;
260 unsigned contrailDist_m = 5;
261 unsigned contrailLifeTime = 25;
262
268 struct wakeTy {
269 float wingSpan_m = NAN;
270 float wingArea_m2 = NAN;
271 float mass_kg = NAN;
272
273 void clear() { *this = wakeTy(); }
274 bool needsDefaults() const;
276 void applyDefaults(const std::string& _wtc, bool _bOverwriteAllFields = true);
278 void fillUpFrom(const wakeTy& o);
279 } wake;
280
282 XPMPInfoTexts_t acInfoTexts;
283
284protected:
285 bool bValid = true;
286 bool bVisible = true;
287 bool bRender = true;
288
289 XPMP2::CSLModel* pCSLMdl = nullptr;
290 int matchQuality = -1;
291 int acRelGrp = 0;
292
293 // this is data from about a second ago to calculate cartesian velocities
294 float prev_x = 0.0f, prev_y = 0.0f, prev_z = 0.0f;
295 float prev_ts = 0.0f;
296 float gs_kn = 0.0f;
297
299 double lat1s = NAN, lon1s = NAN, alt1s_ft = NAN;
300
302 float tsResetTouchDown = NAN;
303
305 std::list<XPLMInstanceRef> listInst;
307 int tcasTargetIdx = -1;
308
310 float camTimLstUpd = 0.0f;
312 float camDist = 0.0f;
314 float camBearing = 0.0f;
315
317 XPLMProbeRef hProbe = nullptr;
318
319 // Data used for drawing icons in X-Plane's map
320 int mapIconRow = 0;
321 int mapIconCol = 0;
322 float mapX = 0.0f;
323 float mapY = 0.0f;
324 std::string mapLabel;
325
326 // *** Sound support ***
327public:
338 typedef std::list<uint64_t> ChnListTy;
339
341 struct SndChTy {
342 bool bAuto = true;
343 uint64_t chnId = 0;
344 float lastDRVal = NAN;
345 float volAdj = 1.0f;
346 };
347
350 int sndMinDist = 50;
351
352protected:
354 SndChTy aSndCh[SND_NUM_EVENTS];
356 bool bChnMuted = false;
360 int skipCounter = 0;
361
362private:
363 bool bDestroyInst = false;
364public:
365
368
376 Aircraft (const std::string& _icaoType,
377 const std::string& _icaoAirline,
378 const std::string& _livery,
379 XPMPPlaneID _modeS_id = 0,
380 const std::string& _cslId = "");
382 Aircraft ();
384 virtual ~Aircraft();
385
387 Aircraft (const Aircraft&) = delete;
389 Aircraft& operator=(const Aircraft&) = delete;
390
399 void Create (const std::string& _icaoType,
400 const std::string& _icaoAirline,
401 const std::string& _livery,
402 XPMPPlaneID _modeS_id = 0,
403 const std::string& _cslId = "",
404 CSLModel* _pCSLModel = nullptr);
408
410 XPMPPlaneID GetModeS_ID () const { return modeS_id; }
414 bool IsRelatedTo (const std::string& _icaoType) const;
416 bool IsGroundVehicle() const;
418 bool IsGlider() const { return IsRelatedTo("GLID"); }
420 int GetTcasTargetIdx () const { return tcasTargetIdx; }
422 bool IsCurrentlyShownAsTcasTarget () const { return tcasTargetIdx >= 1; }
424 bool IsCurrentlyShownAsAI () const;
426 bool ShowAsAIPlane () const { return IsVisible() && acRadar.mode > xpmpTransponderMode_Standby && GetModeS_ID() > 0; }
428 void ResetTcasTargetIdx () { tcasTargetIdx = -1; }
429
432 virtual std::string GetFlightId() const;
433
438
444 int ChangeModel (const std::string& _icaoType,
445 const std::string& _icaoAirline,
446 const std::string& _livery);
447
450 int ReMatchModel () { return ChangeModel(acIcaoType,acIcaoAirline,acLivery); }
451
456 bool AssignModel (const std::string& _cslId,
457 CSLModel* _pCSLModel = nullptr);
458
460 XPMP2::CSLModel* GetModel () const { return pCSLMdl; }
462 const std::string& GetModelName () const;
464 CSLModelInfo_t GetModelInfo() const { return pCSLMdl ? CSLModelInfo_t(*pCSLMdl) : CSLModelInfo_t(); }
466 int GetMatchQuality () const { return matchQuality; }
467
471
473 float GetVertOfs () const;
474
476 bool IsValid() const { return bValid; }
478 virtual void SetInvalid();
479
481 virtual void SetVisible (bool _bVisible);
483 bool IsVisible () const { return bVisible && bValid; }
484
486 virtual void SetRender (bool _bRender);
488 bool IsRendered () const { return bRender && IsVisible(); }
489
491 bool IsInstanciated () const { return !listInst.empty(); }
492
494 void SetDrawLabel (bool _b) { bDrawLabel = _b; }
496 bool ShallDrawLabel () const { return bDrawLabel; }
497
499 float GetCameraDist () const { return camDist; }
501 float GetCameraBearing () const { return camBearing; }
502
511 virtual void UpdatePosition (float _elapsedSinceLastCall, int _flCounter) = 0;
512
514 bool IsOnGrnd () const { return bOnGrnd; }
518 void SetOnGrnd (bool on_grnd, float setTouchDownTime = NAN);
519
523
531 void SetLocation (double lat, double lon, double alt_ft, bool on_grnd, float setTouchDownTime = NAN) {
532 SetLocation(lat, lon, alt_ft);
533 SetOnGrnd(on_grnd, setTouchDownTime);
534 }
535
537 void SetLocation (double lat, double lon, double alt_ft);
538
541 void GetLocation (double& lat, double& lon, double& alt_ft) const;
542
544 void SetLocalLoc (float _x, float _y, float _z) { drawInfo.x = _x; drawInfo.y = _y; drawInfo.z = _z; }
546 const XPLMDrawInfo_t& GetLocation () const { return drawInfo; }
547
548 float GetPitch () const { return drawInfo.pitch; }
549 void SetPitch (float _deg) { drawInfo.pitch = _deg; }
550 float GetHeading () const { return drawInfo.heading; }
551 void SetHeading (float _deg) { drawInfo.heading = _deg; }
552 float GetRoll () const { return drawInfo.roll; }
553 void SetRoll (float _deg) { drawInfo.roll = _deg; }
554
555 float GetGS_kn() const { return gs_kn; }
556
561
562 float GetGearRatio () const { return v[V_CONTROLS_GEAR_RATIO]; }
563 void SetGearRatio (float _f) { v[V_CONTROLS_GEAR_RATIO] = _f; }
564 float GetNoseWheelAngle () const { return v[V_CONTROLS_NWS_RATIO]; }
565 void SetNoseWheelAngle (float _f) { v[V_CONTROLS_NWS_RATIO] = _f; }
566 float GetFlapRatio () const { return v[V_CONTROLS_FLAP_RATIO]; }
567 void SetFlapRatio (float _f) { v[V_CONTROLS_FLAP_RATIO] = _f; }
568 float GetSpoilerRatio () const { return v[V_CONTROLS_SPOILER_RATIO]; }
569 void SetSpoilerRatio (float _f) { v[V_CONTROLS_SPOILER_RATIO] = _f; }
572 float GetSlatRatio () const { return v[V_CONTROLS_SLAT_RATIO]; }
573 void SetSlatRatio (float _f) { v[V_CONTROLS_SLAT_RATIO] = _f; }
574 float GetWingSweepRatio () const { return v[V_CONTROLS_WING_SWEEP_RATIO]; }
575 void SetWingSweepRatio (float _f) { v[V_CONTROLS_WING_SWEEP_RATIO] = _f; }
576 float GetThrustRatio () const { return v[V_CONTROLS_THRUST_RATIO]; }
577 void SetThrustRatio (float _f) { v[V_CONTROLS_THRUST_RATIO] = _f; }
578 float GetYokePitchRatio () const { return v[V_CONTROLS_YOKE_PITCH_RATIO]; }
579 void SetYokePitchRatio (float _f) { v[V_CONTROLS_YOKE_PITCH_RATIO] = _f; }
582 float GetYokeRollRatio () const { return v[V_CONTROLS_YOKE_ROLL_RATIO]; }
583 void SetYokeRollRatio (float _f) { v[V_CONTROLS_YOKE_ROLL_RATIO] = _f; }
584 float GetThrustReversRatio () const { return v[V_CONTROLS_THRUST_REVERS]; }
586
587 bool GetLightsTaxi () const { return v[V_CONTROLS_TAXI_LITES_ON] > 0.5f; }
588 void SetLightsTaxi (bool _b) { v[V_CONTROLS_TAXI_LITES_ON] = float(_b); }
589 bool GetLightsLanding () const { return v[V_CONTROLS_LANDING_LITES_ON] > 0.5f; }
590 void SetLightsLanding (bool _b) { v[V_CONTROLS_LANDING_LITES_ON] = float(_b); }
591 bool GetLightsBeacon () const { return v[V_CONTROLS_BEACON_LITES_ON] > 0.5f; }
592 void SetLightsBeacon (bool _b) { v[V_CONTROLS_BEACON_LITES_ON] = float(_b); }
593 bool GetLightsStrobe () const { return v[V_CONTROLS_STROBE_LITES_ON] > 0.5f; }
594 void SetLightsStrobe (bool _b) { v[V_CONTROLS_STROBE_LITES_ON] = float(_b); }
595 bool GetLightsNav () const { return v[V_CONTROLS_NAV_LITES_ON] > 0.5f; }
596 void SetLightsNav (bool _b) { v[V_CONTROLS_NAV_LITES_ON] = float(_b); }
597
602 float GetTireRotAngle () const { return v[V_GEAR_TIRE_ROTATION_ANGLE_DEG]; }
603 void SetTireRotAngle (float _deg) { v[V_GEAR_TIRE_ROTATION_ANGLE_DEG] = _deg; }
604 float GetTireRotRpm () const { return v[V_GEAR_TIRE_ROTATION_SPEED_RPM]; }
610
612 void SetEngineRotAngle (float _deg);
614 void SetEngineRotRpm (float _rpm);
616 void SetEngineRotRad (float _rad);
617
618 float GetEngineRotAngle (size_t idx) const
619 { return 1 <= idx && idx <= 4 ? v[V_ENGINES_ENGINE_ROTATION_ANGLE_DEG1+idx-1] : 0.0f; }
620 void SetEngineRotAngle (size_t idx, float _deg);
621 float GetEngineRotRpm (size_t idx) const
622 { return 1 <= idx && idx <= 4 ? v[V_ENGINES_ENGINE_ROTATION_SPEED_RPM1+idx-1] : 0.0f; }
623 void SetEngineRotRpm (size_t idx, float _rpm);
624 float GetEngineRotRad (size_t idx) const
625 { return 1 <= idx && idx <= 4 ? v[V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC+idx-1] : 0.0f; }
626 void SetEngineRotRad (size_t idx, float _rad);
627
629 void SetPropRotAngle (float _deg) { v[V_ENGINES_PROP_ROTATION_ANGLE_DEG] = _deg; }
636
639
640 bool GetTouchDown () const { return v[V_MISC_TOUCH_DOWN] > 0.5f; }
641 void SetTouchDown (bool _b) { v[V_MISC_TOUCH_DOWN] = float(_b); }
642
649
652 void WakeApplyDefaults(bool _bOverwriteAllFields = true);
653
654 float GetWingSpan () const { return wake.wingSpan_m; }
655 void SetWingSpan (float _m) { wake.wingSpan_m = _m; }
656
657 float GetWingArea() const { return wake.wingArea_m2; }
658 void SetWingArea (float _m2) { wake.wingArea_m2 = _m2; }
659
660 int GetWakeCat() const;
661
662 float GetMass() const { return wake.mass_kg; }
663 void SetMass(float _kg) { wake.mass_kg = _kg; }
664
665 // Overridables:
666 virtual float GetAoA() const { return GetPitch(); }
667 virtual float GetLift() const { return GetMass() * G_EARTH; }
668
673
681 unsigned ContrailTrigger ();
682
689 void ContrailRequest (unsigned num, unsigned dist_m = 0, unsigned lifeTime = 0);
690
692 void ContrailRemove ();
693
698
700 void MapFindIcon ();
702 void MapPreparePos (XPLMMapProjectionID projection,
703 const float boundsLTRB[4]);
705 void MapDrawIcon (XPLMMapLayerID inLayer, float acSize);
707 void MapDrawLabel (XPLMMapLayerID inLayer, float yOfs);
708
713
718 uint64_t SoundPlay (const std::string& sndName, float vol = 1.0f);
719
722 void SoundStop (uint64_t chnId);
723
727 void SoundVolume (uint64_t chnId, float vol);
728
730 void SoundMuteAll (bool bMute);
732 bool SoundIsMuted() const { return bChnMuted; }
733
742 virtual std::string SoundGetName (SoundEventsTy sndEvent, float& volAdj) const;
743
744protected:
745
747
749 static float FlightLoopCB (float, float, int, void*);
750
753
755 void DoMove ();
757 void DoEverySecondUpdates (float now);
759 void ContrailMove ();
761 void ContrailAutoUpdate ();
763 void UpdateDistBearingCamera (const XPLMCameraPosition_t& posCam);
765 void ClampToGround ();
767 bool CreateInstances ();
769 void DestroyInstances ();
770
773 virtual void ComputeMapLabel ();
774
775 // The following functions are implemented in AIMultiplayer.cpp:
777 virtual void SetTcasTargetIdx (int _idx) { tcasTargetIdx = _idx; }
778
780
781 // These functions perform the TCAS target / multiplayer data updates
782 friend void AIMultiUpdate ();
783 friend size_t AIUpdateTCASTargets ();
784 friend size_t AIUpdateMultiplayerDataRefs ();
785
789
791 virtual void SoundSetup ();
793 virtual void SoundUpdate ();
795 virtual void SoundRemoveAll ();
796
798};
799
801XPMP2_EXPORT Aircraft* AcFindByID (XPMPPlaneID _id);
802
804XPMP2_EXPORT bool AcSetDefaultWakeData(const std::string& _wtc, const Aircraft::wakeTy& _wake);
805
806//
807// MARK: XPMP2 Exception class
808//
809
811class XPMP2_EXPORT XPMP2Error : public std::logic_error {
812protected:
813 std::string fileName;
814 int ln;
815 std::string funcName;
816 std::string msg;
817public:
819 XPMP2Error (const char* szFile, int ln, const char* szFunc, const char* szMsg, ...);
820public:
822 virtual const char* what() const noexcept;
823
824public:
825 // copy/move constructor/assignment as per default
826 XPMP2Error (const XPMP2Error& o) = default;
827 XPMP2Error (XPMP2Error&& o) = default;
828 XPMP2Error& operator = (const XPMP2Error& o) = default;
829 XPMP2Error& operator = (XPMP2Error&& o) = default;
830};
831
832
833
834} // namespace XPMP2
835
836#if _MSC_VER
837#pragma warning(pop)
838#endif
839
840#endif
#define XPMP2_EXPORT
Definition XPMPExport.h:51
Initialization and general control functions for XPMP2.
unsigned XPMPPlaneID
Unique ID for an aircraft created by a plugin.
Definition XPMPMultiplayer.h:266
Actual representation of all aircraft in XPMP2.
Definition XPMPAircraft.h:184
std::list< XPLMInstanceRef > listContrail
Contrail: list of objects for contrail generation.
Definition XPMPAircraft.h:258
bool GetLightsBeacon() const
Beacon lights.
Definition XPMPAircraft.h:591
virtual void UpdatePosition(float _elapsedSinceLastCall, int _flCounter)=0
Called right before updating the aircraft's placement in the world.
float GetGearRatio() const
Gear deploy ratio.
Definition XPMPAircraft.h:562
void SetLocalLoc(float _x, float _y, float _z)
Sets location in local world coordinates.
Definition XPMPAircraft.h:544
float GetThrustReversRatio() const
Thrust reversers ratio.
Definition XPMPAircraft.h:584
std::string label
aircraft label shown in the 3D world next to the plane
Definition XPMPAircraft.h:224
void SetLightsNav(bool _b)
Navigation lights.
Definition XPMPAircraft.h:596
float GetNoseWheelAngle() const
Nose Wheel angle in degrees.
Definition XPMPAircraft.h:564
bool IsRendered() const
Is this plane to be rendered?
Definition XPMPAircraft.h:488
void SetMass(float _kg)
Mass [kg].
Definition XPMPAircraft.h:663
float GetSpeedbrakeRatio() const
Speedbrakes deploy ratio.
Definition XPMPAircraft.h:570
std::string acIcaoType
ICAO aircraft type designator of this plane.
Definition XPMPAircraft.h:198
float GetRoll() const
roll [degree]
Definition XPMPAircraft.h:552
bool IsGlider() const
Is this object a glider?
Definition XPMPAircraft.h:418
CSLModelInfo_t GetModelInfo() const
return an information structure for the CSL model associated with the aircraft
Definition XPMPAircraft.h:464
void SetSpoilerRatio(float _f)
Spoilers deploy ratio.
Definition XPMPAircraft.h:569
bool IsCurrentlyShownAsTcasTarget() const
Is this plane currently also being tracked as a TCAS target, ie. will appear on TCAS?
Definition XPMPAircraft.h:422
int GetTcasTargetIdx() const
return the current TCAS target index (into sim/cockpit2/tcas/targets), 1-based, -1 if not used
Definition XPMPAircraft.h:420
float GetEngineRotAngle() const
Engine rotation angle [degree].
Definition XPMPAircraft.h:611
float GetPropRotAngle() const
Propellor rotation angle [degree].
Definition XPMPAircraft.h:628
std::string acIcaoAirline
ICAO Airline code of this plane.
Definition XPMPAircraft.h:199
float GetNoseGearDeflection() const
Vertical nose gear deflection [meter].
Definition XPMPAircraft.h:598
bool GetLightsLanding() const
Landing lights.
Definition XPMPAircraft.h:589
float GetTireRotRpm() const
Tire rotation speed [rpm].
Definition XPMPAircraft.h:604
std::list< uint64_t > ChnListTy
List of sound channel ids, also beyond sounds created for SoundEventsTy.
Definition XPMPAircraft.h:338
bool GetLightsStrobe() const
Strobe lights.
Definition XPMPAircraft.h:593
float GetEngineRotAngle(size_t idx) const
< Engine rotation angle [degree] for engine idx (1..4)
Definition XPMPAircraft.h:618
float GetThrustRatio() const
Thrust ratio.
Definition XPMPAircraft.h:576
void SetGearRatio(float _f)
Gear deploy ratio.
Definition XPMPAircraft.h:563
float GetSpoilerRatio() const
Spoilers deploy ratio.
Definition XPMPAircraft.h:568
bool GetTouchDown() const
Moment of touch down.
Definition XPMPAircraft.h:640
void SetThrustReversRatio(float _f)
Thrust reversers ratio.
Definition XPMPAircraft.h:585
float GetTireRotAngle() const
Tire rotation angle [degree].
Definition XPMPAircraft.h:602
float GetCameraBearing() const
Bearing from camera [°].
Definition XPMPAircraft.h:501
void SetLightsStrobe(bool _b)
Strobe lights.
Definition XPMPAircraft.h:594
virtual void SetTcasTargetIdx(int _idx)
Define the TCAS target index in use.
Definition XPMPAircraft.h:777
bool GetLightsTaxi() const
Taxi lights.
Definition XPMPAircraft.h:587
SoundEventsTy
Types of sound supported directly by XPMP2.
Definition XPMPAircraft.h:329
@ SND_FLAPS
Flaps extending/retracting (once per event), bases on GetFlapRatio()
Definition XPMPAircraft.h:334
@ SND_TIRE
Tires rolling on the ground (continuously while rolling on ground), bases on GetTireRotRpm()
Definition XPMPAircraft.h:332
@ SND_GEAR
Gear extending/retracting (once per event), bases on GetGearRatio()
Definition XPMPAircraft.h:333
@ SND_REVERSE_THRUST
Engine sound while reverse thrust (continuously while reversers deployed), bases on GetThrustReversRa...
Definition XPMPAircraft.h:331
void SetTireRotRpm(float _rpm)
Definition XPMPAircraft.h:605
void SetNoseWheelAngle(float _f)
Nose Wheel angle in degrees.
Definition XPMPAircraft.h:565
XPMPPlaneID GetModeS_ID() const
return the XPMP2 plane id
Definition XPMPAircraft.h:410
void SetSpeedbrakeRatio(float _f)
Speedbrakes deploy ratio.
Definition XPMPAircraft.h:571
void SetTireDeflection(float _mtr)
Vertical (main) gear deflection [meter].
Definition XPMPAircraft.h:601
void SetLightsLanding(bool _b)
Landing lights.
Definition XPMPAircraft.h:590
std::list< XPLMInstanceRef > listInst
X-Plane instance handles for all objects making up the model.
Definition XPMPAircraft.h:305
bool IsOnGrnd() const
Is the aircraft on the ground?
Definition XPMPAircraft.h:514
float GetGS_kn() const
Rough estimate of a ground speed based on v_x/z
Definition XPMPAircraft.h:555
float GetTireDeflection() const
Vertical (main) gear deflection [meter].
Definition XPMPAircraft.h:600
void SetYokeHeadingRatio(float _f)
Yoke heading ratio.
Definition XPMPAircraft.h:581
bool IsInstanciated() const
Are instances created for this aircraft?
Definition XPMPAircraft.h:491
void SetPropRotRpm(float _rpm)
Definition XPMPAircraft.h:631
void SetFlapRatio(float _f)
Flaps deploy ratio.
Definition XPMPAircraft.h:567
bool ShowAsAIPlane() const
Is this plane to be drawn on TCAS? (It will if transponder is not switched off)
Definition XPMPAircraft.h:426
Aircraft & operator=(const Aircraft &)=delete
Aircraft must not be copied as they reference non-copyable resources like XP instances.
float GetWingArea() const
Wing area [m²].
Definition XPMPAircraft.h:657
float GetTireRotRad() const
Tire rotation speed [rad/s].
Definition XPMPAircraft.h:607
void SetLightsBeacon(bool _b)
Beacon lights.
Definition XPMPAircraft.h:592
virtual float GetLift() const
Lift produced. You should override to blend in/out for take-off/landing, but XPMP2 has no dynamic inf...
Definition XPMPAircraft.h:667
float GetPropRotRpm() const
Propellor rotation speed [rpm].
Definition XPMPAircraft.h:630
XPMP2::CSLModel * GetModel() const
return a pointer to the CSL model in use (Note: The CSLModel structure is not public....
Definition XPMPAircraft.h:460
void SetPropRotAngle(float _deg)
Propellor rotation angle [degree].
Definition XPMPAircraft.h:629
void SetSlatRatio(float _f)
Slats deploy ratio.
Definition XPMPAircraft.h:573
void SetLightsTaxi(bool _b)
Taxi lights.
Definition XPMPAircraft.h:588
XPLMDrawInfo_t drawInfo
Holds position (in local coordinates!) and orientation (pitch, heading roll) of the aircraft.
Definition XPMPAircraft.h:206
float GetYokePitchRatio() const
Yoke pitch ratio.
Definition XPMPAircraft.h:578
void SetDrawLabel(bool _b)
Define if this aircraft's label is to be drawn (provided label drawing is enabled globally)
Definition XPMPAircraft.h:494
std::vector< float > v
actual dataRef values to be provided to the CSL model
Definition XPMPAircraft.h:221
float GetFlapRatio() const
Flaps deploy ratio.
Definition XPMPAircraft.h:566
float GetEngineRotRpm(size_t idx) const
< Engine rotation speed [rpm] for engine idx (1..4)
Definition XPMPAircraft.h:621
float GetEngineRotRad(size_t idx) const
< Engine rotation speed [rad/s] for engine idx (1..4)
Definition XPMPAircraft.h:624
XPMPInfoTexts_t acInfoTexts
Informational texts passed on via multiplayer shared dataRefs.
Definition XPMPAircraft.h:282
float GetMass() const
Mass [kg].
Definition XPMPAircraft.h:662
void SetLocation(double lat, double lon, double alt_ft, bool on_grnd, float setTouchDownTime=NAN)
Converts world coordinates to local coordinates, writes to Aircraft::drawInfo.
Definition XPMPAircraft.h:531
float GetYokeRollRatio() const
Yoke roll ratio.
Definition XPMPAircraft.h:582
void SetHeading(float _deg)
heading [degree]
Definition XPMPAircraft.h:551
bool SoundIsMuted() const
Are all sounds currently muted?
Definition XPMPAircraft.h:732
void SetWingArea(float _m2)
Wing area [m²].
Definition XPMPAircraft.h:658
void SetTouchDown(bool _b)
Moment of touch down.
Definition XPMPAircraft.h:641
void SetWingSpan(float _m)
Wing span [m].
Definition XPMPAircraft.h:655
bool ShallDrawLabel() const
Shall this aircraft's label be drawn?
Definition XPMPAircraft.h:496
void SetNoseGearDeflection(float _mtr)
Vertical nose gear deflection [meter].
Definition XPMPAircraft.h:599
float GetEngineRotRpm() const
Engine rotation speed [rpm].
Definition XPMPAircraft.h:613
void SetReversDeployRatio(float _f)
Thrust reversers deploy ratio.
Definition XPMPAircraft.h:638
bool IsValid() const
Is the a/c object valid?
Definition XPMPAircraft.h:476
float GetEngineRotRad() const
Engine rotation speed [rad/s].
Definition XPMPAircraft.h:615
void SetYokePitchRatio(float _f)
Yoke pitch ratio.
Definition XPMPAircraft.h:579
int GetMatchQuality() const
quality of the match with the CSL model
Definition XPMPAircraft.h:466
XPMPPlaneRadar_t acRadar
Current radar status.
Definition XPMPAircraft.h:255
float GetWingSpan() const
Wing span [m].
Definition XPMPAircraft.h:654
void SetPropRotRad(float _rad)
Definition XPMPAircraft.h:634
bool IsVisible() const
Is the plane visible?
Definition XPMPAircraft.h:483
void ResetTcasTargetIdx()
Reset TCAS target slot index to -1
Definition XPMPAircraft.h:428
float GetReversDeployRatio() const
Thrust reversers deploy ratio.
Definition XPMPAircraft.h:637
bool GetLightsNav() const
Navigation lights.
Definition XPMPAircraft.h:595
void SetRoll(float _deg)
roll [degree]
Definition XPMPAircraft.h:553
float GetWingSweepRatio() const
Wing sweep ratio.
Definition XPMPAircraft.h:574
float GetSlatRatio() const
Slats deploy ratio.
Definition XPMPAircraft.h:572
std::string mapLabel
label for map drawing
Definition XPMPAircraft.h:324
void SetWingSweepRatio(float _f)
Wing sweep ratio.
Definition XPMPAircraft.h:575
float GetHeading() const
heading [degree]
Definition XPMPAircraft.h:550
void SetPitch(float _deg)
pitch [degree]
Definition XPMPAircraft.h:549
void SetYokeRollRatio(float _f)
Yoke roll ratio.
Definition XPMPAircraft.h:583
float GetCameraDist() const
Distance to camera [m].
Definition XPMPAircraft.h:499
void SetTireRotAngle(float _deg)
Tire rotation angle [degree].
Definition XPMPAircraft.h:603
void SetThrustRatio(float _f)
Thrust ratio.
Definition XPMPAircraft.h:577
float GetPropRotRad() const
Propellor rotation speed [rad/s].
Definition XPMPAircraft.h:633
int ReMatchModel()
Finds a match again, using the existing parameters, eg. after more models have been loaded.
Definition XPMPAircraft.h:450
Aircraft(const Aircraft &)=delete
Aircraft must not be copied as they reference non-copyable resources like XP instances.
virtual float GetAoA() const
Angle of Attach, returns pitch (but you can override in your class)
Definition XPMPAircraft.h:666
ChnListTy chnList
List of channels produced via calls to SoundPlay()
Definition XPMPAircraft.h:358
std::string acLivery
Livery code of this plane.
Definition XPMPAircraft.h:200
float GetPitch() const
pitch [degree]
Definition XPMPAircraft.h:548
float GetYokeHeadingRatio() const
Yoke heading ratio.
Definition XPMPAircraft.h:580
void SetTireRotRad(float _rad)
Definition XPMPAircraft.h:608
const XPLMDrawInfo_t & GetLocation() const
Gets all location info (including local coordinates)
Definition XPMPAircraft.h:546
Operational values per sound channel, that is triggered by a standard sound event.
Definition XPMPAircraft.h:341
Represents a CSL model as it is saved on disk.
Definition CSLModels.h:113
XPMP2 Exception class, e.g. thrown if there are no CSL models or duplicate modeS_ids when creating an...
Definition XPMPAircraft.h:811
std::string fileName
filename of the line of code where exception occurred
Definition XPMPAircraft.h:813
std::string msg
additional text message
Definition XPMPAircraft.h:816
std::string funcName
function of the line of code where exception occurred
Definition XPMPAircraft.h:815
int ln
line number of the line of code where exception occurred
Definition XPMPAircraft.h:814
Definition XPMPAircraft.h:76
size_t AIUpdateTCASTargets()
The modern way: Use TCAS override and update TCAS targets.
Definition AIMultiplayer.cpp:346
constexpr float G_EARTH
standard gravitational acceleration [m/s²]
Definition XPMPAircraft.h:90
constexpr double KT_per_M_per_S
Convert m/s to knots.
Definition XPMPAircraft.h:87
XPMP2_EXPORT Aircraft * AcFindByID(XPMPPlaneID _id)
Find aircraft by its plane ID, can return nullptr.
Definition Aircraft.cpp:1107
XPMP2_EXPORT bool AcSetDefaultWakeData(const std::string &_wtc, const Aircraft::wakeTy &_wake)
(Re)Define default wake turbulence values per WTC
Definition Aircraft.cpp:1120
constexpr float RPM_to_RADs
Defined by XPMP2 internally.
Definition XPMPAircraft.h:81
size_t AIUpdateMultiplayerDataRefs()
The old way: Update Multiplayer dataRefs directly.
Definition AIMultiplayer.cpp:245
DR_VALS
The dataRefs provided by XPMP2 to the CSL models.
Definition XPMPAircraft.h:93
@ V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC3
libxplanemp/engines/engine_rotation_speed_rad_sec3
Definition XPMPAircraft.h:137
@ V_CONTROLS_YOKE_HEADING_RATIO
libxplanemp/controls/yoke_heading_ratio and sim/cockpit2/tcas/targets/position/yolk_yaw
Definition XPMPAircraft.h:103
@ V_CONTROLS_THRUST_RATIO
libxplanemp/controls/thrust_ratio and sim/cockpit2/tcas/targets/position/throttle
Definition XPMPAircraft.h:101
@ V_CONTROLS_WING_SWEEP_RATIO
libxplanemp/controls/wing_sweep_ratio and sim/cockpit2/tcas/targets/position/wing_sweep
Definition XPMPAircraft.h:100
@ V_CONTROLS_YOKE_PITCH_RATIO
libxplanemp/controls/yoke_pitch_ratio and sim/cockpit2/tcas/targets/position/yolk_pitch
Definition XPMPAircraft.h:102
@ V_GEAR_TIRE_ROTATION_ANGLE_DEG
libxplanemp/gear/tire_rotation_angle_deg
Definition XPMPAircraft.h:115
@ V_ENGINES_PROP_ROTATION_SPEED_RAD_SEC
libxplanemp/engines/prop_rotation_speed_rad_sec
Definition XPMPAircraft.h:124
@ V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC1
libxplanemp/engines/engine_rotation_speed_rad_sec1
Definition XPMPAircraft.h:135
@ V_MISC_TOUCH_DOWN
libxplanemp/misc/touch_down
Definition XPMPAircraft.h:141
@ V_ENGINES_ENGINE_ROTATION_ANGLE_DEG3
libxplanemp/engines/engine_rotation_angle_deg3
Definition XPMPAircraft.h:129
@ V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC2
libxplanemp/engines/engine_rotation_speed_rad_sec2
Definition XPMPAircraft.h:136
@ V_GEAR_NOSE_GEAR_DEFLECTION_MTR
libxplanemp/gear/nose_gear_deflection_mtr
Definition XPMPAircraft.h:113
@ V_COUNT
always last, number of dataRefs XPMP2 pre-defines
Definition XPMPAircraft.h:143
@ V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC4
libxplanemp/engines/engine_rotation_speed_rad_sec4
Definition XPMPAircraft.h:138
@ V_ENGINES_PROP_ROTATION_ANGLE_DEG
libxplanemp/engines/prop_rotation_angle_deg
Definition XPMPAircraft.h:122
@ V_CONTROLS_YOKE_ROLL_RATIO
libxplanemp/controls/yoke_roll_ratio and sim/cockpit2/tcas/targets/position/yolk_roll
Definition XPMPAircraft.h:104
@ V_CONTROLS_SPOILER_RATIO
libxplanemp/controls/spoiler_ratio
Definition XPMPAircraft.h:97
@ V_CONTROLS_TAXI_LITES_ON
libxplanemp/controls/taxi_lites_on and sim/cockpit2/tcas/targets/position/lights
Definition XPMPAircraft.h:107
@ V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC
libxplanemp/engines/engine_rotation_speed_rad_sec
Definition XPMPAircraft.h:121
@ V_GEAR_TIRE_VERTICAL_DEFLECTION_MTR
libxplanemp/gear/tire_vertical_deflection_mtr
Definition XPMPAircraft.h:114
@ V_CONTROLS_NWS_RATIO
libxplanemp/controls/nws_ratio, the nose wheel angle, actually in degrees
Definition XPMPAircraft.h:95
@ V_ENGINES_ENGINE_ROTATION_ANGLE_DEG4
libxplanemp/engines/engine_rotation_angle_deg4
Definition XPMPAircraft.h:130
@ V_GEAR_TIRE_ROTATION_SPEED_RPM
libxplanemp/gear/tire_rotation_speed_rpm
Definition XPMPAircraft.h:116
@ V_ENGINES_ENGINE_ROTATION_ANGLE_DEG1
libxplanemp/engines/engine_rotation_angle_deg1
Definition XPMPAircraft.h:127
@ V_ENGINES_ENGINE_ROTATION_ANGLE_DEG
libxplanemp/engines/engine_rotation_angle_deg
Definition XPMPAircraft.h:119
@ V_ENGINES_THRUST_REVERSER_DEPLOY_RATIO
libxplanemp/engines/thrust_reverser_deploy_ratio
Definition XPMPAircraft.h:125
@ V_CONTROLS_BEACON_LITES_ON
libxplanemp/controls/beacon_lites_on and sim/cockpit2/tcas/targets/position/lights
Definition XPMPAircraft.h:109
@ V_ENGINES_ENGINE_ROTATION_SPEED_RPM4
libxplanemp/engines/engine_rotation_speed_rpm4
Definition XPMPAircraft.h:134
@ V_ENGINES_PROP_ROTATION_SPEED_RPM
libxplanemp/engines/prop_rotation_speed_rpm
Definition XPMPAircraft.h:123
@ V_ENGINES_ENGINE_ROTATION_SPEED_RPM2
libxplanemp/engines/engine_rotation_speed_rpm2
Definition XPMPAircraft.h:132
@ V_CONTROLS_NAV_LITES_ON
libxplanemp/controls/nav_lites_on and sim/cockpit2/tcas/targets/position/lights
Definition XPMPAircraft.h:111
@ V_ENGINES_ENGINE_ROTATION_SPEED_RPM
libxplanemp/engines/engine_rotation_speed_rpm
Definition XPMPAircraft.h:120
@ V_CONTROLS_SLAT_RATIO
libxplanemp/controls/slat_ratio and sim/cockpit2/tcas/targets/position/slat_ratio
Definition XPMPAircraft.h:99
@ V_ENGINES_ENGINE_ROTATION_SPEED_RPM3
libxplanemp/engines/engine_rotation_speed_rpm3
Definition XPMPAircraft.h:133
@ V_CONTROLS_THRUST_REVERS
libxplanemp/controls/thrust_revers
Definition XPMPAircraft.h:105
@ V_GEAR_TIRE_ROTATION_SPEED_RAD_SEC
libxplanemp/gear/tire_rotation_speed_rad_sec
Definition XPMPAircraft.h:117
@ V_ENGINES_ENGINE_ROTATION_SPEED_RPM1
libxplanemp/engines/engine_rotation_speed_rpm1
Definition XPMPAircraft.h:131
@ V_ENGINES_ENGINE_ROTATION_ANGLE_DEG2
libxplanemp/engines/engine_rotation_angle_deg2
Definition XPMPAircraft.h:128
@ V_CONTROLS_FLAP_RATIO
libxplanemp/controls/flap_ratio and sim/cockpit2/tcas/targets/position/flap_ratio and ....
Definition XPMPAircraft.h:96
@ V_CONTROLS_LANDING_LITES_ON
libxplanemp/controls/landing_lites_on and sim/cockpit2/tcas/targets/position/lights
Definition XPMPAircraft.h:108
@ V_CONTROLS_GEAR_RATIO
libxplanemp/controls/gear_ratio and sim/cockpit2/tcas/targets/position/gear_deploy
Definition XPMPAircraft.h:94
@ V_CONTROLS_STROBE_LITES_ON
libxplanemp/controls/strobe_lites_on and sim/cockpit2/tcas/targets/position/lights
Definition XPMPAircraft.h:110
@ V_CONTROLS_SPEED_BRAKE_RATIO
libxplanemp/controls/speed_brake_ratio and sim/cockpit2/tcas/targets/position/speedbrake_ratio
Definition XPMPAircraft.h:98
void AIMultiUpdate()
Updates all TCAS target dataRefs, both standard X-Plane, as well as additional shared dataRefs for te...
Definition AIMultiplayer.cpp:622
constexpr int M_per_NM
Convert nautical miles to meters.
Definition XPMPAircraft.h:85
constexpr double M_per_FT
Convert feet to meters, e.g. for altitude calculations.
Definition XPMPAircraft.h:83
Wake dataRef support.
Definition XPMPAircraft.h:268
void clear()
clear all values to defaults
Definition XPMPAircraft.h:273
Collates some information on the CSL model.
Definition XPMPAircraft.h:151
vecMatchCrit_t vecMatchCrit
Definition XPMPAircraft.h:174
std::string modelName
name, formed by last part of path plus id
Definition XPMPAircraft.h:155
std::string icaoType
ICAO aircraft type this model represents: xsb_aircraft.txt::ICAO
Definition XPMPAircraft.h:161
std::string cslId
id, just an arbitrary label read from xsb_aircraft.txt::OBJ8_AIRCRAFT
Definition XPMPAircraft.h:153
std::string doc8643WTC
Doc8643 information: wake turbulence class, like M, L/M, L, H.
Definition XPMPAircraft.h:165
std::string doc8643Classification
Doc8643 information: Classification, like L1P, L4J, H1T.
Definition XPMPAircraft.h:163
std::vector< MatchCrit_t > vecMatchCrit_t
Definition XPMPAircraft.h:172
std::string xsbAircraftPath
Path to the xsb_aircraft.txt file from where this model is loaded.
Definition XPMPAircraft.h:157
CSLModelInfo_t()
Default constructor does nothing.
Definition XPMPAircraft.h:177
std::string livery
special livery (not often used)
Definition XPMPAircraft.h:170
std::string icaoAirline
ICAO airine/operator code.
Definition XPMPAircraft.h:169
Any number of airline codes and/or liveries can be assigned to a model for matching purpose.
Definition XPMPAircraft.h:168