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