|
VR-Engage
2.2
|
| SetControllerBase | The base set controller class to extend with VR-Engage functionality |
DtVreSetController is a template class that extends base set controllers with VR-Engage specific functionality for handling DtSetVreControlledRequest messages. These messages assign control of entity roles to specific VR-Engage player stations, supporting multi-station control of a single entity with different roles.
The controller also handles the publishing of resource information for player-controlled entities and provides special handling for altitude setting commands.
All VR-Engage specific set controllers should derive from this template class.
Uses Descriptor Type: DtComponentDescriptor
#include <vreSetController.h>
Classes | |
| struct | SetVreControlledContent |
Public Member Functions | |
| DtVreSetController (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| virtual | ~DtVreSetController () override |
| virtual void | setRadio (DtSimRadio *radio) |
| virtual void | processSetPlayerControlled (DtSimMessage *msg) |
| virtual void | updatePlayerControlled (const SetVreControlledContent &change) |
| virtual void | preFirstTickInit () |
| virtual void | tick () |
| virtual void | processSetAltitude (DtSimMessage *msg) |
Public Member Functions inherited from makVre::DtVreSimComponent< SetControllerBase > | |
| DtVreSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| virtual | ~DtVreSimComponent () |
| bool | isPlayerControlled (const std::string &role="") const |
| DtString | entitySystemName () const |
Static Public Member Functions | |
| static void | setPlayerControlledCallback (DtSimMessage *msg, void *usrData) |
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
Protected Attributes | |
| bool | myWarnedAboutResource |
| std::list< SetVreControlledContent > | myPendingControlChanges |
Private Member Functions | |
| DtVreSetController () | |
| DtVreSetController (const DtVreSetController &orig) | |
| const DtVreSetController & | operator= (const DtVreSetController &orig) |
|
inline |
Constructor.
| name | The name of this component |
| owner | The local object that owns this component |
| simManager | The simulation services manager |
| desc | Component descriptor with configuration parameters |
| parentRegistry | Optional parent registry for reader/writer functionality |
Creates a new VR-Engage set controller component with the specified parameters. Initializes the resource warning flag.
References makVre::DtVreSimComponent< SetControllerBase >::DtVreSimComponent(), and myWarnedAboutResource.
Referenced by creator(), DtVreSetController(), operator=(), and setPlayerControlledCallback().
|
inlineoverridevirtual |
Virtual destructor.
Cleans up resources used by the VR-Engage set controller component, removing the set data callback for player control requests.
References makVre::DtSetVreControlledType(), and setPlayerControlledCallback().
|
private |
Default constructor (not implemented)
Default constructor is private and not implemented to prevent creation of instances without proper initialization. Here because the compiler would generate an unprotected one otherwise.
|
private |
Copy constructor (not implemented)
Copy constructor is private and not implemented to prevent copy construction.
References DtVreSetController().
|
inlinevirtual |
Sets the simulation radio and registers callbacks.
| radio | The simulation radio to use for communication |
Overrides the base method to register the component's interest in DtSetVreControlledType set commands. This ensures the component will be notified when VR-Engage control assignment requests are received.
Reimplemented in makVre::DtVreHumanSetController.
References makVre::DtSetVreControlledType(), and setPlayerControlledCallback().
|
inlinestatic |
Static callback function for player control messages.
| msg | The simulation message containing control assignment information |
| usrData | User data pointer, typically pointing to an instance of this class |
Static function registered as a callback to handle VR-Engage control messages. Forwards the message to the appropriate instance's processSetPlayerControlled method.
References DtVreSetController().
Referenced by setRadio(), and ~DtVreSetController().
|
inlinevirtual |
Processes a VR-Engage control assignment message.
| msg | The simulation message containing control assignment information |
Processes DtSetVreControlledRequest messages, which assign or remove control of entity roles to specific VR-Engage player stations. For each role, maintains a list of controlling stations to support multi-station control of a single entity.
References makVre::DtVreSetController< SetControllerBase >::SetVreControlledContent::myControlled, myPendingControlChanges, makVre::DtVreSetController< SetControllerBase >::SetVreControlledContent::myRoles, makVre::DtVreSetController< SetControllerBase >::SetVreControlledContent::myStationId, makVre::DtSetVreControlledRequest::playerStationControlled(), makVre::DtSetVreControlledRequest::roles(), and makVre::DtSetVreControlledRequest::stationId().
|
inlinevirtual |
References LOG_WARN, makVre::DtVreSetController< SetControllerBase >::SetVreControlledContent::myControlled, makVre::DtVreSetController< SetControllerBase >::SetVreControlledContent::myRoles, and makVre::DtVreSetController< SetControllerBase >::SetVreControlledContent::myStationId.
Referenced by tick().
|
inlinevirtual |
Initializes the controller before the first tick.
Performs initialization that must happen before the first tick but after the component is fully constructed. Clears any existing role assignments by removing all extended data entries with keys starting with "role-". Then calls the base class preFirstTickInit().
References makVre::DtVreSimComponent< SetControllerBase >::DtVreSimComponent().
|
inlinevirtual |
Updates the controller state each simulation frame.
Handles different behavior based on whether the entity is player controlled. If not player controlled, operates normally under CGF control. If player controlled, publishes detailed resource information in the entity's extended data for use by the VR-Engage interface.
References makVre::DtVreSimComponent< SetControllerBase >::DtVreSimComponent(), makVre::DtVreSimComponent< SetControllerBase >::isPlayerControlled(), myPendingControlChanges, and updatePlayerControlled().
|
inlinevirtual |
Processes altitude setting messages with enhanced terrain handling.
| msg | The simulation message containing altitude setting information |
Overrides the base method to correctly handle setting altitude of 0 m above terrain. Provides special handling for altitude values of 0, which are interpreted as "place the entity directly on the terrain" rather than "place at 0 MSL". Also handles terrain clamping appropriately.
Reimplemented in makVre::DtVreAirVehicleSetController.
|
inlinestatic |
Factory method to create a new instance of this component.
| name | The name for the new component |
| owner | The local object that will own this component |
| simManager | The simulation services manager |
| desc | Optional component descriptor |
| parentRegistry | Optional parent registry for reader/writer functionality |
Static factory method used by the component creation system to instantiate new instances of this component type.
References DtVreSetController().
|
private |
Assignment operator (not implemented)
Assignment operator is private and not implemented to prevent assignment.
References DtVreSetController().
|
protected |
Flag indicating if a resource warning has been logged.
Tracks whether a warning about exceeding the maximum resource string size has already been logged, to prevent spamming the log with the same warning.
Referenced by DtVreSetController().
|
protected |
Referenced by processSetPlayerControlled(), and tick().