VR-Engage  2.2
Loading...
Searching...
No Matches
playerStationOsgGlStudioCockpit.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file playerStationOsgGlStudioCockpit.h
7//! \brief Defines the player station OSG GLStudio cockpit integration
8//! \ingroup vreGlsEventSignaler
9#pragma once
10
11#include "mfsRwrVrv.h"
12
14
15#include <vrvGlStudioShared/DtOsgGlStudioCockpit.h>
16
17namespace makVrv
18{
19//! \brief Forward declaration of the channel configuration class
20class DtChannelConfiguration;
21
22//! \brief Forward declaration of the channel manager class
23class DtChannelManager;
24
25//! \brief Forward declaration of the OSG channel class
26class DtOsgChannel;
27
28//! \brief Forward declaration of the camera node class
29class DtCameraNode;
30
31//! \brief Forward declaration of the virtual reality channel class
32class DtVirtualRealityChannel;
33} // namespace makVrv
34
35namespace disti
36{
37//! \brief Forward declaration of the GLStudio component base class
38class ComponentBase;
39} // namespace disti
40
41namespace makVre
42{
43//! \brief Player station implementation of the OSG GLStudio cockpit
44//!
45//! This specialized cockpit implementation sets the entity's name into each
46//! updater, allowing them to look up data based on the associated entity.
47//! Additionally, it identifies all properties with the prefix "Out_" and
48//! sends PropertyUpdateMessages whenever these values change.
49//!
50//! The player station cockpit also adds special handling for visibility and
51//! performance optimization through update throttling.
52//! \ingroup vreGlsEventSignaler
53class DT_DLL_MFSRWRVRV DtPlayerStationOsgGlStudioCockpit : public makVrv::DtOsgGlStudioCockpit
54{
55public:
56 //! \brief Constructor
57 //! \param de Reference to the display element
58 //! \param id Unique identifier for this cockpit instance
59 //!
60 //! Creates a new player station OSG GLStudio cockpit with the specified ID
61 DtPlayerStationOsgGlStudioCockpit(makVrv::DtDe& de, makVrv::DtUniqueID id);
62
63 //! \brief Virtual destructor
65
66 //! \brief Gets the class name of the model instance owner
67 //! \return String containing the class name
68 //!
69 //! This method is used to control how model instances are created and
70 //! to identify the type of cockpit during agent operations
71 virtual std::string className() const override;
72
73 //! \brief Updates the cockpit state
74 //! \return Time in seconds until the next update is needed
75 //!
76 //! On first update call, sets GLStudio component properties such as MAK_HostId.
77 //! Subsequent updates manage component state and property updates.
78 virtual double update() override;
79
80 //! \brief Performs base class update with throttling support
81 //! \return Time in seconds until the next update is needed
82 //!
83 //! Throttles GLStudio component property updates if the framerate falls
84 //! below a specific threshold to maintain performance
86
87 //! \brief Creates the cockpit from the specified file
88 //! \param filename Path to the GLStudio cockpit file
89 //! \param rsoName Name of the RSO (Rendered Scene Object)
90 //! \param p Perspective type for the cockpit
91 //! \param attachedEntityElementId Element ID of the entity to attach to
92 //!
93 //! Initializes the cockpit instance from the specified GLStudio file and
94 //! associates it with the given entity
95 virtual void createCockpit(const std::string& filename, const std::string& rsoName, DtPerspective p,
96 makVrv::DtUniqueID attachedEntityElementId) override;
97
98protected:
99 //! \brief Creates the HUD object and supporting nodes
100 //! \return Pointer to the created OSG group containing overlay objects
101 //!
102 //! Overridden to fix renderCockpitOnly instrument panels with SensorFX integration.
103 //! This method constructs the actual OpenSceneGraph nodes for displaying the cockpit.
104 virtual osg::Group* createOverlayObjects() override;
105
106 //! \brief Creates a channel-specific node for HUD integration
107 //! \return Pointer to the created channel node
108 //!
109 //! Creates channel-specific nodes and determines whether the HUD should be
110 //! added to the channels. Overridden to maintain a reference to myChannelNode
111 //! to prevent deletion during slot_channelModified operations.
112 virtual osg::Group* createChannelNode() override;
113
114 //! \brief Handles cockpit visibility control messages
115 //! \param msg Pointer to the message to handle
116 //! \return Message processing result
117 //!
118 //! Processes SetCockpitVisibility messages to toggle cockpit visibility.
119 //! Used to hide the cockpit when the aircraft model is shown and vice-versa.
121
122 //! \brief Reference-counted pointer to protect the channel node
123 //!
124 //! Keeps myChannelNode from being deleted during slot_channelModified.
125 //! See createChannelNode() for more details.
126 osg::ref_ptr<osg::Group> myChannelNodeProtector;
127
128 //! \brief Index for tracking attribute update cycles during throttling
130
131 //! \brief Current framerate for throttling decisions
133
134 //! \brief Flag indicating if this is the first update
135 //!
136 //! Used to perform special initialization during the first update cycle
138};
139} // namespace makVre
virtual void createCockpit(const std::string &filename, const std::string &rsoName, DtPerspective p, makVrv::DtUniqueID attachedEntityElementId) override
Creates the cockpit from the specified file.
osg::ref_ptr< osg::Group > myChannelNodeProtector
Reference-counted pointer to protect the channel node.
Definition playerStationOsgGlStudioCockpit.h:126
virtual ~DtPlayerStationOsgGlStudioCockpit() override
Virtual destructor.
DtPlayerStationOsgGlStudioCockpit(makVrv::DtDe &de, makVrv::DtUniqueID id)
Constructor.
virtual double DtOsgGlStudioCockpit_update()
Performs base class update with throttling support.
bool myFirstUpdate
Flag indicating if this is the first update.
Definition playerStationOsgGlStudioCockpit.h:137
virtual osg::Group * createChannelNode() override
Creates a channel-specific node for HUD integration.
virtual osg::Group * createOverlayObjects() override
Creates the HUD object and supporting nodes.
int myAttributeTickIndex
Index for tracking attribute update cycles during throttling.
Definition playerStationOsgGlStudioCockpit.h:129
virtual std::string className() const override
Gets the class name of the model instance owner.
virtual DtVreMessageResult handleSetCockpitVisibility(DtVreMessage *msg)
Handles cockpit visibility control messages.
virtual double update() override
Updates the cockpit state.
float myFrameRate
Current framerate for throttling decisions.
Definition playerStationOsgGlStudioCockpit.h:132
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Defines DLL export macros for the RadarWarningReceiver VRV extension.
#define DT_DLL_MFSRWRVRV
Export/import macro for non-Windows platforms (empty)
Definition mfsRwrVrv.h:25
Definition clip_viewport.h:48
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Definition appLauncherComponent.h:28
makVrv::DtDe * de()
Gets the display element pointer used by the plugin.
Defines the base class for all VREngage messages.