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

Detailed Description

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:

  • Configurable yaw and pitch ranges for head movement
  • Binoculars with zoom capability
  • Night vision goggles with special visual effects
  • Look-around functionality with mouse or joystick control
  • VR head tracking integration
  • Saved view positions with per-view configuration

#include <lookAroundObserverUpdater.h>

Inheritance diagram for makVre::DtLookAroundObserverUpdater:
[legend]

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 ObserverRangegetPitchRange ()
 
virtual const ObserverRangegetYawRange ()
 
virtual bool isLookAroundEnabled () const
 
virtual bool isBinocularsEnabled () const
 
virtual bool isNVGEnabled () const
 
std::shared_ptr< DtLookAroundInputLogicgetInputLogic ()
 
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 DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () 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 ()
 

Protected Attributes

std::shared_ptr< DtLookAroundInputLogicmyInputLogic
 
makVrv::DtObserver * myObserver
 
makVre::DtLinearInterpolator< double > * myZoomInterpolator
 
DtVector myAttachedLocationOffset
 
DtQuaternion myAttachedOrientationOffset
 
bool myEnableBinoculars
 
bool myEnableNVG
 
bool myEnableLookAround
 
bool myLastNVGState
 
bool myLookingAround
 
ObserverRange myCurrentYawRange
 
ObserverRange myCurrentPitchRange
 
ObserverRange myDefaultYawRange
 
ObserverRange myDefaultPitchRange
 
double mySnapBackTimeMouse
 
double mySnapBackTimeJoystick
 
bool myUseSavedViews
 
SensorViews myLastSensorViewMode
 
std::vector< SavedViewDatamySupplementalSavedViewData
 
makVre::DtBezierInterpolator< DtVector > * myObserverInterpolator
 
bool myVrEnabled
 
makVrv::DtVirtualRealityDriver * myVrDriver
 
- 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
 

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

◆ DtLookAroundObserverUpdater()

makVre::DtLookAroundObserverUpdater::DtLookAroundObserverUpdater ( )

Constructor for DtLookAroundObserverUpdater.

Initializes component state with default values

◆ ~DtLookAroundObserverUpdater()

virtual makVre::DtLookAroundObserverUpdater::~DtLookAroundObserverUpdater ( )
overridevirtual

Virtual destructor for DtLookAroundObserverUpdater.

Member Function Documentation

◆ initialize()

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

Initializes the look-around observer updater component.

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

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().

◆ tick()

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

Called every frame to update the observer orientation and visual effects.

Parameters
dtDelta 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.

◆ postInitialize()

virtual bool makVre::DtLookAroundObserverUpdater::postInitialize ( )
overridevirtual

Performs post-initialization after all components are initialized.

Returns
True if post-initialization succeeded, false otherwise

Sets up saved view handling, initializes binoculars and NVG state, and configures VR support if enabled

Reimplemented from makVre::DtObserverUpdater.

◆ shutdown()

virtual void makVre::DtLookAroundObserverUpdater::shutdown ( )
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.

◆ type()

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

Returns the type identifier for this component.

Returns
The type string for DtLookAroundObserverUpdater

Reimplemented from makVre::DtObserverUpdater.

◆ updateBinocularsState()

virtual void makVre::DtLookAroundObserverUpdater::updateBinocularsState ( double dt)
virtual

Updates the binoculars zoom state.

Parameters
dtDelta 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.

◆ updateNVGState()

virtual void makVre::DtLookAroundObserverUpdater::updateNVGState ( )
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

◆ updateObserverState()

virtual void makVre::DtLookAroundObserverUpdater::updateObserverState ( double dT)
virtual

Updates the observer's orientation state.

Parameters
dTDelta 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

◆ resetToInitialView()

void makVre::DtLookAroundObserverUpdater::resetToInitialView ( double period = 0.25)

Resets the observer to its initial orientation.

Parameters
periodTime 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

◆ refreshObserverYawAndPitch()

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

◆ getPitchRange()

virtual const ObserverRange & makVre::DtLookAroundObserverUpdater::getPitchRange ( )
virtual

Gets the current pitch range limits.

Returns
Reference to the pitch range structure

◆ getYawRange()

virtual const ObserverRange & makVre::DtLookAroundObserverUpdater::getYawRange ( )
virtual

Gets the current yaw range limits.

Returns
Reference to the yaw range structure

◆ isLookAroundEnabled()

virtual bool makVre::DtLookAroundObserverUpdater::isLookAroundEnabled ( ) const
virtual

Checks if look-around functionality is enabled.

Returns
True if look-around is enabled, false otherwise

◆ isBinocularsEnabled()

virtual bool makVre::DtLookAroundObserverUpdater::isBinocularsEnabled ( ) const
virtual

Checks if binoculars functionality is enabled.

Returns
True if binoculars are enabled, false otherwise

◆ isNVGEnabled()

virtual bool makVre::DtLookAroundObserverUpdater::isNVGEnabled ( ) const
virtual

Checks if night vision goggles functionality is enabled.

Returns
True if NVG is enabled, false otherwise

