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

Detailed Description

DtHumanVrHudUpdater extends the standard human HUD updater with VR-specific functionality, managing specialized rendering of HUD elements for VR displays. It handles positioning, visibility, and updates of HUD elements based on the player state in VR mode, including weapon indicators and reticles.

#include <humanVrHudUpdater.h>

Inheritance diagram for makVre::DtHumanVrHudUpdater:
[legend]

Public Member Functions

 DtHumanVrHudUpdater ()
 
virtual ~DtHumanVrHudUpdater () 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
 
- Public Member Functions inherited from makVre::DtHumanHudUpdater
 DtHumanHudUpdater ()
 
virtual ~DtHumanHudUpdater () override
 
- Public Member Functions inherited from makVre::DtHudUpdater
 DtHudUpdater ()
 
virtual ~DtHudUpdater () override
 
void addItem (makVre::HudItem *item)
 
void removeItem (makVre::HudItem *item)
 
makVrv::DtOverlayRenderer * getOverlay () const
 
float xPixel (const float norm) const
 
float yPixel (const float norm) const
 
float pixelW (const float norm) const
 
float pixelH (const float norm) const
 
- 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 makVrv::DtOsgChannel * findChannel (const std::string &channelName="") override
 
virtual void deleteAll () override
 
virtual bool amReticleProvider () const override
 
void updateGunReticle (bool visible, double dt)
 
void onVrStateChanged (bool enabled)
 
virtual void onWeaponIndexChanged (int index) override
 
virtual void onWeaponStateChanged (int state) override
 
virtual void onLauncherIdChanged (DtEntityIdentifier id) override
 
virtual void onWeaponListChanged (const DtAttributeHandle &) override
 
virtual void onPostureChanged (HumanPosture posture)
 
virtual void delayFade (float *fader, float val)
 
virtual void applyFade (makVrv::DtQuadProxy *quad, float val)
 
virtual void applyFade (makVrv::DtTextProxy *text, float val)
 
- Protected Member Functions inherited from makVre::DtHumanHudUpdater
virtual void onStart () override
 
virtual void onStop () override
 
virtual bool loadWeaponIconExtentConfig (makVre::DtInitTable &initTable, std::string tableName)
 
virtual bool loadWeaponIconPositionsConfig (makVre::DtInitTable &initTable, std::string tableName)
 
virtual void weaponIconPosition (unsigned i, unsigned total, float &x, float &y) const
 
virtual void ammoTextPosition (unsigned i, unsigned total, float &x, float &y) const
 
virtual void clipTextPosition (unsigned i, unsigned total, float &x, float &y) const
 
virtual void initParachuteText ()
 
virtual void positionParachuteText ()
 
virtual void onHasWeaponsChanged (bool hasWeapons)
 
virtual void onDeleteAll () override
 
virtual void onReloadTimerChanged (float time)
 
virtual void updateAll () override
 
virtual void setupHealthElements ()
 
virtual void updateHealthElements (bool visible)
 
virtual void setupFatigueElements ()
 
virtual void updateFatigueElements (bool visible)
 
virtual void updateHudElements (bool visible) override
 
virtual void updateVisionOverlays (bool visible)
 
virtual void updateReticle (bool visible)
 
virtual void computeReticleRandomDirection (double deltaTime)
 
virtual void repositionReticleIntoAimingErrorCircle (makVre::DtVector2DD &newReticlePosition, double aimingErrorCircleRadius)
 
virtual bool isReticleInsideAimingErrorCircle (double aimingErrorCircleRadius, makVre::DtVector2DD &reticleTestPosition)
 
virtual void redirectReticleIntoAimingErrorCircle ()
 
virtual void updateGunReticlePosition (makVre::DtVector2DD &newReticlePosition, makVrv::DtQuadProxy *myCrosshairQuad, double dt)
 
virtual void computeAimingError (const makVre::DtVector2DD &newReticlePosition)
 
virtual void updateGunReticles (bool visible)
 
virtual void updateGrenadeReticle (bool visible)
 
virtual void updateMissileLauncher (bool visible=true, bool reset=false)
 
virtual void updateWeaponAmmoCounts ()
 
virtual void updateMissileLauncherAmmoCount (float count)
 
virtual void setupCurrentWeaponQuad (int pos=-1, int total=-1, int state=-1)
 
virtual void updateWindOverlay ()
 
