VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtSavedViewUpdater Class Reference

Detailed Description

DtSavedViewUpdater loads and manages a set of saved viewpoints for a vehicle or role, allowing the player to switch between different positions (driver, gunner, etc.) and sensor modes (visual, NVG, thermal). It handles observer attachment, view positioning, human model visibility, and channel configuration for each view.

#include <savedViewUpdater.h>

Inheritance diagram for makVre::DtSavedViewUpdater:
[legend]

Public Member Functions

 DtSavedViewUpdater ()
 
virtual ~DtSavedViewUpdater () override
 
virtual bool initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
std::shared_ptr< DtSavedViewInputLogicgetInputLogic ()
 
virtual void gotoView (unsigned int viewIndex)
 
virtual void nextView ()
 
virtual void previousView ()
 
virtual void toggleView (const std::string &viewName, bool allowPartialMatch)
 
makVrv::DtObserver * getObserver ()
 
virtual void loadSavedViews (DtFilename filename)
 
virtual makArchives::DtObserverStateRecordsList getSavedViewsRecords ()
 
virtual DtFilename getSavedViewsFileName ()
 
- 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 DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Types

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

Protected Member Functions

virtual makVre::DtVreMessageResult handleMenuMessage (makVre::DtVreMessage *msg)
 
void updateChannelForViewName (const std::string &viewName)
 
void updateSensor ()
 
void updateDestroyed ()
 
virtual makVre::DtVreMessageResult handlePlayerCreated (makVre::DtVreMessage *msg)
 
virtual void setupObserver ()
 
virtual bool shouldHideHumanModel (std::string viewName) const
 
virtual void showHumanModel ()
 
virtual void hideHumanModel ()
 
virtual DtPlayerStationfindHumanPlayer () const
 
virtual void slot_disSceneObjectToBeDeleted (const makVrv::DtUniqueID &id)
 
virtual void debugSavedViews ()
 
- 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

std::shared_ptr< DtSavedViewInputLogicmyInputLogic
 
makVrv::DtObserver * myObserver
 
int myCurrentView
 
int myViewToReturnTo
 
int myNumViews
 
std::string myGunnerSeatView
 
bool myInGunnerSeat
 
SensorViews myLastSensorViewMode
 
std::vector< std::string > mySavedViews
 
ViewChannelKeywordMap myViewChannelKeywordMap
 
std::vector< std::string > myLastChannelKeywords
 
int myInitialView
 
bool myAllowChangingViews
 
bool myHideModel
 
std::string myObserverName
 
std::string myChannelName
 
std::string myWindowName
 
DtFilename mySavedViewsFileName
 
makArchives::DtObserverStateRecordsList myCachedObserverViews
 
std::vector< std::string > myHideHumanModelInSavedViews
 
makVrv::DtSceneObject * myHumanSceneObject
 
bool myHumanSceneObjectInitiallyVisible
 
- Protected Attributes inherited from makVre::DtObserverUpdater
makVre::DtInstrumentPanelManagermyInstrumentPanelManager
 
ChannelConfigMap myChannelsToUpdate
 
bool myForceChannelUpdate
 
double myVerticalFOV
 
double myHorizontalFOV
 
makVrv::DtWindow * myWindow
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Member Typedef Documentation

◆ ViewChannelKeywordMap

using makVre::DtSavedViewUpdater::ViewChannelKeywordMap = std::map<std::string, std::string>
protected

Type definition for mapping view names to channel keywords.

Constructor & Destructor Documentation

◆ DtSavedViewUpdater()

makVre::DtSavedViewUpdater::DtSavedViewUpdater ( )

Constructor for DtSavedViewUpdater.

Initializes the saved view updater with default settings

◆ ~DtSavedViewUpdater()

virtual makVre::DtSavedViewUpdater::~DtSavedViewUpdater ( )
overridevirtual

Virtual destructor for DtSavedViewUpdater.

Member Function Documentation

◆ initialize()

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

Initializes the saved view updater component.

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

Sets up the saved view system, loads view definitions from a file, configures input handlers, and establishes observer attachment parameters

Reimplemented from makVre::DtObserverUpdater.

References makVre::DtPlayerComponent::player().

◆ tick()

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

Called every frame to update the saved view system.

Parameters
dtDelta time since the last frame in seconds

Updates sensor modes, handles view orientation adjustments for VR, and manages destruction state changes

Reimplemented from makVre::DtObserverUpdater.

◆ shutdown()

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

Shuts down the saved view updater component.

Restores human model visibility to its original state, disconnects message handlers, shuts down input logic, and resets observer attachments

Reimplemented from makVre::DtObserverUpdater.

◆ type()

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

Returns the type identifier for this component.

Returns
The type string for DtSavedViewUpdater

