VR-Engage  2.3
Loading...
Searching...
No Matches
humanHudUpdater.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file humanHudUpdater.h
7//! \brief Defines DtHumanHudUpdater for managing human-specific HUD elements
8//! \ingroup vreHumanFrontend
9
10#pragma once
11
13
15#include "vreUtil/vector2DD.h"
16
18#include <vrvCore/DtBoundingBox.h>
19
20namespace makVre
21{
22
24{
25//! \ingroup RoleConfigParams
26//! \defgroup HumanHudUpdaterRoleParams Human HUD Updater Role Parameters
27//! \roleInherits{PlayerComponentRoleParams}
28//! Configuration Options for human HUD updater component.
29//! @{
30
31//! \vreRoleParam{centerOfGuiLocation,DtVector2DD,"DtVector2DD(0.48333, 0.471296)",humanHudUpdater,Center location for GUI elements in normalized coordinates.}
32constexpr const char* centerOfGuiLocation = "centerOfGuiLocation";
33
34//! \vreRoleParam{fatigueBarColor,table,{},humanHudUpdater,Configuration table for fatigue bar color settings.}
35constexpr const char* fatigueBarColor = "fatigueBarColor";
36
37//! \vreRoleParam{hud,table,{},humanHudUpdater,Configuration table for HUD element definitions and layouts.}
38constexpr const char* hud = "hud";
39
40//! \vreRoleParam{maxAimingErrorCircleRadius,double,50.0,humanHudUpdater,Maximum radius for aiming error circle indicator.}
41constexpr const char* maxAimingErrorCircleRadius = "maxAimingErrorCircleRadius";
42
43//! \vreRoleParam{nvg,table,{},humanHudUpdater,Configuration table for night vision goggle overlay settings.}
44constexpr const char* nvg = "nvg";
45
46//! \vreRoleParam{parachute,table,{},humanHudUpdater,Configuration table for parachute-related HUD elements.}
47constexpr const char* parachute = "parachute";
48
49//! \vreRoleParam{reticleDirectionRandomTimerDuration,double,2.0,humanHudUpdater,Duration in seconds for reticle direction randomization timer.}
50constexpr const char* reticleDirectionRandomTimerDuration = "reticleDirectionRandomTimerDuration";
51
52//! \vreRoleParam{reticleSpeed,double,0.175,humanHudUpdater,Speed of reticle movement animations.}
53constexpr const char* reticleSpeed = "reticleSpeed";
54
55//! \vreRoleParam{showAmmoCounts,bool,true,humanHudUpdater,Whether to display ammunition count information on the HUD.}
56constexpr const char* showAmmoCounts = "showAmmoCounts";
57
58//! \vreRoleParam{showHUD,bool,true,humanHudUpdater,Whether to display the HUD elements.}
59constexpr const char* showHUD = "showHUD";
60
61//! \vreRoleParam{weaponAimingOverlay,table,{},humanHudUpdater,Configuration table for weapon aiming overlay elements.}
62constexpr const char* weaponAimingOverlay = "weaponAimingOverlay";
63
64//! @}
65} // namespace HumanHudUpdaterConfig
66
67} // namespace makVre
68
69namespace makVrv
70{
71//! \brief Forward declaration of the OSG channel class
72class DtOsgChannel;
73
74//! \brief Forward declaration of the channel configuration class
75class DtChannelConfiguration;
76
77//! \brief Forward declaration of the quad proxy class
78class DtQuadProxy;
79
80//! \brief Forward declaration of the overlay renderer class
81class DtOverlayRenderer;
82} // namespace makVrv
83
84namespace makVre
85{
86//! \brief Forward declaration of the weapon resource logic class
88
89//! \brief Type identifier for DtHumanHudUpdater component
90constexpr const char* DtHumanHudUpdaterType = "DtHumanHudUpdater";
91
92//! \brief HUD updater component for human-specific display elements
93//!
94//! DtHumanHudUpdater manages the HUD elements specific to the human role,
95//! including weapon indicators, ammo counters, health and fatigue bars,
96//! crosshairs, and posture indicators. It handles positioning, visibility,
97//! and updates of these elements based on the player state.
99{
100public:
101 //! \brief Default constructor
103
104 //! \brief Virtual destructor
105 virtual ~DtHumanHudUpdater() override;
106
107 //! \brief Initializes the human HUD updater
108 //! \param player Pointer to the player station
109 //! \param config Configuration settings for initialization
110 //! \return True if initialization was successful, false otherwise
112
113 //! \brief Performs post-initialization setup
114 //! \return True if post-initialization was successful, false otherwise
115 virtual bool postInitialize() override;
116
117 //! \brief Updates the HUD elements for the current frame
118 //! \param dt Delta time since the last frame in seconds
119 virtual void tick(double dt) override;
120
121 //! \brief Returns the component type identifier
122 //! \return The component type string
123 virtual const char* type() const override;
124
125protected:
126 //! \brief Called when this HUD updater is started
127 //!
128 //! Initializes and shows HUD elements
129 virtual void onStart() override;
130
131 //! \brief Called when this HUD updater is stopped
132 //!
133 //! Hides and cleans up HUD elements
134 virtual void onStop() override;
135
136 //! \brief Loads weapon icon extent configuration
137 //! \param initTable Initialization table containing configurations
138 //! \param tableName Name of the table containing extent configuration
139 //! \return True if loading was successful, false otherwise
140 //!
141 //! Weapon icons extent in range of 0-1 (for use with normalized screen coordinates).
142 //! All weapon icons should have the same extent.
143 virtual bool loadWeaponIconExtentConfig(makVre::DtInitTable& initTable, std::string tableName);
144
145 //! \brief Loads weapon icon position configuration
146 //! \param initTable Initialization table containing configurations
147 //! \param tableName Name of the table containing position configuration
148 //! \return True if loading was successful, false otherwise
149 //!
150 //! Placeholder positions for weapon icons, in normalized screen coordinates.
151 virtual bool loadWeaponIconPositionsConfig(makVre::DtInitTable& initTable, std::string tableName);
152
153 //! \brief Calculates position for a weapon icon
154 //! \param i Index of the weapon
155 //! \param total Total number of weapons
156 //! \param x [out] Calculated x-coordinate
157 //! \param y [out] Calculated y-coordinate
158 virtual void weaponIconPosition(unsigned i, unsigned total, float& x, float& y) const;
159
160 //! \brief Calculates position for an ammo text display
161 //! \param i Index of the weapon
162 //! \param total Total number of weapons
163 //! \param x [out] Calculated x-coordinate
164 //! \param y [out] Calculated y-coordinate
165 virtual void ammoTextPosition(unsigned i, unsigned total, float& x, float& y) const;
166
167 //! \brief Calculates position for a clip text display
168 //! \param i Index of the weapon
169 //! \param total Total number of weapons
170 //! \param x [out] Calculated x-coordinate
171 //! \param y [out] Calculated y-coordinate
172 virtual void clipTextPosition(unsigned i, unsigned total, float& x, float& y) const;
173
174 //! \brief Initializes parachute-related text elements
175 virtual void initParachuteText();
176
177 //! \brief Positions parachute-related text elements on the HUD
178 virtual void positionParachuteText();
179
180 //! \brief Handles changes in the current weapon index
181 //! \param index New weapon index
182 virtual void onWeaponIndexChanged(int index);
183
184 //! \brief Handles changes in weapon state
185 //! \param state New weapon state
186 virtual void onWeaponStateChanged(int state);
187
188 //! \brief Handles changes in the launcher entity ID
189 //! \param id New launcher entity identifier
190 virtual void onLauncherIdChanged(DtEntityIdentifier id);
191
192 //! \brief Handles changes in the weapon list
193 //! \param weapons New list of weapon names
195
196 //! \brief Handles changes in weapon availability
197 //! \param hasWeapons True if weapons are available, false otherwise
198 virtual void onHasWeaponsChanged(bool hasWeapons);
199
200 //! \brief Called when all HUD elements are being deleted
201 virtual void onDeleteAll() override;
202
203 //! \brief Handles changes in reload timer
204 //! \param time Current reload timer value in seconds
205 virtual void onReloadTimerChanged(double time);
206
207 //! \brief Updates all HUD elements
208 //!
209 //! Refreshes the state and visibility of all HUD elements
210 //! based on current player state
211 virtual void updateAll() override;
212
213 //! \brief Sets up health bar and related HUD elements
214 //!
215 //! Initializes health indicators and their positions
216 virtual void setupHealthElements();
217
218 //! \brief Updates health-related HUD elements
219 //! \param visible Flag indicating if the elements should be visible
220 virtual void updateHealthElements(bool visible);
221
222 //! \brief Sets up fatigue bar and related HUD elements
223 //!
224 //! Initializes fatigue indicators and their positions
225 virtual void setupFatigueElements();
226
227 //! \brief Updates fatigue-related HUD elements
228 //! \param visible Flag indicating if the elements should be visible
229 virtual void updateFatigueElements(bool visible);
230
231 //! \brief Updates all HUD elements based on visibility
232 //! \param visible Flag indicating if the reticle is visible
233 //!
234 //! Overrides base class method to update human-specific HUD elements
235 virtual void updateHudElements(bool visible) override;
236
237 //! \brief Updates vision enhancement overlays like NVG
238 //! \param visible Flag indicating if the overlays should be visible
239 virtual void updateVisionOverlays(bool visible);
240
241 //! \brief Updates the weapon reticle display
242 //! \param visible Flag indicating if the reticle should be visible
243 //!
244 //! Updates position, size, and visibility of the reticle based on current weapon and state
245 virtual void updateReticle(bool visible);
246
247 //! \brief Computes a new random direction for reticle movement
248 //! \param deltaTime Delta time since the last frame in seconds
249 //!
250 //! Computes a new reticle direction if the random timer expires
251 virtual void computeReticleRandomDirection(double deltaTime);
252
253 //! \brief Repositions reticle to keep it within the aiming error circle
254 //! \param newReticlePosition Reference to the reticle position vector to update
255 //! \param aimingErrorCircleRadius Radius of the aiming error circle
256 //!
257 //! If the reticle's position goes outside the aiming error circle, this function
258 //! moves the reticle's position back inside the aiming error circle.
260 makVre::DtVector2DD& newReticlePosition, double aimingErrorCircleRadius);
261
262 //! \brief Checks if the reticle is inside the aiming error circle
263 //! \param aimingErrorCircleRadius Radius of the aiming error circle
264 //! \param reticleTestPosition Position to test
265 //! \return True if the position is inside the circle, false otherwise
267 double aimingErrorCircleRadius, makVre::DtVector2DD& reticleTestPosition);
268
269 //! \brief Computes a new direction for the reticle when it reaches the edge
270 //!
271 //! When the reticle reaches the edge of the aiming error circle, this function
272 //! computes a new direction for the reticle to travel
274
275 //! \brief Updates the position of the gun reticle
276 //! \param newReticlePosition [in,out] The reticle position vector to update
277 //! \param myCrosshairQuad Pointer to the crosshair quad
278 //! \param dt Delta time since the last frame in seconds
279 //!
280 //! Updates the position of the gun reticle based on current aiming factors
282 makVre::DtVector2DD& newReticlePosition, makVrv::DtQuadProxy* myCrosshairQuad, double dt);
283
284 //! \brief Computes the aiming error based on current factors
285 //! \param newReticlePosition Current position of the reticle
286 virtual void computeAimingError(const makVre::DtVector2DD& newReticlePosition);
287
288 //! \brief Updates gun crosshair display
289 //! \param visible Flag indicating if the crosshair should be visible
290 virtual void updateGunReticles(bool visible);
291
292 //! \brief Updates grenade reticle display
293 //! \param visible Flag indicating if the reticle should be visible
294 virtual void updateGrenadeReticle(bool visible);
295
296 //! \brief Updates missile launcher display elements
297 //! \param visible Flag indicating if the elements should be visible
298 //! \param reset Flag indicating if the elements should be reset to default state
299 virtual void updateMissileLauncher(bool visible = true, bool reset = false);
300
301 //! \brief Updates ammunition count displays for all weapons
303
304 //! \brief Updates missile launcher ammunition count display
305 //! \param count Current ammunition count
306 virtual void updateMissileLauncherAmmoCount(float count);
307
308 //! \brief Sets up the current weapon indicator quad
309 //! \param pos Position index of the current weapon, -1 for default
310 //! \param total Total number of weapons, -1 for default
311 //! \param state Current weapon state, -1 for default
312 virtual void setupCurrentWeaponQuad(int pos = -1, int total = -1, int state = -1);
313
314 //! \brief Updates wind indicator display
315 //!
316 //! Updates wind indicator displays with current wind direction and speed
317 virtual void updateWindOverlay();
318
319 //! \brief Handles wind update messages
320 //! \param msg Pointer to the message being processed
321 //! \return Message processing result
323
324 //! \brief Handles resource update messages
325 //! \param msg Pointer to the message being processed
326 //! \return Message processing result
328
329 //! \brief Handles viewport change events
330 //!
331 //! Called when the viewport size or properties change to update HUD element positions
332 virtual void onViewportChanged() override;
333
334 //! \brief Resets weapon indicator quads
335 //!
336 //! Resets the state of weapon indicator quads to default
337 virtual void resetWeaponQuads();
338
339 //! \brief Resets posture indicator quads
340 //! \param overlay Pointer to the overlay renderer
341 //! \param configs Vector of image configurations to create quads from
342 virtual void resetPostureQuads(makVrv::DtOverlayRenderer* overlay, const std::vector<HudImageConfig>& configs);
343
344 //! \brief Checks if this updater provides the reticle
345 //! \return True if this updater provides the reticle, false otherwise
346 virtual bool amReticleProvider() const;
347
348 //! \brief Enumeration of texture indices used in the HUD
350 {
351 NVG_OVERLAY, //!< Night vision goggles overlay texture
352 WEAPON_AIMING_OVERLAY, //!< Weapon aiming overlay texture
353 HEALTH_BAR_BACKER, //!< Background for health bar
354 FATIGUE_BAR_BACKER, //!< Background for fatigue bar
355 STANDING_TEX, //!< Standing posture indicator texture
356 CROUCHING_TEX, //!< Crouching posture indicator texture
357 PRONE_TEX, //!< Prone posture indicator texture
358 KNEELING_TEX, //!< Kneeling posture indicator texture
359 CIVILIAN_STANDING_TEX, //!< Civilian standing posture indicator texture
360 CIVILIAN_CROUCHING_TEX, //!< Civilian crouching posture indicator texture
361 CIVILIAN_PRONE_TEX, //!< Civilian prone posture indicator texture
362 CIVILIAN_KNEELING_TEX, //!< Civilian kneeling posture indicator texture
363 CROSSHAIR, //!< Standard crosshair texture
364 NVG_CROSSHAIR, //!< Night vision crosshair texture
365 CURRENT_WEAPON, //!< Current weapon indicator texture
366 CURRENT_WEAPON_STOWED, //!< Current weapon stowed indicator texture
367 CURRENT_WEAPON_DOWN, //!< Current weapon down indicator texture
368 WEAPON_PROTOTYPE, //!< Generic weapon prototype texture
369 MISSILE_LAUNCHER, //!< Missile launcher texture
370 DRONE_TEX, //!< Drone indicator texture
371 DRONE_VIEW_FRAME, //!< Drone view frame texture
372 FIRST_WEAPON_TEXTURE, //!< Index of first weapon-specific texture
373 TEXTURES_CONFIG_COUNT //!< Total number of texture configurations
374 };
375
376 //! \brief Enumeration of colored quad indices used in the HUD
378 {
379 HEALTH_BAR, //!< Health bar colored quad
380 FATIGUE_BAR, //!< Fatigue bar colored quad
381 COLOR_QUADS_CONFIG_COUNT //!< Total number of colored quad configurations
382 };
383
384 //! \brief Enumeration of text element indices used in the HUD
385 enum Texts
386 {
387 PARACHUTE_WIND_SPEED, //!< Parachute wind speed text
388 PARACHUTE_WIND_DIRECTION, //!< Parachute wind direction text
389 PARACHUTE_OXYGEN_PERCENT, //!< Parachute oxygen percentage text
390 PARACHUTE_ALTITUDE, //!< Parachute altitude text
391 TEXT_HEALTH, //!< Health value text
392 TEXT_FATIGUE, //!< Fatigue value text
393 TEXT_CONFIG_COUNT //!< Total number of text configurations
394 };
395
396 //! \brief Creates quad elements for the HUD
397 //! \param overlay Pointer to the overlay renderer
398 //! \param configs Vector of image configurations to create quads from
399 //!
400 //! Implements the pure virtual method from base class to create HUD quad elements
401 virtual void createQuads(makVrv::DtOverlayRenderer* overlay, const std::vector<HudImageConfig>& configs) override;
402
403 //! \brief Creates and initializes a text proxy for a specific text element
404 //! \param index Index of the text element to create
405 //! \return Pointer to the created text proxy
406 makVrv::DtTextProxy* createAndInitTextProxy(Texts index);
407
408 //! \brief Night vision goggles overlay quad
409 makVrv::DtQuadProxy* myNVGOverlayQuad;
410
411 //! \brief Standard crosshair quad
412 makVrv::DtQuadProxy* myCrosshairQuad;
413
414 //! \brief Night vision crosshair quad
415 makVrv::DtQuadProxy* myNVGCrosshairQuad;
416
417 //! \brief Original bounding box of the standard crosshair
418 //!
419 //! Saved so that scaling can be done based on the original size
420 makVrv::DtBoundingBox myCrosshairOriginalBoundingBox;
421
422 //! \brief Original bounding box of the NVG crosshair
423 //!
424 //! Saved so that scaling can be done based on the original size
426
427 //! \brief missile launcher indicator quad
428 makVrv::DtQuadProxy* myLauncherQuad;
429
430 //! \brief launcher ammunition count text
431 makVrv::DtTextProxy* myLauncherAmmoText;
432
433 //! \brief Flag indicating if the launcher HUD is visible
435
436 //! \brief Vector of weapon icon quads
437 std::vector<makVrv::DtQuadProxy*> myWeaponIcons;
438
439 //! \brief Vector of ammunition count text proxies
440 std::vector<makVrv::DtTextProxy*> myAmmoTexts;
441
442 //! \brief Vector of clip count text proxies
443 std::vector<makVrv::DtTextProxy*> myClipTexts;
444
445 //! \brief Flag indicating if ammunition counts should be shown
447
448 //! \brief Altitude text display for parachute mode
449 makVrv::DtTextProxy* myAltText;
450
451 //! \brief Oxygen percentage text display for parachute mode
452 makVrv::DtTextProxy* myOxygenText;
453
454 //! \brief Wind speed text display
455 makVrv::DtTextProxy* myWindSpeedText;
456
457 //! \brief Wind direction text display
458 makVrv::DtTextProxy* myWindDirectionText;
459
460 //! \brief Current weapon indicator quad
461 makVrv::DtQuadProxy* myCurrentWeaponIndicator;
462
463 //! \brief Standing posture indicator quad
464 makVrv::DtQuadProxy* myStandingQuad;
465
466 //! \brief Prone posture indicator quad
467 makVrv::DtQuadProxy* myProneQuad;
468
469 //! \brief Crouching posture indicator quad
470 makVrv::DtQuadProxy* myCrouchingQuad;
471
472 //! \brief Kneeling posture indicator quad
473 makVrv::DtQuadProxy* myKneelingQuad;
474
475 //! \brief Drone indicator quad
476 makVrv::DtQuadProxy* myDrone;
477
478 //! \brief Drone view frame quad
479 makVrv::DtQuadProxy* myDroneViewFrame;
480
481 //! \brief Drone battery text display
482 makVrv::DtTextProxy* myDroneBatteryText;
483
484 //! \brief Drone distance text display
485 makVrv::DtTextProxy* myDroneDistance;
486
487 //! \brief Drone altitude text display
488 makVrv::DtTextProxy* myDroneAltitude;
489
490 //! \brief Drone bearing text display
491 makVrv::DtTextProxy* myDroneBearing;
492
493 //! \brief Current time in seconds
495
496 //! \brief Time of last wind speed request in seconds
498
499 //! \brief Drone battery amount
501
502 //! \brief Location of last wind request
504
505 //!
506 //! Health status gui related variables
507 //!
508 //! \brief Health value text display
509 makVrv::DtTextProxy* myHealthText;
510
511 //! \brief Health bar colored quad
512 makVrv::DtQuadProxy* myHealthBar;
513
514 //! \brief Health bar background quad
515 makVrv::DtQuadProxy* myHealthBarBacker;
516
517 //! \brief Original width of the health bar
518 float myOriginalHealthBarWidth; // save original width so that scaling can be done based on the original size.
519
520 //! \brief Vector of health bar value-color pairs
521 std::vector<HudValueColorPair> myHealthBarValueColorPairs; // the values in this vector must be descending
522
523 //!
524 //! Fatigue status gui related variables
525 //!
526 //! \brief Fatigue value text display
527 makVrv::DtTextProxy* myFatigueText;
528
529 //! \brief Fatigue bar colored quad
530 makVrv::DtQuadProxy* myFatigueBar;
531
532 //! \brief Fatigue bar background quad
533 makVrv::DtQuadProxy* myFatigueBarBacker;
534
535 //! \brief Original width of the fatigue bar
536 float myOriginalFatigueBarWidth; // save original width so that scaling can be done based on the original size.
537
538 //!
539 //! Reticle gui related variables
540 //!
541 //! \brief Center of the GUI in normalized screen coordinates
542 makVre::DtVector2DD myCenterOfGuiLocation; // center of gui. Specified as a percentage of the screen size.
543
544 //! \brief Maximum aiming error circle radius in pixels
545 double myMaxAimingErrorCircleRadius; // This value is in pixels.
546
547 //! \brief Reticle speed in pixels per second
548 double myReticleSpeed; // This value is set empirically.
549
550 //! \brief Maximum aiming error in radians
551 double myMaxAimingError; // 0.016632 is the radians of 1.4 degrees, the maximum aiming error at 50 meters with 96 max
552 // spread
553
554 //! \brief Timer for random reticle position updates in seconds
556
557 //! \brief Current reticle position in normalized screen coordinates
558 //!
559 //! Range is -0.5 to 0.5, where (0,0) is the center of the screen
561
563
564 //! \brief Cached launcher marking
566
567 //! \brief Pointer to the weapon resource logic
569
570 //! \brief Structure for 2D extent
571 struct Extent2D
572 {
573 double width;
574 double height;
575 };
576
577 //! \brief Extent of weapon icons in normalized screen coordinates
579
580 //! \brief Vector of weapon icon positions in normalized screen coordinates
581 std::vector<makVre::DtVector2DD> myWeaponIconPositions;
582
583 //! \vreAttrKey{weaponList}
585
586 //! \vreAttrKey{launcherEntityId}
588
589 //! \brief Handle for current equipment.
590 //! \vreAttrKey{currentEquipment}
592
593 //! \brief Handle for launcher state.
594 //! \vreAttrKey{launcherState}
596
597 //! \brief Handle for desired posture.
598 //! \vreAttrKey{desiredPosture}
600
601 //! \brief Handle for observer attach mode.
602 //! \vreAttrKey{observerAttachMode}
604
605 //! \brief Handle for aiming state.
606 //! \vreAttrKey{aiming}
608
609 //! \brief Handle for current posture.
610 //! \vreAttrKey{posture}
612
613 //! \brief Handle for night-vision state.
614 //! \vreAttrKey{NVG}
616
617 //! \brief Handle for weapon aim error percentage.
618 //! \vreAttrKey{weaponAimErrorPercentage}
620
621 //! \brief Handle for health value.
622 //! \vreAttrKey{health}
624
625 //! \brief Handle controlling drone HUD element visibility.
626 //! \vreAttrKey{showDroneHUDElements}
628
629 //! \brief Handle controlling master HUD visibility.
630 //! \vreAttrKey{showHUD}
632
633 //! \brief Handle for weapon-ready state.
634 //! \vreAttrKey{weaponReady}
636
637 //! \brief Handle indicating whether gaze yaw is active.
638 //! \vreAttrKey{useGazeYaw}
640
641 //! \brief Handle indicating whether gaze pitch is active.
642 //! \vreAttrKey{useGazePitch}
644
645 //! \brief Handle for drone-control state.
646 //! \vreAttrKey{usingDrone}
648
649 //! \brief Handle controlling drone frame visibility.
650 //! \vreAttrKey{showDroneFrame}
652
653 //! \brief Handle for forward-controls state.
654 //! \vreAttrKey{forwardControls}
656
657 //! \brief Handle controlling grenade reticle visibility.
658 //! \vreAttrKey{showGrenadeReticle}
660
661 //! \brief Handle for current view magnification.
662 //! \vreAttrKey{viewMagnification}
664
665 //! \brief Handle for maximum view magnification.
666 //! \vreAttrKey{maxViewMagnification}
668
669 //! \brief Handle controlling human overlay visibility.
670 //! \vreAttrKey{showHumanOverlay}
672
673 //! \brief Handle for drone signal lost state.
674 //! \vreAttrKey{droneSignalLost}
676};
677} // namespace makVre
Handle class for safe access to attributes.
Definition attributeHandle.h:30
Type-specific handle class for attributes.
Definition attributeHandle.h:229
DtHudUpdater()
Constructor.
virtual void updateVisionOverlays(bool visible)
Updates vision enhancement overlays like NVG.
virtual void updateReticle(bool visible)
Updates the weapon reticle display.
makVrv::DtTextProxy * myLauncherAmmoText
launcher ammunition count text
Definition humanHudUpdater.h:431
virtual void setupHealthElements()
Sets up health bar and related HUD elements.
makVrv::DtQuadProxy * myHealthBarBacker
Health bar background quad.
Definition humanHudUpdater.h:515
virtual void updateFatigueElements(bool visible)
Updates fatigue-related HUD elements.
virtual void updateGunReticles(bool visible)
Updates gun crosshair display.
makVrv::DtTextProxy * myFatigueText
Fatigue status gui related variables.
Definition humanHudUpdater.h:527
makVrv::DtQuadProxy * myCrouchingQuad
Crouching posture indicator quad.
Definition humanHudUpdater.h:470
virtual void onViewportChanged() override
Handles viewport change events.
virtual void updateGrenadeReticle(bool visible)
Updates grenade reticle display.
virtual void onDeleteAll() override
Called when all HUD elements are being deleted.
DtAttributeHandleType< ObserverAttachMode > myObserverAttachModeAttr
Handle for observer attach mode.
Definition humanHudUpdater.h:603
DtAttributeHandleType< bool > myUseGazePitchAttr
Handle indicating whether gaze pitch is active.
Definition humanHudUpdater.h:643
virtual bool postInitialize() override
Performs post-initialization setup.
virtual const char * type() const override
Returns the component type identifier.
double myMaxAimingErrorCircleRadius
Maximum aiming error circle radius in pixels.
Definition humanHudUpdater.h:545
virtual void setupFatigueElements()
Sets up fatigue bar and related HUD elements.
makVre::DtMenuCursor * myLocationCursor
Definition humanHudUpdater.h:562
DtAttributeHandleType< bool > myAimingAttr
Handle for aiming state.
Definition humanHudUpdater.h:607
DtAttributeHandleType< double > myWeaponAimErrorPercentageAttr
Handle for weapon aim error percentage.
Definition humanHudUpdater.h:619
virtual void updateMissileLauncher(bool visible=true, bool reset=false)
Updates missile launcher display elements.
std::vector< makVrv::DtTextProxy * > myClipTexts
Vector of clip count text proxies.
Definition humanHudUpdater.h:443
DtAttributeHandleType< double > myMaxViewMagnificationAttr
Handle for maximum view magnification.
Definition humanHudUpdater.h:667
std::vector< makVrv::DtTextProxy * > myAmmoTexts
Vector of ammunition count text proxies.
Definition humanHudUpdater.h:440
virtual void positionParachuteText()
Positions parachute-related text elements on the HUD.
double myMaxAimingError
Maximum aiming error in radians.
Definition humanHudUpdater.h:551
DtAttributeHandleType< std::vector< std::string > > myWeaponListAttr
Definition humanHudUpdater.h:584
virtual void onStart() override
Called when this HUD updater is started.
DtAttributeHandleType< double > myHealthAttr
Handle for health value.
Definition humanHudUpdater.h:623
DtAttributeHandleType< DtEntityIdentifier > myLauncherId
Definition humanHudUpdater.h:587
DtAttributeHandleType< Equipment > myCurrentEquipmentAttr
Handle for current equipment.
Definition humanHudUpdater.h:591
DtAttributeHandleType< HumanPosture > myPostureAttr
Handle for current posture.
Definition humanHudUpdater.h:611
makVrv::DtBoundingBox myNVGCrosshairOriginalBoundingBox
Original bounding box of the NVG crosshair.
Definition humanHudUpdater.h:425
virtual void updateHealthElements(bool visible)
Updates health-related HUD elements.
DtAttributeHandleType< bool > myShowGrenadeReticleAttr
Handle controlling grenade reticle visibility.
Definition humanHudUpdater.h:659
virtual void onWeaponIndexChanged(int index)
Handles changes in the current weapon index.
DtAttributeHandleType< bool > myShowDroneHudElementsAttr
Handle controlling drone HUD element visibility.
Definition humanHudUpdater.h:627
makVrv::DtQuadProxy * myNVGOverlayQuad
Night vision goggles overlay quad.
Definition humanHudUpdater.h:409
virtual void updateWindOverlay()
Updates wind indicator display.
makVrv::DtQuadProxy * myFatigueBarBacker
Fatigue bar background quad.
Definition humanHudUpdater.h:533
DtWeaponResourceLogic * myWeaponResourceLogic
Pointer to the weapon resource logic.
Definition humanHudUpdater.h:568
virtual void updateAll() override
Updates all HUD elements.
float myOriginalHealthBarWidth
Original width of the health bar.
Definition humanHudUpdater.h:518
ColorQuads
Enumeration of colored quad indices used in the HUD.
Definition humanHudUpdater.h:378
@ FATIGUE_BAR
Fatigue bar colored quad.
Definition humanHudUpdater.h:380
@ HEALTH_BAR
Health bar colored quad.
Definition humanHudUpdater.h:379
@ COLOR_QUADS_CONFIG_COUNT
Total number of colored quad configurations.
Definition humanHudUpdater.h:381
makVrv::DtQuadProxy * myCrosshairQuad
Standard crosshair quad.
Definition humanHudUpdater.h:412
Textures
Enumeration of texture indices used in the HUD.
Definition humanHudUpdater.h:350
@ CURRENT_WEAPON_DOWN
Current weapon down indicator texture.
Definition humanHudUpdater.h:367
@ FIRST_WEAPON_TEXTURE
Index of first weapon-specific texture.
Definition humanHudUpdater.h:372
@ WEAPON_PROTOTYPE
Generic weapon prototype texture.
Definition humanHudUpdater.h:368
@ CIVILIAN_STANDING_TEX
Civilian standing posture indicator texture.
Definition humanHudUpdater.h:359
@ DRONE_VIEW_FRAME
Drone view frame texture.
Definition humanHudUpdater.h:371
@ NVG_CROSSHAIR
Night vision crosshair texture.
Definition humanHudUpdater.h:364
@ CROSSHAIR
Standard crosshair texture.
Definition humanHudUpdater.h:363
@ FATIGUE_BAR_BACKER
Background for fatigue bar.
Definition humanHudUpdater.h:354
@ CROUCHING_TEX
Crouching posture indicator texture.
Definition humanHudUpdater.h:356
@ DRONE_TEX
Drone indicator texture.
Definition humanHudUpdater.h:370
@ HEALTH_BAR_BACKER
Background for health bar.
Definition humanHudUpdater.h:353
@ STANDING_TEX
Standing posture indicator texture.
Definition humanHudUpdater.h:355
@ CURRENT_WEAPON_STOWED
Current weapon stowed indicator texture.
Definition humanHudUpdater.h:366
@ TEXTURES_CONFIG_COUNT
Total number of texture configurations.
Definition humanHudUpdater.h:373
@ PRONE_TEX
Prone posture indicator texture.
Definition humanHudUpdater.h:357
@ WEAPON_AIMING_OVERLAY
Weapon aiming overlay texture.
Definition humanHudUpdater.h:352
@ NVG_OVERLAY
Night vision goggles overlay texture.
Definition humanHudUpdater.h:351
@ CIVILIAN_PRONE_TEX
Civilian prone posture indicator texture.
Definition humanHudUpdater.h:361
@ MISSILE_LAUNCHER
Missile launcher texture.
Definition humanHudUpdater.h:369
@ CIVILIAN_CROUCHING_TEX
Civilian crouching posture indicator texture.
Definition humanHudUpdater.h:360
@ CURRENT_WEAPON
Current weapon indicator texture.
Definition humanHudUpdater.h:365
@ CIVILIAN_KNEELING_TEX
Civilian kneeling posture indicator texture.
Definition humanHudUpdater.h:362
@ KNEELING_TEX
Kneeling posture indicator texture.
Definition humanHudUpdater.h:358
double myDroneBatteryAmount
Drone battery amount.
Definition humanHudUpdater.h:500
DtAttributeHandleType< LauncherState > myLauncherStateAttr
Handle for launcher state.
Definition humanHudUpdater.h:595
makVre::DtVector2DD myReticleRandomDirection
Current reticle position in normalized screen coordinates.
Definition humanHudUpdater.h:560
DtAttributeHandleType< bool > myForwardControlsAttr
Handle for forward-controls state.
Definition humanHudUpdater.h:655
virtual void onWeaponListChanged(const DtAttributeHandle &)
Handles changes in the weapon list.
makVrv::DtTextProxy * myWindDirectionText
Wind direction text display.
Definition humanHudUpdater.h:458
makVrv::DtTextProxy * myDroneAltitude
Drone altitude text display.
Definition humanHudUpdater.h:488
makVrv::DtQuadProxy * myDroneViewFrame
Drone view frame quad.
Definition humanHudUpdater.h:479
virtual void updateHudElements(bool visible) override
Updates all HUD elements based on visibility.
DtAttributeHandleType< HumanPosture > myDesiredPostureAttr
Handle for desired posture.
Definition humanHudUpdater.h:599
DtAttributeHandleType< bool > myUseGazeYawAttr
Handle indicating whether gaze yaw is active.
Definition humanHudUpdater.h:639
virtual void onLauncherIdChanged(DtEntityIdentifier id)
Handles changes in the launcher entity ID.
virtual bool loadWeaponIconExtentConfig(makVre::DtInitTable &initTable, std::string tableName)
Loads weapon icon extent configuration.
virtual void resetPostureQuads(makVrv::DtOverlayRenderer *overlay, const std::vector< HudImageConfig > &configs)
Resets posture indicator quads.
virtual void onReloadTimerChanged(double time)
Handles changes in reload timer.
Extent2D myWeaponIconExtent
Extent of weapon icons in normalized screen coordinates.
Definition humanHudUpdater.h:578
virtual void updateWeaponAmmoCounts()
Updates ammunition count displays for all weapons.
makVrv::DtQuadProxy * myDrone
Drone indicator quad.
Definition humanHudUpdater.h:476
DtAttributeHandleType< bool > myWeaponReadyAttr
Handle for weapon-ready state.
Definition humanHudUpdater.h:635
DtAttributeHandleType< bool > myShowHumanOverlayAttr
Handle controlling human overlay visibility.
Definition humanHudUpdater.h:671
makVrv::DtTextProxy * myAltText
Altitude text display for parachute mode.
Definition humanHudUpdater.h:449
std::vector< makVre::DtVector2DD > myWeaponIconPositions
Vector of weapon icon positions in normalized screen coordinates.
Definition humanHudUpdater.h:581
makVrv::DtTextProxy * myDroneBatteryText
Drone battery text display.
Definition humanHudUpdater.h:482
virtual bool initialize(makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
Initializes the human HUD updater.
makVrv::DtQuadProxy * myFatigueBar
Fatigue bar colored quad.
Definition humanHudUpdater.h:530
virtual void repositionReticleIntoAimingErrorCircle(makVre::DtVector2DD &newReticlePosition, double aimingErrorCircleRadius)
Repositions reticle to keep it within the aiming error circle.
virtual void ammoTextPosition(unsigned i, unsigned total, float &x, float &y) const
Calculates position for an ammo text display.
std::vector< HudValueColorPair > myHealthBarValueColorPairs
Vector of health bar value-color pairs.
Definition humanHudUpdater.h:521
DtHumanHudUpdater()
Default constructor.
virtual void updateMissileLauncherAmmoCount(float count)
Updates missile launcher ammunition count display.
virtual makVre::DtVreMessageResult handleWindUpdate(makVre::DtVreMessage *msg)
Handles wind update messages.
virtual void computeAimingError(const makVre::DtVector2DD &newReticlePosition)
Computes the aiming error based on current factors.
std::vector< makVrv::DtQuadProxy * > myWeaponIcons
Vector of weapon icon quads.
Definition humanHudUpdater.h:437
makVrv::DtTextProxy * createAndInitTextProxy(Texts index)
Creates and initializes a text proxy for a specific text element.
double myReticleDirectionRandomTimerDuration
Timer for random reticle position updates in seconds.
Definition humanHudUpdater.h:555
makVrv::DtQuadProxy * myStandingQuad
Standing posture indicator quad.
Definition humanHudUpdater.h:464
bool myLauncherHudVisible
Flag indicating if the launcher HUD is visible.
Definition humanHudUpdater.h:434
virtual void clipTextPosition(unsigned i, unsigned total, float &x, float &y) const
Calculates position for a clip text display.
makVrv::DtQuadProxy * myProneQuad
Prone posture indicator quad.
Definition humanHudUpdater.h:467
Texts
Enumeration of text element indices used in the HUD.
Definition humanHudUpdater.h:386
@ TEXT_HEALTH
Health value text.
Definition humanHudUpdater.h:391
@ PARACHUTE_WIND_SPEED
Parachute wind speed text.
Definition humanHudUpdater.h:387
@ TEXT_FATIGUE
Fatigue value text.
Definition humanHudUpdater.h:392
@ PARACHUTE_ALTITUDE
Parachute altitude text.
Definition humanHudUpdater.h:390
@ PARACHUTE_OXYGEN_PERCENT
Parachute oxygen percentage text.
Definition humanHudUpdater.h:389
@ PARACHUTE_WIND_DIRECTION
Parachute wind direction text.
Definition humanHudUpdater.h:388
@ TEXT_CONFIG_COUNT
Total number of text configurations.
Definition humanHudUpdater.h:393
float myOriginalFatigueBarWidth
Original width of the fatigue bar.
Definition humanHudUpdater.h:536
virtual makVre::DtVreMessageResult handleResourceUpdate(makVre::DtVreMessage *msg)
Handles resource update messages.
makVrv::DtQuadProxy * myLauncherQuad
missile launcher indicator quad
Definition humanHudUpdater.h:428
virtual void onWeaponStateChanged(int state)
Handles changes in weapon state.
makVrv::DtTextProxy * myOxygenText
Oxygen percentage text display for parachute mode.
Definition humanHudUpdater.h:452
makVre::DtVector2DD myCenterOfGuiLocation
Reticle gui related variables.
Definition humanHudUpdater.h:542
DtAttributeHandleType< bool > myNvgAttr
Handle for night-vision state.
Definition humanHudUpdater.h:615
makVrv::DtTextProxy * myDroneBearing
Drone bearing text display.
Definition humanHudUpdater.h:491
DtAttributeHandleType< bool > myShowDroneFrameAttr
Handle controlling drone frame visibility.
Definition humanHudUpdater.h:651
virtual void redirectReticleIntoAimingErrorCircle()
Computes a new direction for the reticle when it reaches the edge.
makVrv::DtTextProxy * myDroneDistance
Drone distance text display.
Definition humanHudUpdater.h:485
makVrv::DtQuadProxy * myHealthBar
Health bar colored quad.
Definition humanHudUpdater.h:512
DtAttributeHandleType< bool > myDroneSignalLostAttr
Handle for drone signal lost state.
Definition humanHudUpdater.h:675
virtual void tick(double dt) override
Updates the HUD elements for the current frame.
makVrv::DtQuadProxy * myCurrentWeaponIndicator
Current weapon indicator quad.
Definition humanHudUpdater.h:461
double myCurrentTime
Current time in seconds.
Definition humanHudUpdater.h:494
virtual void weaponIconPosition(unsigned i, unsigned total, float &x, float &y) const
Calculates position for a weapon icon.
bool myShowAmmoCounts
Flag indicating if ammunition counts should be shown.
Definition humanHudUpdater.h:446
DtVector myWindRequestLocation
Location of last wind request.
Definition humanHudUpdater.h:503
DtAttributeHandleType< bool > myShowHudAttr
Handle controlling master HUD visibility.
Definition humanHudUpdater.h:631
makVrv::DtBoundingBox myCrosshairOriginalBoundingBox
Original bounding box of the standard crosshair.
Definition humanHudUpdater.h:420
DtAttributeHandleType< double > myViewMagnificationAttr
Handle for current view magnification.
Definition humanHudUpdater.h:663
virtual ~DtHumanHudUpdater() override
Virtual destructor.
virtual void setupCurrentWeaponQuad(int pos=-1, int total=-1, int state=-1)
Sets up the current weapon indicator quad.
DtAttributeHandleType< bool > myUsingDroneAttr
Handle for drone-control state.
Definition humanHudUpdater.h:647
makVrv::DtQuadProxy * myNVGCrosshairQuad
Night vision crosshair quad.
Definition humanHudUpdater.h:415
virtual void onStop() override
Called when this HUD updater is stopped.
std::string myCachedLauncherMarking
Cached launcher marking.
Definition humanHudUpdater.h:565
virtual void resetWeaponQuads()
Resets weapon indicator quads.
virtual bool amReticleProvider() const
Checks if this updater provides the reticle.
virtual bool isReticleInsideAimingErrorCircle(double aimingErrorCircleRadius, makVre::DtVector2DD &reticleTestPosition)
Checks if the reticle is inside the aiming error circle.
makVrv::DtTextProxy * myWindSpeedText
Wind speed text display.
Definition humanHudUpdater.h:455
makVrv::DtTextProxy * myHealthText
Health status gui related variables.
Definition humanHudUpdater.h:509
makVrv::DtQuadProxy * myKneelingQuad
Kneeling posture indicator quad.
Definition humanHudUpdater.h:473
double myReticleSpeed
Reticle speed in pixels per second.
Definition humanHudUpdater.h:548
virtual void initParachuteText()
Initializes parachute-related text elements.
virtual bool loadWeaponIconPositionsConfig(makVre::DtInitTable &initTable, std::string tableName)
Loads weapon icon position configuration.
virtual void updateGunReticlePosition(makVre::DtVector2DD &newReticlePosition, makVrv::DtQuadProxy *myCrosshairQuad, double dt)
Updates the position of the gun reticle.
virtual void createQuads(makVrv::DtOverlayRenderer *overlay, const std::vector< HudImageConfig > &configs) override
Creates quad elements for the HUD.
virtual void computeReticleRandomDirection(double deltaTime)
Computes a new random direction for reticle movement.
virtual void onHasWeaponsChanged(bool hasWeapons)
Handles changes in weapon availability.
double myTimeLastWindSpeedRequested
Time of last wind speed request in seconds.
Definition humanHudUpdater.h:497
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
Class representing a 2D vector with double precision.
Definition vector2DD.h:20
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Component for managing weapon resources, equipment, and related state attributes.
Definition weaponResourceLogic.h:45
constexpr const char * hud
Definition humanHudUpdater.h:38
constexpr const char * fatigueBarColor
Definition humanHudUpdater.h:35
constexpr const char * centerOfGuiLocation
\vreRoleParam{centerOfGuiLocation,DtVector2DD,"DtVector2DD(0.48333, 0.471296)",humanHudUpdater,...
Definition humanHudUpdater.h:32
constexpr const char * showHUD
Definition humanHudUpdater.h:59
constexpr const char * showAmmoCounts
Definition humanHudUpdater.h:56
constexpr const char * nvg
Definition humanHudUpdater.h:44
constexpr const char * weaponAimingOverlay
Definition humanHudUpdater.h:62
constexpr const char * maxAimingErrorCircleRadius
Definition humanHudUpdater.h:41
constexpr const char * reticleDirectionRandomTimerDuration
Definition humanHudUpdater.h:50
constexpr const char * parachute
Definition humanHudUpdater.h:47
constexpr const char * reticleSpeed
Definition humanHudUpdater.h:53
Defines DtHudUpdater base class for managing HUD elements in the human role.
Defines export macros for the Human Frontend library.
#define HUMAN_DLL
Definition export.h:19
Definition humanHudUpdater.h:24
!
Definition glsVreMessageUtil.h:50
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
constexpr const char * DtHumanHudUpdaterType
Type identifier for DtHumanHudUpdater component.
Definition humanHudUpdater.h:90
Definition appLauncherComponent.h:28
Common enumeration definitions used throughout the VREngage system.
Structure for 2D extent.
Definition humanHudUpdater.h:572
double width
Definition humanHudUpdater.h:573
double height
Definition humanHudUpdater.h:574
Provides a class for 2D vector operations with double precision.