VR-Engage  2.3
Loading...
Searching...
No Matches
makVre::DtGunnerObserverUpdater Class Reference

Detailed Description

DtGunnerObserverUpdater attaches the observer to a weapon system and provides gunner-specific controls including zoom levels, sensor modes (visual, NVG, thermal), and appropriate gunner view positioning. It handles observer resets on player creation and manages smooth transitions between zoom levels.

#include <gunnerObserverUpdater.h>

Inheritance diagram for makVre::DtGunnerObserverUpdater:
[legend]

Public Member Functions

 DtGunnerObserverUpdater ()
 
virtual ~DtGunnerObserverUpdater () 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 ()
 
bool componentReady () const
 
void setComponentReady (bool ready)
 
virtual DtInitTickStatus finalizeInitTick (double dt)
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStation & player ()
 
virtual DtAttributeHandle & playerAttributeStore ()
 
virtual const DtAttributeHandle & playerAttributeStore () const
 
virtual const DtAttributeHandle & ownshipState () const
 
virtual void setExtendedData (const std::string &key, const std::string &value, DtEntityIdentifier entity=DtEntityIdentifier::nullId())
 

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
 
makVre::DtLinearInterpolator< double > * myZoomInterpolator
 
int myAttachPart
 
DtVector myAttachedOffset
 
DtQuaternion myOriOffest
 
SensorViews myLastSensorViewMode
 
std::map< enum SensorViews, std::string > mySensorModes
 
DtAttributeHandleType< int > myResetObserverAttr
 
DtAttributeHandleType< bool > myZoomChangedAttr
 
DtAttributeHandleType< double > myZoomAttr
 
DtAttributeHandleType< int > myCurrentSensorAttr
 
DtAttributeHandleType< DtDamageState > myDamageStateAttr
 
DtAttributeHandleType< std::vector< std::string > > mySensorModesAttr
 
DtAttributeHandleType< std::string > myCurrentSensorNameAttr
 
- 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
bool myComponentReady = true
 
std::string myName
 
DtInitTable myConfig
 
DtPlayerStation * myPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolver * myResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 
DtVreMessageHandlerGroup myMessageHandlers
 

Additional Inherited Members

- Protected Types inherited from makVre::DtObserverUpdater
using WindowAndChannelName = std::pair<std::string, std::string>
 
using ChannelConfigMap = std::map<WindowAndChannelName, makVrv::DtChannelConfiguration>
 

Constructor & Destructor Documentation

◆ DtGunnerObserverUpdater()

makVre::DtGunnerObserverUpdater::DtGunnerObserverUpdater ( )

Constructor for DtGunnerObserverUpdater.

Initializes observer state variables including attachment status and sensor modes

◆ ~DtGunnerObserverUpdater()

virtual makVre::DtGunnerObserverUpdater::~DtGunnerObserverUpdater ( )
overridevirtual

Destructor for DtGunnerObserverUpdater.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtGunnerObserverUpdater::initialize ( DtPlayerStation * player,
DtInitTable & config )
overridevirtual

Initializes the gunner observer updater component.

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing gunner observer settings
Returns
True if initialization succeeded, false otherwise

Sets up observer attachments, configures sensor modes, and registers message handlers for player creation and reset events

Reimplemented from makVre::DtObserverUpdater.

References makVre::DtPlayerComponent::player().

◆ tick()

virtual void makVre::DtGunnerObserverUpdater::tick ( double dt)
overridevirtual

Called every frame to update the gunner observer.

Parameters
dtDelta time since the last frame in seconds

Updates zoom interpolation, observer attachment properties, sensor modes, and handles special cases when the vehicle is destroyed

Reimplemented from makVre::DtObserverUpdater.

◆ shutdown()

virtual void makVre::DtGunnerObserverUpdater::shutdown ( )
overridevirtual

Shuts down the gunner observer updater component.

Removes message handlers, detaches the observer, and resets sensor modes

Reimplemented from makVre::DtObserverUpdater.

◆ type()

virtual const char * makVre::DtGunnerObserverUpdater::type ( ) const
overridevirtual

Returns the type identifier for this component.

Returns
The type string for DtGunnerObserverUpdater

Reimplemented from makVre::DtObserverUpdater.

◆ handlePlayerCreated()

virtual makVre::DtVreMessageResult makVre::DtGunnerObserverUpdater::handlePlayerCreated ( makVre::DtVreMessage * msg)
protectedvirtual