Reimplemented from makVre::DtObserverUpdater.

◆ getInputLogic()

std::shared_ptr< DtSavedViewInputLogic > makVre::DtSavedViewUpdater::getInputLogic ( )

Gets the input logic component for saved views.

Returns
Shared pointer to the saved view input logic component

Provides access to the input logic component that handles saved view input bindings

◆ gotoView()

virtual void makVre::DtSavedViewUpdater::gotoView ( unsigned int viewIndex)
virtual

Switches to a specific saved view by index.

Parameters
viewIndexIndex of the view to activate

Changes the observer's position and orientation to the specified saved view, updates channel keywords, and handles human model visibility

◆ nextView()

virtual void makVre::DtSavedViewUpdater::nextView ( )
virtual

Switches to the next saved view in sequence.

Increments the current view index and activates that view

◆ previousView()

virtual void makVre::DtSavedViewUpdater::previousView ( )
virtual

Switches to the previous saved view in sequence.

Decrements the current view index and activates that view

◆ toggleView()

virtual void makVre::DtSavedViewUpdater::toggleView ( const std::string & viewName,
bool allowPartialMatch )
virtual

Toggles between a named view and a previously active view.

Parameters
viewNameName of the view to toggle to/from
allowPartialMatchIf true, allows partial matching of view names

If the named view is not the current view, sets myViewToReturnTo to the current view and switches to the named view. If the named view is already the current view and myViewToReturnTo is valid, switches back to the previously stored view. Note: myViewToReturnTo is reset to -1 by gotoView.

◆ getObserver()

makVrv::DtObserver * makVre::DtSavedViewUpdater::getObserver ( )

Gets the observer being managed by this component.

Returns
Pointer to the observer object

Provides access to the VRV observer object for direct manipulation

◆ loadSavedViews()

virtual void makVre::DtSavedViewUpdater::loadSavedViews ( DtFilename filename)
virtual

Loads saved views from a file.

Parameters
filenamePath to the file containing saved view definitions

Reads and processes observer state records from the specified file

◆ getSavedViewsRecords()

virtual makArchives::DtObserverStateRecordsList makVre::DtSavedViewUpdater::getSavedViewsRecords ( )
virtual

Gets the list of loaded saved view records.

Returns
List of observer state records representing the saved views

Provides access to the cached observer state records loaded from the file

◆ getSavedViewsFileName()

virtual DtFilename makVre::DtSavedViewUpdater::getSavedViewsFileName ( )
virtual

Gets the filename of the currently loaded saved views file.

Returns
Filename of the saved views file

Returns the path to the file from which saved views were loaded

◆ handleMenuMessage()

virtual makVre::DtVreMessageResult makVre::DtSavedViewUpdater::handleMenuMessage ( makVre::DtVreMessage * msg)
protectedvirtual

Handles menu action messages related to saved views.

Parameters
msgThe menu action message
Returns
Message handling result indicating if the message was handled

Processes menu actions for next/previous view and explicit view selection

◆ updateChannelForViewName()

void makVre::DtSavedViewUpdater::updateChannelForViewName ( const std::string & viewName)
protected

Updates channel keywords based on the current view name.

Parameters
viewNameName of the current view

Applies or removes channel keywords based on the view-to-keyword mapping

◆ updateSensor()

void makVre::DtSavedViewUpdater::updateSensor ( )
protected

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

Changes the observer's sensor based on the currentSensor attribute, handling transitions between visual, NVG, and thermal modes

◆ updateDestroyed()

void makVre::DtSavedViewUpdater::updateDestroyed ( )
protected

Updates view settings when the vehicle is destroyed.

Handles special cases for observer settings when damage state is "destroyed"

◆ handlePlayerCreated()

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

Handles player creation messages.

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

Calls setupObserver() to establish the observer attachment details when the player entity is created in the simulation

◆ setupObserver()

virtual void makVre::DtSavedViewUpdater::setupObserver ( )
protectedvirtual

Sets up the observer attachment configuration.

Configures the observer with AttachTypeMimic attachment to the player entity and activates the initial view specified in the configuration

◆ shouldHideHumanModel()

virtual bool makVre::DtSavedViewUpdater::shouldHideHumanModel ( std::string viewName) const
protectedvirtual

Determines if the human model should be hidden for a specific view.

Parameters
viewNameName of the view to check
Returns
True if the human model should be hidden, false otherwise

Checks if the specified view is in the list of views that should hide the human model (relevant for walk-on embarkation)

◆ showHumanModel()

virtual void makVre::DtSavedViewUpdater::showHumanModel ( )
protectedvirtual

Shows the human model if it exists.

Makes the human model visible by sending a visibility message

◆ hideHumanModel()

