|
VR-Engage
2.2
|
DtHumanHudUpdater manages the HUD elements specific to the human role, including weapon indicators, ammo counters, health and fatigue bars, crosshairs, and posture indicators. It handles positioning, visibility, and updates of these elements based on the player state.
#include <humanHudUpdater.h>
Classes | |
| struct | Extent2D |
Public Member Functions | |
| DtHumanHudUpdater () | |
| virtual | ~DtHumanHudUpdater () override |
| virtual bool | initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override |
| virtual bool | postInitialize () override |
| virtual void | tick (double dt) override |
| virtual const char * | type () const override |
Public Member Functions inherited from makVre::DtHudUpdater | |
| DtHudUpdater () | |
| virtual | ~DtHudUpdater () override |
| virtual void | shutdown () 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 DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () const |
Protected Types | |
| 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 } |
Protected Member Functions | |
| 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 | onWeaponIndexChanged (int index) |
| virtual void | onWeaponStateChanged (int state) |
| virtual void | onLauncherIdChanged (DtEntityIdentifier id) |
| virtual void | onWeaponListChanged (const DtAttributeHandle &) |
| 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 bool | amReticleProvider () const |
| 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 void | deleteAll () |
| virtual makVrv::DtOsgChannel * | findChannel (const std::string &channelName="Channel 1") |
| 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 |
Enumeration of texture indices used in the HUD.
|
protected |
|
protected |
Enumeration of text element indices used in the HUD.
| makVre::DtHumanHudUpdater::DtHumanHudUpdater | ( | ) |
Default constructor.
|
overridevirtual |
Virtual destructor.
|
overridevirtual |
Initializes the human HUD updater.
| player | Pointer to the player station |
| config | Configuration settings for initialization |
Reimplemented from makVre::DtHudUpdater.
Reimplemented in makVre::DtHumanVrHudUpdater.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Performs post-initialization setup.
Reimplemented from makVre::DtHudUpdater.
Reimplemented in makVre::DtHumanVrHudUpdater.
|
overridevirtual |
Updates the HUD elements for the current frame.
| dt | Delta time since the last frame in seconds |
Reimplemented from makVre::DtHudUpdater.
Reimplemented in makVre::DtHumanVrHudUpdater.
|
overridevirtual |
Returns the component type identifier.
Reimplemented from makVre::DtHudUpdater.
Reimplemented in makVre::DtHumanVrHudUpdater.
|
overrideprotectedvirtual |
Called when this HUD updater is started.
Initializes and shows HUD elements
Implements makVre::DtHudUpdater.
|
overrideprotectedvirtual |
Called when this HUD updater is stopped.
Hides and cleans up HUD elements
Implements makVre::DtHudUpdater.
|
protectedvirtual |
Loads weapon icon extent configuration.
| initTable | Initialization table containing configurations |
| tableName | Name of the table containing extent configuration |
Weapon icons extent in range of 0-1 (for use with normalized screen coordinates). All weapon icons should have the same extent.
|
protectedvirtual |
Loads weapon icon position configuration.
| initTable | Initialization table containing configurations |
| tableName | Name of the table containing position configuration |
Placeholder positions for weapon icons, in normalized screen coordinates.
|
protectedvirtual |
Calculates position for a weapon icon.
| i | Index of the weapon |
| total | Total number of weapons |
| x | [out] Calculated x-coordinate |
| y | [out] Calculated y-coordinate |
|
protectedvirtual |
Calculates position for an ammo text display.
| i | Index of the weapon |
| total | Total number of weapons |
| x | [out] Calculated x-coordinate |
| y | [out] Calculated y-coordinate |
|
protectedvirtual |
Calculates position for a clip text display.
| i | Index of the weapon |
| total | Total number of weapons |
| x | [out] Calculated x-coordinate |
| y | [out] Calculated y-coordinate |
|
protectedvirtual |
Initializes parachute-related text elements.
|
protectedvirtual |
Positions parachute-related text elements on the HUD.
|
protectedvirtual |
Handles changes in the current weapon index.
| index | New weapon index |
Reimplemented in makVre::DtHumanVrHudUpdater.
|
protectedvirtual |
Handles changes in weapon state.
| state | New weapon state |
Reimplemented in makVre::DtHumanVrHudUpdater.
|
protectedvirtual |
Handles changes in the launcher entity ID.
| id | New launcher entity identifier |
Reimplemented in makVre::DtHumanVrHudUpdater.
|
protectedvirtual |
Handles changes in the weapon list.
| weapons | New list of weapon names |
Reimplemented in makVre::DtHumanVrHudUpdater.
|
protectedvirtual |
Handles changes in weapon availability.
| hasWeapons | True if weapons are available, false otherwise |
|
overrideprotectedvirtual |
Called when all HUD elements are being deleted.
Implements makVre::DtHudUpdater.
|
protectedvirtual |
Handles changes in reload timer.
| time | Current reload timer value in seconds |
|
overrideprotectedvirtual |
Updates all HUD elements.
Refreshes the state and visibility of all HUD elements based on current player state
Reimplemented from makVre::DtHudUpdater.
|
protectedvirtual |
Sets up health bar and related HUD elements.
Initializes health indicators and their positions
|
protectedvirtual |
Updates health-related HUD elements.
| visible | Flag indicating if the elements should be visible |
|
protectedvirtual |
Sets up fatigue bar and related HUD elements.
Initializes fatigue indicators and their positions
|
protectedvirtual |
Updates fatigue-related HUD elements.
| visible | Flag indicating if the elements should be visible |
|
overrideprotectedvirtual |
Updates all HUD elements based on visibility.
| visible | Flag indicating if the reticle is visible |
Overrides base class method to update human-specific HUD elements
Implements makVre::DtHudUpdater.
|
protectedvirtual |
Updates vision enhancement overlays like NVG.
| visible | Flag indicating if the overlays should be visible |
|
protectedvirtual |
Updates the weapon reticle display.
| visible | Flag indicating if the reticle should be visible |
Updates position, size, and visibility of the reticle based on current weapon and state
|
protectedvirtual |
Computes a new random direction for reticle movement.
| deltaTime | Delta time since the last frame in seconds |
Computes a new reticle direction if the random timer expires
|
protectedvirtual |
Repositions reticle to keep it within the aiming error circle.
| newReticlePosition | Reference to the reticle position vector to update |
| aimingErrorCircleRadius | Radius of the aiming error circle |
If the reticle's position goes outside the aiming error circle, this function moves the reticle's position back inside the aiming error circle.
|
protectedvirtual |
Checks if the reticle is inside the aiming error circle.
| aimingErrorCircleRadius | Radius of the aiming error circle |
| reticleTestPosition | Position to test |
|
protectedvirtual |
Computes a new direction for the reticle when it reaches the edge.
When the reticle reaches the edge of the aiming error circle, this function computes a new direction for the reticle to travel
|
protectedvirtual |
Updates the position of the gun reticle.
| newReticlePosition | [in,out] The reticle position vector to update |
| myCrosshairQuad | Pointer to the crosshair quad |
| dt | Delta time since the last frame in seconds |
Updates the position of the gun reticle based on current aiming factors
References myCrosshairQuad.
|
protectedvirtual |
Computes the aiming error based on current factors.
| newReticlePosition | Current position of the reticle |
|
protectedvirtual |
Updates gun crosshair display.
| visible | Flag indicating if the crosshair should be visible |
|
protectedvirtual |
Updates grenade reticle display.
| visible | Flag indicating if the reticle should be visible |
|
protectedvirtual |
Updates missile launcher display elements.
| visible | Flag indicating if the elements should be visible |
| reset | Flag indicating if the elements should be reset to default state |
|
protectedvirtual |
Updates ammunition count displays for all weapons.
|
protectedvirtual |
Updates missile launcher ammunition count display.
| count | Current ammunition count |
|
protectedvirtual |
Sets up the current weapon indicator quad.
| pos | Position index of the current weapon, -1 for default |
| total | Total number of weapons, -1 for default |
| state | Current weapon state, -1 for default |
|
protectedvirtual |
Updates wind indicator display.
Updates wind indicator displays with current wind direction and speed
|
protectedvirtual |
Handles wind update messages.
| msg | Pointer to the message being processed |
|
protectedvirtual |
Handles resource update messages.
| msg | Pointer to the message being processed |
|
overrideprotectedvirtual |
Handles viewport change events.
Called when the viewport size or properties change to update HUD element positions
Reimplemented from makVre::DtHudUpdater.
|
protectedvirtual |
Resets weapon indicator quads.
Resets the state of weapon indicator quads to default
|
protectedvirtual |
Resets posture indicator quads.
| overlay | Pointer to the overlay renderer |
| configs | Vector of image configurations to create quads from |
|
protectedvirtual |
Checks if this updater provides the reticle.
Reimplemented in makVre::DtHumanVrHudUpdater.
|
overrideprotectedvirtual |
Creates quad elements for the HUD.
| overlay | Pointer to the overlay renderer |
| configs | Vector of image configurations to create quads from |
Implements the pure virtual method from base class to create HUD quad elements
Implements makVre::DtHudUpdater.
|
protected |
Creates and initializes a text proxy for a specific text element.
| index | Index of the text element to create |
|
protected |
Night vision goggles overlay quad.
|
protected |
Standard crosshair quad.
Referenced by updateGunReticlePosition().
|
protected |
Night vision crosshair quad.
|
protected |
Original bounding box of the standard crosshair.
Saved so that scaling can be done based on the original size
|
protected |
Original bounding box of the NVG crosshair.
Saved so that scaling can be done based on the original size
|
protected |
missile launcher indicator quad
|
protected |
launcher ammunition count text
|
protected |
Flag indicating if the launcher HUD is visible.
|
protected |
Vector of weapon icon quads.
|
protected |
Vector of ammunition count text proxies.
|
protected |
Vector of clip count text proxies.
|
protected |
Flag indicating if ammunition counts should be shown.
|
protected |
Altitude text display for parachute mode.
|
protected |
Oxygen percentage text display for parachute mode.
|
protected |
Wind speed text display.
|
protected |
Wind direction text display.
|
protected |
Current weapon indicator quad.
|
protected |
Standing posture indicator quad.
|
protected |
Prone posture indicator quad.
|
protected |
Crouching posture indicator quad.
|
protected |
Kneeling posture indicator quad.
|
protected |
Drone indicator quad.
|
protected |
Drone view frame quad.
|
protected |
Drone battery text display.
|
protected |
Drone distance text display.
|
protected |
Drone altitude text display.
|
protected |
Drone bearing text display.
|
protected |
Current time in seconds.
|
protected |
Time of last wind speed request in seconds.
|
protected |
Drone battery amount.
|
protected |
Location of last wind request.
|
protected |
Health status gui related variables.
Health value text display
|
protected |
Health bar colored quad.
|
protected |
Health bar background quad.
|
protected |
Original width of the health bar.
|
protected |
Vector of health bar value-color pairs.
|
protected |
Fatigue status gui related variables.
Fatigue value text display
|
protected |
Fatigue bar colored quad.
|
protected |
Fatigue bar background quad.
|
protected |
Original width of the fatigue bar.
|
protected |
Reticle gui related variables.
Center of the GUI in normalized screen coordinates
|
protected |
Maximum aiming error circle radius in pixels.
|
protected |
Reticle speed in pixels per second.
|
protected |
Maximum aiming error in radians.
|
protected |
Timer for random reticle position updates in seconds.
|
protected |
Current reticle position in normalized screen coordinates.
Range is -0.5 to 0.5, where (0,0) is the center of the screen
|
protected |
|
protected |
Cached launcher marking.
|
protected |
Pointer to the weapon resource logic.
|
protected |
Extent of weapon icons in normalized screen coordinates.
|
protected |
Vector of weapon icon positions in normalized screen coordinates.
|
protected |
|
protected |