VR-Engage  2.2
Loading...
Searching...
No Matches
humanVrHudUpdater.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file humanVrHudUpdater.h
7//! \brief Defines DtHumanVrHudUpdater for managing human-specific HUD elements in VR mode
8//! \ingroup vreHumanFrontend
9
10#pragma once
11
13
16
17
18namespace makVre
19{
20//! \brief Type identifier for DtHumanVrHudUpdater component
21constexpr const char* DtHumanVrHudUpdaterType = "DtHumanVrHudUpdater";
22
23//! \brief HUD updater component for the human role in VR mode
24//!
25//! DtHumanVrHudUpdater extends the standard human HUD updater with VR-specific
26//! functionality, managing specialized rendering of HUD elements for VR displays.
27//! It handles positioning, visibility, and updates of HUD elements based on
28//! the player state in VR mode, including weapon indicators and reticles.
30{
31public:
32 //! \brief Default constructor
34
35 //! \brief Virtual destructor
36 virtual ~DtHumanVrHudUpdater() override;
37
38 //! \brief Initializes the VR HUD updater component
39 //! \param player Pointer to the player station
40 //! \param config Configuration settings for initialization
41 //! \return True if initialization was successful, false otherwise
43
44 //! \brief Performs post-initialization setup
45 //! \return True if post-initialization was successful, false otherwise
46 virtual bool postInitialize() override;
47
48 //! \brief Updates the VR HUD elements for the current frame
49 //! \param dt Delta time since the last frame in seconds
50 virtual void tick(double dt) override;
51
52 //! \brief Cleans up resources when the component is being shut down
53 virtual void shutdown() override;
54
55 //! \brief Returns the component type identifier
56 //! \return The component type string
57 virtual const char* type() const override;
58
59protected:
60 //! \brief Finds an OSG channel by name
61 //! \param channelName Name of the channel to find, empty for default channel
62 //! \return Pointer to the found channel, or nullptr if not found
63 virtual makVrv::DtOsgChannel* findChannel(const std::string& channelName = "") override;
64
65 //! \brief Deletes all HUD elements
66 virtual void deleteAll() override;
67
68 //! \brief Checks if this updater provides the reticle
69 //! \return True if this updater provides the reticle, false otherwise
70 //! \note Overrides parent class method to handle VR-specific reticle behavior
71 virtual bool amReticleProvider() const override;
72
73 //! \brief Updates the gun reticle in VR mode
74 //! \param visible Flag indicating if the reticle should be visible
75 //! \param dt Delta time since the last frame in seconds
76 //!
77 //! Updates position, size, and visibility of the gun reticle for VR
78 void updateGunReticle(bool visible, double dt);
79
80 //! \brief Handles changes in VR state
81 //! \param enabled True if VR is enabled, false otherwise
82 void onVrStateChanged(bool enabled);
83
84 //! \brief Handles changes in the current weapon index
85 //! \param index New weapon index
86 //! \note Overrides parent class method to handle VR-specific behavior
87 virtual void onWeaponIndexChanged(int index) override;
88
89 //! \brief Handles changes in weapon state
90 //! \param state New weapon state
91 //! \note Overrides parent class method to handle VR-specific behavior
92 virtual void onWeaponStateChanged(int state) override;
93
94 //! \brief Handles changes in the launcher entity ID
95 //! \param id New launcher entity identifier
96 //! \note Overrides parent class method to handle VR-specific behavior
97 virtual void onLauncherIdChanged(DtEntityIdentifier id) override;
98
99 //! \brief Handles changes in the weapon list
100 //! \param weapons New list of weapon names
101 //! \note Overrides parent class method to handle VR-specific behavior
102 virtual void onWeaponListChanged(const DtAttributeHandle&) override;
103
104 //! \brief Handles changes in player posture
105 //! \param posture New player posture
106 //! \note Overrides parent class method to handle VR-specific behavior
107 virtual void onPostureChanged(HumanPosture posture);
108
109 //! \brief Applies a delayed fade effect to a fader value
110 //! \param fader Pointer to the fader value to update
111 //! \param val Target fade value
112 virtual void delayFade(float* fader, float val);
113
114 //! \brief Applies a fade effect to a quad proxy
115 //! \param quad Pointer to the quad proxy to fade
116 //! \param val Fade value to apply
117 virtual void applyFade(makVrv::DtQuadProxy* quad, float val);
118
119 //! \brief Applies a fade effect to a text proxy
120 //! \param text Pointer to the text proxy to fade
121 //! \param val Fade value to apply
122 virtual void applyFade(makVrv::DtTextProxy* text, float val);
123
124protected:
125 //! \brief Current fade value for weapon indicators
127
128 //! \brief Current fade value for posture indicators
130
131 //! \brief VR-specific aim point cursor
133};
134} // namespace makVre
Handle class for safe access to attributes.
Definition attributeHandle.h:30
DtHumanHudUpdater()
Default constructor.
virtual void onWeaponStateChanged(int state) override
Handles changes in weapon state.
virtual void onWeaponIndexChanged(int index) override
Handles changes in the current weapon index.
virtual bool postInitialize() override
Performs post-initialization setup.
virtual void onPostureChanged(HumanPosture posture)
Handles changes in player posture.
virtual ~DtHumanVrHudUpdater() override
Virtual destructor.
virtual void onWeaponListChanged(const DtAttributeHandle &) override
Handles changes in the weapon list.
virtual const char * type() const override
Returns the component type identifier.
virtual void tick(double dt) override
Updates the VR HUD elements for the current frame.
virtual void applyFade(makVrv::DtQuadProxy *quad, float val)
Applies a fade effect to a quad proxy.
void updateGunReticle(bool visible, double dt)
Updates the gun reticle in VR mode.
DtHumanVrHudUpdater()
Default constructor.
virtual void applyFade(makVrv::DtTextProxy *text, float val)
Applies a fade effect to a text proxy.
virtual bool amReticleProvider() const override
Checks if this updater provides the reticle.
float myPostureFadeValue
Current fade value for posture indicators.
Definition humanVrHudUpdater.h:129
void onVrStateChanged(bool enabled)
Handles changes in VR state.
virtual void delayFade(float *fader, float val)
Applies a delayed fade effect to a fader value.
makVre::DtMenuCursor * myVrAimPoint
VR-specific aim point cursor.
Definition humanVrHudUpdater.h:132
virtual void shutdown() override
Cleans up resources when the component is being shut down.
float myWeaponFadeValue
Current fade value for weapon indicators.
Definition humanVrHudUpdater.h:126
virtual void onLauncherIdChanged(DtEntityIdentifier id) override
Handles changes in the launcher entity ID.
virtual void deleteAll() override
Deletes all HUD elements.
virtual makVrv::DtOsgChannel * findChannel(const std::string &channelName="") override
Finds an OSG channel by name.
virtual bool initialize(makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
Initializes the VR HUD updater component.
Table-based access to Lua state for configuration data.
Definition initializer.h:38
Class for managing menu cursor visualization.
Definition actionMenuManager.h:60
virtual DtPlayerStation & player()
Gets the player station.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
Defines DtHumanHudUpdater for managing human-specific HUD elements.
Defines export macros for the Human Frontend library.
#define HUMAN_DLL
Definition export.h:19
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
constexpr const char * DtHumanVrHudUpdaterType
Type identifier for DtHumanVrHudUpdater component.
Definition humanVrHudUpdater.h:21
HumanPosture
Enumeration of human posture states.
Definition stateDefines.h:30
Common enumeration definitions used throughout the VREngage system.