VR-Engage  2.3
Loading...
Searching...
No Matches
remoteSensorViewLogic.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2024 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6#pragma once
7
13
14#include <matrix/vlVector.h>
15#include <vlpi/entityIdentifier.h>
16
17#include <map>
18#include <string>
19#include <vector>
20
21namespace makVre
22{
23
25
27{
28//! \ingroup RoleConfigParams
29//! \defgroup RemoteSensorViewLogicRoleParams Remote Sensor View Logic Role Parameters
30//! \roleInherits{PlayerComponentRoleParams}
31//! Configuration options for remote sensor view logic.
32//! @{
33
34//! \vreRoleParam{remoteViewer,table,{},remoteSensorViewLogic,Configuration table for the remote sensor view channel\, viewports\, and sensor settings.}
35constexpr const char* remoteViewer = "remoteViewer";
36
37//! \vreRoleParam{droneSensorModes,vector<string>|table,{},remoteSensorViewLogic,Available sensor mode names or mapping for drone cameras.}
38constexpr const char* droneSensorModes = "droneSensorModes";
39
40//! \vreRoleParam{enablePitchRollStabilization,bool,true,remoteSensorViewLogic,Whether to stabilize the remote camera pitch and roll.}
41constexpr const char* enablePitchRollStabilization = "enablePitchRollStabilization";
42
43//! \vreRoleParam{droneCameraOffset,DtVector,{0\,0\,0},remoteSensorViewLogic,Camera-relative offset in meters for drone views: x forward\, y right\, z up. Launcher views are unchanged.}
44constexpr const char* droneCameraOffset = "droneCameraOffset";
45
46//! @}
47} // namespace RemoteSensorViewLogicConfig
48
49//! \brief Type identifier for DtRemoteSensorViewLogic component
50constexpr const char* DtRemoteSensorViewLogicType = "DtRemoteSensorViewLogic";
51
52//! \brief Component that manages all remote sensor view rendering via WindowOperationMessage.
53//!
54//! This is the sole component permitted to send WindowOperationMessage. It reacts to
55//! messages from DtDroneControlLogic and DtLauncherControlLogic and to attribute changes
56//! published by those components in order to create, modify, and destroy stealth channels.
58{
59public:
61 virtual ~DtRemoteSensorViewLogic() override;
62
63 virtual bool initialize(DtPlayerStation* player, DtInitTable& config) override;
64 virtual bool postInitialize() override;
65 virtual void tick(double dt) override;
66 virtual void shutdown() override;
67
68 virtual const char* type() const override;
69
70 virtual void openRemoteSensorView(const DtEntityIdentifier& viewEntity);
71 virtual void closeRemoteSensorView();
72 virtual void toggleRemoteViewViewport(double val);
73 virtual void setRemoteViewZoomLevel(double val);
74 virtual std::string scopeChannelName() const;
75
76protected:
77 virtual bool scopeExists(DtEntityIdentifier& ownshipId, std::string& channelName);
78
87
88 //! \brief Applies the configured drone camera offset when its remote channel is created.
90
91 void nextSensor(double val);
92
93 //! \brief Returns the viewport configuration key matching the currently open remote view.
94 //!
95 //! \return `"drone"` when a drone view is active, otherwise `"launcher"`.
96 std::string activeViewportKey() const;
97
98 //! \brief Applies the currently selected viewport rectangle for \a key to \a msg.
99 //!
100 //! Does nothing if no viewport configurations were supplied for \a key.
101 //!
102 //! \param msg Message to populate. Must not be null. Ownership is not transferred.
103 //! \param key Viewport configuration key, typically `"drone"` or `"launcher"`.
104 void applyCurrentViewport(WindowOperationMessage* msg, const std::string& key);
105
106 //! \brief Publishes viewport edges as screen-percentage player attributes.
107 //! \param viewport Viewport rectangle to publish.
109
110 void onMissileIdChanged(DtEntityIdentifier id);
111 void onMissileTargetIdChanged(makVrv::DtUniqueID id);
112 void onMissileTargetChanged(DtVector location);
114
115 DtEntityIdentifier computeLauncherId() const;
116
119
120 std::map<std::string, std::vector<ChannelViewport>> myViewportConfigurations;
121 std::map<std::string, int> myCurrentViewportIndex;
122
126
127 //! Camera-relative drone view offset in meters: forward, right, up.
129
130 std::map<enum SensorViews, std::string> mySensorModes;
132
133 DtEntityIdentifier myRemoteViewEntityId;
134 DtEntityIdentifier myCurrentDroneId;
135 DtEntityIdentifier myCurrentLauncherId;
136
137 // Missile tracking: maintained here to correctly build modify messages
138 DtEntityIdentifier myCurrentMissileId;
140
156};
157
158} // namespace makVre
Type-specific handle class for attributes.
Definition attributeHandle.h:229
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
virtual void setRemoteViewZoomLevel(double val)
DtEntityIdentifier myCurrentMissileId
Definition remoteSensorViewLogic.h:138
virtual ~DtRemoteSensorViewLogic() override
DtAttributeHandleType< DtVector > myMissileTargetLocationAttr
Definition remoteSensorViewLogic.h:146
virtual const char * type() const override
Gets the component type identifier.
virtual makVre::DtVreMessageResult handleWindowCreated(makVre::DtVreMessage *msg)
Applies the configured drone camera offset when its remote channel is created.
DtEntityIdentifier computeLauncherId() const
SensorViews myLastSensorViewMode
Definition remoteSensorViewLogic.h:131
DtEntityIdentifier myRemoteViewEntityId
Definition remoteSensorViewLogic.h:133
virtual makVre::DtVreMessageResult handleCloseLauncherRemoteView(makVre::DtVreMessage *msg)
virtual makVre::DtVreMessageResult handleCloseDroneRemoteView(makVre::DtVreMessage *msg)
std::map< std::string, std::vector< ChannelViewport > > myViewportConfigurations
Definition remoteSensorViewLogic.h:120
void onMissileTargetIdChanged(makVrv::DtUniqueID id)
virtual makVre::DtVreMessageResult handleOpenDroneRemoteView(makVre::DtVreMessage *msg)
DtAttributeHandleType< bool > myMissileInFlightAttr
Definition remoteSensorViewLogic.h:148
virtual void toggleRemoteViewViewport(double val)
DtAttributeHandleType< bool > myShowDroneFrameAttr
Definition remoteSensorViewLogic.h:152
DtEntityIdentifier myCurrentLauncherId
Definition remoteSensorViewLogic.h:135
DtAttributeHandleType< int > myDroneCurrentSensorAttr
Definition remoteSensorViewLogic.h:141
void onDroneCurrentSensorChanged(int sensor)
std::string myCurrentMissileMarking
Definition remoteSensorViewLogic.h:139
virtual makVre::DtVreMessageResult handleOpenLauncherRemoteView(makVre::DtVreMessage *msg)
virtual void shutdown() override
Shuts down the component.
virtual makVre::DtVreMessageResult handleSetDroneRemoteViewVisibility(makVre::DtVreMessage *msg)
void onMissileTargetChanged(DtVector location)
DtAttributeHandleType< DtEntityIdentifier > myLauncherMissileIdAttr
Definition remoteSensorViewLogic.h:144
virtual makVre::DtVreMessageResult handleEntityRemoved(makVre::DtVreMessage *msg)
void onMissileIdChanged(DtEntityIdentifier id)
virtual bool scopeExists(DtEntityIdentifier &ownshipId, std::string &channelName)
virtual void tick(double dt) override
Updates the component.
DtEntityIdentifier myCurrentDroneId
Definition remoteSensorViewLogic.h:134
DtAttributeHandleType< std::vector< std::string > > myDroneSensorModesAttr
Definition remoteSensorViewLogic.h:142
std::string activeViewportKey() const
Returns the viewport configuration key matching the currently open remote view.
virtual std::string scopeChannelName() const
void publishViewportAttributes(const ChannelViewport &viewport)
Publishes viewport edges as screen-percentage player attributes.
std::map< enum SensorViews, std::string > mySensorModes
Definition remoteSensorViewLogic.h:130
DtAttributeHandleType< bool > myShowHumanOverlayAttr
Definition remoteSensorViewLogic.h:154
DtAttributeHandleType< bool > myRemoteViewOpenAttr
Definition remoteSensorViewLogic.h:151
DtAttributeHandleType< makVrv::DtUniqueID > myMissileTargetIdAttr
Definition remoteSensorViewLogic.h:147
std::map< std::string, int > myCurrentViewportIndex
Definition remoteSensorViewLogic.h:121
virtual bool postInitialize() override
Performs post-initialization setup.
virtual void closeRemoteSensorView()
DtAttributeHandleType< std::string > myLauncherMissileNameAttr
Definition remoteSensorViewLogic.h:145
virtual makVre::DtVreMessageResult handleBlankDroneRemoteView(makVre::DtVreMessage *msg)
DtAttributeHandleType< LauncherType > myLauncherTypeAttr
Definition remoteSensorViewLogic.h:149
virtual makVre::DtVreMessageResult handleMenuActionMessage(makVre::DtVreMessage *msg)
DtAttributeHandleType< std::string > myDroneCurrentSensorNameAttr
Definition remoteSensorViewLogic.h:143
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the component.
std::string myRemoteViewChannelName
Definition remoteSensorViewLogic.h:117
DtVector myDroneCameraOffset
Camera-relative drone view offset in meters: forward, right, up.
Definition remoteSensorViewLogic.h:128
void applyCurrentViewport(WindowOperationMessage *msg, const std::string &key)
Applies the currently selected viewport rectangle for key to msg.
DtAttributeHandleType< DtEntityIdentifier > myLauncherEntityIdAttr
Definition remoteSensorViewLogic.h:150
DtAttributeHandleType< bool > myShowDroneHUDElementsAttr
Definition remoteSensorViewLogic.h:153
bool myRemoteViewAttachToMunition
Definition remoteSensorViewLogic.h:123
virtual void openRemoteSensorView(const DtEntityIdentifier &viewEntity)
std::string myRemoteViewSensorMode
Definition remoteSensorViewLogic.h:118
DtAttributeHandleType< std::string > myRemoteViewChannelNameAttr
Definition remoteSensorViewLogic.h:155
double myRemoteViewZoomLevel
Definition remoteSensorViewLogic.h:125
double myRemoteViewResetTime
Definition remoteSensorViewLogic.h:124
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Used to create, modify or destroy a window or channel.
Definition windowOperation.h:36
constexpr const char * enablePitchRollStabilization
Definition remoteSensorViewLogic.h:41
constexpr const char * droneSensorModes
Definition remoteSensorViewLogic.h:38
constexpr const char * remoteViewer
Definition remoteSensorViewLogic.h:35
constexpr const char * droneCameraOffset
Definition remoteSensorViewLogic.h:44
Defines export/import macros for the vreCommonComponents library.
#define VRECOMMONCOMPONENTS_DLL
DLL export/import macro for the vreCommonComponents library.
Definition export.h:28
Definition remoteSensorViewLogic.h:27
!
Definition glsVreMessageUtil.h:50
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
SensorViews
Enumeration of available sensor view modes.
Definition stateDefines.h:18
constexpr const char * DtRemoteSensorViewLogicType
Type identifier for DtRemoteSensorViewLogic component.
Definition remoteSensorViewLogic.h:50
Defines the DtPlayerComponent base class for VR-Engage role components.
Common enumeration definitions used throughout the VREngage system.
Definition deployableObjectsTypes.h:32
Defines the base class for all VREngage messages.