|
VR-Engage
2.2
|
The DtCommanderObserverUpdater manages the visual aspects of a vehicle commander's view. It handles attachment to specific vehicle parts, orientation control, sensor mode switching, and updates the observer state based on vehicle damage state.
This component supports multiple sensor modes (Visual, NVG, Thermal White/Black) that can be configured in the role file.
#include <commanderObserverUpdater.h>
Public Member Functions | |
| DtCommanderObserverUpdater () | |
| virtual | ~DtCommanderObserverUpdater () override |
| virtual bool | initialize (DtPlayerStation *player, DtInitTable &config) override |
| virtual void | tick (double dt) override |
| virtual void | shutdown () override |
| virtual const char * | type () const override |
Public Member Functions inherited from makVre::DtObserverUpdater | |
| DtObserverUpdater () | |
| virtual | ~DtObserverUpdater () override |
| virtual bool | postInitialize () override |
| virtual void | addChannelToUpdate (const std::string &windowName, const std::string &channelName) |
| virtual void | removeChannelToUpdate (const std::string &windowName, const std::string &channelName, bool restoreInitialSettings=true) |
Public Member Functions inherited from makVre::DtPlayerComponent | |
| DtPlayerComponent () | |
| virtual | ~DtPlayerComponent () |
| virtual void | setName (const std::string &name) |
| virtual const std::string & | name () |
| virtual DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () const |
Protected Member Functions | |
| virtual makVre::DtVreMessageResult | handlePlayerCreated (makVre::DtVreMessage *msg) |
| virtual makVre::DtVreMessageResult | handlePlayerReset (makVre::DtVreMessage *msg) |
| void | resetObserver () |
| void | updateSensor () |
| void | updateDestroyed () |
Protected Member Functions inherited from makVre::DtObserverUpdater | |
| virtual void | initializeStateAttributes () override |
| virtual void | onSensorModeChanged (std::string sensorMode) |
| virtual void | onObserverModeChanged (std::string observerMode) |
| virtual void | addDefaultChannels () |
| virtual void | addVrChannels () |
| virtual bool | findChannelConfiguration (const std::string &windowName, const std::string &channelName, makVrv::DtChannelConfiguration &config) |
| virtual void | updateAllChannels () |
| virtual void | setShowCockpits (bool show) |
| virtual bool | applyConfigurationToChannel (const std::string &windowName, const std::string &channelName, const makVrv::DtChannelConfiguration &newConfig) |
| bool | firstWindowAndChannelNames (std::string &windowName, std::string &channelName) |
| virtual void | updateStateAttributes () |
Protected Attributes | |
| bool | myAttached |
| makVrv::DtObserver * | myObserver |
| DtLinearInterpolator< double > * | myZoomInterpolator |
| int | myAttachPart |
| DtVector | myAttachedOffset |
| DtQuaternion | myOriOffest |
| SensorViews | myLastSensorViewMode |
| std::map< enum SensorViews, std::string > | mySensorModes |
Protected Attributes inherited from makVre::DtObserverUpdater | |
| makVre::DtInstrumentPanelManager * | myInstrumentPanelManager |
| ChannelConfigMap | myChannelsToUpdate |
| bool | myForceChannelUpdate |
| double | myVerticalFOV |
| double | myHorizontalFOV |
| makVrv::DtWindow * | myWindow |
Protected Attributes inherited from makVre::DtPlayerComponent | |
| std::string | myName |
| DtInitTable | myConfig |
| DtPlayerStation * | myPlayer |
| makVrv::DtDe * | myDe |
| DtEntityResolver * | myResolver |
| DtAttributeCallbackManager | myAttributeCallbacks |
Additional Inherited Members | |
Protected Types inherited from makVre::DtObserverUpdater | |
| using | WindowAndChannelName = std::pair<std::string, std::string> |
| using | ChannelConfigMap = std::map<WindowAndChannelName, makVrv::DtChannelConfiguration> |
| makVre::DtCommanderObserverUpdater::DtCommanderObserverUpdater | ( | ) |
Constructor for DtCommanderObserverUpdater.
Initializes the component with default values including no attachment, Visual sensor mode, and empty sensor mode map.
|
overridevirtual |
Virtual destructor for DtCommanderObserverUpdater.
|
overridevirtual |
Initializes the component with configuration from Lua.
Reads configuration values including attachment part, position/orientation offsets, and available sensor modes. Sets up the observer and message handlers for PlayerCreatedMessage and ResetMessage.
Also populates the mySensorModes map with configured sensor types and their corresponding VR-Vantage sensor names.
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing initialization parameters |
Reimplemented from makVre::DtObserverUpdater.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Updates the observer's position, orientation, and sensor mode.
Called each frame to update the observer position based on entity position, read observer orientation from state attributes, update sensor mode based on the "currentSensor" state attribute, and handle the entity destruction state.
| dt | Delta time in seconds since the last tick |
Reimplemented from makVre::DtObserverUpdater.
|
overridevirtual |
Shuts down the component.
Removes message handlers and resets the observer to default settings. Also switches the observer back to the Visual sensor mode.
Reimplemented from makVre::DtObserverUpdater.
|
overridevirtual |
Returns the component type identifier.
Reimplemented from makVre::DtObserverUpdater.
|
protectedvirtual |
Handles player created messages.
Called when a player is created in the simulation. Calls resetObserver() to re-attach the observer to the entity.
| msg | The player created message |
|
protectedvirtual |
Handles reset messages.
Called when a reset message is received. Calls resetObserver() to re-attach the observer to the entity.
| msg | The reset message |
|
protected |
Resets and re-attaches the observer to the entity.
Configures the observer to use AttachTypeMimic, attaches it to the player's element, and sets the part attachment and offset values.
|
protected |
Updates the observer's sensor mode.
Checks the "currentSensor" state attribute and updates the observer's sensor mode if it has changed. Also updates the "currentSensorName" state attribute. Uses the VR-Engage sensor mode mapper to convert role-specific sensor names to VR-Vantage sensor names.
|
protected |
Handles entity destruction state changes.
Monitors the "ownship.damageState" attribute. When the entity is destroyed, switches to Visual mode, resets zoom, and changes the attachment type. When the entity is restored, calls resetObserver() to restore normal operation.
|
protected |
Flag indicating if the observer is attached to an entity.
|
protected |
Cached pointer to the observer being controlled.
|
protected |
Interpolator for smooth zoom transitions.
Created as needed when zoom level changes and deleted when transition completes
|
protected |
DIS part enumeration value for the vehicle part to attach the observer to.
Defaults to 5376 (primary radar system 1, representing commander sensor)
|
protected |
Position offset from the attachment part.
Vector offset in meters from the attachment point
|
protected |
Orientation offset from the attachment part.
Quaternion representing orientation offset from the attachment point
|
protected |
Last known sensor view mode.
Used to detect changes in sensor mode to avoid unnecessary updates
|
protected |
Map of SensorViews enums to VR-Engage sensor mode names.
This map links the enumerated sensor types (VISUAL, NVG, etc.) to their corresponding VR-Engage sensor mode names configured in the role file.