|
VR-Engage
2.2
|
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>
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< DtSavedViewInputLogic > | getInputLogic () |
| 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 DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () 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 DtPlayerStation * | findHumanPlayer () 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 |
Type definition for mapping view names to channel keywords.
| makVre::DtSavedViewUpdater::DtSavedViewUpdater | ( | ) |
Constructor for DtSavedViewUpdater.
Initializes the saved view updater with default settings
|
overridevirtual |
Virtual destructor for DtSavedViewUpdater.
|
overridevirtual |
Initializes the saved view updater component.
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing saved view settings |
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().
|
overridevirtual |
Called every frame to update the saved view system.
| dt | Delta 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.
|
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.
|
overridevirtual |
Returns the type identifier for this component.
Reimplemented from makVre::DtObserverUpdater.
| std::shared_ptr< DtSavedViewInputLogic > makVre::DtSavedViewUpdater::getInputLogic | ( | ) |
Gets the input logic component for saved views.
Provides access to the input logic component that handles saved view input bindings
|
virtual |
Switches to a specific saved view by index.
| viewIndex | Index 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
|
virtual |
Switches to the next saved view in sequence.
Increments the current view index and activates that view
|
virtual |
Switches to the previous saved view in sequence.
Decrements the current view index and activates that view
|
virtual |
Toggles between a named view and a previously active view.
| viewName | Name of the view to toggle to/from |
| allowPartialMatch | If 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.
| makVrv::DtObserver * makVre::DtSavedViewUpdater::getObserver | ( | ) |
Gets the observer being managed by this component.
Provides access to the VRV observer object for direct manipulation
|
virtual |
Loads saved views from a file.
| filename | Path to the file containing saved view definitions |
Reads and processes observer state records from the specified file
|
virtual |
Gets the list of loaded saved view records.
Provides access to the cached observer state records loaded from the file
|
virtual |
Gets the filename of the currently loaded saved views file.
Returns the path to the file from which saved views were loaded
|
protectedvirtual |
Handles menu action messages related to saved views.
| msg | The menu action message |
Processes menu actions for next/previous view and explicit view selection
|
protected |
Updates channel keywords based on the current view name.
| viewName | Name of the current view |
Applies or removes channel keywords based on the view-to-keyword mapping
|
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
|
protected |
Updates view settings when the vehicle is destroyed.
Handles special cases for observer settings when damage state is "destroyed"
|
protectedvirtual |
Handles player creation messages.
| msg | The player created message |
Calls setupObserver() to establish the observer attachment details when the player entity is created in the simulation
|
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
|
protectedvirtual |
Determines if the human model should be hidden for a specific view.
| viewName | Name of the view to check |
Checks if the specified view is in the list of views that should hide the human model (relevant for walk-on embarkation)
|
protectedvirtual |
Shows the human model if it exists.
Makes the human model visible by sending a visibility message
|
protectedvirtual |
Hides the human model if it exists.
Makes the human model invisible by sending a visibility message
|
protectedvirtual |
Finds the human player station if walk-on embarkation was used.
Locates the suspended human player station that corresponds to this vehicle role when the player has performed walk-on embarkation
|
protectedvirtual |
Slot called when the human scene object is about to be deleted.
| id | Unique ID of the scene object being deleted |
Clears the human scene object reference when the object is destroyed
|
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.
|
protected |
Input logic component that handles saved view input bindings.
|
protected |
Pointer to the observer being managed by this component.
|
protected |
Index of the currently active saved view.
|
protected |
Index of the view to return to when toggling views.
|
protected |
Total number of available saved views.
|
protected |
Name of the gunner seat view.
|
protected |
Flag indicating if the current view is a gunner seat view.
|
protected |
Last sensor view mode that was applied.
|
protected |
Names of the saved views.
|
protected |
Mapping from view names to channel keywords.
|
protected |
List of channel keywords applied for the current view.
|
protected |
Index of the initial view to activate on startup.
|
protected |
Flag indicating if view changes are allowed.
|
protected |
Flag indicating if the model should be hidden.
|
protected |
Name of the observer to use.
|
protected |
Name of the channel to update with view keywords.
|
protected |
Name of the window containing the channel.
|
protected |
Path to the file containing saved view definitions.
|
protected |
List of observer state records loaded from the saved views file.
|
protected |
List of view names for which the human model should be hidden.
|
protected |
Pointer to the human scene object for walk-on embarkation.
|
protected |
Initial visibility state of the human scene object.