|
VR-Engage
2.2
|
The DtCommanderHatchViewUpdater updates the visual aspects of the commander-hatch role. It orients the observer based on state attributes and provides specialized visual effects such as binocular zoom and night vision goggles.
The following parameters are available for configuration in the role file:
#include <commanderHatchViewUpdater.h>
Public Member Functions | |
| DtCommanderHatchViewUpdater () | |
| virtual | ~DtCommanderHatchViewUpdater () override |
| virtual bool | initialize (DtPlayerStation *player, DtInitTable &config) override |
| virtual void | tick (double dt) override |
| void | updateBinocularsState (double dt) |
| void | updateNVGState () |
| 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) |
| virtual void | setupObserver () |
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 | |
| int | myPartAttachment |
| DtVector | myAttachedLocationOffset |
| DtQuaternion | myAttachedRotationOffset |
| makVre::DtLinearInterpolator< double > * | myZoomInterpolator |
| makVrv::DtObserver * | myObserver |
| bool | myLimitObserverRange |
| ObserverRange | myYawRange |
| ObserverRange | myPitchRange |
| bool | myLastNVGState |
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::DtCommanderHatchViewUpdater::DtCommanderHatchViewUpdater | ( | ) |
Constructor for DtCommanderHatchViewUpdater.
Initializes the component with default values including identity rotation offset and no zoom interpolator.
|
overridevirtual |
Virtual destructor for DtCommanderHatchViewUpdater.
|
overridevirtual |
Initializes the component with configuration from Lua.
Reads configuration values including observer name, part attachment ID, and attached location offset. Caches a pointer to the observer and adds handlers for PlayerCreatedMessage and ResetMessage.
| 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 visual aspects of the commander view.
Reads "observerYaw" and "observerPitch" state attributes and updates the observer's attached orientation accordingly. Calls updateBinocularsState() to handle zoom effects and updateNVGState() to handle night vision mode switching.
| dt | Delta time in seconds since the last tick |
Reimplemented from makVre::DtObserverUpdater.
| void makVre::DtCommanderHatchViewUpdater::updateBinocularsState | ( | double | dt | ) |
Updates binocular zoom effects.
Checks the "viewMagnification" state attribute and manages the zoom interpolator to create smooth transitions between zoom levels. Creates the interpolator when needed, updates its endpoint if the target zoom changes, and applies the interpolated value to the observer's view magnification.
| dt | Delta time in seconds since the last tick |
| void makVre::DtCommanderHatchViewUpdater::updateNVGState | ( | ) |
Updates night vision goggles state.
Checks the boolean "NVG" state attribute and, if it has changed since the last update, sets the observer's sensor mode accordingly. When NVG is activated, uses the VR-Engage sensor mode mapper to find the appropriate VR-Vantage sensor mode.
|
overridevirtual |
Shuts down the component.
Removes message handlers for PlayerCreatedMessage and ResetMessage.
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 setupObserver() to configure the observer attachment details.
| msg | The player created message |
|
protectedvirtual |
Handles reset messages.
This method currently has no implementation (TODO in the code).
| msg | The reset message |
|
protectedvirtual |
Sets up observer attachment configuration.
Configures the observer with AttachTypeMimic, attaching it to the player's element with the part and location/rotation offsets specified in the role config file.
|
protected |
DIS enumeration for the vehicle part to attach the eyepoint to.
Defaults to -1, which represents the base part (the vehicle itself).
|
protected |
Offset vector from the attachment point in meters.
Coordinates are: +x right, +y front, +z up
|
protected |
Rotation offset quaternion from the attachment point.
Defaults to identity quaternion (1,0,0,0) - no rotation
|
protected |
Interpolator for smooth zoom transitions.
Created as needed when zoom level changes and deleted when transition completes
|
protected |
Cached pointer to the observer being controlled.
|
protected |
Flag indicating whether observer rotation is constrained.
When true, observer yaw and pitch are clamped to the ranges defined by myYawRange and myPitchRange. Set to true if either pitchRange or yawRange configuration parameters are provided.
|
protected |
Yaw range limits in radians.
|
protected |
Pitch range limits in radians.
|
protected |
Tracks the last known state of night vision goggles.
Used to detect changes in NVG state to avoid unnecessary sensor mode changes