diff --git a/docs/Contrails.md b/docs/Contrails.md new file mode 100644 index 00000000..11f56864 --- /dev/null +++ b/docs/Contrails.md @@ -0,0 +1,61 @@ +## Contrails + +XPMP2 can add contrails to planes. This is achieved by instantiating +one additional object per contrail at the same position as the actual plane. +This object `Resources/Contrail/Contrail.obj` has no tris, +but only holds a reference to a particle system file, `Contrail.pss`. +The contrail is then created through X-Plane's +[particle system](https://developer.x-plane.com/article/x-plane-11-particle-system/). + +### Disable + +If you don't want contrails at all, you need to return `0` for the two config items +`XPMP_CFG_ITM_CONTR_MIN_ALT` and `XPMP_CFG_ITM_CONTR_MAX_ALT`. +In that case you don't even need to provide the `Resources/Contrail` folder +with your deployment. + +### Deployment + +If you want to make use of contrails, you need to ship the +`Resources/Contrail` folder with all its 3 files with your plugin. + +### Default + +By default, ie. without any provision in code, a single contrail will be +generated for jet aircraft flying in an altitude between 25,000 and 45,000 ft. + +### Configuration of Automatic Contrails + +XPMP2 asks for four contrail-related configuration items, with which +you can fine-tune how XPMP2 automatically generates contrails. +This should be sufficient for most usages, even complex plugins like LiveTraffic +only provide pass-through configuration options for these four parameters, +but no self-development implementation. + +Config item | Default | Description +------------|---------|------------------- +`XPMP_CFG_ITM_CONTR_MIN_ALT` | 25000 | Minimum altitude in feet for automatic contrail generation +`XPMP_CFG_ITM_CONTR_MAX_ALT` | 45000 | Maximum altitude in feet for automatic contrail generation; set both min and max altitude to `0` to switch off automatic contrails +`XPMP_CFG_ITM_CONTR_LIFE` | 25 | Default maximum lifetime of contrail puffs in seconds, determines contrail length +`XPMP_CFG_ITM_CONTR_MULTI` | 0 | Boolean: Shall multiple contrails be auto-created (one per engine), or just one? + +Keep in mind that contrails, using the particle system, may have the potential +to affect performance. That's why by default just a single contrail is generated. + +### More Control + +If you need more control and want to direct yourself when how many contrails +are shown, you should switch off the auto-generation by returning `0` to +both `XPMP_CFG_ITM_CONTR_MIN_ALT` and `XPMP_CFG_ITM_CONTR_MAX_ALT`, +and then call either of the following two member functions of `XPMP2::Aircraft`: + +- `ContrailTrigger()` tells XPMP2 to check the plane's engine type, + and if it is jet then a contrail (or even multiple, depending on + config `XPMP_CFG_ITM_CONTR_MULTI`) are created. This is the function + internally used by the auto-generation mechanism once a plane is in the + right altitude. +- `ContrailRequest (unsigned num, unsigned dist_m = 0, unsigned lifeTime = 0)` + allows even more control by specifying the number of contrails, its spacing, + and the life time. + +Last but not least, there's `ContrailRemove()` to remove contrails. diff --git a/docs/Deploying.md b/docs/Deploying.md index cf7cfab3..123cf259 100644 --- a/docs/Deploying.md +++ b/docs/Deploying.md @@ -40,6 +40,10 @@ You should ship all the files provided in the `Resources` folder: It defines dataRef replacements. You don't need to ship this file if you do not enable that functionality in your plugin. +- `Contrail` folder with 3 files, `Contrail.obj/.png/.pss`; + this is needed for drawing contrails. If missing, contrails aren't + available. The folder is not needed if you + [disable contrails](Contrails.html#disable). These files have all to be installed in the same folder. It is good practice to install these files in a folder named `Resources` in diff --git a/docs/html/Client_8cpp.html b/docs/html/Client_8cpp.html deleted file mode 100644 index c4c2f925..00000000 --- a/docs/html/Client_8cpp.html +++ /dev/null @@ -1,721 +0,0 @@ - - -
- - - - -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Main Client functionality, processing received data. -More...
-#include "XPMP2-Remote.h"
-Macros | |
#define | INFO_NEW_SENDER_PLUGIN "First data received from %.*s (%u) @ %s" |
#define | INFO_SENDER_PLUGIN_LOST "Sender %.*s (%u) @ %s fell silent, removed" |
#define | WARN_LOST_PLANE_CONTACT "Lost contact to plane 0x%06X of %.*s (%u) @ %s" |
#define | INFO_GOT_AI_CONTROL "Have TCAS / AI control now" |
#define | INFO_DEACTIVATED "Deactivated, stopped listening to network" |
#define | memcpy_min(to, from) std::memcpy(to,from,std::min(sizeof(from),sizeof(to))) |
-Functions | |
std::unique_lock< std::mutex > | glockDataMain (gmutexData, std::defer_lock) |
The lock used by main thread functions to acquire data access. More... | |
void | ClientTryGetAI () |
Try getting TCAS/AI control. More... | |
void | ClientCBRetryGetAI (void *) |
Callback for requesting TCAS: Maybe now we have a chance? More... | |
void | ClientReleaseAI () |
Stop TCAS/AI control. More... | |
void | ClientProcSettings (const std::uint32_t from[4], const std::string &sFrom, const XPMP2::RemoteMsgSettingsTy &_msgSettings) |
Handles a received Settings message, which also identifies a sending plugin. More... | |
void | ClientFlightLoopBegins () |
Called at the beginning of each flight loop processing: Get the data lock, create waiting planes. More... | |
void | ClientFlightLoopEnds () noexcept |
Called at the end of each flight loop processing: Release the data lock. More... | |
void | ClientProcAcDetails (const std::uint32_t _from[4], size_t _msgLen, const XPMP2::RemoteMsgAcDetailTy &_msgAcDetails) |
Handle A/C Details messages, called by XPMP2 via callback. More... | |
void | ClientProcAcPosUpdate (const std::uint32_t _from[4], size_t _msgLen, const XPMP2::RemoteMsgAcPosUpdateTy &_msgAcPosUpdate) |
Handle A/C Position Update message, called by XPMP2 via callback. More... | |
void | ClientProcAcAnim (const std::uint32_t _from[4], size_t _msgLen, const XPMP2::RemoteMsgAcAnimTy &_msgAcAnim) |
Handle A/C Animation dataRef messages, called by XPMP2 via callback. More... | |
void | ClientProcAcRemove (const std::uint32_t _from[4], size_t _msgLen, const XPMP2::RemoteMsgAcRemoveTy &_msgAcRemove) |
Handle A/C Removal message, called by XPMP2 via callback. More... | |
void | ClientInit () |
Initializes the module. More... | |
void | ClientCleanup () |
Shuts down the module gracefully. More... | |
void | ClientToggleActive (int nForce) |
Toggles the cient's activitiy status, as based on menu command. More... | |
-Variables | |
std::chrono::time_point< std::chrono::steady_clock > | nowFlightLoop |
Contains 'now' at the time the flight loop starts. More... | |
bool | bWaitingForAI = false |
have we requested AI access and are now waiting for a callback? More... | |
std::mutex | gmutexData |
std::atomic_flag | gbSkipSettingsUpdate = ATOMIC_FLAG_INIT |
Indicates if it is needed in the main thread to process updates to settings. More... | |
std::atomic_flag | gbSkipAcMaintenance = ATOMIC_FLAG_INIT |
Indicates if it is needed in the main thread to process new aircraft. More... | |
Main Client functionality, processing received data.
- -#define INFO_DEACTIVATED "Deactivated, stopped listening to network" | -
#define INFO_GOT_AI_CONTROL "Have TCAS / AI control now" | -
#define INFO_NEW_SENDER_PLUGIN "First data received from %.*s (%u) @ %s" | -
#define INFO_SENDER_PLUGIN_LOST "Sender %.*s (%u) @ %s fell silent, removed" | -
#define memcpy_min | -( | -- | to, | -
- | - | - | from | -
- | ) | -std::memcpy(to,from,std::min(sizeof(from),sizeof(to))) | -
#define WARN_LOST_PLANE_CONTACT "Lost contact to plane 0x%06X of %.*s (%u) @ %s" | -
void ClientCBRetryGetAI | -( | -void * | -) | -- |
Callback for requesting TCAS: Maybe now we have a chance?
- -void ClientCleanup | -( | -) | -- |
Shuts down the module gracefully.
- -void ClientFlightLoopBegins | -( | -) | -- |
Called at the beginning of each flight loop processing: Get the data lock, create waiting planes.
- -
-
|
- -noexcept | -
Called at the end of each flight loop processing: Release the data lock.
- -void ClientInit | -( | -) | -- |
Initializes the module.
- -void ClientProcAcAnim | -( | -const std::uint32_t | -_from[4], | -
- | - | size_t | -_msgLen, | -
- | - | const XPMP2::RemoteMsgAcAnimTy & | -_msgAcAnim | -
- | ) | -- |
Handle A/C Animation dataRef messages, called by XPMP2 via callback.
- -void ClientProcAcDetails | -( | -const std::uint32_t | -_from[4], | -
- | - | size_t | -_msgLen, | -
- | - | const XPMP2::RemoteMsgAcDetailTy & | -_msgAcDetails | -
- | ) | -- |
Handle A/C Details messages, called by XPMP2 via callback.
-void ClientProcAcPosUpdate | -( | -const std::uint32_t | -_from[4], | -
- | - | size_t | -_msgLen, | -
- | - | const XPMP2::RemoteMsgAcPosUpdateTy & | -_msgAcPosUpdate | -
- | ) | -- |
Handle A/C Position Update message, called by XPMP2 via callback.
- -void ClientProcAcRemove | -( | -const std::uint32_t | -_from[4], | -
- | - | size_t | -_msgLen, | -
- | - | const XPMP2::RemoteMsgAcRemoveTy & | -_msgAcRemove | -
- | ) | -- |
Handle A/C Removal message, called by XPMP2 via callback.
- -void ClientProcSettings | -( | -const std::uint32_t | -from[4], | -
- | - | const std::string & | -sFrom, | -
- | - | const XPMP2::RemoteMsgSettingsTy & | -_msgSettings | -
- | ) | -- |
Handles a received Settings message, which also identifies a sending plugin.
-void ClientReleaseAI | -( | -) | -- |
Stop TCAS/AI control.
- -void ClientToggleActive | -( | -int | -nForce = 0 | ) | -- |
Toggles the cient's activitiy status, as based on menu command.
-nForce | 3-way toggle: -1? force off, 0toggle, +1` force on |
void ClientTryGetAI | -( | -) | -- |
Try getting TCAS/AI control.
- -std::unique_lock<std::mutex> glockDataMain | -( | -gmutexData | -, | -
- | - | std::defer_lock | -- |
- | ) | -- |
The lock used by main thread functions to acquire data access.
- -bool bWaitingForAI = false | -
have we requested AI access and are now waiting for a callback?
- -std::atomic_flag gbSkipAcMaintenance = ATOMIC_FLAG_INIT | -
Indicates if it is needed in the main thread to process new aircraft.
- -std::atomic_flag gbSkipSettingsUpdate = ATOMIC_FLAG_INIT | -
Indicates if it is needed in the main thread to process updates to settings.
- -std::mutex gmutexData | -
the mutex controlling access to all data between network and main thread
- -std::chrono::time_point<std::chrono::steady_clock> nowFlightLoop | -
Contains 'now' at the time the flight loop starts.
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Main Client functionality, processing received data. -More...
- -Go to the source code of this file.
--Classes | |
class | RemoteAC |
Representation of a remote aircraft. More... | |
struct | SenderAddrTy |
Uniquely identifies a sending plugin. More... | |
struct | SenderTy |
-Typedefs | |
typedef std::map< XPMPPlaneID, RemoteAC > | mapRemoteAcTy |
Map of remote aircraft; key is the plane id as sent by the sending plugin (while the _modeS_id of the local copy could differ) More... | |
typedef std::map< SenderAddrTy, SenderTy > | mapSenderTy |
map of sender information More... | |
-Functions | |
void | ClientInit () |
Initializes the module. More... | |
void | ClientCleanup () |
Shuts down the module gracefully. More... | |
void | ClientTryGetAI () |
Try getting TCAS/AI control. More... | |
void | ClientReleaseAI () |
Stop TCAS/AI control. More... | |
void | ClientToggleActive (int nForce=0) |
Toggles the cient's activitiy status, as based on menu command. More... | |
void | ClientFlightLoopBegins () |
Called at the beginning of each flight loop processing: Get the data lock, create waiting planes. More... | |
void | ClientFlightLoopEnds () noexcept |
Called at the end of each flight loop processing: Release the data lock. More... | |
Main Client functionality, processing received data.
- -typedef std::map<XPMPPlaneID,RemoteAC> mapRemoteAcTy | -
Map of remote aircraft; key is the plane id as sent by the sending plugin (while the _modeS_id of the local copy could differ)
- -typedef std::map<SenderAddrTy,SenderTy> mapSenderTy | -
map of sender information
- -void ClientCleanup | -( | -) | -- |
Shuts down the module gracefully.
- -void ClientFlightLoopBegins | -( | -) | -- |
Called at the beginning of each flight loop processing: Get the data lock, create waiting planes.
- -
-
|
- -noexcept | -
Called at the end of each flight loop processing: Release the data lock.
- -void ClientInit | -( | -) | -- |
Initializes the module.
- -void ClientReleaseAI | -( | -) | -- |
Stop TCAS/AI control.
- -void ClientToggleActive | -( | -int | -nForce = 0 | ) | -- |
Toggles the cient's activitiy status, as based on menu command.
-nForce | 3-way toggle: -1? force off, 0toggle, +1` force on |
void ClientTryGetAI | -( | -) | -- |
Try getting TCAS/AI control.
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Compressed version of the FMOD logo with code to create a texture ID in X-Plane for display with Dear ImGui. -More...
-#include "FMOD_Logo.h"
#include <cassert>
#include <GL/gl.h>
#include <GL/glext.h>
#include "XPLMGraphics.h"
-Namespaces | |
FMODLogo | |
-Functions | |
uint8_t * | FMODLogo::LoadRGBA (bool bBlack=true) |
Load the data of the FMOD logo, expanded into RGBA data. More... | |
bool | FMODLogo::GetTexture (int &texId, bool bBlack=true) |
The one "public" function to return a texture id for the logo. More... | |
-Variables | |
constexpr size_t | FMODLogo::RLE_SIZE = 5527 |
number of array entries in the RLE array More... | |
const uint16_t | FMODLogo::ALPHA_RLE [RLE_SIZE] |
Run-length encoded data of the Alpha value of each pixel in the FMOD logo. More... | |
Compressed version of the FMOD logo with code to create a texture ID in X-Plane for display with Dear ImGui.
-The FMOD logo is essential a single-color image, either black (RGB 0x06 0x08 0x0b) or white (0xff 0xff 0xff), with only the alpha value varying across the image. The below array ALPHA_RLE
is a run-length encoded dump of these alpha values. The provided functions recreate the full RGBA data, so that it can be used with OpenGL functionality to be turned into a texture.
Usage
-
#include "FMOD_Logo.inc" - ... - int logoId = 0; - if (FMODLogo::GetTexture(logoId)) { - ImGui::Image((void*)(intptr_t)logoId, ImVec2(FMODLogo::IMG_WIDTH, FMODLogo::IMG_HEIGHT)); - } -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Compressed version of the FMOD logo with code to create a texture ID in X-Plane for display with Dear ImGui. -More...
-#include <cstdint>
Go to the source code of this file.
--Namespaces | |
FMODLogo | |
-Functions | |
bool | FMODLogo::GetTexture (int &texId, bool bBlack=true) |
The one "public" function to return a texture id for the logo. More... | |
uint8_t * | FMODLogo::LoadRGBA (bool bBlack=true) |
Load the data of the FMOD logo, expanded into RGBA data. More... | |
-Variables | |
constexpr int | FMODLogo::IMG_WIDTH = 728 |
Logo image width. More... | |
constexpr int | FMODLogo::IMG_HEIGHT = 192 |
Logo image height. More... | |
constexpr int | FMODLogo::IMG_SIZE = IMG_WIDTH * IMG_HEIGHT |
Logo image size in number of pixels. More... | |
Compressed version of the FMOD logo with code to create a texture ID in X-Plane for display with Dear ImGui.
-The FMOD logo is essential a single-color image, either black (RGB 0x06 0x08 0x0b) or white (0xff 0xff 0xff), with only the alpha value varying across the image. The below array ALPHA_RLE
is a run-length encoded dump of these alpha values. The provided functions recreate the full RGBA data, so that it can be used with OpenGL functionality to be turned into a texture.
Usage
-
#include "FMOD_Logo.h" - ... - int logoId = 0; - if (FMODLogo::GetTexture(logoId)) { - ImGui::Image((void*)(intptr_t)logoId, ImVec2(FMODLogo::IMG_WIDTH, FMODLogo::IMG_HEIGHT)); - } -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Miscellaneous utility functions, including logging. -More...
-#include "XPMP2-Remote.h"
-Macros | |
#define | PATH_DELIM_STD '/' |
-Functions | |
float | GetMiscNetwTime () |
Get synched network time from X-Plane (sim/network/misc/network_time_sec) as used in Log.txt. More... | |
bool | CheckEverySoOften (float &_lastCheck, float _interval, float _now) |
Convenience function to check on something at most every x seconds. More... | |
std::string | GetPluginName (XPLMPluginID who) |
Return a plugin's name. More... | |
std::string | str_n (const char *s, size_t max) |
Copy at most n chars from location, or less if zero-terminated. More... | |
const char * | LogGetString (const char *szPath, int ln, const char *szFunc, logLevelTy lvl, const char *szMsg, va_list args) |
Returns ptr to static buffer filled with formatted log string. More... | |
void | LogMsg (const char *szPath, int ln, const char *szFunc, logLevelTy lvl, const char *szMsg,...) |
Log Text to log file. More... | |
-Variables | |
XPMP2RCGlobals | rcGlob |
The one global variable object. More... | |
const char * | LOG_LEVEL [] |
Miscellaneous utility functions, including logging.
- -#define PATH_DELIM_STD '/' | -
bool CheckEverySoOften | -( | -float & | -_lastCheck, | -
- | - | float | -_interval, | -
- | - | float | -_now | -
- | ) | -- |
Convenience function to check on something at most every x seconds.
-_lastCheck | Provide a float which holds the time of last check (init with 0.0f ) |
_interval | [seconds] How often to perform the check? |
_now | Current time, possibly from a call to GetTotalRunningTime() |
true
if more than _interval
time has passed since _lastCheck
float GetMiscNetwTime | -( | -) | -- |
Get synched network time from X-Plane (sim/network/misc/network_time_sec) as used in Log.txt.
- -std::string GetPluginName | -( | -XPLMPluginID | -who | ) | -- |
Return a plugin's name.
- -const char* LogGetString | -( | -const char * | -szPath, | -
- | - | int | -ln, | -
- | - | const char * | -szFunc, | -
- | - | logLevelTy | -lvl, | -
- | - | const char * | -szMsg, | -
- | - | va_list | -args | -
- | ) | -- |
Returns ptr to static buffer filled with formatted log string.
- -void LogMsg | -( | -const char * | -szPath, | -
- | - | int | -ln, | -
- | - | const char * | -szFunc, | -
- | - | logLevelTy | -lvl, | -
- | - | const char * | -szMsg, | -
- | - | - | ... | -
- | ) | -- |
Log Text to log file.
- -std::string str_n | -( | -const char * | -s, | -
- | - | size_t | -max | -
- | ) | -- |
Copy at most n
chars from location, or less if zero-terminated.
Unlike std::string(char*, n) this will not copy null chars
- -const char* LOG_LEVEL[] | -
XPMP2RCGlobals rcGlob | -
The one global variable object.
-the one and only instance of XPMP2RCGlobals
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Miscellaneous utility functions, including logging. -More...
- -Go to the source code of this file.
--Macros | |
#define | ERR_ASSERT "ASSERT FAILED: %s" |
#define | ERR_EXCEPTION "EXCEPTION CAUGHT: %s" |
#define | STR_N(s) str_n(s,sizeof(s)) |
Simplify using str_n() with char arrays. More... | |
#define | XPMP2RC_FMTARGS(FMT) |
To apply printf-style warnings to our functions. More... | |
#define | LOG_MSG(lvl, ...) |
Log a message if lvl is greater or equal currently defined log level. More... | |
#define | THROW_ERROR(...) throw XPMP2::XPMP2Error(__FILE__, __LINE__, __func__, __VA_ARGS__); |
Throws an exception using XPMP2Error. More... | |
#define | LOG_ASSERT(cond) |
Throw in an assert-style (logging takes place in XPMP2Error constructor) More... | |
#define | SET_THREAD_NAME(sName) |
-Enumerations | |
enum | logLevelTy : std::uint8_t { - logDEBUG = 0 -, logINFO -, logWARN -, logERR -, - logFATAL -, logMSG - - } |
Logging level. More... | |
-Functions | |
float | GetMiscNetwTime () |
Get synched network time from X-Plane (sim/network/misc/network_time_sec) as used in Log.txt. More... | |
bool | CheckEverySoOften (float &_lastCheck, float _interval, float _now) |
Convenience function to check on something at most every x seconds. More... | |
bool | CheckEverySoOften (float &_lastCheck, float _interval) |
Convenience function to check on something at most every x seconds. More... | |
std::string | GetPluginName (XPLMPluginID who) |
Return a plugin's name. More... | |
std::string | str_n (const char *s, size_t max) |
Copy at most n chars from location, or less if zero-terminated. More... | |
const char * | LogGetString (const char *szFile, int ln, const char *szFunc, logLevelTy lvl, const char *szMsg, va_list args) |
Returns ptr to static buffer filled with formatted log string. More... | |
void | LogMsg (const char *szFile, int ln, const char *szFunc, logLevelTy lvl, const char *szMsg,...) XPMP2RC_FMTARGS(5) |
Log Text to log file. More... | |
Miscellaneous utility functions, including logging.
- -#define ERR_ASSERT "ASSERT FAILED: %s" | -
#define ERR_EXCEPTION "EXCEPTION CAUGHT: %s" | -
#define LOG_ASSERT | -( | -- | cond | ) | -- |
Throw in an assert-style (logging takes place in XPMP2Error constructor)
-#define LOG_MSG | -( | -- | lvl, | -
- | - | - | ... | -
- | ) | -- |
Log a message if lvl is greater or equal currently defined log level.
-#define SET_THREAD_NAME | -( | -- | sName | ) | -- |
#define STR_N | -( | -- | s | ) | -str_n(s,sizeof(s)) | -
Simplify using str_n() with char arrays.
- -#define THROW_ERROR | -( | -- | ... | ) | -throw XPMP2::XPMP2Error(__FILE__, __LINE__, __func__, __VA_ARGS__); | -
Throws an exception using XPMP2Error.
-#define XPMP2RC_FMTARGS | -( | -- | FMT | ) | -- |
To apply printf-style warnings to our functions.
-enum logLevelTy : std::uint8_t | -
Logging level.
-
-
|
- -inline | -
Convenience function to check on something at most every x seconds.
-_lastCheck | Provide a float which holds the time of last check (init with 0.0f ) |
_interval | [seconds] How often to perform the check? |
true
if more than _interval
time has passed since _lastCheck
bool CheckEverySoOften | -( | -float & | -_lastCheck, | -
- | - | float | -_interval, | -
- | - | float | -_now | -
- | ) | -- |
Convenience function to check on something at most every x seconds.
-_lastCheck | Provide a float which holds the time of last check (init with 0.0f ) |
_interval | [seconds] How often to perform the check? |
_now | Current time, possibly from a call to GetTotalRunningTime() |
true
if more than _interval
time has passed since _lastCheck
float GetMiscNetwTime | -( | -) | -- |
Get synched network time from X-Plane (sim/network/misc/network_time_sec) as used in Log.txt.
- -std::string GetPluginName | -( | -XPLMPluginID | -who | ) | -- |
Return a plugin's name.
- -const char* LogGetString | -( | -const char * | -szFile, | -
- | - | int | -ln, | -
- | - | const char * | -szFunc, | -
- | - | logLevelTy | -lvl, | -
- | - | const char * | -szMsg, | -
- | - | va_list | -args | -
- | ) | -- |
Returns ptr to static buffer filled with formatted log string.
- -void LogMsg | -( | -const char * | -szFile, | -
- | - | int | -ln, | -
- | - | const char * | -szFunc, | -
- | - | logLevelTy | -lvl, | -
- | - | const char * | -szMsg, | -
- | - | - | ... | -
- | ) | -- |
Log Text to log file.
- -std::string str_n | -( | -const char * | -s, | -
- | - | size_t | -max | -
- | ) | -- |
Copy at most n
chars from location, or less if zero-terminated.
Unlike std::string(char*, n) this will not copy null chars
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
XPMP2 Remote Client: Displays aircraft served from other XPMP2-based plugins in the network. -More...
-#include "XPMP2-Remote.h"
-Classes | |
struct | CmdMenuDefTy |
Command definition per menu item. More... | |
-Functions | |
int | CBIntPrefsFunc (const char *, [[maybe_unused]] const char *item, int defaultVal) |
void | MenuUpdateCheckmarks () |
Sets all menu checkmarks according to current status. More... | |
void | MenuUpdateSenders () |
(Re)Create the submenu listing information about connected senders More... | |
int | CmdCallback (XPLMCommandRef cmdRef, XPLMCommandPhase inPhase, void *) |
Callback function for menu. More... | |
void | MenuLabelsCB (void *, void *inItemRef) |
Callback function for the Labels submenu. More... | |
float | FlightLoopCallback (float, float, int, void *) |
Regular tasks, called by flight loop. More... | |
PLUGIN_API int | XPluginStart (char *outName, char *outSig, char *outDesc) |
PLUGIN_API void | XPluginStop (void) |
PLUGIN_API int | XPluginEnable (void) |
PLUGIN_API void | XPluginDisable (void) |
PLUGIN_API void | XPluginReceiveMessage (XPLMPluginID who, long inMsg, void *) |
-Variables | |
XPLMMenuID | hMenu = nullptr |
menu id of our plugin's menu More... | |
XPLMMenuID | hLabels = nullptr |
menu id of the Labels submenu More... | |
XPLMMenuID | hSenders = nullptr |
menu id of the Senders submenu More... | |
int | numSendersInMenu = 0 |
how many lines to we currently server in the menu? More... | |
constexpr std::uintptr_t | MENU_ACTIVE = 0 |
constexpr std::uintptr_t | MENU_TCAS = 1 |
constexpr std::uintptr_t | MENU_LABELS = 2 |
constexpr std::uintptr_t | MENU_SENDER = 3 |
struct CmdMenuDefTy | CMD_MENU_DEF [2] |
XPLMFlightLoopID | flId = nullptr |
ID of our flight loop callback for regular tasks. More... | |
XPMP2 Remote Client: Displays aircraft served from other XPMP2-based plugins in the network.
-This plugin is intended to be used in a multi-computer simulator setup, usually in the PCs used for external visuals.
- The typical setup would be:
Technically, this works as follows:
struct CmdMenuDefTy | -
int CBIntPrefsFunc | -( | -const char * | -, | -
- | - | [[maybe_unused] ] const char * | -item, | -
- | - | int | -defaultVal | -
- | ) | -- |
This is a callback the XPMP2 calls regularly to learn about configuration settings. Only 3 are left, all of them integers.
- -int CmdCallback | -( | -XPLMCommandRef | -cmdRef, | -
- | - | XPLMCommandPhase | -inPhase, | -
- | - | void * | -- |
- | ) | -- |
Callback function for menu.
- -float FlightLoopCallback | -( | -float | -, | -
- | - | float | -, | -
- | - | int | -, | -
- | - | void * | -- |
- | ) | -- |
Regular tasks, called by flight loop.
- -void MenuLabelsCB | -( | -void * | -, | -
- | - | void * | -inItemRef | -
- | ) | -- |
Callback function for the Labels submenu.
- -void MenuUpdateCheckmarks | -( | -) | -- |
Sets all menu checkmarks according to current status.
- -void MenuUpdateSenders | -( | -) | -- |
(Re)Create the submenu listing information about connected senders
- -PLUGIN_API void XPluginDisable | -( | -void | -) | -- |
PLUGIN_API int XPluginEnable | -( | -void | -) | -- |
PLUGIN_API void XPluginReceiveMessage | -( | -XPLMPluginID | -who, | -
- | - | long | -inMsg, | -
- | - | void * | -- |
- | ) | -- |
PLUGIN_API int XPluginStart | -( | -char * | -outName, | -
- | - | char * | -outSig, | -
- | - | char * | -outDesc | -
- | ) | -- |
PLUGIN_API void XPluginStop | -( | -void | -) | -- |
struct CmdMenuDefTy CMD_MENU_DEF[2] | -
XPLMFlightLoopID flId = nullptr | -
ID of our flight loop callback for regular tasks.
- -XPLMMenuID hLabels = nullptr | -
menu id of the Labels submenu
- -XPLMMenuID hMenu = nullptr | -
menu id of our plugin's menu
- -XPLMMenuID hSenders = nullptr | -
menu id of the Senders submenu
- -
-
|
- -constexpr | -
-
|
- -constexpr | -
-
|
- -constexpr | -
-
|
- -constexpr | -
int numSendersInMenu = 0 | -
how many lines to we currently server in the menu?
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
XPMP2 Remote Client: Displays aircraft served from other XPMP2-based plugins in the network. -More...
-#include <cassert>
#include <cstdio>
#include <cstdarg>
#include <cstring>
#include <cmath>
#include <string>
#include <map>
#include <chrono>
#include <memory>
#include <atomic>
#include <algorithm>
#include <thread>
#include <mutex>
#include "XPLMDataAccess.h"
#include "XPLMUtilities.h"
#include "XPLMPlugin.h"
#include "XPLMMenus.h"
#include "XPLMProcessing.h"
#include "XPMPAircraft.h"
#include "XPMPMultiplayer.h"
#include "XPMPRemote.h"
#include "Utilities.h"
#include "Client.h"
Go to the source code of this file.
--Classes | |
struct | XPMP2RCGlobals |
Holds all global variables. More... | |
-Variables | |
constexpr const char * | REMOTE_CLIENT_NAME = "XPMP2 Remote Client" |
Plugin name. More... | |
constexpr const char * | REMOTE_CLIENT_LOG = "XPMP2_RC" |
ID used in own log entries. More... | |
constexpr const char * | REMOTE_CLIENT_LOG2 = "RC" |
Short ID used in XPMP2 log entries. More... | |
constexpr float | REMOTE_CLIENT_VER = 1.20f |
Version number for the XPMP2 Remote plugin. More... | |
XPMP2RCGlobals | rcGlob |
the one and only instance of XPMP2RCGlobals More... | |
XPMP2 Remote Client: Displays aircraft served from other XPMP2-based plugins in the network.
-This plugin is intended to be used in a multi-computer simulator setup, usually in the PCs used for external visuals.
- The typical setup would be:
Technically, this works as follows:
-
|
- -extern | -
the one and only instance of XPMP2RCGlobals
-the one and only instance of XPMP2RCGlobals
- -
-
|
- -constexpr | -
ID used in own log entries.
- -
-
|
- -constexpr | -
Short ID used in XPMP2 log entries.
- -
-
|
- -constexpr | -
Plugin name.
- -
-
|
- -constexpr | -
Version number for the XPMP2 Remote plugin.
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Example plugin demonstrating XPMP2 techniques. -More...
-#include <cstdio>
#include <cstdarg>
#include <cstring>
#include <cmath>
#include "XPLMDataAccess.h"
#include "XPLMUtilities.h"
#include "XPLMPlugin.h"
#include "XPLMGraphics.h"
#include "XPLMMenus.h"
#include "XPCAircraft.h"
#include "XPMPAircraft.h"
#include "XPMPMultiplayer.h"
-Classes | |
struct | positionTy |
Summarizes the 3 values of a position in the local coordinate system. More... | |
class | SampleAircraft |
Subclassing XPMP2::Aircraft to create our own class. More... | |
class | LegacySampleAircraft |
Subclassing XPCAircraft to create our own class. More... | |
-Enumerations | |
enum | MenuItemsTy { - MENU_PLANES = 0 -, MENU_VISIBLE -, MENU_FREEZE -, MENU_CYCLE_MDL -, - MENU_REMATCH_MDL -, MENU_AI - - } |
List of all menu item indexes. More... | |
-Functions | |
void | LogMsg (const char *szMsg,...) |
Log a message to X-Plane's Log.txt with sprintf-style parameters. More... | |
int | CBIntPrefsFunc (const char *, [[maybe_unused]] const char *item, int defaultVal) |
This is a callback the XPMP2 calls regularly to learn about configuration settings. More... | |
void | CBPlaneNotifier (XPMPPlaneID inPlaneID, XPMPPlaneNotification inNotification, void *) |
float | GetTimeFragment () |
Returns a number between 0.0 and 1.0, increasing over the course of 10 seconds, then restarting. More... | |
float | GetTimeUpDown () |
Returns a number between 0.0 and 1.0, going up and down over the course of 10 seconds. More... | |
double | deg2rad (const double deg) |
Convert from degree to radians. More... | |
char * | strScpy (char *dest, const char *src, size_t size) |
Save string copy. More... | |
positionTy | FindCenterPos (float dist) |
Finds a position 200m in front of the user's plane serving as the center for further operations. More... | |
void | CirclePos (positionTy &pos, float heading, float radius) |
Put the position on a circle around itself. More... | |
void | ConvLocalToWorld (const positionTy &pos, double &lat, double &lon, double &alt) |
Convert local position to world coordinates. More... | |
XPMPPlaneCallbackResult | SetPositionData (XPMPPlanePosition_t &data) |
Handles requests for plane's position data. More... | |
XPMPPlaneCallbackResult | SetSurfaceData (XPMPPlaneSurfaces_t &data) |
Handles requests for plane's surface data. More... | |
XPMPPlaneCallbackResult | SetRadarData (XPMPPlaneRadar_t &data) |
Handles requests for plane's radar data (doesn't actually change over time) More... | |
XPMPPlaneCallbackResult | SetInfoData (XPMPInfoTexts_t &data) |
Handles requests for plane's informational texts. More... | |
XPMPPlaneCallbackResult | CBPlaneData (XPMPPlaneID inPlane, XPMPPlaneDataType inDataType, void *ioData, void *) |
Callback function handed to XPMP2, will be called in every drawing frame to deliver plane position and configuration. More... | |
bool | ArePlanesCreated () |
Is any plane object created? More... | |
void | PlanesCreate () |
Create our 3 planes (if they don't exist already) More... | |
void | PlanesRemove () |
Remove all planes. More... | |
void | PlanesShowHide () |
Show/hide the planes (temporarily, without destroying the plane objects) More... | |
void | PlanesCycleModels () |
Cycle the CSL models of the 3 planes. More... | |
void | PlanesRematch () |
Rematch CSL models based on existing definition. More... | |
void | MenuUpdateCheckmarks () |
void | CPRequestAIAgain (void *) |
Callback function for the case that we might get AI access later. More... | |
void | CBMenu (void *, void *inItemRef) |
Callback function for menu. More... | |
PLUGIN_API int | XPluginStart (char *outName, char *outSig, char *outDesc) |
PLUGIN_API void | XPluginStop (void) |
PLUGIN_API int | XPluginEnable (void) |
PLUGIN_API void | XPluginDisable (void) |
PLUGIN_API void | XPluginReceiveMessage (XPLMPluginID, long inMsg, void *) |
-Variables | |
std::string | PLANE_MODEL [3][3] |
bool | gbFreeze = false |
Freeze all movements at the moment? More... | |
constexpr float | PLANE_DIST_M = 200.0f |
Distance of our simulated planes to the user's plane's position? [m]. More... | |
constexpr float | PLANE_RADIUS_M = 100.0f |
Radius of the circle the planes do [m]. More... | |
constexpr float | PLANE_STACK_ALT_M = 50.0f |
Altitude difference to stack the 3 planes one above the other [m]. More... | |
constexpr float | PLANE_CIRCLE_TIME_S = 20.0f |
Time it shall take to fly/roll a full circle [seconds]. More... | |
constexpr float | PLANE_CIRCLE_TIME_MIN = PLANE_CIRCLE_TIME_S / 60.0f |
Time it shall take to fly/roll a full circle [minutes]. More... | |
constexpr float | PLANE_TIRE_CIRCUMFENCE_M = 3.2f |
Assumed circumfence of one plane's tire (rough guess for commercial jet planes) More... | |
constexpr float | PLANE_PROP_RPM = 300.0f |
Engine / prop rotation assumptions: rotations per minute. More... | |
constexpr double | PI = 3.1415926535897932384626433832795028841971693993751 |
PI. More... | |
SampleAircraft * | pSamplePlane = nullptr |
The one aircraft of this type that we manage. More... | |
LegacySampleAircraft * | pLegacyPlane = nullptr |
The one aircraft of this type that we manage. More... | |
XPMPPlaneID | hStdPlane = 0 |
We handle just one aircraft with standard functions, this one: More... | |
XPLMMenuID | hMenu = nullptr |
menu id of our plugin's menu More... | |
bool | gbVisible = true |
Planes currently visible? More... | |
bool | gbMapLabels = true |
Labels currently shown in map view? More... | |
int | gModelIdxBase = 0 |
for cycling CSL models: what is the index used for the first plane? More... | |
Example plugin demonstrating XPMP2 techniques.
-This plugin creates 3 planes, one with each of the available ways of using the XPMP2 library. All planes move in a circle around a position 200m in front of the user's plane (even if the user plane moves).
-Three menu items are provided:
-For the plugin to work properly some CSL models are necessary in some folders under Resources
(all folders under Resources
are scanned for xsb_aircraft.txt
file, so the actual structure underneath Resources
does not matter).
The directory structure would look as follows:
- XPMP2-Sample/
- lin_x64/
- XPMP2-Sample.xpl
- mac_x64/
- XPMP2-Sample.xpl
- win_x64/
- XPMP2-Sample.xpl
- Resources/
- CSL/ <-- install CSL models here
- Doc8643.txt
- MapIcons.png
- Obj8DataRefs.txt
- related.txt
-
struct positionTy | -
enum MenuItemsTy | -
List of all menu item indexes.
-
-
|
- -inline | -
Is any plane object created?
- -int CBIntPrefsFunc | -( | -const char * | -, | -
- | - | [[maybe_unused] ] const char * | -item, | -
- | - | int | -defaultVal | -
- | ) | -- |
This is a callback the XPMP2 calls regularly to learn about configuration settings.
- -void CBMenu | -( | -void * | -, | -
- | - | void * | -inItemRef | -
- | ) | -- |
Callback function for menu.
- -XPMPPlaneCallbackResult CBPlaneData | -( | -XPMPPlaneID | -inPlane, | -
- | - | XPMPPlaneDataType | -inDataType, | -
- | - | void * | -ioData, | -
- | - | void * | -- |
- | ) | -- |
Callback function handed to XPMP2, will be called in every drawing frame to deliver plane position and configuration.
- -void CBPlaneNotifier | -( | -XPMPPlaneID | -inPlaneID, | -
- | - | XPMPPlaneNotification | -inNotification, | -
- | - | void * | -- |
- | ) | -- |
This is the callback for the plane notifier function, which just logs some info to Log.txt
void CirclePos | -( | -positionTy & | -pos, | -
- | - | float | -heading, | -
- | - | float | -radius | -
- | ) | -- |
Put the position on a circle around itself.
- -void ConvLocalToWorld | -( | -const positionTy & | -pos, | -
- | - | double & | -lat, | -
- | - | double & | -lon, | -
- | - | double & | -alt | -
- | ) | -- |
Convert local position to world coordinates.
- -void CPRequestAIAgain | -( | -void * | -) | -- |
Callback function for the case that we might get AI access later.
- -
-
|
- -inline | -
Convert from degree to radians.
- -positionTy FindCenterPos | -( | -float | -dist | ) | -- |
Finds a position 200m in front of the user's plane serving as the center for further operations.
- -float GetTimeFragment | -( | -) | -- |
Returns a number between 0.0 and 1.0, increasing over the course of 10 seconds, then restarting.
- -float GetTimeUpDown | -( | -) | -- |
Returns a number between 0.0 and 1.0, going up and down over the course of 10 seconds.
- -void LogMsg | -( | -const char * | -szMsg, | -
- | - | - | ... | -
- | ) | -- |
Log a message to X-Plane's Log.txt with sprintf-style parameters.
- -void MenuUpdateCheckmarks | -( | -) | -- |
void PlanesCreate | -( | -) | -- |
Create our 3 planes (if they don't exist already)
- -void PlanesCycleModels | -( | -) | -- |
Cycle the CSL models of the 3 planes.
- -void PlanesRematch | -( | -) | -- |
Rematch CSL models based on existing definition.
-This will pick a different (partly random) CSL model for those planes, for which no exact match has been found. The A321 is defined without operator code, so each re-match will pick any of the available A321 models.
- -void PlanesRemove | -( | -) | -- |
Remove all planes.
- -void PlanesShowHide | -( | -) | -- |
Show/hide the planes (temporarily, without destroying the plane objects)
- -XPMPPlaneCallbackResult SetInfoData | -( | -XPMPInfoTexts_t & | -data | ) | -- |
Handles requests for plane's informational texts.
-Handling this requests is completely optional. The texts are provided on shared dataRefs and used only by few other plugins, one of it is FSTramp.
- Here in the example we keep it simple and just return the ICAO plane type.
XPMPPlaneCallbackResult SetPositionData | -( | -XPMPPlanePosition_t & | -data | ) | -- |
Handles requests for plane's position data.
-XPMPPlaneCallbackResult SetRadarData | -( | -XPMPPlaneRadar_t & | -data | ) | -- |
Handles requests for plane's radar data (doesn't actually change over time)
-XPMPPlaneCallbackResult SetSurfaceData | -( | -XPMPPlaneSurfaces_t & | -data | ) | -- |
Handles requests for plane's surface data.
-
-
|
- -inline | -
Save string copy.
- -PLUGIN_API void XPluginDisable | -( | -void | -) | -- |
PLUGIN_API int XPluginEnable | -( | -void | -) | -- |
PLUGIN_API void XPluginReceiveMessage | -( | -XPLMPluginID | -, | -
- | - | long | -inMsg, | -
- | - | void * | -- |
- | ) | -- |
PLUGIN_API int XPluginStart | -( | -char * | -outName, | -
- | - | char * | -outSig, | -
- | - | char * | -outDesc | -
- | ) | -- |
PLUGIN_API void XPluginStop | -( | -void | -) | -- |
bool gbFreeze = false | -
Freeze all movements at the moment?
- -bool gbMapLabels = true | -
Labels currently shown in map view?
- -bool gbVisible = true | -
Planes currently visible?
- -int gModelIdxBase = 0 | -
for cycling CSL models: what is the index used for the first plane?
- -XPLMMenuID hMenu = nullptr | -
menu id of our plugin's menu
- -XPMPPlaneID hStdPlane = 0 | -
We handle just one aircraft with standard functions, this one:
- -
-
|
- -constexpr | -
PI.
- -
-
|
- -constexpr | -
Time it shall take to fly/roll a full circle [minutes].
- -
-
|
- -constexpr | -
Time it shall take to fly/roll a full circle [seconds].
- -
-
|
- -constexpr | -
Distance of our simulated planes to the user's plane's position? [m].
- -std::string PLANE_MODEL[3][3] | -
Initial type / airline / livery to be used to create our 3 planes
-
|
- -constexpr | -
Engine / prop rotation assumptions: rotations per minute.
- -
-
|
- -constexpr | -
Radius of the circle the planes do [m].
- -
-
|
- -constexpr | -
Altitude difference to stack the 3 planes one above the other [m].
- -
-
|
- -constexpr | -
Assumed circumfence of one plane's tire (rough guess for commercial jet planes)
- -LegacySampleAircraft* pLegacyPlane = nullptr | -
The one aircraft of this type that we manage.
- -SampleAircraft* pSamplePlane = nullptr | -
The one aircraft of this type that we manage.
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
This is the complete list of members for LegacySampleAircraft, including all inherited members.
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Subclassing XPCAircraft to create our own class. - More...
--Public Member Functions | |
LegacySampleAircraft (const char *inICAOCode, const char *inAirline, const char *inLivery, XPMPPlaneID _modeS_id=0, const char *inModelName=nullptr) | |
Constructor just passes on all parameters to library. More... | |
virtual XPMPPlaneCallbackResult | GetPlanePosition (XPMPPlanePosition_t *outPosition) |
Called before rendering to query plane's current position, overwritten to provide your implementation. More... | |
virtual XPMPPlaneCallbackResult | GetPlaneSurfaces (XPMPPlaneSurfaces_t *outSurfaces) |
Called before rendering to query plane's current configuration, overwritten to provide your implementation. More... | |
virtual XPMPPlaneCallbackResult | GetPlaneRadar (XPMPPlaneRadar_t *outRadar) |
Called before rendering to query plane's current radar visibility, overwritten to provide your implementation. More... | |
virtual XPMPPlaneCallbackResult | GetInfoTexts (XPMPInfoTexts_t *outInfoTexts) |
Called before rendering to query plane's textual information, overwritten to provide your implementation (optional) More... | |
Public Member Functions inherited from XPCAircraft | |
XPCAircraft (const char *_icaoType, const char *_icaoAirline, const char *_livery, XPMPPlaneID _modeS_id=0, const char *_modelId=nullptr) | |
Legacy constructor creates a plane and puts it under control of XPlaneMP. More... | |
virtual void | UpdatePosition (float _elapsedSinceLastCall, int _flCounter) |
Just calls all 4 previous Get... functions and copies the provided values into drawInfo and v More... | |
Public Member Functions inherited from XPMP2::Aircraft | |
Aircraft (const std::string &_icaoType, const std::string &_icaoAirline, const std::string &_livery, XPMPPlaneID _modeS_id=0, const std::string &_cslId="") | |
Constructor creates a new aircraft object, which will be managed and displayed. More... | |
Aircraft () | |
Default constructor creates an empty, invalid(!) and invisible shell; call XPMP2::Aircraft::Create() to actually create a plane. More... | |
virtual | ~Aircraft () |
Destructor cleans up all resources acquired. More... | |
Aircraft (const Aircraft &)=delete | |
Aircraft must not be copied as they reference non-copyable resources like XP instances. More... | |
Aircraft & | operator= (const Aircraft &)=delete |
Aircraft must not be copied as they reference non-copyable resources like XP instances. More... | |
void | Create (const std::string &_icaoType, const std::string &_icaoAirline, const std::string &_livery, XPMPPlaneID _modeS_id=0, const std::string &_cslId="", CSLModel *_pCSLModel=nullptr) |
Creates a plane, only a valid operation if object was created using the default constructor. More... | |
XPMPPlaneID | GetModeS_ID () const |
return the XPMP2 plane id More... | |
bool | IsGroundVehicle () const |
Is this object a ground vehicle? More... | |
bool | IsRelatedTo (const std::string &_icaoType) const |
Is this object "related" to the given ICAO code? (named in the same line in related.txt) More... | |
int | GetTcasTargetIdx () const |
return the current TCAS target index (into sim/cockpit2/tcas/targets ), 1-based, -1 if not used More... | |
bool | IsCurrentlyShownAsTcasTarget () const |
Is this plane currently also being tracked as a TCAS target, ie. will appear on TCAS? More... | |
bool | IsCurrentlyShownAsAI () const |
Is this plane currently also being tracked by X-Plane's classic AI/multiplayer? More... | |
bool | ShowAsAIPlane () const |
Is this plane to be drawn on TCAS? (It will if transponder is not switched off) More... | |
void | ResetTcasTargetIdx () |
Reset TCAS target slot index to -1 More... | |
virtual std::string | GetFlightId () const |
Return a value for dataRef .../tcas/target/flight_id. More... | |
int | ChangeModel (const std::string &_icaoType, const std::string &_icaoAirline, const std::string &_livery) |
(Potentially) changes the plane's model after doing a new match attempt More... | |
int | ReMatchModel () |
Finds a match again, using the existing parameters, eg. after more models have been loaded. More... | |
bool | AssignModel (const std::string &_cslId, CSLModel *_pCSLModel=nullptr) |
Assigns the given model. More... | |
XPMP2::CSLModel * | GetModel () const |
return a pointer to the CSL model in use (Note: The CSLModel structure is not public.) More... | |
const std::string & | GetModelName () const |
return the name of the CSL model in use More... | |
CSLModelInfo_t | GetModelInfo () const |
return an information structure for the CSL model associated with the aircraft More... | |
int | GetMatchQuality () const |
quality of the match with the CSL model More... | |
float | GetVertOfs () const |
Vertical offset, ie. the value that needs to be added to drawInfo.y to make the aircraft appear on the ground. More... | |
bool | IsValid () const |
Is the a/c object valid? More... | |
virtual void | SetInvalid () |
Mark the plane invalid, e.g. after exceptions occured on the data. More... | |
virtual void | SetVisible (bool _bVisible) |
Make the plane (in)visible. More... | |
bool | IsVisible () const |
Is the plane visible? More... | |
virtual void | SetRender (bool _bRender) |
Switch rendering of the CSL model on or off. More... | |
bool | IsRendered () const |
Is this plane to be rendered? More... | |
bool | IsInstanciated () const |
Are instances created for this aircraft? More... | |
void | SetDrawLabel (bool _b) |
Define if this aircraft's label is to be drawn (provided label drawing is enabled globally) More... | |
bool | ShallDrawLabel () const |
Shall this aircraft's label be drawn? More... | |
float | GetCameraDist () const |
Distance to camera [m]. More... | |
float | GetCameraBearing () const |
Bearing from camera [°]. More... | |
bool | IsOnGrnd () const |
Is the aircraft on the ground? More... | |
void | SetOnGrnd (bool on_grnd, float setTouchDownTime=NAN) |
Set if the aircraft is on the ground. More... | |
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. More... | |
void | SetLocation (double lat, double lon, double alt_ft) |
Legacy version of above version of SetLocatiion(), here without setting ground flag. More... | |
void | GetLocation (double &lat, double &lon, double &alt_ft) const |
Converts aircraft's local coordinates to lat/lon values. More... | |
void | SetLocalLoc (float _x, float _y, float _z) |
Sets location in local world coordinates. More... | |
const XPLMDrawInfo_t & | GetLocation () const |
Gets all location info (including local coordinates) More... | |
float | GetPitch () const |
pitch [degree] More... | |
void | SetPitch (float _deg) |
pitch [degree] More... | |
float | GetHeading () const |
heading [degree] More... | |
void | SetHeading (float _deg) |
heading [degree] More... | |
float | GetRoll () const |
roll [degree] More... | |
void | SetRoll (float _deg) |
roll [degree] More... | |
float | GetGS_kn () const |
Rough estimate of a ground speed based on v_x/z More... | |
float | GetGearRatio () const |
Gear deploy ratio. More... | |
void | SetGearRatio (float _f) |
Gear deploy ratio. More... | |
float | GetNoseWheelAngle () const |
Nose Wheel angle in degrees. More... | |
void | SetNoseWheelAngle (float _f) |
Nose Wheel angle in degrees. More... | |
float | GetFlapRatio () const |
Flaps deploy ratio. More... | |
void | SetFlapRatio (float _f) |
Flaps deploy ratio. More... | |
float | GetSpoilerRatio () const |
Spoilers deploy ratio. More... | |
void | SetSpoilerRatio (float _f) |
Spoilers deploy ratio. More... | |
float | GetSpeedbrakeRatio () const |
Speedbrakes deploy ratio. More... | |
void | SetSpeedbrakeRatio (float _f) |
Speedbrakes deploy ratio. More... | |
float | GetSlatRatio () const |
Slats deploy ratio. More... | |
void | SetSlatRatio (float _f) |
Slats deploy ratio. More... | |
float | GetWingSweepRatio () const |
Wing sweep ratio. More... | |
void | SetWingSweepRatio (float _f) |
Wing sweep ratio. More... | |
float | GetThrustRatio () const |
Thrust ratio. More... | |
void | SetThrustRatio (float _f) |
Thrust ratio. More... | |
float | GetYokePitchRatio () const |
Yoke pitch ratio. More... | |
void | SetYokePitchRatio (float _f) |
Yoke pitch ratio. More... | |
float | GetYokeHeadingRatio () const |
Yoke heading ratio. More... | |
void | SetYokeHeadingRatio (float _f) |
Yoke heading ratio. More... | |
float | GetYokeRollRatio () const |
Yoke roll ratio. More... | |
void | SetYokeRollRatio (float _f) |
Yoke roll ratio. More... | |
float | GetThrustReversRatio () const |
Thrust reversers ratio. More... | |
void | SetThrustReversRatio (float _f) |
Thrust reversers ratio. More... | |
bool | GetLightsTaxi () const |
Taxi lights. More... | |
void | SetLightsTaxi (bool _b) |
Taxi lights. More... | |
bool | GetLightsLanding () const |
Landing lights. More... | |
void | SetLightsLanding (bool _b) |
Landing lights. More... | |
bool | GetLightsBeacon () const |
Beacon lights. More... | |
void | SetLightsBeacon (bool _b) |
Beacon lights. More... | |
bool | GetLightsStrobe () const |
Strobe lights. More... | |
void | SetLightsStrobe (bool _b) |
Strobe lights. More... | |
bool | GetLightsNav () const |
Navigation lights. More... | |
void | SetLightsNav (bool _b) |
Navigation lights. More... | |
float | GetNoseGearDeflection () const |
Vertical nose gear deflection [meter]. More... | |
void | SetNoseGearDeflection (float _mtr) |
Vertical nose gear deflection [meter]. More... | |
float | GetTireDeflection () const |
Vertical (main) gear deflection [meter]. More... | |
void | SetTireDeflection (float _mtr) |
Vertical (main) gear deflection [meter]. More... | |
float | GetTireRotAngle () const |
Tire rotation angle [degree]. More... | |
void | SetTireRotAngle (float _deg) |
Tire rotation angle [degree]. More... | |
float | GetTireRotRpm () const |
Tire rotation speed [rpm]. More... | |
void | SetTireRotRpm (float _rpm) |
float | GetTireRotRad () const |
Tire rotation speed [rad/s]. More... | |
void | SetTireRotRad (float _rad) |
float | GetEngineRotAngle () const |
Engine rotation angle [degree]. More... | |
void | SetEngineRotAngle (float _deg) |
Engine rotation angle [degree], also sets engines 1..4. More... | |
float | GetEngineRotRpm () const |
Engine rotation speed [rpm]. More... | |
void | SetEngineRotRpm (float _rpm) |
Engine rotation speed [rpm], also sets [rad/s] and engines 1..4. More... | |
float | GetEngineRotRad () const |
Engine rotation speed [rad/s]. More... | |
void | SetEngineRotRad (float _rad) |
Engine rotation speed [rad/s], also sets [rpm] and engines 1..4. More... | |
float | GetEngineRotAngle (size_t idx) const |
< Engine rotation angle [degree] for engine idx (1..4) More... | |
void | SetEngineRotAngle (size_t idx, float _deg) |
Engine rotation angle [degree] for engine idx (1..4) More... | |
float | GetEngineRotRpm (size_t idx) const |
< Engine rotation speed [rpm] for engine idx (1..4) More... | |
void | SetEngineRotRpm (size_t idx, float _rpm) |
Engine rotation speed [rpm] for engine idx (1..4), also sets [rad/s]. More... | |
float | GetEngineRotRad (size_t idx) const |
< Engine rotation speed [rad/s] for engine idx (1..4) More... | |
void | SetEngineRotRad (size_t idx, float _rad) |
Engine rotation speed [rad/s] for engine idx (1..4), also sets [rpm]. More... | |
float | GetPropRotAngle () const |
Propellor rotation angle [degree]. More... | |
void | SetPropRotAngle (float _deg) |
Propellor rotation angle [degree]. More... | |
float | GetPropRotRpm () const |
Propellor rotation speed [rpm]. More... | |
void | SetPropRotRpm (float _rpm) |
float | GetPropRotRad () const |
Propellor rotation speed [rad/s]. More... | |
void | SetPropRotRad (float _rad) |
float | GetReversDeployRatio () const |
Thrust reversers deploy ratio. More... | |
void | SetReversDeployRatio (float _f) |
Thrust reversers deploy ratio. More... | |
bool | GetTouchDown () const |
Moment of touch down. More... | |
void | SetTouchDown (bool _b) |
Moment of touch down. More... | |
void | WakeApplyDefaults (bool _bOverwriteAllFields=true) |
Fill in default wake turbulence support data based on Doc8643 wake turbulence category. More... | |
float | GetWingSpan () const |
Wing span [m]. More... | |
void | SetWingSpan (float _m) |
Wing span [m]. More... | |
float | GetWingArea () const |
Wing area [m²]. More... | |
void | SetWingArea (float _m2) |
Wing area [m²]. More... | |
int | GetWakeCat () const |
Category between 0=light and 3=Super, derived from WTC. More... | |
float | GetMass () const |
Mass [kg]. More... | |
void | SetMass (float _kg) |
Mass [kg]. More... | |
virtual float | GetAoA () const |
Angle of Attach, returns pitch (but you can override in your class) More... | |
virtual float | GetLift () const |
Lift produced. You should override to blend in/out for take-off/landing, but XPMP2 has no dynamic info of your plane, not even an on-the-ground flag. More... | |
void | MapFindIcon () |
Determine which map icon to use for this aircraft. More... | |
void | MapPreparePos (XPLMMapProjectionID projection, const float boundsLTRB[4]) |
Prepare map coordinates. More... | |
void | MapDrawIcon (XPLMMapLayerID inLayer, float acSize) |
Actually draw the map icon. More... | |
void | MapDrawLabel (XPLMMapLayerID inLayer, float yOfs) |
Actually draw the map label. More... | |
FMOD_CHANNEL * | SoundPlay (const std::string &sndName, float vol=1.0f) |
Play a sound; a looping sound plays until explicitely stopped. More... | |
void | SoundStop (FMOD_CHANNEL *pChn) |
Stop a continuously playing sound. More... | |
void | SoundVolume (FMOD_CHANNEL *pChn, float vol) |
Sets the sound's volume (after applying master volume and Sound File's adjustments) More... | |
void | SoundMuteAll (bool bMute) |
Mute/Unmute all sounds of the airplane temporarily. More... | |
virtual std::string | SoundGetName (SoundEventsTy sndEvent, float &volAdj) const |
Returns the name of the sound to play per event. More... | |
-Additional Inherited Members | |
Public Types inherited from XPMP2::Aircraft | |
enum | SoundEventsTy { - SND_ENG = 0 -, SND_REVERSE_THRUST -, SND_TIRE -, SND_GEAR -, - SND_FLAPS -, SND_NUM_EVENTS - - } |
Types of sound supported directly by XPMP2. More... | |
typedef std::list< FMOD_CHANNEL * > | ChnListTy |
List of FMOD channels, also beyond sounds created for SoundEvetsTy. More... | |
Public Attributes inherited from XPCAircraft | |
XPMPPlanePosition_t | acPos |
Last position data. GetPlanePosition() passes a pointer to this member variable. More... | |
XPMPPlaneSurfaces_t | acSurfaces |
Last surface data. GetPlaneSurfaces() passes a pointer to this member variable. More... | |
Public Attributes inherited from XPMP2::Aircraft | |
std::string | acIcaoType |
ICAO aircraft type designator of this plane. More... | |
std::string | acIcaoAirline |
ICAO Airline code of this plane. More... | |
std::string | acLivery |
Livery code of this plane. More... | |
XPLMDrawInfo_t | drawInfo |
Holds position (in local coordinates!) and orientation (pitch, heading roll) of the aircraft. More... | |
bool | bOnGrnd = false |
Is the aircraft on the ground? More... | |
std::vector< float > | v |
actual dataRef values to be provided to the CSL model More... | |
std::string | label |
aircraft label shown in the 3D world next to the plane More... | |
float | colLabel [4] = {1.0f,1.0f,0.0f,1.0f} |
label base color (RGB) More... | |
bool | bDrawLabel = true |
Shall this aircraft's label be drawn? More... | |
float | vertOfsRatio = 1.0f |
How much of the vertical offset shall be applied? (This allows phasing out the vertical offset in higher altitudes.) [0..1]. More... | |
float | gearDeflectRatio = 0.5f |
By how much of the gear deflection shall the plane's altitude be reduced? More... | |
bool | bClampToGround = false |
Shall this plane be clamped to ground (ie. never sink below ground)? More... | |
int | aiPrio = 1 |
Priority for display in one of the limited number of TCAS target slots. More... | |
XPMPPlaneRadar_t | acRadar |
Current radar status. More... | |
struct XPMP2::Aircraft::wakeTy | wake |
wake-support data More... | |
XPMPInfoTexts_t | acInfoTexts |
Informational texts passed on via multiplayer shared dataRefs. More... | |
int | sndMinDist = 50.0 |
Minimum distance in [m] to play sound in full volume, the larger the 'louder' the aircraft. More... | |
Protected Member Functions inherited from XPMP2::Aircraft | |
void | DoMove () |
Internal: This puts the instance into XP's sky and makes it move. More... | |
void | UpdateDistBearingCamera (const XPLMCameraPosition_t &posCam) |
Internal: Update the plane's distance/bearing from the camera location. More... | |
void | ClampToGround () |
Clamp to ground: Make sure the plane is not below ground, corrects Aircraft::drawInfo if needed. More... | |
bool | CreateInstances () |
Create the instances required to represent the plane, return if successful. More... | |
void | DestroyInstances () |
Destroy all instances. More... | |
virtual void | ComputeMapLabel () |
Put together the map label. More... | |
virtual void | SetTcasTargetIdx (int _idx) |
Define the TCAS target index in use. More... | |
virtual void | SoundSetup () |
Sound-related initializations, called by Create() and ChangeModel() More... | |
virtual void | SoundUpdate () |
Update sound, like position and volume, called once per frame. More... | |
virtual void | SoundRemoveAll () |
Remove all sound, e.g. during destruction. More... | |
Static Protected Member Functions inherited from XPMP2::Aircraft | |
static float | FlightLoopCB (float, float, int, void *) |
Internal: Flight loop callback function controlling update and movement of all planes. More... | |
Protected Attributes inherited from XPMP2::Aircraft | |
XPMPPlaneID | modeS_id = 0 |
A plane is uniquely identified by a 24bit number [0x01..0xFFFFFF]. More... | |
bool | bValid = true |
is this object valid? (Will be reset in case of exceptions) More... | |
bool | bVisible = true |
Shall this plane be drawn at the moment and be visible to TCAS/interfaces? More... | |
bool | bRender = true |
Shall the CSL model be drawn in 3D world? (if !bRender && bVivile then still visible on TCAS/interfaces, Remote Client uses this for local senders' planes to take over TCAS but not drawing) More... | |
XPMP2::CSLModel * | pCSLMdl = nullptr |
the CSL model in use More... | |
int | matchQuality = -1 |
quality of the match with the CSL model More... | |
int | acRelGrp = 0 |
related group, ie. line in related.txt in which this a/c appears, if any More... | |
float | prev_x = 0.0f |
float | prev_y = 0.0f |
float | prev_z = 0.0f |
float | prev_ts = 0.0f |
last update of prev_x/y/z in XP's network time More... | |
float | v_x = 0.0f |
float | v_y = 0.0f |
float | v_z = 0.0f |
Cartesian velocity in m/s per axis. More... | |
float | gs_kn = 0.0f |
float | tsResetTouchDown = NAN |
ground speed in [kn] based on above v_x/z More... | |
std::list< XPLMInstanceRef > | listInst |
X-Plane instance handles for all objects making up the model. More... | |
int | tcasTargetIdx = -1 |
Which sim/cockpit2/tcas/targets -index does this plane occupy? [1..63], -1 if none. More... | |
float | camTimLstUpd = 0.0f |
Timestamp of last update of camera dist/bearing. More... | |
float | camDist = 0.0f |
Distance to camera in meters (updated internally regularly) More... | |
float | camBearing = 0.0f |
Bearing from camera in degrees (updated internally regularly) More... | |
XPLMProbeRef | hProbe = nullptr |
Y Probe for terrain testing, needed in ground clamping. More... | |
int | mapIconRow = 0 |
map icon coordinates, row More... | |
int | mapIconCol = 0 |
map icon coordinates, column More... | |
float | mapX = 0.0f |
temporary: map coordinates (NAN = not to be drawn) More... | |
float | mapY = 0.0f |
temporary: map coordinates (NAN = not to be drawn) More... | |
std::string | mapLabel |
label for map drawing More... | |
SndChTy | aSndCh [SND_NUM_EVENTS] |
Operational values per sound channel, that is triggered by a standard sound event. More... | |
bool | bChnLowPass = false |
Is Low Pass Filter currently being active? More... | |
bool | bChnMuted = false |
Is sound for this aircraft currently muted? More... | |
ChnListTy | chnList |
List of channels produced via calls to SoundPlay() More... | |
int | skipCounter = 0 |
Counts how often we skipped expensive computations. More... | |
Subclassing XPCAircraft to create our own class.
-
-
|
- -inline | -
Constructor just passes on all parameters to library.
- -
-
|
- -inlinevirtual | -
Called before rendering to query plane's textual information, overwritten to provide your implementation (optional)
-Handling this requests is completely optional. The texts are provided on shared dataRefs and used only by few other plugins, one of it is FSTramp.
- Here in the example we keep it simple and just return some known data.
Reimplemented from XPCAircraft.
- -
-
|
- -inlinevirtual | -
Called before rendering to query plane's current position, overwritten to provide your implementation.
- -Implements XPCAircraft.
- -
-
|
- -inlinevirtual | -
Called before rendering to query plane's current radar visibility, overwritten to provide your implementation.
- -Implements XPCAircraft.
- -
-
|
- -inlinevirtual | -
Called before rendering to query plane's current configuration, overwritten to provide your implementation.
- -Implements XPCAircraft.
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
This is the complete list of members for RemoteAC, including all inherited members.
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Representation of a remote aircraft. - More...
- -#include <Client.h>
-Public Member Functions | |
RemoteAC (SenderTy &_sender, const XPMP2::RemoteAcDetailTy &_acDetails) | |
Constructor for use in network thread: Does not Create the aircraft but only stores the passed information. More... | |
virtual | ~RemoteAC () |
Destructor. More... | |
void | Create () |
Actually create the aircraft, ultimately calls XPMP2::Aircraft::Create() More... | |
void | Update (const XPMP2::RemoteAcDetailTy &_acDetails) |
Update data from an a/c detail structure. More... | |
void | Update (const XPMP2::RemoteAcPosUpdateTy &_acPosUpd) |
Update data from an a/c position update. More... | |
void | Update (const XPMP2::RemoteAcAnimTy &_acAnim) |
Update data from an a/c animation dataRefs message. More... | |
void | UpdatePosition (float, int) override |
Called by XPMP2 for position updates, extrapolates from historic positions. More... | |
void | MarkForDeletion () |
Mark this aircraft as to-be-deleted in the next flight loop (can't do in worker thread) More... | |
bool | IsToBeDeleted () const |
To be deleted? More... | |
Public Member Functions inherited from XPMP2::Aircraft | |
Aircraft (const std::string &_icaoType, const std::string &_icaoAirline, const std::string &_livery, XPMPPlaneID _modeS_id=0, const std::string &_cslId="") | |
Constructor creates a new aircraft object, which will be managed and displayed. More... | |
Aircraft () | |
Default constructor creates an empty, invalid(!) and invisible shell; call XPMP2::Aircraft::Create() to actually create a plane. More... | |
virtual | ~Aircraft () |
Destructor cleans up all resources acquired. More... | |
Aircraft (const Aircraft &)=delete | |
Aircraft must not be copied as they reference non-copyable resources like XP instances. More... | |
Aircraft & | operator= (const Aircraft &)=delete |
Aircraft must not be copied as they reference non-copyable resources like XP instances. More... | |
void | Create (const std::string &_icaoType, const std::string &_icaoAirline, const std::string &_livery, XPMPPlaneID _modeS_id=0, const std::string &_cslId="", CSLModel *_pCSLModel=nullptr) |
Creates a plane, only a valid operation if object was created using the default constructor. More... | |
XPMPPlaneID | GetModeS_ID () const |
return the XPMP2 plane id More... | |
bool | IsGroundVehicle () const |
Is this object a ground vehicle? More... | |
bool | IsRelatedTo (const std::string &_icaoType) const |
Is this object "related" to the given ICAO code? (named in the same line in related.txt) More... | |
int | GetTcasTargetIdx () const |
return the current TCAS target index (into sim/cockpit2/tcas/targets ), 1-based, -1 if not used More... | |
bool | IsCurrentlyShownAsTcasTarget () const |
Is this plane currently also being tracked as a TCAS target, ie. will appear on TCAS? More... | |
bool | IsCurrentlyShownAsAI () const |
Is this plane currently also being tracked by X-Plane's classic AI/multiplayer? More... | |
bool | ShowAsAIPlane () const |
Is this plane to be drawn on TCAS? (It will if transponder is not switched off) More... | |
void | ResetTcasTargetIdx () |
Reset TCAS target slot index to -1 More... | |
virtual std::string | GetFlightId () const |
Return a value for dataRef .../tcas/target/flight_id. More... | |
int | ChangeModel (const std::string &_icaoType, const std::string &_icaoAirline, const std::string &_livery) |
(Potentially) changes the plane's model after doing a new match attempt More... | |
int | ReMatchModel () |
Finds a match again, using the existing parameters, eg. after more models have been loaded. More... | |
bool | AssignModel (const std::string &_cslId, CSLModel *_pCSLModel=nullptr) |
Assigns the given model. More... | |
XPMP2::CSLModel * | GetModel () const |
return a pointer to the CSL model in use (Note: The CSLModel structure is not public.) More... | |
const std::string & | GetModelName () const |
return the name of the CSL model in use More... | |
CSLModelInfo_t | GetModelInfo () const |
return an information structure for the CSL model associated with the aircraft More... | |
int | GetMatchQuality () const |
quality of the match with the CSL model More... | |
float | GetVertOfs () const |
Vertical offset, ie. the value that needs to be added to drawInfo.y to make the aircraft appear on the ground. More... | |
bool | IsValid () const |
Is the a/c object valid? More... | |
virtual void | SetInvalid () |
Mark the plane invalid, e.g. after exceptions occured on the data. More... | |
virtual void | SetVisible (bool _bVisible) |
Make the plane (in)visible. More... | |
bool | IsVisible () const |
Is the plane visible? More... | |
virtual void | SetRender (bool _bRender) |
Switch rendering of the CSL model on or off. More... | |
bool | IsRendered () const |
Is this plane to be rendered? More... | |
bool | IsInstanciated () const |
Are instances created for this aircraft? More... | |
void | SetDrawLabel (bool _b) |
Define if this aircraft's label is to be drawn (provided label drawing is enabled globally) More... | |
bool | ShallDrawLabel () const |
Shall this aircraft's label be drawn? More... | |
float | GetCameraDist () const |
Distance to camera [m]. More... | |
float | GetCameraBearing () const |
Bearing from camera [°]. More... | |
bool | IsOnGrnd () const |
Is the aircraft on the ground? More... | |
void | SetOnGrnd (bool on_grnd, float setTouchDownTime=NAN) |
Set if the aircraft is on the ground. More... | |
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. More... | |
void | SetLocation (double lat, double lon, double alt_ft) |
Legacy version of above version of SetLocatiion(), here without setting ground flag. More... | |
void | GetLocation (double &lat, double &lon, double &alt_ft) const |
Converts aircraft's local coordinates to lat/lon values. More... | |
void | SetLocalLoc (float _x, float _y, float _z) |
Sets location in local world coordinates. More... | |
const XPLMDrawInfo_t & | GetLocation () const |
Gets all location info (including local coordinates) More... | |
float | GetPitch () const |
pitch [degree] More... | |
void | SetPitch (float _deg) |
pitch [degree] More... | |
float | GetHeading () const |
heading [degree] More... | |
void | SetHeading (float _deg) |
heading [degree] More... | |
float | GetRoll () const |
roll [degree] More... | |
void | SetRoll (float _deg) |
roll [degree] More... | |
float | GetGS_kn () const |
Rough estimate of a ground speed based on v_x/z More... | |
float | GetGearRatio () const |
Gear deploy ratio. More... | |
void | SetGearRatio (float _f) |
Gear deploy ratio. More... | |
float | GetNoseWheelAngle () const |
Nose Wheel angle in degrees. More... | |
void | SetNoseWheelAngle (float _f) |
Nose Wheel angle in degrees. More... | |
float | GetFlapRatio () const |
Flaps deploy ratio. More... | |
void | SetFlapRatio (float _f) |
Flaps deploy ratio. More... | |
float | GetSpoilerRatio () const |
Spoilers deploy ratio. More... | |
void | SetSpoilerRatio (float _f) |
Spoilers deploy ratio. More... | |
float | GetSpeedbrakeRatio () const |
Speedbrakes deploy ratio. More... | |
void | SetSpeedbrakeRatio (float _f) |
Speedbrakes deploy ratio. More... | |
float | GetSlatRatio () const |
Slats deploy ratio. More... | |
void | SetSlatRatio (float _f) |
Slats deploy ratio. More... | |
float | GetWingSweepRatio () const |
Wing sweep ratio. More... | |
void | SetWingSweepRatio (float _f) |
Wing sweep ratio. More... | |
float | GetThrustRatio () const |
Thrust ratio. More... | |
void | SetThrustRatio (float _f) |
Thrust ratio. More... | |
float | GetYokePitchRatio () const |
Yoke pitch ratio. More... | |
void | SetYokePitchRatio (float _f) |
Yoke pitch ratio. More... | |
float | GetYokeHeadingRatio () const |
Yoke heading ratio. More... | |
void | SetYokeHeadingRatio (float _f) |
Yoke heading ratio. More... | |
float | GetYokeRollRatio () const |
Yoke roll ratio. More... | |
void | SetYokeRollRatio (float _f) |
Yoke roll ratio. More... | |
float | GetThrustReversRatio () const |
Thrust reversers ratio. More... | |
void | SetThrustReversRatio (float _f) |
Thrust reversers ratio. More... | |
bool | GetLightsTaxi () const |
Taxi lights. More... | |
void | SetLightsTaxi (bool _b) |
Taxi lights. More... | |
bool | GetLightsLanding () const |
Landing lights. More... | |
void | SetLightsLanding (bool _b) |
Landing lights. More... | |
bool | GetLightsBeacon () const |
Beacon lights. More... | |
void | SetLightsBeacon (bool _b) |
Beacon lights. More... | |
bool | GetLightsStrobe () const |
Strobe lights. More... | |
void | SetLightsStrobe (bool _b) |
Strobe lights. More... | |
bool | GetLightsNav () const |
Navigation lights. More... | |
void | SetLightsNav (bool _b) |
Navigation lights. More... | |
float | GetNoseGearDeflection () const |
Vertical nose gear deflection [meter]. More... | |
void | SetNoseGearDeflection (float _mtr) |
Vertical nose gear deflection [meter]. More... | |
float | GetTireDeflection () const |
Vertical (main) gear deflection [meter]. More... | |
void | SetTireDeflection (float _mtr) |
Vertical (main) gear deflection [meter]. More... | |
float | GetTireRotAngle () const |
Tire rotation angle [degree]. More... | |
void | SetTireRotAngle (float _deg) |
Tire rotation angle [degree]. More... | |
float | GetTireRotRpm () const |
Tire rotation speed [rpm]. More... | |
void | SetTireRotRpm (float _rpm) |
float | GetTireRotRad () const |
Tire rotation speed [rad/s]. More... | |
void | SetTireRotRad (float _rad) |
float | GetEngineRotAngle () const |
Engine rotation angle [degree]. More... | |
void | SetEngineRotAngle (float _deg) |
Engine rotation angle [degree], also sets engines 1..4. More... | |
float | GetEngineRotRpm () const |
Engine rotation speed [rpm]. More... | |
void | SetEngineRotRpm (float _rpm) |
Engine rotation speed [rpm], also sets [rad/s] and engines 1..4. More... | |
float | GetEngineRotRad () const |
Engine rotation speed [rad/s]. More... | |
void | SetEngineRotRad (float _rad) |
Engine rotation speed [rad/s], also sets [rpm] and engines 1..4. More... | |
float | GetEngineRotAngle (size_t idx) const |
< Engine rotation angle [degree] for engine idx (1..4) More... | |
void | SetEngineRotAngle (size_t idx, float _deg) |
Engine rotation angle [degree] for engine idx (1..4) More... | |
float | GetEngineRotRpm (size_t idx) const |
< Engine rotation speed [rpm] for engine idx (1..4) More... | |
void | SetEngineRotRpm (size_t idx, float _rpm) |
Engine rotation speed [rpm] for engine idx (1..4), also sets [rad/s]. More... | |
float | GetEngineRotRad (size_t idx) const |
< Engine rotation speed [rad/s] for engine idx (1..4) More... | |
void | SetEngineRotRad (size_t idx, float _rad) |
Engine rotation speed [rad/s] for engine idx (1..4), also sets [rpm]. More... | |
float | GetPropRotAngle () const |
Propellor rotation angle [degree]. More... | |
void | SetPropRotAngle (float _deg) |
Propellor rotation angle [degree]. More... | |
float | GetPropRotRpm () const |
Propellor rotation speed [rpm]. More... | |
void | SetPropRotRpm (float _rpm) |
float | GetPropRotRad () const |
Propellor rotation speed [rad/s]. More... | |
void | SetPropRotRad (float _rad) |
float | GetReversDeployRatio () const |
Thrust reversers deploy ratio. More... | |
void | SetReversDeployRatio (float _f) |
Thrust reversers deploy ratio. More... | |
bool | GetTouchDown () const |
Moment of touch down. More... | |
void | SetTouchDown (bool _b) |
Moment of touch down. More... | |
void | WakeApplyDefaults (bool _bOverwriteAllFields=true) |
Fill in default wake turbulence support data based on Doc8643 wake turbulence category. More... | |
float | GetWingSpan () const |
Wing span [m]. More... | |
void | SetWingSpan (float _m) |
Wing span [m]. More... | |
float | GetWingArea () const |
Wing area [m²]. More... | |
void | SetWingArea (float _m2) |
Wing area [m²]. More... | |
int | GetWakeCat () const |
Category between 0=light and 3=Super, derived from WTC. More... | |
float | GetMass () const |
Mass [kg]. More... | |
void | SetMass (float _kg) |
Mass [kg]. More... | |
virtual float | GetAoA () const |
Angle of Attach, returns pitch (but you can override in your class) More... | |
virtual float | GetLift () const |
Lift produced. You should override to blend in/out for take-off/landing, but XPMP2 has no dynamic info of your plane, not even an on-the-ground flag. More... | |
void | MapFindIcon () |
Determine which map icon to use for this aircraft. More... | |
void | MapPreparePos (XPLMMapProjectionID projection, const float boundsLTRB[4]) |
Prepare map coordinates. More... | |
void | MapDrawIcon (XPLMMapLayerID inLayer, float acSize) |
Actually draw the map icon. More... | |
void | MapDrawLabel (XPLMMapLayerID inLayer, float yOfs) |
Actually draw the map label. More... | |
FMOD_CHANNEL * | SoundPlay (const std::string &sndName, float vol=1.0f) |
Play a sound; a looping sound plays until explicitely stopped. More... | |
void | SoundStop (FMOD_CHANNEL *pChn) |
Stop a continuously playing sound. More... | |
void | SoundVolume (FMOD_CHANNEL *pChn, float vol) |
Sets the sound's volume (after applying master volume and Sound File's adjustments) More... | |
void | SoundMuteAll (bool bMute) |
Mute/Unmute all sounds of the airplane temporarily. More... | |
virtual std::string | SoundGetName (SoundEventsTy sndEvent, float &volAdj) const |
Returns the name of the sound to play per event. More... | |
-Protected Attributes | |
XPMPPlaneID | senderId = 0 |
sender's plane id (might be different here in case of deduplication) More... | |
std::uint16_t | pkgHash = 0 |
hash value of CSL model package More... | |
std::string | sShortId |
CSL model's short id. More... | |
bool | bDeleteMe = false |
flag that this a/c needs to removed More... | |
XPLMDrawInfo_t | histPos [2] |
We keep 2 historic positions to be able to calculate simple linear extrapolation. More... | |
std::chrono::time_point< std::chrono::steady_clock > | histTs [2] |
Timestamps when these two positions were valid. More... | |
double | lat = NAN |
latitude More... | |
double | lon = NAN |
longitude More... | |
double | alt_ft = NAN |
altitude [ft] More... | |
std::chrono::duration< int, std::ratio< 1, 10000 > > | diffTime |
time difference to previous historic position as passed in by the sender More... | |
bool | bWorldCoordUpdated = false |
shall freshly set values be used in the next UpdatePosition callback? More... | |
bool | bCSLModelChanged = false |
SenderTy & | sender |
Protected Attributes inherited from XPMP2::Aircraft | |
XPMPPlaneID | modeS_id = 0 |
A plane is uniquely identified by a 24bit number [0x01..0xFFFFFF]. More... | |
bool | bValid = true |
is this object valid? (Will be reset in case of exceptions) More... | |
bool | bVisible = true |
Shall this plane be drawn at the moment and be visible to TCAS/interfaces? More... | |
bool | bRender = true |
Shall the CSL model be drawn in 3D world? (if !bRender && bVivile then still visible on TCAS/interfaces, Remote Client uses this for local senders' planes to take over TCAS but not drawing) More... | |
XPMP2::CSLModel * | pCSLMdl = nullptr |
the CSL model in use More... | |
int | matchQuality = -1 |
quality of the match with the CSL model More... | |
int | acRelGrp = 0 |
related group, ie. line in related.txt in which this a/c appears, if any More... | |
float | prev_x = 0.0f |
float | prev_y = 0.0f |
float | prev_z = 0.0f |
float | prev_ts = 0.0f |
last update of prev_x/y/z in XP's network time More... | |
float | v_x = 0.0f |
float | v_y = 0.0f |
float | v_z = 0.0f |
Cartesian velocity in m/s per axis. More... | |
float | gs_kn = 0.0f |
float | tsResetTouchDown = NAN |
ground speed in [kn] based on above v_x/z More... | |
std::list< XPLMInstanceRef > | listInst |
X-Plane instance handles for all objects making up the model. More... | |
int | tcasTargetIdx = -1 |
Which sim/cockpit2/tcas/targets -index does this plane occupy? [1..63], -1 if none. More... | |
float | camTimLstUpd = 0.0f |
Timestamp of last update of camera dist/bearing. More... | |
float | camDist = 0.0f |
Distance to camera in meters (updated internally regularly) More... | |
float | camBearing = 0.0f |
Bearing from camera in degrees (updated internally regularly) More... | |
XPLMProbeRef | hProbe = nullptr |
Y Probe for terrain testing, needed in ground clamping. More... | |
int | mapIconRow = 0 |
map icon coordinates, row More... | |
int | mapIconCol = 0 |
map icon coordinates, column More... | |
float | mapX = 0.0f |
temporary: map coordinates (NAN = not to be drawn) More... | |
float | mapY = 0.0f |
temporary: map coordinates (NAN = not to be drawn) More... | |
std::string | mapLabel |
label for map drawing More... | |
SndChTy | aSndCh [SND_NUM_EVENTS] |
Operational values per sound channel, that is triggered by a standard sound event. More... | |
bool | bChnLowPass = false |
Is Low Pass Filter currently being active? More... | |
bool | bChnMuted = false |
Is sound for this aircraft currently muted? More... | |
ChnListTy | chnList |
List of channels produced via calls to SoundPlay() More... | |
int | skipCounter = 0 |
Counts how often we skipped expensive computations. More... | |
-Additional Inherited Members | |
Public Types inherited from XPMP2::Aircraft | |
enum | SoundEventsTy { - SND_ENG = 0 -, SND_REVERSE_THRUST -, SND_TIRE -, SND_GEAR -, - SND_FLAPS -, SND_NUM_EVENTS - - } |
Types of sound supported directly by XPMP2. More... | |
typedef std::list< FMOD_CHANNEL * > | ChnListTy |
List of FMOD channels, also beyond sounds created for SoundEvetsTy. More... | |
Public Attributes inherited from XPMP2::Aircraft | |
std::string | acIcaoType |
ICAO aircraft type designator of this plane. More... | |
std::string | acIcaoAirline |
ICAO Airline code of this plane. More... | |
std::string | acLivery |
Livery code of this plane. More... | |
XPLMDrawInfo_t | drawInfo |
Holds position (in local coordinates!) and orientation (pitch, heading roll) of the aircraft. More... | |
bool | bOnGrnd = false |
Is the aircraft on the ground? More... | |
std::vector< float > | v |
actual dataRef values to be provided to the CSL model More... | |
std::string | label |
aircraft label shown in the 3D world next to the plane More... | |
float | colLabel [4] = {1.0f,1.0f,0.0f,1.0f} |
label base color (RGB) More... | |
bool | bDrawLabel = true |
Shall this aircraft's label be drawn? More... | |
float | vertOfsRatio = 1.0f |
How much of the vertical offset shall be applied? (This allows phasing out the vertical offset in higher altitudes.) [0..1]. More... | |
float | gearDeflectRatio = 0.5f |
By how much of the gear deflection shall the plane's altitude be reduced? More... | |
bool | bClampToGround = false |
Shall this plane be clamped to ground (ie. never sink below ground)? More... | |
int | aiPrio = 1 |
Priority for display in one of the limited number of TCAS target slots. More... | |
XPMPPlaneRadar_t | acRadar |
Current radar status. More... | |
struct XPMP2::Aircraft::wakeTy | wake |
wake-support data More... | |
XPMPInfoTexts_t | acInfoTexts |
Informational texts passed on via multiplayer shared dataRefs. More... | |
int | sndMinDist = 50.0 |
Minimum distance in [m] to play sound in full volume, the larger the 'louder' the aircraft. More... | |
Protected Member Functions inherited from XPMP2::Aircraft | |
void | DoMove () |
Internal: This puts the instance into XP's sky and makes it move. More... | |
void | UpdateDistBearingCamera (const XPLMCameraPosition_t &posCam) |
Internal: Update the plane's distance/bearing from the camera location. More... | |
void | ClampToGround () |
Clamp to ground: Make sure the plane is not below ground, corrects Aircraft::drawInfo if needed. More... | |
bool | CreateInstances () |
Create the instances required to represent the plane, return if successful. More... | |
void | DestroyInstances () |
Destroy all instances. More... | |
virtual void | ComputeMapLabel () |
Put together the map label. More... | |
virtual void | SetTcasTargetIdx (int _idx) |
Define the TCAS target index in use. More... | |
virtual void | SoundSetup () |
Sound-related initializations, called by Create() and ChangeModel() More... | |
virtual void | SoundUpdate () |
Update sound, like position and volume, called once per frame. More... | |
virtual void | SoundRemoveAll () |
Remove all sound, e.g. during destruction. More... | |
Static Protected Member Functions inherited from XPMP2::Aircraft | |
static float | FlightLoopCB (float, float, int, void *) |
Internal: Flight loop callback function controlling update and movement of all planes. More... | |
Representation of a remote aircraft.
-RemoteAC::RemoteAC | -( | -SenderTy & | -_sender, | -
- | - | const XPMP2::RemoteAcDetailTy & | -_acDetails | -
- | ) | -- |
Constructor for use in network thread: Does not Create the aircraft but only stores the passed information.
- -
-
|
- -virtual | -
Destructor.
- -void RemoteAC::Create | -( | -) | -- |
Actually create the aircraft, ultimately calls XPMP2::Aircraft::Create()
- -
-
|
- -inline | -
To be deleted?
- -
-
|
- -inline | -
Mark this aircraft as to-be-deleted in the next flight loop (can't do in worker thread)
- -void RemoteAC::Update | -( | -const XPMP2::RemoteAcAnimTy & | -_acAnim | ) | -- |
Update data from an a/c animation dataRefs message.
- -void RemoteAC::Update | -( | -const XPMP2::RemoteAcDetailTy & | -_acDetails | ) | -- |
Update data from an a/c detail structure.
- -void RemoteAC::Update | -( | -const XPMP2::RemoteAcPosUpdateTy & | -_acPosUpd | ) | -- |
Update data from an a/c position update.
- -
-
|
- -overridevirtual | -
Called by XPMP2 for position updates, extrapolates from historic positions.
- -Implements XPMP2::Aircraft.
- -
-
|
- -protected | -
altitude [ft]
- -
-
|
- -protected | -
-
|
- -protected | -
flag that this a/c needs to removed
- -
-
|
- -protected | -
shall freshly set values be used in the next UpdatePosition callback?
- -
-
|
- -protected | -
time difference to previous historic position as passed in by the sender
- -
-
|
- -protected | -
We keep 2 historic positions to be able to calculate simple linear extrapolation.
-Index 0 is the older one, index 1 the newer one
- -
-
|
- -protected | -
Timestamps when these two positions were valid.
- -
-
|
- -protected | -
latitude
- -
-
|
- -protected | -
longitude
- -
-
|
- -protected | -
hash value of CSL model package
- -
-
|
- -protected | -
-
|
- -protected | -
sender's plane id (might be different here in case of deduplication)
- -
-
|
- -protected | -
CSL model's short id.
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
This is the complete list of members for SampleAircraft, including all inherited members.
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Subclassing XPMP2::Aircraft to create our own class. - More...
--Public Member Functions | |
SampleAircraft (const std::string &_icaoType, const std::string &_icaoAirline, const std::string &_livery, XPMPPlaneID _modeS_id=0, const std::string &_cslId="") | |
Constructor just passes on all parameters to library. More... | |
virtual void | UpdatePosition (float, int) |
Custom implementation for the virtual function providing updates values. More... | |
Public Member Functions inherited from XPMP2::Aircraft | |
Aircraft (const std::string &_icaoType, const std::string &_icaoAirline, const std::string &_livery, XPMPPlaneID _modeS_id=0, const std::string &_cslId="") | |
Constructor creates a new aircraft object, which will be managed and displayed. More... | |
Aircraft () | |
Default constructor creates an empty, invalid(!) and invisible shell; call XPMP2::Aircraft::Create() to actually create a plane. More... | |
virtual | ~Aircraft () |
Destructor cleans up all resources acquired. More... | |
Aircraft (const Aircraft &)=delete | |
Aircraft must not be copied as they reference non-copyable resources like XP instances. More... | |
Aircraft & | operator= (const Aircraft &)=delete |
Aircraft must not be copied as they reference non-copyable resources like XP instances. More... | |
void | Create (const std::string &_icaoType, const std::string &_icaoAirline, const std::string &_livery, XPMPPlaneID _modeS_id=0, const std::string &_cslId="", CSLModel *_pCSLModel=nullptr) |
Creates a plane, only a valid operation if object was created using the default constructor. More... | |
XPMPPlaneID | GetModeS_ID () const |
return the XPMP2 plane id More... | |
bool | IsGroundVehicle () const |
Is this object a ground vehicle? More... | |
bool | IsRelatedTo (const std::string &_icaoType) const |
Is this object "related" to the given ICAO code? (named in the same line in related.txt) More... | |
int | GetTcasTargetIdx () const |
return the current TCAS target index (into sim/cockpit2/tcas/targets ), 1-based, -1 if not used More... | |
bool | IsCurrentlyShownAsTcasTarget () const |
Is this plane currently also being tracked as a TCAS target, ie. will appear on TCAS? More... | |
bool | IsCurrentlyShownAsAI () const |
Is this plane currently also being tracked by X-Plane's classic AI/multiplayer? More... | |
bool | ShowAsAIPlane () const |
Is this plane to be drawn on TCAS? (It will if transponder is not switched off) More... | |
void | ResetTcasTargetIdx () |
Reset TCAS target slot index to -1 More... | |
virtual std::string | GetFlightId () const |
Return a value for dataRef .../tcas/target/flight_id. More... | |
int | ChangeModel (const std::string &_icaoType, const std::string &_icaoAirline, const std::string &_livery) |
(Potentially) changes the plane's model after doing a new match attempt More... | |
int | ReMatchModel () |
Finds a match again, using the existing parameters, eg. after more models have been loaded. More... | |
bool | AssignModel (const std::string &_cslId, CSLModel *_pCSLModel=nullptr) |
Assigns the given model. More... | |
XPMP2::CSLModel * | GetModel () const |
return a pointer to the CSL model in use (Note: The CSLModel structure is not public.) More... | |
const std::string & | GetModelName () const |
return the name of the CSL model in use More... | |
CSLModelInfo_t | GetModelInfo () const |
return an information structure for the CSL model associated with the aircraft More... | |
int | GetMatchQuality () const |
quality of the match with the CSL model More... | |
float | GetVertOfs () const |
Vertical offset, ie. the value that needs to be added to drawInfo.y to make the aircraft appear on the ground. More... | |
bool | IsValid () const |
Is the a/c object valid? More... | |
virtual void | SetInvalid () |
Mark the plane invalid, e.g. after exceptions occured on the data. More... | |
virtual void | SetVisible (bool _bVisible) |
Make the plane (in)visible. More... | |
bool | IsVisible () const |
Is the plane visible? More... | |
virtual void | SetRender (bool _bRender) |
Switch rendering of the CSL model on or off. More... | |
bool | IsRendered () const |
Is this plane to be rendered? More... | |
bool | IsInstanciated () const |
Are instances created for this aircraft? More... | |
void | SetDrawLabel (bool _b) |
Define if this aircraft's label is to be drawn (provided label drawing is enabled globally) More... | |
bool | ShallDrawLabel () const |
Shall this aircraft's label be drawn? More... | |
float | GetCameraDist () const |
Distance to camera [m]. More... | |
float | GetCameraBearing () const |
Bearing from camera [°]. More... | |
bool | IsOnGrnd () const |
Is the aircraft on the ground? More... | |
void | SetOnGrnd (bool on_grnd, float setTouchDownTime=NAN) |
Set if the aircraft is on the ground. More... | |
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. More... | |
void | SetLocation (double lat, double lon, double alt_ft) |
Legacy version of above version of SetLocatiion(), here without setting ground flag. More... | |
void | GetLocation (double &lat, double &lon, double &alt_ft) const |
Converts aircraft's local coordinates to lat/lon values. More... | |
void | SetLocalLoc (float _x, float _y, float _z) |
Sets location in local world coordinates. More... | |
const XPLMDrawInfo_t & | GetLocation () const |
Gets all location info (including local coordinates) More... | |
float | GetPitch () const |
pitch [degree] More... | |
void | SetPitch (float _deg) |
pitch [degree] More... | |
float | GetHeading () const |
heading [degree] More... | |
void | SetHeading (float _deg) |
heading [degree] More... | |
float | GetRoll () const |
roll [degree] More... | |
void | SetRoll (float _deg) |
roll [degree] More... | |
float | GetGS_kn () const |
Rough estimate of a ground speed based on v_x/z More... | |
float | GetGearRatio () const |
Gear deploy ratio. More... | |
void | SetGearRatio (float _f) |
Gear deploy ratio. More... | |
float | GetNoseWheelAngle () const |
Nose Wheel angle in degrees. More... | |
void | SetNoseWheelAngle (float _f) |
Nose Wheel angle in degrees. More... | |
float | GetFlapRatio () const |
Flaps deploy ratio. More... | |
void | SetFlapRatio (float _f) |
Flaps deploy ratio. More... | |
float | GetSpoilerRatio () const |
Spoilers deploy ratio. More... | |
void | SetSpoilerRatio (float _f) |
Spoilers deploy ratio. More... | |
float | GetSpeedbrakeRatio () const |
Speedbrakes deploy ratio. More... | |
void | SetSpeedbrakeRatio (float _f) |
Speedbrakes deploy ratio. More... | |
float | GetSlatRatio () const |
Slats deploy ratio. More... | |
void | SetSlatRatio (float _f) |
Slats deploy ratio. More... | |
float | GetWingSweepRatio () const |
Wing sweep ratio. More... | |
void | SetWingSweepRatio (float _f) |
Wing sweep ratio. More... | |
float | GetThrustRatio () const |
Thrust ratio. More... | |
void | SetThrustRatio (float _f) |
Thrust ratio. More... | |
float | GetYokePitchRatio () const |
Yoke pitch ratio. More... | |
void | SetYokePitchRatio (float _f) |
Yoke pitch ratio. More... | |
float | GetYokeHeadingRatio () const |
Yoke heading ratio. More... | |
void | SetYokeHeadingRatio (float _f) |
Yoke heading ratio. More... | |
float | GetYokeRollRatio () const |
Yoke roll ratio. More... | |
void | SetYokeRollRatio (float _f) |
Yoke roll ratio. More... | |
float | GetThrustReversRatio () const |
Thrust reversers ratio. More... | |
void | SetThrustReversRatio (float _f) |
Thrust reversers ratio. More... | |
bool | GetLightsTaxi () const |
Taxi lights. More... | |
void | SetLightsTaxi (bool _b) |
Taxi lights. More... | |
bool | GetLightsLanding () const |
Landing lights. More... | |
void | SetLightsLanding (bool _b) |
Landing lights. More... | |
bool | GetLightsBeacon () const |
Beacon lights. More... | |
void | SetLightsBeacon (bool _b) |
Beacon lights. More... | |
bool | GetLightsStrobe () const |
Strobe lights. More... | |
void | SetLightsStrobe (bool _b) |
Strobe lights. More... | |
bool | GetLightsNav () const |
Navigation lights. More... | |
void | SetLightsNav (bool _b) |
Navigation lights. More... | |
float | GetNoseGearDeflection () const |
Vertical nose gear deflection [meter]. More... | |
void | SetNoseGearDeflection (float _mtr) |
Vertical nose gear deflection [meter]. More... | |
float | GetTireDeflection () const |
Vertical (main) gear deflection [meter]. More... | |
void | SetTireDeflection (float _mtr) |
Vertical (main) gear deflection [meter]. More... | |
float | GetTireRotAngle () const |
Tire rotation angle [degree]. More... | |
void | SetTireRotAngle (float _deg) |
Tire rotation angle [degree]. More... | |
float | GetTireRotRpm () const |
Tire rotation speed [rpm]. More... | |
void | SetTireRotRpm (float _rpm) |
float | GetTireRotRad () const |
Tire rotation speed [rad/s]. More... | |
void | SetTireRotRad (float _rad) |
float | GetEngineRotAngle () const |
Engine rotation angle [degree]. More... | |
void | SetEngineRotAngle (float _deg) |
Engine rotation angle [degree], also sets engines 1..4. More... | |
float | GetEngineRotRpm () const |
Engine rotation speed [rpm]. More... | |
void | SetEngineRotRpm (float _rpm) |
Engine rotation speed [rpm], also sets [rad/s] and engines 1..4. More... | |
float | GetEngineRotRad () const |
Engine rotation speed [rad/s]. More... | |
void | SetEngineRotRad (float _rad) |
Engine rotation speed [rad/s], also sets [rpm] and engines 1..4. More... | |
float | GetEngineRotAngle (size_t idx) const |
< Engine rotation angle [degree] for engine idx (1..4) More... | |
void | SetEngineRotAngle (size_t idx, float _deg) |
Engine rotation angle [degree] for engine idx (1..4) More... | |
float | GetEngineRotRpm (size_t idx) const |
< Engine rotation speed [rpm] for engine idx (1..4) More... | |
void | SetEngineRotRpm (size_t idx, float _rpm) |
Engine rotation speed [rpm] for engine idx (1..4), also sets [rad/s]. More... | |
float | GetEngineRotRad (size_t idx) const |
< Engine rotation speed [rad/s] for engine idx (1..4) More... | |
void | SetEngineRotRad (size_t idx, float _rad) |
Engine rotation speed [rad/s] for engine idx (1..4), also sets [rpm]. More... | |
float | GetPropRotAngle () const |
Propellor rotation angle [degree]. More... | |
void | SetPropRotAngle (float _deg) |
Propellor rotation angle [degree]. More... | |
float | GetPropRotRpm () const |
Propellor rotation speed [rpm]. More... | |
void | SetPropRotRpm (float _rpm) |
float | GetPropRotRad () const |
Propellor rotation speed [rad/s]. More... | |
void | SetPropRotRad (float _rad) |
float | GetReversDeployRatio () const |
Thrust reversers deploy ratio. More... | |
void | SetReversDeployRatio (float _f) |
Thrust reversers deploy ratio. More... | |
bool | GetTouchDown () const |
Moment of touch down. More... | |
void | SetTouchDown (bool _b) |
Moment of touch down. More... | |
void | WakeApplyDefaults (bool _bOverwriteAllFields=true) |
Fill in default wake turbulence support data based on Doc8643 wake turbulence category. More... | |
float | GetWingSpan () const |
Wing span [m]. More... | |
void | SetWingSpan (float _m) |
Wing span [m]. More... | |
float | GetWingArea () const |
Wing area [m²]. More... | |
void | SetWingArea (float _m2) |
Wing area [m²]. More... | |
int | GetWakeCat () const |
Category between 0=light and 3=Super, derived from WTC. More... | |
float | GetMass () const |
Mass [kg]. More... | |
void | SetMass (float _kg) |
Mass [kg]. More... | |
virtual float | GetAoA () const |
Angle of Attach, returns pitch (but you can override in your class) More... | |
virtual float | GetLift () const |
Lift produced. You should override to blend in/out for take-off/landing, but XPMP2 has no dynamic info of your plane, not even an on-the-ground flag. More... | |
void | MapFindIcon () |
Determine which map icon to use for this aircraft. More... | |
void | MapPreparePos (XPLMMapProjectionID projection, const float boundsLTRB[4]) |
Prepare map coordinates. More... | |
void | MapDrawIcon (XPLMMapLayerID inLayer, float acSize) |
Actually draw the map icon. More... | |
void | MapDrawLabel (XPLMMapLayerID inLayer, float yOfs) |
Actually draw the map label. More... | |
FMOD_CHANNEL * | SoundPlay (const std::string &sndName, float vol=1.0f) |
Play a sound; a looping sound plays until explicitely stopped. More... | |
void | SoundStop (FMOD_CHANNEL *pChn) |
Stop a continuously playing sound. More... | |
void | SoundVolume (FMOD_CHANNEL *pChn, float vol) |
Sets the sound's volume (after applying master volume and Sound File's adjustments) More... | |
void | SoundMuteAll (bool bMute) |
Mute/Unmute all sounds of the airplane temporarily. More... | |
virtual std::string | SoundGetName (SoundEventsTy sndEvent, float &volAdj) const |
Returns the name of the sound to play per event. More... | |
-Additional Inherited Members | |
Public Types inherited from XPMP2::Aircraft | |
enum | SoundEventsTy { - SND_ENG = 0 -, SND_REVERSE_THRUST -, SND_TIRE -, SND_GEAR -, - SND_FLAPS -, SND_NUM_EVENTS - - } |
Types of sound supported directly by XPMP2. More... | |
typedef std::list< FMOD_CHANNEL * > | ChnListTy |
List of FMOD channels, also beyond sounds created for SoundEvetsTy. More... | |
Public Attributes inherited from XPMP2::Aircraft | |
std::string | acIcaoType |
ICAO aircraft type designator of this plane. More... | |
std::string | acIcaoAirline |
ICAO Airline code of this plane. More... | |
std::string | acLivery |
Livery code of this plane. More... | |
XPLMDrawInfo_t | drawInfo |
Holds position (in local coordinates!) and orientation (pitch, heading roll) of the aircraft. More... | |
bool | bOnGrnd = false |
Is the aircraft on the ground? More... | |
std::vector< float > | v |
actual dataRef values to be provided to the CSL model More... | |
std::string | label |
aircraft label shown in the 3D world next to the plane More... | |
float | colLabel [4] = {1.0f,1.0f,0.0f,1.0f} |
label base color (RGB) More... | |
bool | bDrawLabel = true |
Shall this aircraft's label be drawn? More... | |
float | vertOfsRatio = 1.0f |
How much of the vertical offset shall be applied? (This allows phasing out the vertical offset in higher altitudes.) [0..1]. More... | |
float | gearDeflectRatio = 0.5f |
By how much of the gear deflection shall the plane's altitude be reduced? More... | |
bool | bClampToGround = false |
Shall this plane be clamped to ground (ie. never sink below ground)? More... | |
int | aiPrio = 1 |
Priority for display in one of the limited number of TCAS target slots. More... | |
XPMPPlaneRadar_t | acRadar |
Current radar status. More... | |
struct XPMP2::Aircraft::wakeTy | wake |
wake-support data More... | |
XPMPInfoTexts_t | acInfoTexts |
Informational texts passed on via multiplayer shared dataRefs. More... | |
int | sndMinDist = 50.0 |
Minimum distance in [m] to play sound in full volume, the larger the 'louder' the aircraft. More... | |
Protected Member Functions inherited from XPMP2::Aircraft | |
void | DoMove () |
Internal: This puts the instance into XP's sky and makes it move. More... | |
void | UpdateDistBearingCamera (const XPLMCameraPosition_t &posCam) |
Internal: Update the plane's distance/bearing from the camera location. More... | |
void | ClampToGround () |
Clamp to ground: Make sure the plane is not below ground, corrects Aircraft::drawInfo if needed. More... | |
bool | CreateInstances () |
Create the instances required to represent the plane, return if successful. More... | |
void | DestroyInstances () |
Destroy all instances. More... | |
virtual void | ComputeMapLabel () |
Put together the map label. More... | |
virtual void | SetTcasTargetIdx (int _idx) |
Define the TCAS target index in use. More... | |
virtual void | SoundSetup () |
Sound-related initializations, called by Create() and ChangeModel() More... | |
virtual void | SoundUpdate () |
Update sound, like position and volume, called once per frame. More... | |
virtual void | SoundRemoveAll () |
Remove all sound, e.g. during destruction. More... | |
Static Protected Member Functions inherited from XPMP2::Aircraft | |
static float | FlightLoopCB (float, float, int, void *) |
Internal: Flight loop callback function controlling update and movement of all planes. More... | |
Protected Attributes inherited from XPMP2::Aircraft | |
XPMPPlaneID | modeS_id = 0 |
A plane is uniquely identified by a 24bit number [0x01..0xFFFFFF]. More... | |
bool | bValid = true |
is this object valid? (Will be reset in case of exceptions) More... | |
bool | bVisible = true |
Shall this plane be drawn at the moment and be visible to TCAS/interfaces? More... | |
bool | bRender = true |
Shall the CSL model be drawn in 3D world? (if !bRender && bVivile then still visible on TCAS/interfaces, Remote Client uses this for local senders' planes to take over TCAS but not drawing) More... | |
XPMP2::CSLModel * | pCSLMdl = nullptr |
the CSL model in use More... | |
int | matchQuality = -1 |
quality of the match with the CSL model More... | |
int | acRelGrp = 0 |
related group, ie. line in related.txt in which this a/c appears, if any More... | |
float | prev_x = 0.0f |
float | prev_y = 0.0f |
float | prev_z = 0.0f |
float | prev_ts = 0.0f |
last update of prev_x/y/z in XP's network time More... | |
float | v_x = 0.0f |
float | v_y = 0.0f |
float | v_z = 0.0f |
Cartesian velocity in m/s per axis. More... | |
float | gs_kn = 0.0f |
float | tsResetTouchDown = NAN |
ground speed in [kn] based on above v_x/z More... | |
std::list< XPLMInstanceRef > | listInst |
X-Plane instance handles for all objects making up the model. More... | |
int | tcasTargetIdx = -1 |
Which sim/cockpit2/tcas/targets -index does this plane occupy? [1..63], -1 if none. More... | |
float | camTimLstUpd = 0.0f |
Timestamp of last update of camera dist/bearing. More... | |
float | camDist = 0.0f |
Distance to camera in meters (updated internally regularly) More... | |
float | camBearing = 0.0f |
Bearing from camera in degrees (updated internally regularly) More... | |
XPLMProbeRef | hProbe = nullptr |
Y Probe for terrain testing, needed in ground clamping. More... | |
int | mapIconRow = 0 |
map icon coordinates, row More... | |
int | mapIconCol = 0 |
map icon coordinates, column More... | |
float | mapX = 0.0f |
temporary: map coordinates (NAN = not to be drawn) More... | |
float | mapY = 0.0f |
temporary: map coordinates (NAN = not to be drawn) More... | |
std::string | mapLabel |
label for map drawing More... | |
SndChTy | aSndCh [SND_NUM_EVENTS] |
Operational values per sound channel, that is triggered by a standard sound event. More... | |
bool | bChnLowPass = false |
Is Low Pass Filter currently being active? More... | |
bool | bChnMuted = false |
Is sound for this aircraft currently muted? More... | |
ChnListTy | chnList |
List of channels produced via calls to SoundPlay() More... | |
int | skipCounter = 0 |
Counts how often we skipped expensive computations. More... | |
Subclassing XPMP2::Aircraft to create our own class.
-
-
|
- -inline | -
Constructor just passes on all parameters to library.
- -
-
|
- -inlinevirtual | -
Custom implementation for the virtual function providing updates values.
- -Implements XPMP2::Aircraft.
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
-Directories | |
directory | lib |
-Files | |
file | XPMP2-Sample.cpp |
Example plugin demonstrating XPMP2 techniques. | |
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
-Directories | |
directory | logo |
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
-Directories | |
directory | fmod |
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
-Files | |
file | FMOD_Logo.cpp |
Compressed version of the FMOD logo with code to create a texture ID in X-Plane for display with Dear ImGui. | |
file | FMOD_Logo.h [code] |
Compressed version of the FMOD logo with code to create a texture ID in X-Plane for display with Dear ImGui. | |
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
-Files | |
file | Client.cpp |
Main Client functionality, processing received data. | |
file | Client.h [code] |
Main Client functionality, processing received data. | |
file | Utilities.cpp |
Miscellaneous utility functions, including logging. | |
file | Utilities.h [code] |
Miscellaneous utility functions, including logging. | |
file | XPMP2-Remote.cpp |
XPMP2 Remote Client: Displays aircraft served from other XPMP2-based plugins in the network. | |
file | XPMP2-Remote.h [code] |
XPMP2 Remote Client: Displays aircraft served from other XPMP2-based plugins in the network. | |
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
A new plugin, which wants to use the XPMP2 library, needs to include the following 2 header files, provided in the inc
folder:
XPMP2's Audio Engine is FMOD Core API by Firelight Technologies Pty Ltd. Understand FMOD licensing and attribution requirements first, as they will apply to your plugin if using XPMP2 with sound support.
Because of the licensing requirements, XPMP2 by default is built without sound support. See the Sound Support documentation for details how to enable sound support and how to include it into your plugin.
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Synchronizing Planes across the Network
-Planes displayed using XPMP2 can by synchronized across the network. The XPMP2 Remote Client needs to run on all remote computers, receives aircraft data from any number of XPMP2-based plugins anywhere in the network, and displays the aircraft using the same CSL model, at the same world location with the same animation dataRefs.
-This supports usage in setups like
For end user documentation refer to LiveTraffic/XPMP2 Remote Client documentation.
-For more background information refer to GitHub XPMP2 documentation.
-One of many possible setups:
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
This is a fully functional sample implementation that you can use to play with XPMP2 features and as a starting point for your own implementations.
-I am also using it as a testbed for new features, so the implementation is regularly built, tested, and sometimes even enhanced to make use of latest features.
-There are separate projects available to only build the XPMP2-Sample plugin, serving as a starting point for your projects.
-Please refer to the GitHub Build documentation for details.
-This plugin creates 3 planes, one with each of the available ways of using the XPMP2 library. All planes move in a circle around a position 200m in front of the user's plane (even if the user plane moves).
XPMP2::Aircraft
in class SampleAircraft
, which is the recommended way for any new plugin. This plane flies highest, 100m above the user plane.class XPCAircraft
. This plane flies in the middle, 50m above the user plane.Three menu items are provided:
-For the plugin to work properly some CSL models are necessary in some folders under Resources
(all folders under Resources
are scanned for xsb_aircraft.txt
file, so the actual structure underneath Resources
does not matter).
The directory structure would look as follows: ``` XPMP2-Sample/ lin_x64/ XPMP2-Sample.xpl mac_x64/ XPMP2-Sample.xpl win_x64/ XPMP2-Sample.xpl Resources/ CSL/ <– install CSL models here Doc8643.txt MapIcons.png Obj8DataRefs.txt related.txt
-XPMP2 provides the following dataRef values for each CSL model rendered. That means, a CSL model can use it for its animations.
Actual values are taken from the XPMP2::Aircraft::v
array. Compare the indexes listed in the second comlumn as defined in the enum DR_VALS
(XPMPAircraft.h
).
It is recommended to use the various getter/setter member functions in XPMP2::Aircraft to get/set values. Some of them perform additional functionality like synchronising RPM and RAD/s values.
-libxplanemp/misc/touch_down | Get/SetTouchDown | V_MISC_TOUCH_DOWN | Moment of touch down, 0 or 1 |
libxplanemp/controls/nav_lites_on | Get/SetLightsNav | V_CONTROLS_NAV_LITES_ON | Navigation lights on? 0 or 1 |
libxplanemp/gear/tire_rotation_speed_rad_sec | Get/SetTireRotRad | V_GEAR_TIRE_ROTATION_SPEED_RAD_SEC | Tire rotation speed in radians per second (= _RPM * PI/30 ) |
+ XPMP2
+
+ X-Plane multiplayer library 2 - using instancing
+ |
+
XPMP2 can add contrails to planes. This is achieved by instantiating one additional object per contrail at the same position as the actual plane. This object Resources/Contrail/Contrail.obj
has no tris, but only holds a reference to a particle system file, Contrail.pss
. The contrail is then created through X-Plane's particle system.
If you don't want contrails at all, you need to return 0
for the two config items XPMP_CFG_ITM_CONTR_MIN_ALT
and XPMP_CFG_ITM_CONTR_MAX_ALT
. In that case you don't even need to provide the Resources/Contrail
folder with your deployment.
If you want to make use of contrails, you need to ship the Resources/Contrail
folder with all its 3 files with your plugin.
By default, ie. without any provision in code, a single contrail will be generated for jet aircraft flying in an altitude between 25,000 and 45,000 ft.
+XPMP2 asks for four contrail-related configuration items, with which you can fine-tune how XPMP2 automatically generates contrails. This should be sufficient for most usages, even complex plugins like LiveTraffic only provide pass-through configuration options for these four parameters, but no self-development implementation.
+Config item | Default | Description |
---|---|---|
XPMP_CFG_ITM_CONTR_MIN_ALT | 25000 | Minimum altitude in feet for automatic contrail generation |
XPMP_CFG_ITM_CONTR_MAX_ALT | 45000 | Maximum altitude in feet for automatic contrail generation; set both min and max altitude to 0 to switch off automatic contrails |
XPMP_CFG_ITM_CONTR_LIFE | 25 | Default maximum lifetime of contrail puffs in seconds, determines contrail length |
XPMP_CFG_ITM_CONTR_MULTI | 0 | Boolean: Shall multiple contrails be auto-created (one per engine), or just one? |
Keep in mind that contrails, using the particle system, may have the potential to affect performance. That's why by default just a single contrail is generated.
+If you need more control and want to direct yourself when how many contrails are shown, you should switch off the auto-generation by returning 0
to both XPMP_CFG_ITM_CONTR_MIN_ALT
and XPMP_CFG_ITM_CONTR_MAX_ALT
, and then call either of the following two member functions of XPMP2::Aircraft
:
ContrailTrigger()
tells XPMP2 to check the plane's engine type, and if it is jet then a contrail (or even multiple, depending on config XPMP_CFG_ITM_CONTR_MULTI
) are created. This is the function internally used by the auto-generation mechanism once a plane is in the right altitude.ContrailRequest (unsigned num, unsigned dist_m = 0, unsigned lifeTime = 0)
allows even more control by specifying the number of contrails, its spacing, and the life time.Last but not least, there's ContrailRemove()
to remove contrails.
If copying takes place, then a new .obj
file is written into the same folder next to the original one. The file name of the copy is as follows:
A320fCFM.DLH.xpmp2.obj
as a copy for the fuselage, referencing the DLH.png
and A320fCFM_LIT.png
textures.Each copied file includes a comment in line 4 stating its origin:
This is off by default, because well curated packages won't need it. To enable it return 1 when called for configuration item XPMP_CFG_ITM_REPLDATAREFS
.
When enabled, a copy for each .obj
file will be created just before it is to be loaded. In each copy, dataRefs are replaced based on the definition in <resourceDir>/Obj8DataRefs.txt
. That file just lists dataRef names to be replaced with the replacement dataRef like this:
The Obj8DataRefs.txt
file available with XPMP2 defines a number of replacements to unlock more features in the Bluebell CSL models. The simple text format allows you to add/change replacement definitions easily and ship your version with your plugin.
This is on by default. You could switch it off by returning 0
when asked for configuration item XPMP_CFG_ITM_REPLTEXTURE
.
A copy will only be initiated if additional textures are defined as 4th (and optionally 5th) parameter with the OBJ8
command in xsb_aircraft.txt
.
If you built XPMP2 and your plugin with FMOD Sound Support, and you want to allow running your plugin with X-Plane 11 under Windows, then you should ship the fmod.dll
, too, as
next to your plugin's Windows version. Find api/core/lib/x64/fmod.dll
in the Windows version of the FMOD Core API that you had downloaded from FMOD.
The reason is that X-Plane updated the FMOD versions included in X-Plane between XP11 and XP12. While XPMP2 is built in a way that it can run with either version, XP11 ships a DLL by the name of fmod64.dll
while XPMP2 expects it by the name fmod.dll
as XP12 provides it.
XPMP2 needs a couple additional files to work. In your calls to XPMPMultiplayerInit
and XPMPLoadCSLPackage
you provide the locations to the folders holding these files.
You should ship all the files provided in the Resources
folder:
MapIcons.png
contains the aircraft icons displayed in the additional map layer. Without this file that map layer cannot be created.related.txt
defines "similar looking" aircraft types, so that an A320 model could be used if no exact match for the A319 at hand is found. Without that file this "related" matching cannot take place.Obj8DataRefs.txt
is only required for the "Copying .OBJ Files" functionality: It defines dataRef replacements. You don't need to ship this file if you do not enable that functionality in your plugin.Contrail
folder with 3 files, Contrail.obj/.png/.pss
; this is needed for drawing contrails. If missing, contrails aren't available. The folder is not needed if you disable contrails.These files have all to be installed in the same folder. It is good practice to install these files in a folder named Resources
in the plugin's folder. Your plugin provides XPMP2 with the folder location in the resourceDir
parameter of the XPMPMultiplayerInit
call (see XPMPMultiplayer.h for more details).
You do not need to and shall not ship the XPMP2 Remote Client with your plugin. This plugin is maintained and provided centrally. Please refer your users to
CSL Models are not shipped with XPMP2. They are available as separate downloads. Recommended sources are:
This page probably requires more attention... but there is a working sample plugin available in the XPMP2-Sample
folder for you to study:
This package comes with a sample plugin in the XPMP2-Sample
folder. It is a complete plugin including build projects and CMake setup. It displays 3 aircraft flying circles in front of the user's plane. Each of the 3 aircraft is using a different technology: the now recommended way of subclassing XPMP2::Aircraft
, the legacy way of subclassing XPCAircraft
(as used by LiveTraffic v1.x), and by calling standard C functions.
For the sample plugin to work you need to follow instruction in Deploying XPMP2-based Plugins for
@@ -66,10 +66,10 @@You don't need to build the library yourself if you don't want. Archives with headers and release/debug builds are available in the Release section here on GitHub.
-Generically you should probably use XPMP2 as follows:
-New plugin implementations are strongly advised to directly sub-class from the new class XPMP2::Aircraft
, which is the actual aircraft representation.
See the SampleAircraft
class defined in XPMP2-Sample/XPMP2-Sample.cpp
for an example implementation.
XPMP2::Aircraft
,XPMP2::Aircraft::ChangeModel
or XPMP2::Aircraft::ReMatchModel
.Matching is based on 3 input parameters:
All parameters are optional. Pass an empty string if you can't provide details.
Internally, a fourth parameter named related group is added, derived from the ICAO aircraft type designator: There are many similar looking aircraft models in the world...just think of A319, A320, A321. The related.txt
files combines all similar looking models into one line, which make up such a group. Each aircraft type is allowed to appear at maximum once in the entire file. The idea is to use a A320 model if a necessary A319 model is not available.
Aircraft / airline / livery combinations available for the user are listed in the xsb_aircraft.txt
files in the user's CSL model folders. XPMP2 reads all of these files into a cache when your plugin calls XPMPLoadCSLPackage
, i.e. typically at startup.
Model Matching now compares 10 attributes between the parameters you pass during aircraft creation and the available models. They are rated according to the following priority from broad to fine-grained attributes:
The better a potential CSL model matches with the passed-in parameters the more of the above attributes match, the higher is the "match quality". Higher priority attributes count more than lower ones: technically it is a bit mask with the number 1 attribute at the most significant bit.
The model with the best match quality is picked. If there are several models ending up with the same match quality, then XPMP2 takes a random pick. This often happens if there are several models available for the expected ICAO aircraft type designator, but none of them has the correct livery for the requested operator.
There is no "default" livery any longer as there was in libxplanemp
. The downside is that it is a bit harder to identify non-matching liveries: Asking twice with the same match parameters can end in different models being picked.
If you are interested in how models are picked then you can activate logging of model matching: In your configuration callback return 1
for key XPMP_CFG_ITM_MODELMATCHING
and 0
or 1
for key XPMP_CFG_ITM_LOGLEVEL
.
With model matching logging activated, XPMP2 writes info into Log.txt
like this:
This page explains the technical background of the XPMP2 Remote functionality. For end user documentation refer to LiveTraffic/XPMP2 Remote Client documentation.
-You do not need to do anything specifically in your plugin to support the Remote functionality. Just build and link with the latest XPMP2 library. Don't even ship the Remote Client, but refer to the download location, which is maintained centrally.
Optionally, you could respond to the new XPMP_CFG_ITM_SUPPORT_REMOTE
configuration item in your XPMPIntPrefsFuncTy
configuration callback function, e.g. to provide the user with an option to switch Remote support on regardless of network configuration. However, the default, "auto-detect", works in by far most scenarios already. And in the few others the users would still have the chance to use the XPMP2.prf config file as documented.
Optionally, you could react to an inter-plugin message XPLM_MSG_RELEASE_PLANES
from the XPMP2 Remote Client and cede TCAS/AI control in that case because the Remote Client will take care of your TCAS in that case, too, but will also have the chance to pick up planes of other XPMP2-based plugins. See LiveTraffic's XPluginReceiveMessage function for an example.
RemoteMsgSettingsTy
(grey)Textual aircraft and flight information is provided via shared dataRefs of type xplmType_Data
as suggested by FSTramp. This information is offered to 3rd party plugins, which want to show (information of) AI planes like camera or map plugins.
DRE and DRT are informed about these dataRef names as soon as the first aircraft is created. So you can use either to have a peek.
-The names of the shared dataRefs follow the naming conventions known from pre-XP11.50 times when there were just 19 multiplayer planes support with similarly named dataRefs for position and configuration information. For each plane there is a set of dataRefs, each dataRef contains up to 40 byte data to be interpreted as a zero-terminated C string.
XPMP2 creates and maintains up to 63 sets of these dataRefs, starting at sim/multiplayer/position/plane1_tailnum
and ending at sim/multiplayer/position/plane63_apt_to
.
plane#_cslModel
*) _cslModel
differs from the others in that it is not related to live flight information but to the way the plane is rendered by the XPMP2-based plugin. It returns the CSL model used as returned by XPMP2::Aircraft::GetModelName()
, that is: last folder name plus model id.
A plugin that wants to use this data
XPLMGetDatab
as usual. Provide at least a 40 character buffer to be on the safe side.XPLMSetActiveAircraftCount
X-Plane is informed about the exact number of provided planes. (This might not be strictly necessary, but probably a cleaner approach than to wait 10 cylces for not updated dataRefs to be taken out of X-Plane's consideration.)When TCS Override is not available (like up to X-Plane 11.41), then TCAS is provided by writing the classic multiplayer dataRefs directly.
-There is a limited number of "slots" available for TCAS/multiplayer purposes. With TCAS Override, this is currently 63, with classic multiplayer dataRefs, this is up to 19, though for many 3rd party plugins the number of actually configured AI Aircraft (X-Planes Flight Setup) plays a role, too.
XPMP2 will show the aircraft closest to current camera location. This set of aircraft will change over time. But XPMP2 will try to keep a plane, which once was shown on TCAS, in the same slot to make it easier for 3rd party plugins to follow one plane.
@@ -63,7 +63,7 @@XPMP2 writes the folloing TCAS target dataRefs when it has TCAS control:
weight_on_wheels | - |
...is provided by X-Plane automatically when feeding above TCAS target dataRefs. That means: The lower 19 planes are mirrored into the well-known sim/multiplayer/position/plane#_*
dataRefs. Plugins still relying on these dataRefs will mainly "just work". And this without any workarounds like defining AI Aircraft in X-Plane's settings!
Please note that XPLMCountAircraft
can now return values larger than 20, up to 64 at the moment.
As a trade-off between complexity (knowing exact wing dimensions and weight/lift of any plane) and results (strength of the wake) XPMP2 applies defaults to the aircraft dimensions based on the Wake Turbulence Category (WTC) listed in the Doc8643
data, which is looked up based on the icaoType
. If the icaoType
isn't found then a default WTC of M
is assumed.
So even if you don't provide any overrides in your plugin implementation, there's are reasonable factors in place to provide about matching wakes:
@@ -71,7 +71,7 @@with Weight = Empty Weight + 80% * (MTOW - Empty Weight)
Default Lift is Weight multiplied by 9.81
, ie. standard gravity. No g load is taken into account.
Default AoA is the plane's pitch, which should be fairly accurate.
-A plugin using XPMP2 can opt to provide its own values for even more precice results. Search XPMP2Aircraft.h
for "Wake support" to find the group of functions to support wake tubulence definition.
WakeApplyDefaults()
sets wing span, area, and weight as per above defaults.
The xsb_aircraft.txt
file describes the content of one CSL model package. XPMP2 reads the file to learn about available CSL models and which ICAO aircraft type designators, airlines, and special liveries they match.
The original file format supported more commands necessary to support older formats like .acf
or OBJ7. XPMP2 only supported OBJ8 models and processes only the commands listed here. Others are ignored. They may raise warnings in Log.txt
but otherwise do no harm.
The following is taken from the beginning of Bluebell's xsb_aircraft.txt
file in its BB_Airbus
folder:
A xsb_aircraft.txt
file starts defining one (or even more) package name(s) using the EXPORT_NAME
command. Packages are identified by these names, which are then used as a root name to define the .obj
file locations.
Then follow one or typically many aircraft definitions. Each aircraft definition starts with an OBJ8_AIRCRAFT
command defining a package-unique id. XPMP2 expects the combination of EXPORT_NAME
and OBJ8_AIRCRAFT
name to be unique and ignores any duplicates (with a warning written to Log.txt
).
EXPORT_NAME
These aspects are relevant for developers using XPMP2 in their own plugin:
If you are familiar with the original libxplanemp
and are using it already in your plugins, then you will find these information on backward compatibility useful, which explain how you can replace libxplanemp
with XPMP2 with limited effort.
Apart from the binaries that you build you will need to ship the files provided here in the 'Resources' folder. Also, users will need to install CSL models. Find more details here.
-These aspects are relevant for CSL model developers and package providers:
xsb_aircraft.txt
File FormatTo drive CSL models' ANIMations, a long list of dataRefs is provided by XPMP2. See its documentation here.
.obj
files on loadCSL packages come in different flavours. Popular ones for general use are the Bluebell and the X-CSL packages. Both come with different history. For XPMP2 to use all their features it needs to change their .obj
files. Performing these changes is built into XPMP2. See here for details.
The TCAS Override approach explains how TCAS information is provided, the classic multiplayer dataRefs are maintained and how 3rd party plugins can access this information. XPMP2 publishes data via the sim/cockpit2/tcas/targets
dataRefs.
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
-Functions | |
uint8_t * | LoadRGBA (bool bBlack=true) |
Load the data of the FMOD logo, expanded into RGBA data. More... | |
bool | GetTexture (int &texId, bool bBlack=true) |
The one "public" function to return a texture id for the logo. More... | |
-Variables | |
constexpr size_t | RLE_SIZE = 5527 |
number of array entries in the RLE array More... | |
const uint16_t | ALPHA_RLE [RLE_SIZE] |
Run-length encoded data of the Alpha value of each pixel in the FMOD logo. More... | |
constexpr int | IMG_WIDTH = 728 |
Logo image width. More... | |
constexpr int | IMG_HEIGHT = 192 |
Logo image height. More... | |
constexpr int | IMG_SIZE = IMG_WIDTH * IMG_HEIGHT |
Logo image size in number of pixels. More... | |
bool FMODLogo::GetTexture | -( | -int & | -texId, | -
- | - | bool | -bBlack = true |
-
- | ) | -- |
The one "public" function to return a texture id for the logo.
-On first call will load the logo and create a texture from it, on subsequent calls will return the already loaded id.
[out] | texId | receives the texture id for the (black or white) FMOD logo |
bBlack | [opt] Black or White logo? (Will return different texture ids) |
true
if successful uint8_t * FMODLogo::LoadRGBA | -( | -bool | -bBlack = true | ) | -- |
Load the data of the FMOD logo, expanded into RGBA data.
-This function is internally used by GetTexture(). It is not typically used publicly but provided just in case what you need is not an OpenGL texture but the raw RGBA data. Data is provided in 4-byte blocks, one byte per RGBA value. The returned array has size IMG_SIZE * 4
. Caller has to free the data using delete[]
.
const uint16_t FMODLogo::ALPHA_RLE[RLE_SIZE] | -
Run-length encoded data of the Alpha value of each pixel in the FMOD logo.
- -
-
|
- -constexpr | -
Logo image height.
- -
-
|
- -constexpr | -
Logo image size in number of pixels.
- -
-
|
- -constexpr | -
Logo image width.
- -
-
|
- -constexpr | -
number of array entries in the RLE array
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Miscellaneous utility functions, including logging. -More...
-#include "XPMP2.h"
-Namespaces | |
XPMP2 | |
Defined by FMOD. | |
-Macros | |
#define | S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) |
-Functions | |
int | XPMP2::PrefsFuncIntDefault (const char *, const char *, int _default) |
Default config function just always returns the provided default value. More... | |
bool | XPMP2::ExistsFile (const std::string &filename) |
Does a file path exist? More... | |
bool | XPMP2::IsDir (const std::string &path) |
Is path a directory? More... | |
bool | XPMP2::CreateDir (const std::string &path) |
Create directory if it does not exist. More... | |
bool | XPMP2::CopyFileIfNewer (const std::string &source, const std::string &destDir) |
Copy file if source is newer or destination missing. More... | |
std::list< std::string > | XPMP2::GetDirContents (const std::string &path) |
List of files in a directory (wrapper around XPLMGetDirectoryContents) More... | |
std::istream & | XPMP2::safeGetline (std::istream &is, std::string &t) |
Read a line from a text file, no matter if ending on CRLF or LF. More... | |
const std::string & | XPMP2::GetXPSystemPath () |
Returns XP's system directory, including a trailing slash. More... | |
std::string | XPMP2::StripXPSysDir (const std::string &path) |
If a path starts with X-Plane's system directory it is stripped. More... | |
void | XPMP2::RemoveExtension (std::string &path) |
Removes everything after the last dot, the dot including. More... | |
std::string & | XPMP2::str_tolower (std::string &s) |
change a std::string to uppercase More... | |
std::vector< std::string > | XPMP2::str_tokenize (const std::string s, const std::string tokens, bool bSkipEmpty=true) |
separates string into tokens More... | |
std::uint16_t | XPMP2::PJWHash16 (const char *s) |
Produces a reproducible(!) hash value for strings. More... | |
float | XPMP2::headDiff (float head1, float head2) |
(Shortest) difference between 2 angles: How much to turn to go from h1 to h2? More... | |
float | XPMP2::GetMiscNetwTime () |
Get synched network time from X-Plane (sim/network/misc/network_time_sec) as used in Log.txt. More... | |
std::string | XPMP2::GetMiscNetwTimeStr (float _time=NAN) |
Return the network time as a string like used in the XP's Log.txt. More... | |
const char * | XPMP2::GetGraphicsDriverTxt () |
Text string for current graphics driver in use. More... | |
bool | XPMP2::IsPaused () |
X-Plane in a Pause state? More... | |
bool | XPMP2::IsViewExternal () |
Is current X-Plane view an external view (outside a cockpit)? More... | |
bool | XPMP2::CheckEverySoOften (float &_lastCheck, float _interval, float _now) |
Convenience function to check on something at most every x seconds. More... | |
const char * | XPMP2::LogGetString (const char *szFile, int ln, const char *szFunc, logLevelTy lvl, const char *szMsg, va_list args) |
Returns ptr to static buffer filled with formatted log string. More... | |
void | XPMP2::LogMsg (const char *szFile, int ln, const char *szFunc, logLevelTy lvl, const char *szMsg,...) XPMP2_FMTARGS(5) |
Log Text to log file. More... | |
-Variables | |
GlobVars | XPMP2::glob |
The one and only global variable structure. More... | |
const char * | XPMP2::LOG_LEVEL [] |
Miscellaneous utility functions, including logging.
- -#define S_ISDIR | -( | -- | m | ) | -(((m) & _S_IFMT) == _S_IFDIR) | -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Miscellaneous utility functions, including logging. -More...
- -Go to the source code of this file.
--Namespaces | |
XPMP2 | |
Defined by FMOD. | |
-Macros | |
#define | ERR_ASSERT "ASSERT FAILED: %s" |
#define | ERR_EXCEPTION "EXCEPTION CAUGHT: %s" |
#define | PATH_DELIM_STD '/' |
#define | WHITESPACE " \t\f\v\r\n" |
#define | XPMP2_FMTARGS(FMT) |
To apply printf-style warnings to our functions. More... | |
#define | LOG_MSG(lvl, ...) |
Log a message if lvl is greater or equal currently defined log level. More... | |
#define | LOG_MATCHING(lvl, ...) |
Log a message about matching if logging of model matching is enabled. More... | |
#define | THROW_ERROR(...) throw XPMP2Error(__FILE__, __LINE__, __func__, __VA_ARGS__); |
Throws an exception using XPMP2Error. More... | |
#define | LOG_ASSERT(cond) |
Throw in an assert-style (logging takes place in XPMP2Error constructor) More... | |
#define | CATCH_AC(ac) |
Standard catch clauses for dealing with aircraft: logs message, sets aircraft invalid. More... | |
#define | STRCPY_S(dest, src) strncpy_s(dest,sizeof(dest),src,sizeof(dest)-1) |
Simpler access to strncpy_s if dest is a char array (not a pointer!) More... | |
#define | STRCPY_ATMOST(dest, src) strncpy_s(dest,sizeof(dest),strAtMost(src,sizeof(dest)-1).c_str(),sizeof(dest)-1) |
#define | SET_THREAD_NAME(sName) |
-Enumerations | |
enum | XPMP2::logLevelTy { - XPMP2::logDEBUG = 0 -, XPMP2::logINFO -, XPMP2::logWARN -, XPMP2::logERR -, - XPMP2::logFATAL -, XPMP2::logMSG - - } |
Logging level. More... | |
-Functions | |
int | XPMP2::PrefsFuncIntDefault (const char *, const char *, int _default) |
Default config function just always returns the provided default value. More... | |
float | XPMP2::PrefsFuncFloatDefault (const char *, const char *, float _default) |
bool | XPMP2::ExistsFile (const std::string &filename) |
Does a file path exist? More... | |
bool | XPMP2::IsDir (const std::string &path) |
Is path a directory? More... | |
bool | XPMP2::CreateDir (const std::string &path) |
Create directory if it does not exist. More... | |
bool | XPMP2::CopyFileIfNewer (const std::string &source, const std::string &destDir) |
Copy file if source is newer or destination missing. More... | |
std::list< std::string > | XPMP2::GetDirContents (const std::string &path) |
List of files in a directory (wrapper around XPLMGetDirectoryContents) More... | |
std::istream & | XPMP2::safeGetline (std::istream &is, std::string &t) |
Read a line from a text file, no matter if ending on CRLF or LF. More... | |
const std::string & | XPMP2::GetXPSystemPath () |
Returns XP's system directory, including a trailing slash. More... | |
std::string | XPMP2::StripXPSysDir (const std::string &path) |
If a path starts with X-Plane's system directory it is stripped. More... | |
void | XPMP2::RemoveExtension (std::string &path) |
Removes everything after the last dot, the dot including. More... | |
std::string & | XPMP2::str_tolower (std::string &s) |
change a std::string to uppercase More... | |
std::string & | XPMP2::rtrim (std::string &s, const char *t=WHITESPACE) |
trimming of string (from right) More... | |
std::string & | XPMP2::ltrim (std::string &s, const char *t=WHITESPACE) |
trimming of string (from left) More... | |
std::string & | XPMP2::trim (std::string &s, const char *t=WHITESPACE) |
trimming of string (from both ends) More... | |
std::string | XPMP2::leftOf (const std::string &s, const std::string &terminators) |
Returns everything left of any of terminators. More... | |
std::vector< std::string > | XPMP2::str_tokenize (const std::string s, const std::string tokens, bool bSkipEmpty=true) |
separates string into tokens More... | |
template<class T > | |
T | XPMP2::rad2deg (const T _rad) |
Convert radians to degrees, normalized to [0..360) More... | |
template<class T > | |
T | XPMP2::deg2rad (const T _deg) |
Convert degree to radians. More... | |
template<class T > | |
T | XPMP2::sqr (const T a) |
Square. More... | |
template<class T > | |
T | XPMP2::dist (const T x1, const T y1, const T z1, const T x2, const T y2, const T z2) |
Pythagorean distance between two points in a 3-D world. More... | |
float | XPMP2::atan2deg (float x, float y) |
atan2 converted to degrees: the angle between (0|0) and the given point More... | |
float | XPMP2::angleLocCoord (float x1, float z1, float x2, float z2) |
Angle of line from point (x1|z1) to point (x2|z2) More... | |
float | XPMP2::headDiff (float head1, float head2) |
(Shortest) difference between 2 angles: How much to turn to go from h1 to h2? More... | |
template<class numT > | |
numT | XPMP2::headNormalize (numT _head) |
Normalize a heading value to [0..360), works for both float and double values. More... | |
float | XPMP2::GetMiscNetwTime () |
Get synched network time from X-Plane (sim/network/misc/network_time_sec) as used in Log.txt. More... | |
std::string | XPMP2::GetMiscNetwTimeStr (float _time=NAN) |
Return the network time as a string like used in the XP's Log.txt. More... | |
const char * | XPMP2::GetGraphicsDriverTxt () |
Text string for current graphics driver in use. More... | |
bool | XPMP2::IsPaused () |
X-Plane in a Pause state? More... | |
bool | XPMP2::IsViewExternal () |
Is current X-Plane view an external view (outside a cockpit)? More... | |
bool | XPMP2::CheckEverySoOften (float &_lastCheck, float _interval, float _now) |
Convenience function to check on something at most every x seconds. More... | |
bool | XPMP2::CheckEverySoOften (float &_lastCheck, float _interval) |
Convenience function to check on something at most every x seconds. More... | |
const char * | XPMP2::LogGetString (const char *szFile, int ln, const char *szFunc, logLevelTy lvl, const char *szMsg, va_list args) |
Returns ptr to static buffer filled with formatted log string. More... | |
void | XPMP2::LogMsg (const char *szFile, int ln, const char *szFunc, logLevelTy lvl, const char *szMsg,...) XPMP2_FMTARGS(5) |
Log Text to log file. More... | |
std::string | XPMP2::TOPOSIX (const std::string &p) |
On Lin/Win there is no need for a conversion, but we do treat p now as std::string More... | |
std::string | XPMP2::FROMPOSIX (const std::string &p) |
On Lin/Win there is no need for a conversion, but we do treat p now as std::string More... | |
-Variables | |
constexpr const char * | XPMP2::RSRC_RELATED = "related.txt" |
constexpr const char * | XPMP2::RSRC_DOC8643 = "Doc8643.txt" |
constexpr const char * | XPMP2::RSRC_MAP_ICONS = "MapIcons.png" |
constexpr const char * | XPMP2::RSRC_OBJ8DATAREFS = "Obj8DataRefs.txt" |
constexpr double | XPMP2::PI = 3.1415926535897932384626433832795028841971693993751 |
Pi. More... | |
Miscellaneous utility functions, including logging.
- -#define CATCH_AC | -( | -- | ac | ) | -- |
Standard catch clauses for dealing with aircraft: logs message, sets aircraft invalid.
- -#define ERR_ASSERT "ASSERT FAILED: %s" | -
#define ERR_EXCEPTION "EXCEPTION CAUGHT: %s" | -
#define LOG_ASSERT | -( | -- | cond | ) | -- |
Throw in an assert-style (logging takes place in XPMP2Error constructor)
-#define LOG_MATCHING | -( | -- | lvl, | -
- | - | - | ... | -
- | ) | -- |
Log a message about matching if logging of model matching is enabled.
-#define LOG_MSG | -( | -- | lvl, | -
- | - | - | ... | -
- | ) | -- |
Log a message if lvl is greater or equal currently defined log level.
-#define PATH_DELIM_STD '/' | -
#define SET_THREAD_NAME | -( | -- | sName | ) | -- |
#define STRCPY_ATMOST | -( | -- | dest, | -
- | - | - | src | -
- | ) | -strncpy_s(dest,sizeof(dest),strAtMost(src,sizeof(dest)-1).c_str(),sizeof(dest)-1) | -
#define STRCPY_S | -( | -- | dest, | -
- | - | - | src | -
- | ) | -strncpy_s(dest,sizeof(dest),src,sizeof(dest)-1) | -
Simpler access to strncpy_s if dest is a char array (not a pointer!)
- -#define THROW_ERROR | -( | -- | ... | ) | -throw XPMP2Error(__FILE__, __LINE__, __func__, __VA_ARGS__); | -
Throws an exception using XPMP2Error.
-#define WHITESPACE " \t\f\v\r\n" | -
#define XPMP2_FMTARGS | -( | -- | FMT | ) | -- |
To apply printf-style warnings to our functions.
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
This is the complete list of members for SenderAddrTy, including all inherited members.
-from | SenderAddrTy | |
operator<(const SenderAddrTy &o) const | SenderAddrTy | |
pluginId | SenderAddrTy | |
SenderAddrTy(XPLMPluginID _id, const std::uint32_t _from[4]) | SenderAddrTy | inline |
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Uniquely identifies a sending plugin. - More...
- -#include <Client.h>
-Public Member Functions | |
bool | operator< (const SenderAddrTy &o) const |
SenderAddrTy (XPLMPluginID _id, const std::uint32_t _from[4]) | |
Constructor just fills values. More... | |
-Public Attributes | |
const XPLMPluginID | pluginId |
sender's plugin id within X-Plane (first to speed up memcmp as usually this will already differ between plugins) More... | |
std::uint32_t | from [4] |
numerical part of sender's IP address (only differentiating in rare cases of two plugins on different PCs having the same plugin id) More... | |
Uniquely identifies a sending plugin.
-
-
|
- -inline | -
Constructor just fills values.
- -bool SenderAddrTy::operator< | -( | -const SenderAddrTy & | -o | ) | -const | -
uses memcmp to compare this
- -std::uint32_t SenderAddrTy::from[4] | -
numerical part of sender's IP address (only differentiating in rare cases of two plugins on different PCs having the same plugin id)
- -const XPLMPluginID SenderAddrTy::pluginId | -
sender's plugin id within X-Plane (first to speed up memcmp as usually this will already differ between plugins)
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
This is the complete list of members for SenderTy, including all inherited members.
-bLocal | SenderTy | |
Find(XPLMPluginID _id, const std::uint32_t _from[4]) | SenderTy | static |
lastMsg | SenderTy | |
mapAc | SenderTy | |
SenderTy(const std::string &_from, const XPMP2::RemoteMsgSettingsTy &_s) | SenderTy | |
settings | SenderTy | |
sFrom | SenderTy |
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
#include <Client.h>
-Public Member Functions | |
SenderTy (const std::string &_from, const XPMP2::RemoteMsgSettingsTy &_s) | |
Constructor copies values and sets lastMsg to now. More... | |
-Static Public Member Functions | |
static SenderTy * | Find (XPLMPluginID _id, const std::uint32_t _from[4]) |
Find a sender based on plugin id and IP address. More... | |
-Public Attributes | |
std::string | sFrom |
string representaton of the sender's IP address More... | |
const bool | bLocal |
is this a local sender on the same computer? More... | |
XPMP2::RemoteMsgSettingsTy | settings |
that plugin's settings More... | |
std::chrono::time_point< std::chrono::steady_clock > | lastMsg |
mapRemoteAcTy | mapAc |
map of aircraft sent by this plugin More... | |
SenderTy::SenderTy | -( | -const std::string & | -_from, | -
- | - | const XPMP2::RemoteMsgSettingsTy & | -_s | -
- | ) | -- |
Constructor copies values and sets lastMsg to now.
- -
-
|
- -static | -
Find a sender based on plugin id and IP address.
- -const bool SenderTy::bLocal | -
is this a local sender on the same computer?
- -std::chrono::time_point<std::chrono::steady_clock> SenderTy::lastMsg | -
mapRemoteAcTy SenderTy::mapAc | -
map of aircraft sent by this plugin
- -XPMP2::RemoteMsgSettingsTy SenderTy::settings | -
that plugin's settings
- -std::string SenderTy::sFrom | -
string representaton of the sender's IP address
- -
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
This is the complete list of members for XPMP2RCGlobals, including all inherited members.
-DrawLabelsTy enum name | XPMP2RCGlobals | |
eDrawLabels | XPMP2RCGlobals | |
gmapSender | XPMP2RCGlobals | |
IsXPThread() const | XPMP2RCGlobals | inline |
LABELS_OFF enum value | XPMP2RCGlobals | |
LABELS_ON enum value | XPMP2RCGlobals | |
LABELS_SYNCH enum value | XPMP2RCGlobals | |
mergedS | XPMP2RCGlobals | |
now | XPMP2RCGlobals | |
xpThread | XPMP2RCGlobals |
- XPMP2
-
- X-Plane multiplayer library 2 - using instancing
- |
-
Holds all global variables. - More...
- -#include <XPMP2-Remote.h>
-Public Types | |
enum | DrawLabelsTy { LABELS_SYNCH = 0 -, LABELS_ON -, LABELS_OFF - } |
Shall aircraft labels be drawn at remote site? More... | |
-Public Member Functions | |
bool | IsXPThread () const |
Is this thread XP's main thread? More... | |
-Public Attributes | |
XPMP2::RemoteMsgSettingsTy | mergedS |
Config values reconciled from sending plugins. More... | |
enum XPMP2RCGlobals::DrawLabelsTy | eDrawLabels = LABELS_SYNCH |
Shall aircraft labels be drawn at remote site? More... | |
mapSenderTy | gmapSender |
The global map of all sending plugins we've ever heard of. More... | |
float | now = 0.0f |
Latest timestamp read from network_time_sec. More... | |
std::thread::id | xpThread |
Holds all global variables.
-enum XPMP2RCGlobals::DrawLabelsTy | -
-
|
- -inline | -
Is this thread XP's main thread?
- -enum XPMP2RCGlobals::DrawLabelsTy XPMP2RCGlobals::eDrawLabels = LABELS_SYNCH | -
Shall aircraft labels be drawn at remote site?
- -mapSenderTy XPMP2RCGlobals::gmapSender | -
The global map of all sending plugins we've ever heard of.
- -XPMP2::RemoteMsgSettingsTy XPMP2RCGlobals::mergedS | -
Config values reconciled from sending plugins.
- -float XPMP2RCGlobals::now = 0.0f | -
Latest timestamp read from network_time_sec.
-id of X-Plane's thread (when it is OK to use XP API calls)
- -std::thread::id XPMP2RCGlobals::xpThread | -