◆ getInputLogic()

std::shared_ptr< DtLookAroundInputLogic > makVre::DtLookAroundObserverUpdater::getInputLogic ( )

Gets the associated input logic component.

Returns
Shared pointer to the input logic component

◆ isLookingAround()

virtual bool makVre::DtLookAroundObserverUpdater::isLookingAround ( ) const
virtual

Checks if the player is currently looking around.

Returns
True if looking around is active and enabled, false otherwise

◆ setLookingAround()

virtual void makVre::DtLookAroundObserverUpdater::setLookingAround ( bool look,
bool mouse = true )
virtual

Enables or disables active looking around.

Parameters
lookTrue to enable looking around, false to disable
mouseTrue if input is from mouse, false if from joystick

When disabling looking around, initiates a smooth transition back to the initial view orientation

◆ onCurrentViewNameChanged()

virtual void makVre::DtLookAroundObserverUpdater::onCurrentViewNameChanged ( const std::string & viewName)
protectedvirtual

Handles changes to the current view name.

Parameters
viewNameThe new view name

Called when the current view changes, refreshes observer orientation and updates range limits based on the new view

◆ handlePlayerCreated()

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

Handles player creation messages.

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

Calls setupObserver() to set up the observer attachment details

◆ setupObserver()

virtual void makVre::DtLookAroundObserverUpdater::setupObserver ( )
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

Member Data Documentation

◆ myInputLogic

std::shared_ptr<DtLookAroundInputLogic> makVre::DtLookAroundObserverUpdater::myInputLogic
protected

Shared pointer to the associated input logic component.

◆ myObserver

makVrv::DtObserver* makVre::DtLookAroundObserverUpdater::myObserver
protected

Pointer to the observer being controlled.

◆ myZoomInterpolator

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

Interpolator for smooth zoom level transitions.

◆ myAttachedLocationOffset

DtVector makVre::DtLookAroundObserverUpdater::myAttachedLocationOffset
protected

Position offset from the attachment point.

◆ myAttachedOrientationOffset

DtQuaternion makVre::DtLookAroundObserverUpdater::myAttachedOrientationOffset
protected

Orientation offset from the attachment point.

◆ myEnableBinoculars

bool makVre::DtLookAroundObserverUpdater::myEnableBinoculars
protected

Flag indicating if binoculars functionality is enabled.

◆ myEnableNVG

bool makVre::DtLookAroundObserverUpdater::myEnableNVG
protected

Flag indicating if night vision goggles functionality is enabled.

◆ myEnableLookAround

bool makVre::DtLookAroundObserverUpdater::myEnableLookAround
protected

Flag indicating if look-around functionality is enabled.

◆ myLastNVGState

bool makVre::DtLookAroundObserverUpdater::myLastNVGState
protected

Last known state of night vision goggles.

◆ myLookingAround

bool makVre::DtLookAroundObserverUpdater::myLookingAround
protected

Flag indicating if the player is currently looking around.

◆ myCurrentYawRange

ObserverRange makVre::DtLookAroundObserverUpdater::myCurrentYawRange
protected

Current yaw range limits in radians.

◆ myCurrentPitchRange

ObserverRange makVre::DtLookAroundObserverUpdater::myCurrentPitchRange
protected

Current pitch range limits in radians.

◆ myDefaultYawRange

ObserverRange makVre::DtLookAroundObserverUpdater::myDefaultYawRange
protected

Default yaw range limits in radians.

◆ myDefaultPitchRange

ObserverRange makVre::DtLookAroundObserverUpdater::myDefaultPitchRange
protected

Default pitch range limits in radians.

◆ mySnapBackTimeMouse

double makVre::DtLookAroundObserverUpdater::mySnapBackTimeMouse
protected

Time in seconds to transition back to initial view when using mouse.

◆ mySnapBackTimeJoystick

double makVre::DtLookAroundObserverUpdater::mySnapBackTimeJoystick
protected

Time in seconds to transition back to initial view when using joystick.

◆ myUseSavedViews

bool makVre::DtLookAroundObserverUpdater::myUseSavedViews
protected

Flag indicating if saved views system is in use.

◆ myLastSensorViewMode

SensorViews makVre::DtLookAroundObserverUpdater::myLastSensorViewMode
protected

Last active sensor view mode.

◆ mySupplementalSavedViewData

std::vector<SavedViewData> makVre::DtLookAroundObserverUpdater::mySupplementalSavedViewData
protected

Collection of supplemental configuration data for saved views.

◆ myObserverInterpolator

makVre::DtBezierInterpolator<DtVector>* makVre::DtLookAroundObserverUpdater::myObserverInterpolator
protected

Interpolator for smooth transitions between observer orientations.

◆ myVrEnabled

bool makVre::DtLookAroundObserverUpdater::myVrEnabled
protected

Flag indicating if VR mode is enabled.

◆ myVrDriver

makVrv::DtVirtualRealityDriver* makVre::DtLookAroundObserverUpdater::myVrDriver
protected

Pointer to the VR driver if VR is enabled.


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