VR-Engage  2.3
Loading...
Searching...
No Matches
droneHudUpdater.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file droneHudUpdater.h
7//! \brief Defines DtDroneHudUpdater for drone-specific HUD elements and overlays
8//! \ingroup vreHumanFrontend
9
10#pragma once
11
13
15
17
18namespace makVre
19{
20//! \brief Type identifier for DtHumanVrHudUpdater component
21constexpr const char* DtDroneHudUpdaterType = "DtDroneHudUpdater";
22
23//! \brief HUD updater component for drone operation displays
24//!
25//! DtDroneHudUpdater manages the drone-specific HUD elements including
26//! the drone view frame, battery status, distance from home, altitude,
27//! heading, and speed indicators. It updates these elements based on
28//! the current drone state and sensor information.
30{
31public:
32 //! \brief Default constructor
34
35 //! \brief Virtual destructor
36 virtual ~DtDroneHudUpdater() override;
37
38 //! \brief Initializes the drone HUD updater
39 //! \param player Pointer to the player station
40 //! \param config Configuration settings for initialization
41 //! \return True if initialization was successful, false otherwise
43
44 //! \brief Updates the drone HUD elements for the current frame
45 //! \param dt Delta time since the last frame in seconds
46 virtual void tick(double dt) override;
47
48 //! \brief Returns the component type identifier
49 //! \return The component type string
50 virtual const char* type() const override;
51
52protected:
53 //! \brief Handles changes in drone operation state
54 //! \param usingDrone True if the player is using a drone, false otherwise
55 virtual void onUsingDroneChanged(bool usingDrone);
56
57 //! \brief Called when the HUD updater is started
58 virtual void onStart() override;
59
60 //! \brief Called when the HUD updater is stopped
61 virtual void onStop() override;
62
63 //! \brief Updates all HUD elements
64 virtual void updateAll() override;
65
66 //! \brief Updates all HUD elements based on visibility
67 //! \param visible Flag indicating if the reticle is visible
68 virtual void updateHudElements(bool visible) override;
69
70 //! \brief Updates the drone display elements
71 //! \param visible Flag indicating if the drone display should be visible
72 //! \param reset Flag indicating if the display should be reset to default state
73 virtual void updateDroneDisplay(bool visible = true, bool reset = false);
74
75 //! \brief Updates the drone battery amount display
76 //! \param amount Current battery level as a percentage
77 virtual void updateDroneBatteryAmount(float amount);
78
79 //! \brief Handles resource update messages
80 //! \param msg Pointer to the message being processed
81 //! \return Message processing result
83
84 //! \brief Handles simulation state change messages
85 //! \param msg Pointer to the message being processed
86 //! \return Message processing result
88
89 //! \brief Deletes all HUD elements
90 virtual void onDeleteAll() override;
91
92 //! \brief Finds a channel by name
93 //! \param channelName Name of the channel to find, defaults to "Channel 1"
94 //! \return Pointer to the found channel, or nullptr if not found
95 virtual makVrv::DtOsgChannel* findChannel(const std::string& channelName = "Channel 1") override;
96
97 //! \brief Creates quad overlays based on the provided configurations
98 //! \param overlay Pointer to the overlay renderer
99 //! \param configs Vector of HUD image configurations to create
100 virtual void createQuads(makVrv::DtOverlayRenderer* overlay, const std::vector<HudImageConfig>& configs) override;
101
102 //! \brief Flag indicating if the drone HUD is currently visible
104
105 //! \brief Quad proxy for the drone icon display
106 makVrv::DtQuadProxy* myDrone;
107
108 //! \brief Quad proxy for the drone view frame
109 makVrv::DtQuadProxy* myDroneViewFrame;
110
111 //! \brief Text proxy for displaying battery status
112 makVrv::DtTextProxy* myBatteryText;
113
114 //! \brief Text proxy for displaying distance from home base
115 makVrv::DtTextProxy* myDistanceFromHome;
116
117 //! \brief Text proxy for displaying altitude above ground level
118 makVrv::DtTextProxy* myAgl;
119
120 //! \brief Text proxy for displaying current heading
121 makVrv::DtTextProxy* myHeading;
122
123 //! \brief Text proxy for displaying horizontal speed
124 makVrv::DtTextProxy* myHorizontalSpeed;
125
126 //! \brief Text proxy for displaying vertical speed
127 makVrv::DtTextProxy* myVerticalSpeed;
128
129 //! \brief Current drone battery amount as a percentage
131
132 //! \brief Location for wind effect requests
134
135 //! \brief Name of the channel used for drone display
136 std::string myChannelName;
137
138 //! \brief Current velocity vector of the drone
140
141 //! \brief Handle indicating whether the player is using a drone.
142 //! \vreAttrKey{usingDrone}
144
145 //! \brief Handle for the active drone entity identifier.
146 //! \vreAttrKey{droneEntityId}
148
149 //! \brief Handle for the drone battery full amount.
150 //! \vreAttrKey{droneFullAmount}
152};
153} // namespace makVre
Provides handle classes for safe access to attributes.
Type-specific handle class for attributes.
Definition attributeHandle.h:229
virtual void updateDroneBatteryAmount(float amount)
Updates the drone battery amount display.
virtual void updateDroneDisplay(bool visible=true, bool reset=false)
Updates the drone display elements.
DtAttributeHandleType< bool > myUsingDroneAttr
Handle indicating whether the player is using a drone.
Definition droneHudUpdater.h:143
virtual const char * type() const override
Returns the component type identifier.
virtual bool initialize(makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
Initializes the drone HUD updater.
virtual void onDeleteAll() override
Deletes all HUD elements.
virtual void createQuads(makVrv::DtOverlayRenderer *overlay, const std::vector< HudImageConfig > &configs) override
Creates quad overlays based on the provided configurations.
virtual makVre::DtVreMessageResult handleResourceUpdate(makVre::DtVreMessage *msg)
Handles resource update messages.
virtual void tick(double dt) override
Updates the drone HUD elements for the current frame.
virtual void updateHudElements(bool visible) override
Updates all HUD elements based on visibility.
DtAttributeHandleType< double > myDroneFullAmountAttr
Handle for the drone battery full amount.
Definition droneHudUpdater.h:151
virtual void updateAll() override
Updates all HUD elements.
makVrv::DtTextProxy * myBatteryText
Text proxy for displaying battery status.
Definition droneHudUpdater.h:112
bool myDroneHudVisible
Flag indicating if the drone HUD is currently visible.
Definition droneHudUpdater.h:103
makVrv::DtQuadProxy * myDrone
Quad proxy for the drone icon display.
Definition droneHudUpdater.h:106
makVrv::DtQuadProxy * myDroneViewFrame
Quad proxy for the drone view frame.
Definition droneHudUpdater.h:109
makVrv::DtTextProxy * myDistanceFromHome
Text proxy for displaying distance from home base.
Definition droneHudUpdater.h:115
makVrv::DtTextProxy * myVerticalSpeed
Text proxy for displaying vertical speed.
Definition droneHudUpdater.h:127
makVrv::DtTextProxy * myHorizontalSpeed
Text proxy for displaying horizontal speed.
Definition droneHudUpdater.h:124
virtual void onUsingDroneChanged(bool usingDrone)
Handles changes in drone operation state.
std::string myChannelName
Name of the channel used for drone display.
Definition droneHudUpdater.h:136
DtVector myDroneVelocity
Current velocity vector of the drone.
Definition droneHudUpdater.h:139
virtual void onStart() override
Called when the HUD updater is started.
virtual ~DtDroneHudUpdater() override
Virtual destructor.
makVrv::DtTextProxy * myAgl
Text proxy for displaying altitude above ground level.
Definition droneHudUpdater.h:118
virtual void onStop() override
Called when the HUD updater is stopped.
virtual makVre::DtVreMessageResult handleSimulationState(makVre::DtVreMessage *msg)
Handles simulation state change messages.
DtVector myWindRequestLocation
Location for wind effect requests.
Definition droneHudUpdater.h:133
double myDroneBatteryAmount
Current drone battery amount as a percentage.
Definition droneHudUpdater.h:130
makVrv::DtTextProxy * myHeading
Text proxy for displaying current heading.
Definition droneHudUpdater.h:121
virtual makVrv::DtOsgChannel * findChannel(const std::string &channelName="Channel 1") override
Finds a channel by name.
DtAttributeHandleType< DtEntityIdentifier > myDroneEntityIdAttr
Handle for the active drone entity identifier.
Definition droneHudUpdater.h:147
DtDroneHudUpdater()
Default constructor.
DtHudUpdater()
Constructor.
Table-based access to Lua state for configuration data.
Definition initializer.h:38
virtual DtPlayerStation & player()
Gets the player station.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
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 glsVreMessageUtil.h:50
constexpr const char * DtDroneHudUpdaterType
Type identifier for DtHumanVrHudUpdater component.
Definition droneHudUpdater.h:21
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33