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

Detailed Description

DtBinocularsOverlay provides a specialized overlay for binoculars view, displaying reticle markings and managing post-processing effects. It handles display visibility based on player state, equipment, and view mode. The component supports both standard and VR viewing modes, automatically adjusting reticle dimensions based on viewport and zoom settings.

#include <vreBinocularsOverlay.h>

Inheritance diagram for makVre::DtBinocularsOverlay:
[legend]

Public Member Functions

 DtBinocularsOverlay (const std::string &className="DtBinocularsOverlay")
 
virtual ~DtBinocularsOverlay () 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 bool isOverlayVisible ()
 
void setReticleHeight (float height)
 
void setVisible (bool visible)
 
- Public Member Functions inherited from makVre::DtQtQuickOverlay
 DtQtQuickOverlay ()
 
virtual ~DtQtQuickOverlay () override
 
virtual void setRoot (QQuickItem *root)
 
virtual void initdoc (QQuickItem *root)
 
virtual DtVreMessageResult handleEnterPlayerState (DtVreMessage *msg)
 
virtual DtVreMessageResult handleExitPlayerState (DtVreMessage *msg)
 
virtual void setVisibility (bool visible)
 
virtual bool isVisible ()
 
virtual void setMenuState (bool on)
 
- 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 computeReticleDimensions ()
 
virtual void slot_channelConfigurationModified (const std::string &deName, const std::string &winName, const std::string &oldChannelName, const makVrv::DtChannelConfiguration &config)
 
virtual void slot_channelDestroyed (makVrv::DtChannelManager *channelManager, makVrv::DtChannel *channel)
 
- Protected Member Functions inherited from makVre::DtQtQuickOverlay
virtual void updateVals (double dt)
 
virtual void disconnect ()
 
virtual bool buildConnections (DtInitTable &connections)
 
virtual void onVisibilityAttributeChanged (bool on)
 
virtual void removeModelSetAndSkyFromChannel ()
 
virtual void restoreModelSetAndSkyToChannel ()
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

float myReticleTotalMils
 
bool myUsePostEffect
 
makVrv::DtOsgChannel * myChannel
 
makVre::DtInitTable myConfig
 
- Protected Attributes inherited from makVre::DtQtQuickOverlay
DtInitTable myBindQmlPropertyToAttribute
 
QQuickItem * myRoot
 
std::string myTargetWindow
 
std::vector< ConnectionmyConnections
 
std::string myQmlFile
 
std::string myQmlDataItemName
 
bool myIsInMenuState
 
bool myCachedVisibility
 
DtAttributeHandleType< bool > myVisibilityAttribute
 
bool myRenderOverlayOnly
 
bool myWantSceneHidden
 
makVrv::DtOsgChannel * myChannel
 
makVrv::DtObserverObject * myObserver
 
QObject myQObject
 
bool myHasTickFunction
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Constructor & Destructor Documentation

◆ DtBinocularsOverlay()

makVre::DtBinocularsOverlay::DtBinocularsOverlay ( const std::string & className = "DtBinocularsOverlay")

Constructor for DtBinocularsOverlay.

Parameters
classNameClass name for identification, defaults to "DtBinocularsOverlay"

Initializes the component with default reticle settings

◆ ~DtBinocularsOverlay()

virtual makVre::DtBinocularsOverlay::~DtBinocularsOverlay ( )
overridevirtual

Virtual destructor for DtBinocularsOverlay.

Member Function Documentation

◆ initialize()

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

Initializes the binoculars overlay component.

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

Reads configuration values for reticle dimensions and sets up channel configuration change signals

Reimplemented from makVre::DtQtQuickOverlay.

Reimplemented in makVre::DtBinocularsLasingOverlay, and makVre::DtBinocularsZoomOverlay.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

virtual bool makVre::DtBinocularsOverlay::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 and initializes post-processing effect settings

Reimplemented from makVre::DtQtQuickOverlay.

Reimplemented in makVre::DtBinocularsLasingOverlay, and makVre::DtBinocularsZoomOverlay.

◆ tick()

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

Called every frame to update the overlay state.

Parameters
dtDelta time since the last frame in seconds

Updates visibility and manages post-processing effects based on current overlay visibility state

Reimplemented from makVre::DtQtQuickOverlay.

Reimplemented in makVre::DtBinocularsLasingOverlay, and makVre::DtBinocularsZoomOverlay.

◆ shutdown()

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

Shuts down the binoculars overlay component.

Disconnects signals and removes any post-processing effects

Reimplemented from makVre::DtQtQuickOverlay.

Reimplemented in makVre::DtBinocularsLasingOverlay.

◆ type()

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

Returns the type identifier for this component.

Returns
The type string for DtBinocularsOverlay

Reimplemented from makVre::DtQtQuickOverlay.

Reimplemented in makVre::DtBinocularsLasingOverlay, and makVre::DtBinocularsZoomOverlay.

◆ isOverlayVisible()

virtual bool makVre::DtBinocularsOverlay::isOverlayVisible ( )
virtual

Determines if the overlay should be visible.

Returns
True if the overlay should be visible, false otherwise

Checks player status, health, posture, and equipment to decide if the binoculars overlay should be shown

Reimplemented in makVre::DtBinocularsLasingOverlay, and makVre::DtBinocularsZoomOverlay.

◆ setReticleHeight()

void makVre::DtBinocularsOverlay::setReticleHeight ( float height)

Sets the height of the binoculars reticle.

Parameters
heightHeight value for the reticle in screen units

Updates the reticle height property in the QML overlay

◆ setVisible()

void makVre::DtBinocularsOverlay::setVisible ( bool visible)

Sets the visibility state of the overlay.

Parameters
visibleTrue to show the overlay, false to hide it

Updates the visible property in the QML overlay

◆ computeReticleDimensions()

virtual void makVre::DtBinocularsOverlay::computeReticleDimensions ( )
protectedvirtual

Calculates the dimensions of the reticle based on current view settings.

Computes reticle size based on channel projection, viewport dimensions, and zoom settings, with special handling for VR mode

◆ slot_channelConfigurationModified()

virtual void makVre::DtBinocularsOverlay::slot_channelConfigurationModified ( const std::string & deName,
const std::string & winName,
const std::string & oldChannelName,
const makVrv::DtChannelConfiguration & config )
protectedvirtual

Slot called when a channel configuration is modified.

Parameters
deNameName of the display engine
winNameName of the window containing the channel
oldChannelNamePrevious name of the channel
configNew channel configuration

Recalculates reticle dimensions when channel configuration changes

◆ slot_channelDestroyed()

virtual void makVre::DtBinocularsOverlay::slot_channelDestroyed ( makVrv::DtChannelManager * channelManager,
makVrv::DtChannel * channel )
protectedvirtual

Slot called when a channel is about to be destroyed.

Parameters
channelManagerPointer to the channel manager
channelPointer to the channel being destroyed

Clears the channel reference if our tracked channel is being destroyed

Member Data Documentation

◆ myReticleTotalMils

float makVre::DtBinocularsOverlay::myReticleTotalMils
protected

Total size of the reticle in mils.

◆ myUsePostEffect

bool makVre::DtBinocularsOverlay::myUsePostEffect
protected

Flag indicating whether post-processing effects should be used.

◆ myChannel

makVrv::DtOsgChannel* makVre::DtBinocularsOverlay::myChannel
protected

Pointer to the channel used for rendering.

◆ myConfig

makVre::DtInitTable makVre::DtBinocularsOverlay::myConfig
protected

Cached configuration table for accessing settings during runtime.


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