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

Detailed Description

DtBinocularsSimLogic manages binoculars zoom operations, handling zoom messages and maintaining the current view magnification state. It provides specialized functionality for VR environments, including head orientation smoothing when using binoculars. The component supports both direct zoom-to values and incremental zoom changes.

#include <vreBinocularsSimLogic.h>

Inheritance diagram for makVre::DtBinocularsSimLogic:
[legend]

Public Member Functions

 DtBinocularsSimLogic ()
 
virtual ~DtBinocularsSimLogic () override
 
virtual bool initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
 
virtual bool postInitialize () override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
virtual makVre::DtVreMessageResult handleZoomToEvent (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleZoomByEvent (makVre::DtVreMessage *msg)
 
virtual void onViewMagnificationChanged (double mag)
 
- 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 Attributes

double myMaxViewMagnification
 
makVrv::DtVirtualRealityDriver * myVrDriver
 
bool myMrWasActive
 
bool myHmdSmoothingEnabled
 
double myHmdSmoothingAlpha
 
double myHmdSmoothingThreshold
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Additional Inherited Members

- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Constructor & Destructor Documentation

◆ DtBinocularsSimLogic()

makVre::DtBinocularsSimLogic::DtBinocularsSimLogic ( )

Constructor for DtBinocularsSimLogic.

Initializes the component with default zoom and smoothing settings

◆ ~DtBinocularsSimLogic()

virtual makVre::DtBinocularsSimLogic::~DtBinocularsSimLogic ( )
overridevirtual

Virtual destructor for DtBinocularsSimLogic.

Member Function Documentation

◆ initialize()

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

Initializes the binoculars simulation logic component.

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

Reads configuration values for maximum view magnification and HMD smoothing settings, registers message handlers, and sets up attribute callbacks

Reimplemented from makVre::DtPlayerComponent.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

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

Performs post-initialization after all components are initialized.

Returns
True if post-initialization succeeded, false otherwise

Sets up VR-specific configurations if applicable, including configuring the VR driver's orientation smoothing settings

Reimplemented from makVre::DtPlayerComponent.

◆ tick()

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

Called every frame to update the component state.

Parameters
dtDelta time since the last frame in seconds

Current implementation is empty as updates occur through message handlers and attribute change callbacks

Implements makVre::DtPlayerComponent.

◆ shutdown()

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

Shuts down the binoculars simulation logic component.

Removes message handlers and attribute change callbacks

Reimplemented from makVre::DtPlayerComponent.

◆ type()

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

Returns the type identifier for this component.

Returns
The type string for DtBinocularsSimLogic

Implements makVre::DtPlayerComponent.

◆ handleZoomToEvent()

virtual makVre::DtVreMessageResult makVre::DtBinocularsSimLogic::handleZoomToEvent ( makVre::DtVreMessage * msg)
virtual

Handles zoom-to messages for binoculars.

Parameters
msgZoom-to message
Returns
Message handling result indicating the message was handled

Sets the view magnification directly to the specified value, clamped between 1.0 and the maximum configured magnification

◆ handleZoomByEvent()

virtual makVre::DtVreMessageResult makVre::DtBinocularsSimLogic::handleZoomByEvent ( makVre::DtVreMessage * msg)
virtual

Handles zoom-by messages for binoculars.

Parameters
msgZoom-by message
Returns
Message handling result indicating the message was handled

Adjusts the view magnification incrementally by the specified amount, either increasing or decreasing based on the sign of the zoom value

◆ onViewMagnificationChanged()

virtual void makVre::DtBinocularsSimLogic::onViewMagnificationChanged ( double mag)
virtual

Callback for view magnification attribute changes.

Parameters
magNew magnification value

Updates the usingBinoculars attribute based on the current magnification and handles VR-specific state changes, including mixed reality mode management

Member Data Documentation

◆ myMaxViewMagnification

double makVre::DtBinocularsSimLogic::myMaxViewMagnification
protected

Maximum allowed view magnification value.

◆ myVrDriver

makVrv::DtVirtualRealityDriver* makVre::DtBinocularsSimLogic::myVrDriver
protected

Pointer to the VR driver if available.

◆ myMrWasActive

bool makVre::DtBinocularsSimLogic::myMrWasActive
protected

Flag indicating if mixed reality was active before entering binoculars mode.

◆ myHmdSmoothingEnabled

bool makVre::DtBinocularsSimLogic::myHmdSmoothingEnabled
protected

Flag indicating if HMD orientation smoothing is enabled.

◆ myHmdSmoothingAlpha

double makVre::DtBinocularsSimLogic::myHmdSmoothingAlpha
protected

Smoothing alpha parameter for HMD orientation smoothing.

Note
Higher values (closer to 1.0) produce more smoothing

◆ myHmdSmoothingThreshold

double makVre::DtBinocularsSimLogic::myHmdSmoothingThreshold
protected

Threshold parameter for HMD orientation smoothing in degrees per second.

Note
Rotation speeds below this threshold will be smoothed

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