VR-Engage  2.2
Loading...
Searching...
No Matches
cigiHostControl.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file cigiHostControl.h
7//! \brief Defines the CIGI host control component for VREngage
8//!
9//! This file contains the DtCigiHostControl class which implements a player
10//! component that manages the Common Image Generator Interface (CIGI) host
11//! functionality. It handles communication with image generators through the
12//! CIGI protocol, managing session state, view updates, and other CIGI-related
13//! operations in the VREngage system.
14
15#pragma once
16
18
20
22
23#include <vlpi/simulationAddress.h>
24
25#include <matrix/vlVector.h>
26#include <matrix/vlTaitBryan.h>
27
28#include <vlutil/vlPerformanceStats.h>
29
30#include <boost/signals2.hpp>
31
32#include <memory>
33
34namespace makVre
35{
37{
38//! \ingroup RoleConfigParams
39//! \defgroup CigiHostControlRoleParams CIGI Host Control Role Parameters
40//! \roleInherits{PlayerComponentRoleParams}
41//! Configuration Options for CIGI host control role.
42//! @{
43
44//! \vreRoleParam{displayConfiguration,string,"",cigiHostControl,Display configuration (.dcx) file path for defining view windows and parameters.}
45constexpr const char* displayConfiguration = "displayConfiguration";
46
47//! \vreRoleParam{framerateLimit,double,0.0,cigiHostControl,Framerate limit for CIGI host communication (0.0 for no limit).}
48constexpr const char* framerateLimit = "framerateLimit";
49
50//! \vreRoleParam{hostConfig,string,"",cigiHostControl,Required host configuration file path for CIGI session parameters.}
51constexpr const char* hostConfig = "hostConfig";
52
53//! \vreRoleParam{hostSimAddress,string,"",cigiHostControl,Host simulation address for the target backend (optional).}
54constexpr const char* hostSimAddress = "hostSimAddress";
55
56//! \vreRoleParam{igAddress,string,"",cigiHostControl,Image generator address for CIGI communication (optional).}
57constexpr const char* igAddress = "igAddress";
58
59//! \vreRoleParam{maxFireFxDistance,float,0.0,cigiHostControl,Maximum distance for fire effects rendering in view definitions.}
60constexpr const char* maxFireFxDistance = "maxFireFxDistance";
61
62//! \vreRoleParam{maxViewDistance,float,0.0,cigiHostControl,Maximum view distance for view definitions.}
63constexpr const char* maxViewDistance = "maxViewDistance";
64
65//! @}
66} // namespace CigiHostControlConfig
67
68//! \brief Type identifier constant for DtCigiHostControl components
69//!
70//! This constant defines the string identifier used to identify DtCigiHostControl
71//! component types within the VR-Engage framework. It is used for component
72//! registration, type checking, and serialization operations.
73constexpr const char* DtCigiHostControlType = "DtCigiHostControl";
74
75//! \brief CIGI host control component for VREngage
76//!
77//! This class implements a player component that manages the Common Image Generator
78//! Interface (CIGI) host functionality. It handles communication with image generators
79//! through the CIGI protocol, managing session state, view definitions, entity
80//! synchronization, and other CIGI-related operations in the VREngage system.
81//!
82//! The component initializes CIGI communication, processes messages from the
83//! VREngage messaging system, and synchronizes the state of the simulation with
84//! the image generator during each tick of the simulation loop.
86{
87public:
88 //! \brief Default constructor
89 //!
90 //! Initializes a new instance of the CIGI host control component with
91 //! default settings.
93
94 //! \brief Virtual destructor
95 //!
96 //! Cleans up resources and terminates any active CIGI sessions.
97 virtual ~DtCigiHostControl() override;
98
99 //! \brief Initializes the CIGI host control component
100 //! \param player Pointer to the player station that owns this component
101 //! \param config Configuration table with initialization parameters
102 //! \return True if initialization succeeded, false otherwise
103 //!
104 //! This method initializes the CIGI host control component with the specified
105 //! player station and configuration. It sets up the CIGI session parameters,
106 //! registers message handlers, and initializes the view definitions.
107 virtual bool initialize(DtPlayerStation* player, DtInitTable& config) override;
108
109 //! \brief Updates the CIGI host control during each simulation tick
110 //! \param dt Delta time in seconds since the last tick
111 //!
112 //! This method is called during each simulation tick to update the CIGI
113 //! host control component. It processes pending messages, updates entity
114 //! positions and states, and sends updates to the image generator.
115 virtual void tick(double dt) override;
116
117 //! \brief Performs post-tick processing for the CIGI host control
118 //!
119 //! This method is called after all components have been ticked to perform
120 //! any final processing before the next simulation frame begins.
121 virtual void postTick();
122
123 //! \brief Shuts down the CIGI host control component
124 //!
125 //! This method terminates the CIGI session, unregisters message handlers,
126 //! and releases any resources used by the component.
127 virtual void shutdown() override;
128
129 //! \brief Returns the component type identifier
130 //! \return String identifier for this component type
131 //!
132 //! Returns the type identifier string for this component, which is used
133 //! by the VR-Engage framework for component identification and management.
134 //! The returned value matches DtCigiHostControlType.
135 virtual const char* type() const override;
136
137protected:
138 //! \brief Initializes the state attributes for the CIGI host control
139 //!
140 //! This method sets up the state attributes that will be synchronized
141 //! with the image generator through the CIGI protocol.
142 virtual void initializeStateAttributes() override;
143
144 //! \brief Handles CIGI session status messages
145 //! \param msg Pointer to the received message
146 //! \return Message processing result
147 //!
148 //! This method processes messages related to CIGI session status,
149 //! such as session creation, connection, disconnection, etc.
151
152 //! \brief Initializes view definitions for the CIGI session
153 //!
154 //! This method sets up the initial view definitions that will be
155 //! synchronized with the image generator.
156 virtual void initViews();
157
158 //! \brief Updates view definitions during simulation
159 //!
160 //! This method updates the view definitions based on the current
161 //! state of the simulation and sends the updates to the image generator.
162 virtual void updateViews();
163
164 //! \brief Simulation address for the CIGI host
165 DtSimulationAddress mySimAddress;
166
167 //! \brief Name of the CIGI session
168 std::string mySessionName;
169
170 //! \brief Flag indicating whether the CIGI session is started
172
173 //! \brief Group ID for the out-the-window (OTW) view
175
176 //! \brief Position offset for the observer in the CIGI coordinate system
178
179 //! \brief Rotation offset for the observer in the CIGI coordinate system
181
182 //! \brief Framerate limit for CIGI updates in Hz
184
185 //! \brief Performance timer for measuring CIGI processing time
186 std::shared_ptr<DtTimedSection> myPerformanceTimer;
187
188 //! \brief Connection for the post-tick signal
189 boost::signals2::scoped_connection myPostTickConnection;
190};
191
192} // namespace makVre
virtual ~DtCigiHostControl() override
Virtual destructor.
std::shared_ptr< DtTimedSection > myPerformanceTimer
Performance timer for measuring CIGI processing time.
Definition cigiHostControl.h:186
DtSimulationAddress mySimAddress
Simulation address for the CIGI host.
Definition cigiHostControl.h:165
DtTaitBryan myObserverRotationOffset
Rotation offset for the observer in the CIGI coordinate system.
Definition cigiHostControl.h:180
std::string mySessionName
Name of the CIGI session.
Definition cigiHostControl.h:168
virtual const char * type() const override
Returns the component type identifier.
DtCigiHostControl()
Default constructor.
virtual void tick(double dt) override
Updates the CIGI host control during each simulation tick.
bool mySessionStarted
Flag indicating whether the CIGI session is started.
Definition cigiHostControl.h:171
virtual void updateViews()
Updates view definitions during simulation.
virtual void initViews()
Initializes view definitions for the CIGI session.
int myOtwGroupId
Group ID for the out-the-window (OTW) view.
Definition cigiHostControl.h:174
virtual void initializeStateAttributes() override
Initializes the state attributes for the CIGI host control.
DtVector32 myObserverPositionOffset
Position offset for the observer in the CIGI coordinate system.
Definition cigiHostControl.h:177
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the CIGI host control component.
DtVreMessageResult handleCigiSessionStatusMessage(DtVreMessage *msg)
Handles CIGI session status messages.
virtual void postTick()
Performs post-tick processing for the CIGI host control.
virtual void shutdown() override
Shuts down the CIGI host control component.
double myFramerateLimit
Framerate limit for CIGI updates in Hz.
Definition cigiHostControl.h:183
boost::signals2::scoped_connection myPostTickConnection
Connection for the post-tick signal.
Definition cigiHostControl.h:189
Table-based access to Lua state for configuration data.
Definition initializer.h:38
Base class for all role components in VR-Engage.
Definition playerComponent.h:78
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
constexpr const char * hostConfig
Definition cigiHostControl.h:51
constexpr const char * maxViewDistance
Definition cigiHostControl.h:63
constexpr const char * igAddress
Definition cigiHostControl.h:57
constexpr const char * framerateLimit
Definition cigiHostControl.h:48
constexpr const char * hostSimAddress
Definition cigiHostControl.h:54
constexpr const char * maxFireFxDistance
Definition cigiHostControl.h:60
constexpr const char * displayConfiguration
Definition cigiHostControl.h:45
Defines export macros for the CIGI Host Control Plugin library.
#define CIGIHOSTCONTROL_DLL
Export/import macro for non-Windows platforms.
Definition export.h:39
Definition cigiHostControl.h:37
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
constexpr const char * DtCigiHostControlType
Type identifier constant for DtCigiHostControl components.
Definition cigiHostControl.h:73
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.