virtual void makVre::DtSavedViewUpdater::hideHumanModel ( )
protectedvirtual

Hides the human model if it exists.

Makes the human model invisible by sending a visibility message

◆ findHumanPlayer()

virtual DtPlayerStation * makVre::DtSavedViewUpdater::findHumanPlayer ( ) const
protectedvirtual

Finds the human player station if walk-on embarkation was used.

Returns
Pointer to the human player station if found, nullptr otherwise

Locates the suspended human player station that corresponds to this vehicle role when the player has performed walk-on embarkation

◆ slot_disSceneObjectToBeDeleted()

virtual void makVre::DtSavedViewUpdater::slot_disSceneObjectToBeDeleted ( const makVrv::DtUniqueID & id)
protectedvirtual

Slot called when the human scene object is about to be deleted.

Parameters
idUnique ID of the scene object being deleted

Clears the human scene object reference when the object is destroyed

◆ debugSavedViews()

virtual void makVre::DtSavedViewUpdater::debugSavedViews ( )
protectedvirtual

Provides an interactive ImGui debug interface for saved views management.

Creates a collapsible debug panel that displays the current saved views file, lists all available views (selectable to switch views), and provides interactive controls for real-time adjustment of observer position and rotation offsets. Also includes functionality to save modified views back to the file or create new saved view files. Used by the VRE debug system for saved view development and troubleshooting.

Member Data Documentation

◆ myInputLogic

std::shared_ptr<DtSavedViewInputLogic> makVre::DtSavedViewUpdater::myInputLogic
protected

Input logic component that handles saved view input bindings.

◆ myObserver

makVrv::DtObserver* makVre::DtSavedViewUpdater::myObserver
protected

Pointer to the observer being managed by this component.

◆ myCurrentView

int makVre::DtSavedViewUpdater::myCurrentView
protected

Index of the currently active saved view.

◆ myViewToReturnTo

int makVre::DtSavedViewUpdater::myViewToReturnTo
protected

Index of the view to return to when toggling views.

◆ myNumViews

int makVre::DtSavedViewUpdater::myNumViews
protected

Total number of available saved views.

◆ myGunnerSeatView

std::string makVre::DtSavedViewUpdater::myGunnerSeatView
protected

Name of the gunner seat view.

◆ myInGunnerSeat

bool makVre::DtSavedViewUpdater::myInGunnerSeat
protected

Flag indicating if the current view is a gunner seat view.

◆ myLastSensorViewMode

SensorViews makVre::DtSavedViewUpdater::myLastSensorViewMode
protected

Last sensor view mode that was applied.

◆ mySavedViews

std::vector<std::string> makVre::DtSavedViewUpdater::mySavedViews
protected

Names of the saved views.

◆ myViewChannelKeywordMap

ViewChannelKeywordMap makVre::DtSavedViewUpdater::myViewChannelKeywordMap
protected

Mapping from view names to channel keywords.

◆ myLastChannelKeywords

std::vector<std::string> makVre::DtSavedViewUpdater::myLastChannelKeywords
protected

List of channel keywords applied for the current view.

◆ myInitialView

int makVre::DtSavedViewUpdater::myInitialView
protected

Index of the initial view to activate on startup.

◆ myAllowChangingViews

bool makVre::DtSavedViewUpdater::myAllowChangingViews
protected

Flag indicating if view changes are allowed.

◆ myHideModel

bool makVre::DtSavedViewUpdater::myHideModel
protected

Flag indicating if the model should be hidden.

◆ myObserverName

std::string makVre::DtSavedViewUpdater::myObserverName
protected

Name of the observer to use.

◆ myChannelName

std::string makVre::DtSavedViewUpdater::myChannelName
protected

Name of the channel to update with view keywords.

◆ myWindowName

std::string makVre::DtSavedViewUpdater::myWindowName
protected

Name of the window containing the channel.

◆ mySavedViewsFileName

DtFilename makVre::DtSavedViewUpdater::mySavedViewsFileName
protected

Path to the file containing saved view definitions.

◆ myCachedObserverViews

makArchives::DtObserverStateRecordsList makVre::DtSavedViewUpdater::myCachedObserverViews
protected

List of observer state records loaded from the saved views file.

◆ myHideHumanModelInSavedViews

std::vector<std::string> makVre::DtSavedViewUpdater::myHideHumanModelInSavedViews
protected

List of view names for which the human model should be hidden.

◆ myHumanSceneObject

makVrv::DtSceneObject* makVre::DtSavedViewUpdater::myHumanSceneObject
protected

Pointer to the human scene object for walk-on embarkation.

◆ myHumanSceneObjectInitiallyVisible

bool makVre::DtSavedViewUpdater::myHumanSceneObjectInitiallyVisible
protected

Initial visibility state of the human scene object.


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