VR-Engage  2.2
Loading...
Searching...
No Matches
glstudioHudMapperLogic.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file glstudioHudMapperLogic.h
7//! \brief Defines the DtGlStudioHudMapperLogic component for managing GLStudio-based cockpit displays.
8//!
9//! This component provides functionality to configure and manage cockpit displays and instrument panels
10//! created with GLStudio. It handles mapping entity types to model definitions and manages configurations
11//! for multiple instrument panels.
12//!
13//! \ingroup vreCommonComponents
14
15#pragma once
16
19
21
22#include <vector>
23#include <string>
24
25namespace makVre
26{
28{
29//! \ingroup RoleConfigParams
30//! \defgroup GlStudioHudMapperLogicRoleParams GLStudio HUD Mapper Logic Role Parameters
31//! \roleInherits{PlayerComponentRoleParams}
32//! Configuration Options for GLStudio HUD mapper logic role.
33//! @{
34
35//! \vreRoleParam{instrumentPanels,table,{},glStudioHudMapperLogic,Table of instrument panel configurations for creating multiple cockpit displays and panels.}
36constexpr const char* instrumentPanels = "instrumentPanels";
37
38//! \vreRoleParam{modelDefinitions,table,{},glStudioHudMapperLogic,Table or string of GLStudio model definition files for mapping entity types to cockpit models.}
39constexpr const char* modelDefinitions = "modelDefinitions";
40
41//! \vreRoleParam{properties,table,{},glStudioHudMapperLogic,Properties configuration block for main cockpit display panel settings.}
42constexpr const char* properties = "properties";
43
44//! \vreRoleParam{realCockpit,bool,false,glStudioHudMapperLogic,Flag indicating whether this is a real cockpit display configuration.}
45constexpr const char* realCockpit = "realCockpit";
46
47//! @}
48} // namespace GlStudioHudMapperLogicConfig
49
50//! \brief Type identifier for DtGlStudioHudMapperLogic component
51constexpr const char* DtGlStudioHudMapperLogicType = "DtGlStudioHudMapperLogic";
52
53//! \brief Component for managing GLStudio-based cockpit displays and instrument panels
54//!
55//! The DtGlStudioHudMapperLogic handles configuration and management of cockpit displays
56//! and instrument panels created with GLStudio. It supports:
57//! - Mapping entity types to model definitions for cockpit displays
58//! - Creating and configuring multiple instrument panels
59//! - Handling configuration requests from GLStudio components
60//! - Managing panel properties and configurations
61//!
62//! This component works in conjunction with GLStudio to provide a complete cockpit visualization
63//! system for vehicle roles.
65{
66public:
67 //! \brief Constructor for DtGlStudioHudMapperLogic
68 //!
69 //! Initializes the component with the name "DtGlStudioHudMapperLogic" and empty model definitions
70 //! and panel configurations.
72
73 //! \brief Virtual destructor for DtGlStudioHudMapperLogic
74 virtual ~DtGlStudioHudMapperLogic() override;
75
76 //! \brief Initializes the component with configuration from Lua
77 //!
78 //! Sets up the model definitions for cockpit displays, processes instrument panel configurations,
79 //! and adds a handler for GLStudio configuration requests. The method also sets the "realCockpit"
80 //! state attribute based on configuration.
81 //!
82 //! Configuration parameters include:
83 //! - modelDefinitions: String or table of strings defining cockpit model definitions
84 //! - properties: Table of properties for the main cockpit display
85 //! - realCockpit: Boolean flag indicating if this is a real cockpit (default: false)
86 //! - instrumentPanels: Table of instrument panel configurations
87 //!
88 //! \param player Pointer to the player station this component belongs to
89 //! \param config Configuration table containing initialization parameters
90 //! \return True if initialization succeeds, false otherwise
92
93 //! \brief Updates the component state (empty implementation)
94 //!
95 //! This method is called each frame but currently has no implementation.
96 //!
97 //! \param dt Delta time in seconds since the last tick
98 virtual void tick(double dt) override;
99
100 //! \brief Shuts down the component
101 //!
102 //! Closes all instrument panels associated with this entity by sending a WindowOperationMessage
103 //! with the OperationType_Destroy operation. Also removes the GLStudio configuration request handler.
104 virtual void shutdown() override;
105
106 //! \brief Returns the component type identifier
107 //! \return The component type string
108 virtual const char* type() const override;
109
110protected:
111 //! \brief Creates instrument panels used by the current display layout
112 //!
113 //! Processes the "instrumentPanels" section from the configuration and creates instrument
114 //! panels with the specified properties. For each panel, sends a WindowOperationMessage
115 //! to create a new instrument panel window with the specified parameters.
116 //!
117 //! Panel configuration parameters include:
118 //! - modelDefinition: GLStudio model definition to use
119 //! - panelPositionX/Y: Screen coordinates for panel position
120 //! - panelSizeX/Y: Panel dimensions
121 //! - screen: Screen index to display on
122 //! - fullscreen: Whether the panel should be fullscreen
123 //! - cockpitOnly: Whether to display only when in cockpit view
124 //! - panelId: Unique identifier for the panel (for configuration)
125 //! - additionalChannelKeywords: Additional channel keywords
126 //!
127 //! \param config Configuration table containing instrument panel settings
129
130 //! \brief Handles configuration requests from GLStudio components
131 //!
132 //! Processes GlsConfigRequestMessages by looking up the requested panel ID in the
133 //! myPanelConfigurations map. If found, sends a GlsConfigResponseMessage with the
134 //! panel's properties.
135 //!
136 //! Properties are defined in the "properties" section of a panel's configuration
137 //! as key-value pairs.
138 //!
139 //! \param msg The message to process (expected to be a GlsConfigRequestMessage)
140 //! \return HANDLED if the message was processed successfully
142
143protected:
144 //! \brief List of model definitions for cockpit displays
145 //!
146 //! These model definitions are registered with the DtSharedCockpitSettings
147 //! to map entity types to cockpit models.
148 std::vector<std::string> myModelDefinitions;
149
150 //! \brief Map of panel IDs to their configuration data
151 //!
152 //! This map stores initialization data for instrument panels, allowing the component
153 //! to respond to panel configuration requests. The key is the panel ID, and the value
154 //! is the configuration table containing the panel's properties.
155 //!
156 //! An empty string key represents the main cockpit display's configuration.
157 std::map<std::string, DtInitTable> myPanelConfigurations;
158};
159} // namespace makVre
std::map< std::string, DtInitTable > myPanelConfigurations
Map of panel IDs to their configuration data.
Definition glstudioHudMapperLogic.h:157
virtual void createInstrumentPanels(makVre::DtInitTable &config)
Creates instrument panels used by the current display layout.
DtGlStudioHudMapperLogic()
Constructor for DtGlStudioHudMapperLogic.
virtual void shutdown() override
Shuts down the component.
std::vector< std::string > myModelDefinitions
List of model definitions for cockpit displays.
Definition glstudioHudMapperLogic.h:148
virtual const char * type() const override
Returns the component type identifier.
virtual makVre::DtVreMessageResult handleGlsConfigRequest(makVre::DtVreMessage *msg)
Handles configuration requests from GLStudio components.
virtual void tick(double dt) override
Updates the component state (empty implementation)
virtual ~DtGlStudioHudMapperLogic() override
Virtual destructor for DtGlStudioHudMapperLogic.
virtual bool initialize(makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
Initializes the component with configuration from Lua.
Table-based access to Lua state for configuration data.
Definition initializer.h:38
virtual DtPlayerStation & player()
Gets the player station.
DtPlayerComponent()
Constructor.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
constexpr const char * instrumentPanels
Definition glstudioHudMapperLogic.h:36
constexpr const char * properties
Definition glstudioHudMapperLogic.h:42
constexpr const char * realCockpit
Definition glstudioHudMapperLogic.h:45
constexpr const char * modelDefinitions
Definition glstudioHudMapperLogic.h:39
Defines export/import macros for the vreCommonComponents library.
#define VRECOMMONCOMPONENTS_DLL
DLL export/import macro for the vreCommonComponents library.
Definition export.h:28
Definition glstudioHudMapperLogic.h:28
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
constexpr const char * DtGlStudioHudMapperLogicType
Type identifier for DtGlStudioHudMapperLogic component.
Definition glstudioHudMapperLogic.h:51
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Defines the DtPlayerComponent base class for VR-Engage role components.
Defines the base class for all VREngage messages.