|
VR-Engage
2.2
|
DtLookAroundObserverUpdater updates the visual aspects of the player's view. It orients the observer based on input and provides support for special equipment visual effects like binoculars (with zooming capability) and night vision goggles. It can be configured to work with saved views and to limit the range of movement for different viewing positions.
The component supports:
#include <lookAroundObserverUpdater.h>
Public Member Functions | |
| DtLookAroundObserverUpdater () | |
| virtual | ~DtLookAroundObserverUpdater () override |
| virtual bool | initialize (DtPlayerStation *player, DtInitTable &config) override |
| virtual void | tick (double dt) override |
| virtual bool | postInitialize () override |
| virtual void | shutdown () override |
| virtual const char * | type () const override |
| virtual void | updateBinocularsState (double dt) |
| virtual void | updateNVGState () |
| virtual void | updateObserverState (double dT) |
| void | resetToInitialView (double period=0.25) |
| void | refreshObserverYawAndPitch () |
| virtual const ObserverRange & | getPitchRange () |
| virtual const ObserverRange & | getYawRange () |
| virtual bool | isLookAroundEnabled () const |
| virtual bool | isBinocularsEnabled () const |
| virtual bool | isNVGEnabled () const |
| std::shared_ptr< DtLookAroundInputLogic > | getInputLogic () |
| virtual bool | isLookingAround () const |
| virtual void | setLookingAround (bool look, bool mouse=true) |
Public Member Functions inherited from makVre::DtObserverUpdater | |
| DtObserverUpdater () | |
| virtual | ~DtObserverUpdater () 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 void | onCurrentViewNameChanged (const std::string &viewName) |
| virtual makVre::DtVreMessageResult | handlePlayerCreated (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 () |
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::DtLookAroundObserverUpdater::DtLookAroundObserverUpdater | ( | ) |
Constructor for DtLookAroundObserverUpdater.
Initializes component state with default values
|
overridevirtual |
Virtual destructor for DtLookAroundObserverUpdater.
|
overridevirtual |
Initializes the look-around observer updater component.
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing observer settings |
Initializes member variables from the configuration table, caches pointer to the observer, adds handlers for PlayerCreatedMessage, and creates the input logic component
Reimplemented from makVre::DtObserverUpdater.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Called every frame to update the observer orientation and visual effects.
| dt | Delta time since the last frame in seconds |
Updates the observer's orientation based on input, manages binoculars and NVG effects, and handles smooth transitions between different states
Reimplemented from makVre::DtObserverUpdater.
|
overridevirtual |
Performs post-initialization after all components are initialized.
Sets up saved view handling, initializes binoculars and NVG state, and configures VR support if enabled
Reimplemented from makVre::DtObserverUpdater.
|
overridevirtual |
Shuts down the look-around observer updater component.
Shuts down the input logic component, removes message handlers and attribute callbacks, and performs cleanup operations
Reimplemented from makVre::DtObserverUpdater.
|
overridevirtual |
Returns the type identifier for this component.
Reimplemented from makVre::DtObserverUpdater.
|
virtual |
Updates the binoculars zoom state.
| dt | Delta time since the last frame in seconds |
Checks for the "viewMagnification" state attribute and creates, updates, or deletes the zoom interpolator as needed. Updates the observer view magnification based on the interpolator's current value for smooth transitions.
|
virtual |
Updates the night vision goggles (NVG) state.
Checks for the "NVG" state attribute and applies the appropriate sensor mode to the observer when the state changes
|
virtual |
Updates the observer's orientation state.
| dT | Delta time since the last frame in seconds |
Handles both VR and non-VR observer orientation updates, including interpolation for smooth transitions when returning to initial views
| void makVre::DtLookAroundObserverUpdater::resetToInitialView | ( | double | period = 0.25 | ) |
Resets the observer to its initial orientation.
| period | Time in seconds for the smooth transition (default:.25 seconds) |
Creates an interpolator to smoothly transition from the current view back to the initial saved view orientation
| void makVre::DtLookAroundObserverUpdater::refreshObserverYawAndPitch | ( | ) |
Refreshes the observer yaw and pitch values.
Updates the observer's orientation attributes based on the current saved view or attached orientation offset, and sets appropriate range limits
|
virtual |
Gets the current pitch range limits.
|
virtual |
Gets the current yaw range limits.
|
virtual |
Checks if look-around functionality is enabled.
|
virtual |
Checks if binoculars functionality is enabled.
|
virtual |
Checks if night vision goggles functionality is enabled.
| std::shared_ptr< DtLookAroundInputLogic > makVre::DtLookAroundObserverUpdater::getInputLogic | ( | ) |
Gets the associated input logic component.
|
virtual |
Checks if the player is currently looking around.
|
virtual |
Enables or disables active looking around.
| look | True to enable looking around, false to disable |
| mouse | True if input is from mouse, false if from joystick |
When disabling looking around, initiates a smooth transition back to the initial view orientation
|
protectedvirtual |
Handles changes to the current view name.
| viewName | The new view name |
Called when the current view changes, refreshes observer orientation and updates range limits based on the new view
|
protectedvirtual |
Handles player creation messages.
| msg | The player created message |
Calls setupObserver() to set up the observer attachment details
|
protectedvirtual |
Sets up the observer's attachment to the player entity.
Configures the observer attachment as AttachTypeMimic, with the part and location/rotation offsets specified in the configuration
|
protected |
Shared pointer to the associated input logic component.
|
protected |
Pointer to the observer being controlled.
|
protected |
Interpolator for smooth zoom level transitions.
|
protected |
Position offset from the attachment point.
|
protected |
Orientation offset from the attachment point.
|
protected |
Flag indicating if binoculars functionality is enabled.
|
protected |
Flag indicating if night vision goggles functionality is enabled.
|
protected |
Flag indicating if look-around functionality is enabled.
|
protected |
Last known state of night vision goggles.
|
protected |
Flag indicating if the player is currently looking around.
|
protected |
Current yaw range limits in radians.
|
protected |
Current pitch range limits in radians.
|
protected |
Default yaw range limits in radians.
|
protected |
Default pitch range limits in radians.
|
protected |
Time in seconds to transition back to initial view when using mouse.
|
protected |
Time in seconds to transition back to initial view when using joystick.
|
protected |
Flag indicating if saved views system is in use.
|
protected |
Last active sensor view mode.
|
protected |
Collection of supplemental configuration data for saved views.
|
protected |
Interpolator for smooth transitions between observer orientations.
|
protected |
Flag indicating if VR mode is enabled.
|
protected |
Pointer to the VR driver if VR is enabled.