virtual makVre::DtVreMessageResult handleWindUpdate (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleResourceUpdate (makVre::DtVreMessage *msg)
 
virtual void onViewportChanged () override
 
virtual void resetWeaponQuads ()
 
virtual void resetPostureQuads (makVrv::DtOverlayRenderer *overlay, const std::vector< HudImageConfig > &configs)
 
virtual void createQuads (makVrv::DtOverlayRenderer *overlay, const std::vector< HudImageConfig > &configs) override
 
makVrv::DtTextProxy * createAndInitTextProxy (Texts index)
 
- Protected Member Functions inherited from makVre::DtHudUpdater
double headingAngleTo (const DtVector &geocentricObserverPosition, const DtVector &geocentricTargetPosition)
 
virtual void start ()
 
virtual void stop ()
 
virtual void setupOverlays ()
 
virtual void channelDestroyed (const std::string &displayName, const std::string &windowName, const std::string &channelName)
 
virtual makVrv::DtOverlayRenderer * createOverlay (makVrv::DtOsgChannel *channel, osg::Geode *&geodeOut)
 
virtual void setupQuads ()
 
void slot_onChannelCreated ()
 
void slot_onChannelToBeDestroyed ()
 
virtual osg::Texture * createTexture (std::string path)
 
virtual makVrv::DtQuadProxy * createQuad (makVrv::DtOverlayRenderer *overlay, const HudImageConfig &config)
 
virtual makVrv::DtQuadProxy * createQuadWithColor (makVrv::DtOverlayRenderer *overlay, const HudColorQuadConfig &element)
 
virtual bool loadImageConfig (unsigned int e, makVre::DtInitTable &imageTable, std::string imageName, bool loadDimensions=true)
 
virtual bool loadTextConfig (unsigned int t, makVre::DtInitTable &textTable, std::string textName)
 
virtual bool loadColorQuadConfig (unsigned int quadIndex, makVre::DtInitTable &colorQuadTable, std::string colorQuadName, bool loadDimensions=true)
 
virtual bool loadColorConfig (makVre::DtColor &colorInfo, makVre::DtInitTable &colorTable, std::string colorName)
 
virtual bool loadValueColorPairsConfig (std::vector< HudValueColorPair > &valueColorPairsContainer, makVre::DtInitTable &hudTable, const std::string &valueColorPairsName)
 
virtual bool loadValueColorPairConfig (HudValueColorPair &valueColorPair, makVre::DtInitTable &valueColorPairConfig)
 
makVrv::DtTextProxy * createAndInitTextProxy (double normalizedX, double normalizedY, const std::string &defaultText)
 
virtual makVre::DtVreMessageResult handleEnterPlayerState (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleExitPlayerState (makVre::DtVreMessage *msg)
 
virtual enum Layers overlayGroup ()
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

float myWeaponFadeValue
 
float myPostureFadeValue
 
makVre::DtMenuCursormyVrAimPoint
 
- Protected Attributes inherited from makVre::DtHumanHudUpdater
makVrv::DtQuadProxy * myNVGOverlayQuad
 
makVrv::DtQuadProxy * myCrosshairQuad
 
makVrv::DtQuadProxy * myNVGCrosshairQuad
 
makVrv::DtBoundingBox myCrosshairOriginalBoundingBox
 
makVrv::DtBoundingBox myNVGCrosshairOriginalBoundingBox
 
makVrv::DtQuadProxy * myLauncherQuad
 
makVrv::DtTextProxy * myLauncherAmmoText
 
bool myLauncherHudVisible
 
std::vector< makVrv::DtQuadProxy * > myWeaponIcons
 
std::vector< makVrv::DtTextProxy * > myAmmoTexts
 
std::vector< makVrv::DtTextProxy * > myClipTexts
 
bool myShowAmmoCounts
 
makVrv::DtTextProxy * myAltText
 
makVrv::DtTextProxy * myOxygenText
 
makVrv::DtTextProxy * myWindSpeedText
 
makVrv::DtTextProxy * myWindDirectionText
 
makVrv::DtQuadProxy * myCurrentWeaponIndicator
 
makVrv::DtQuadProxy * myStandingQuad
 
makVrv::DtQuadProxy * myProneQuad
 
makVrv::DtQuadProxy * myCrouchingQuad
 
makVrv::DtQuadProxy * myKneelingQuad
 
makVrv::DtQuadProxy * myDrone
 
makVrv::DtQuadProxy * myDroneViewFrame
 
makVrv::DtTextProxy * myDroneBatteryText
 
makVrv::DtTextProxy * myDroneDistance
 
makVrv::DtTextProxy * myDroneAltitude
 
makVrv::DtTextProxy * myDroneBearing
 
double myCurrentTime
 
double myTimeLastWindSpeedRequested
 
double myDroneBatteryAmount
 
DtVector myWindRequestLocation
 
makVrv::DtTextProxy * myHealthText
 
makVrv::DtQuadProxy * myHealthBar
 
makVrv::DtQuadProxy * myHealthBarBacker
 
float myOriginalHealthBarWidth
 
std::vector< HudValueColorPairmyHealthBarValueColorPairs
 
makVrv::DtTextProxy * myFatigueText
 
makVrv::DtQuadProxy * myFatigueBar
 
makVrv::DtQuadProxy * myFatigueBarBacker
 
float myOriginalFatigueBarWidth
 
makVre::DtVector2DD myCenterOfGuiLocation
 
double myMaxAimingErrorCircleRadius
 
double myReticleSpeed
 
double myMaxAimingError
 
double myReticleDirectionRandomTimerDuration
 
makVre::DtVector2DD myReticleRandomDirection
 
makVre::DtMenuCursormyLocationCursor
 
std::string myCachedLauncherMarking
 
DtWeaponResourceLogicmyWeaponResourceLogic
 
Extent2D myWeaponIconExtent
 
std::vector< makVre::DtVector2DDmyWeaponIconPositions
 
DtAttributeHandleType< std::vector< std::string > > myWeaponList
 
DtAttributeHandleType< DtEntityIdentifier > myLauncherId
 
- Protected Attributes inherited from makVre::DtHudUpdater
std::map< const makVre::HudTextItem *, std::pair< makVre::HudTextItem *, makVrv::DtTextProxy * > > myTextItemMap
 
std::map< const makVre::HudImageItem *, std::pair< makVre::HudImageItem *, makVrv::DtQuadProxy * > > myImageItemMap
 
bool myActive
 
DtAttributeHandleType< bool > myUsingVr
 
std::vector< HudImageConfigmyImages
 
std::vector< HudColorQuadConfigmyColorQuads
 
std::vector< HudTextConfigmyTexts
 
makVrv::DtOverlayRenderer * myOverlayInterface
 
makVrv::DtOsgChannel * myChannel
 
float myFontSize
 
makVrv::DtFontInterface * myFont
 
std::string myFontFilePath
 
int myLineHeight
 
osg::Geode * myGeode
 
bool myChannelsUpdated
 
bool myShowOverlays
 
- 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::DtHumanHudUpdater
enum  Textures {
  NVG_OVERLAY , WEAPON_AIMING_OVERLAY , HEALTH_BAR_BACKER , FATIGUE_BAR_BACKER ,
  STANDING_TEX , CROUCHING_TEX , PRONE_TEX , KNEELING_TEX ,
  CIVILIAN_STANDING_TEX , CIVILIAN_CROUCHING_TEX , CIVILIAN_PRONE_TEX , CIVILIAN_KNEELING_TEX ,
  CROSSHAIR , NVG_CROSSHAIR , CURRENT_WEAPON , CURRENT_WEAPON_STOWED ,
  CURRENT_WEAPON_DOWN , WEAPON_PROTOTYPE , MISSILE_LAUNCHER , DRONE_TEX ,
  DRONE_VIEW_FRAME , FIRST_WEAPON_TEXTURE , TEXTURES_CONFIG_COUNT
}
 
enum  ColorQuads { HEALTH_BAR , FATIGUE_BAR , COLOR_QUADS_CONFIG_COUNT }
 
enum  Texts {
  PARACHUTE_WIND_SPEED , PARACHUTE_WIND_DIRECTION , PARACHUTE_OXYGEN_PERCENT , PARACHUTE_ALTITUDE ,
  TEXT_HEALTH , TEXT_FATIGUE , TEXT_CONFIG_COUNT
}
 
- Protected Types inherited from makVre::DtHudUpdater
enum  Layers { HIDDEN = 0 , OVERLAY = 1 , UI = 2 }
 

Constructor & Destructor Documentation

◆ DtHumanVrHudUpdater()

makVre::DtHumanVrHudUpdater::DtHumanVrHudUpdater ( )

Default constructor.

◆ ~DtHumanVrHudUpdater()

virtual makVre::DtHumanVrHudUpdater::~DtHumanVrHudUpdater ( )
overridevirtual

Virtual destructor.

Member Function Documentation

◆ initialize()

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

Initializes the VR HUD updater component.

Parameters
playerPointer to the player station
configConfiguration settings for initialization
Returns
True if initialization was successful, false otherwise

Reimplemented from makVre::DtHumanHudUpdater.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

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

Performs post-initialization setup.

Returns
True if post-initialization was successful, false otherwise

Reimplemented from makVre::DtHumanHudUpdater.

◆ tick()

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

Updates the VR HUD elements for the current frame.

Parameters
dtDelta time since the last frame in seconds

Reimplemented from makVre::DtHumanHudUpdater.

◆ shutdown()

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

Cleans up resources when the component is being shut down.

Reimplemented from makVre::DtHudUpdater.

◆ type()

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

Returns the component type identifier.

Returns
The component type string

Reimplemented from makVre::DtHumanHudUpdater.

◆ findChannel()

virtual makVrv::DtOsgChannel * makVre::DtHumanVrHudUpdater::findChannel ( const std::string & channelName = "")
overrideprotectedvirtual

Finds an OSG channel by name.

Parameters
channelNameName of the channel to find, empty for default channel
Returns
Pointer to the found channel, or nullptr if not found

Reimplemented from makVre::DtHudUpdater.

◆ deleteAll()

virtual void makVre::DtHumanVrHudUpdater::deleteAll ( )
overrideprotectedvirtual

Deletes all HUD elements.

Reimplemented from makVre::DtHudUpdater.

◆ amReticleProvider()

virtual bool makVre::DtHumanVrHudUpdater::amReticleProvider ( ) const
overrideprotectedvirtual

Checks if this updater provides the reticle.

Returns
True if this updater provides the reticle, false otherwise
Note
Overrides parent class method to handle VR-specific reticle behavior

Reimplemented from makVre::DtHumanHudUpdater.

◆ updateGunReticle()

void makVre::DtHumanVrHudUpdater::updateGunReticle ( bool visible,
double dt )
protected

Updates the gun reticle in VR mode.

Parameters
visibleFlag indicating if the reticle should be visible
dtDelta time since the last frame in seconds

Updates position, size, and visibility of the gun reticle for VR

◆ onVrStateChanged()

void makVre::DtHumanVrHudUpdater::onVrStateChanged ( bool enabled)
protected

Handles changes in VR state.

Parameters
enabledTrue if VR is enabled, false otherwise

◆ onWeaponIndexChanged()

virtual void makVre::DtHumanVrHudUpdater::onWeaponIndexChanged ( int index)
overrideprotectedvirtual

Handles changes in the current weapon index.

Parameters
indexNew weapon index
Note
Overrides parent class method to handle VR-specific behavior

Reimplemented from makVre::DtHumanHudUpdater.

◆ onWeaponStateChanged()

virtual void makVre::DtHumanVrHudUpdater::onWeaponStateChanged ( int state)
overrideprotectedvirtual

Handles changes in weapon state.

Parameters
stateNew weapon state
Note
Overrides parent class method to handle VR-specific behavior

Reimplemented from makVre::DtHumanHudUpdater.

◆ onLauncherIdChanged()

virtual void makVre::DtHumanVrHudUpdater::onLauncherIdChanged ( DtEntityIdentifier id)
overrideprotectedvirtual

Handles changes in the launcher entity ID.

Parameters
idNew launcher entity identifier
Note
Overrides parent class method to handle VR-specific behavior

Reimplemented from makVre::DtHumanHudUpdater.

◆ onWeaponListChanged()

virtual void makVre::DtHumanVrHudUpdater::onWeaponListChanged ( const DtAttributeHandle & )
overrideprotectedvirtual

Handles changes in the weapon list.

Parameters
weaponsNew list of weapon names
Note
Overrides parent class method to handle VR-specific behavior

Reimplemented from makVre::DtHumanHudUpdater.

◆ onPostureChanged()

virtual void makVre::DtHumanVrHudUpdater::onPostureChanged ( HumanPosture posture)
protectedvirtual

Handles changes in player posture.

Parameters
postureNew player posture
Note
Overrides parent class method to handle VR-specific behavior

◆ delayFade()

virtual void makVre::DtHumanVrHudUpdater::delayFade ( float * fader,
float val )
protectedvirtual

Applies a delayed fade effect to a fader value.

Parameters
faderPointer to the fader value to update
valTarget fade value

◆ applyFade() [1/2]

virtual void makVre::DtHumanVrHudUpdater::applyFade ( makVrv::DtQuadProxy * quad,
float val )
protectedvirtual

Applies a fade effect to a quad proxy.

Parameters
quadPointer to the quad proxy to fade
valFade value to apply

◆ applyFade() [2/2]

virtual void makVre::DtHumanVrHudUpdater::applyFade ( makVrv::DtTextProxy * text,
float val )
protectedvirtual

Applies a fade effect to a text proxy.

Parameters
textPointer to the text proxy to fade
valFade value to apply

Member Data Documentation

◆ myWeaponFadeValue

float makVre::DtHumanVrHudUpdater::myWeaponFadeValue
protected

Current fade value for weapon indicators.

◆ myPostureFadeValue

float makVre::DtHumanVrHudUpdater::myPostureFadeValue
protected

Current fade value for posture indicators.

◆ myVrAimPoint

makVre::DtMenuCursor* makVre::DtHumanVrHudUpdater::myVrAimPoint
protected

VR-specific aim point cursor.


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