Handles player creation messages.

Parameters
msgThe player created message
Returns
Message handling result indicating message was handled

Resets the observer when a new player is created

◆ handlePlayerReset()

virtual makVre::DtVreMessageResult makVre::DtGunnerObserverUpdater::handlePlayerReset ( makVre::DtVreMessage * msg)
protectedvirtual

Handles player reset messages.

Parameters
msgThe reset message
Returns
Message handling result indicating message was handled

Resets the observer when the player is reset

◆ resetObserver()

void makVre::DtGunnerObserverUpdater::resetObserver ( )
protected

Resets the observer to the proper attachment point and orientation.

Configures the observer to attach to the correct part of the entity with the appropriate offset and rotation settings

◆ updateSensor()

void makVre::DtGunnerObserverUpdater::updateSensor ( )
protected

Updates the observer's sensor mode based on player state.

Changes sensor modes (visual, NVG, thermal) when the player's currentSensor attribute changes

◆ updateDestroyed()

void makVre::DtGunnerObserverUpdater::updateDestroyed ( )
protected

Updates observer behavior when the vehicle is destroyed.

Changes observer attachment type and resets when destruction state changes

Member Data Documentation

◆ myAttached

bool makVre::DtGunnerObserverUpdater::myAttached
protected

Flag indicating if the observer is attached to a scene object.

◆ myObserver

makVrv::DtObserver* makVre::DtGunnerObserverUpdater::myObserver
protected

Pointer to the observer object being controlled.

◆ myZoomInterpolator

makVre::DtLinearInterpolator<double>* makVre::DtGunnerObserverUpdater::myZoomInterpolator
protected

Interpolator for smooth zoom level transitions.

◆ myAttachPart

int makVre::DtGunnerObserverUpdater::myAttachPart
protected

ID of the part to attach the observer to (e.g., gun barrel)

◆ myAttachedOffset

DtVector makVre::DtGunnerObserverUpdater::myAttachedOffset
protected

Position offset from the attachment point.

◆ myOriOffest

DtQuaternion makVre::DtGunnerObserverUpdater::myOriOffest
protected

Orientation offset from the attachment point.

◆ myLastSensorViewMode

SensorViews makVre::DtGunnerObserverUpdater::myLastSensorViewMode
protected

Currently active sensor view mode.

◆ mySensorModes

std::map<enum SensorViews, std::string> makVre::DtGunnerObserverUpdater::mySensorModes
protected

Map of SensorViews enums to VR-Engage sensor mode names.

This map is initialized with data from the player configuration and maps the SensorViews enumeration values to their corresponding string names used in VR-Vantage

◆ myResetObserverAttr

DtAttributeHandleType<int> makVre::DtGunnerObserverUpdater::myResetObserverAttr
protected

Attribute handle tracking a countdown for resetting the observer position.

Attribute Store KeyresetObserver

◆ myZoomChangedAttr

DtAttributeHandleType<bool> makVre::DtGunnerObserverUpdater::myZoomChangedAttr
protected

Attribute handle indicating whether the zoom level has changed and the interpolator needs updating.

Attribute Store KeyzoomChanged

◆ myZoomAttr

DtAttributeHandleType<double> makVre::DtGunnerObserverUpdater::myZoomAttr
protected

Attribute handle storing the current zoom magnification level.

Attribute Store Keyzoom

◆ myCurrentSensorAttr

DtAttributeHandleType<int> makVre::DtGunnerObserverUpdater::myCurrentSensorAttr
protected

Attribute handle storing the active sensor view index (0=Visual, 1=NVG, 2=Thermal-white, 3=Thermal-black).

Attribute Store KeycurrentSensor

◆ myDamageStateAttr

DtAttributeHandleType<DtDamageState> makVre::DtGunnerObserverUpdater::myDamageStateAttr
protected

Attribute handle storing the ownship's current damage state.

Attribute Store Keyownship.damageState

◆ mySensorModesAttr

DtAttributeHandleType<std::vector<std::string> > makVre::DtGunnerObserverUpdater::mySensorModesAttr
protected

Attribute handle storing the list of available sensor mode name strings.

Attribute Store KeysensorModes

◆ myCurrentSensorNameAttr

DtAttributeHandleType<std::string> makVre::DtGunnerObserverUpdater::myCurrentSensorNameAttr
protected

Attribute handle storing the display name of the currently active sensor mode.

Attribute Store KeycurrentSensorName

The documentation for this class was generated from the following file: