VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtVreSetController< SetControllerBase > Class Template Reference

Detailed Description

template<typename SetControllerBase>
class makVre::DtVreSetController< SetControllerBase >
Template Parameters
SetControllerBaseThe 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>

Inheritance diagram for makVre::DtVreSetController< SetControllerBase >:
[legend]

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< SetVreControlledContentmyPendingControlChanges
 

Private Member Functions

 DtVreSetController ()
 
 DtVreSetController (const DtVreSetController &orig)
 
const DtVreSetControlleroperator= (const DtVreSetController &orig)
 

Constructor & Destructor Documentation

◆ DtVreSetController() [1/3]

template<typename SetControllerBase>
makVre::DtVreSetController< SetControllerBase >::DtVreSetController ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc = 0,
DtReaderWriterRegistry * parentRegistry = 0 )
inline

Constructor.

Parameters
nameThe name of this component
ownerThe local object that owns this component
simManagerThe simulation services manager
descComponent descriptor with configuration parameters
parentRegistryOptional 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().

◆ ~DtVreSetController()

template<typename SetControllerBase>
virtual makVre::DtVreSetController< SetControllerBase >::~DtVreSetController ( )
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().

◆ DtVreSetController() [2/3]

template<typename SetControllerBase>
makVre::DtVreSetController< SetControllerBase >::DtVreSetController ( )
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.

◆ DtVreSetController() [3/3]

template<typename SetControllerBase>
makVre::DtVreSetController< SetControllerBase >::DtVreSetController ( const DtVreSetController< SetControllerBase > & orig)
private

Copy constructor (not implemented)

Copy constructor is private and not implemented to prevent copy construction.

References DtVreSetController().

Member Function Documentation

◆ setRadio()

template<typename SetControllerBase>
virtual void makVre::DtVreSetController< SetControllerBase >::setRadio ( DtSimRadio * radio)
inlinevirtual

Sets the simulation radio and registers callbacks.

Parameters
radioThe 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().

◆ setPlayerControlledCallback()

template<typename SetControllerBase>
static void makVre::DtVreSetController< SetControllerBase >::setPlayerControlledCallback ( DtSimMessage * msg,
void * usrData )
inlinestatic

Static callback function for player control messages.

Parameters
msgThe simulation message containing control assignment information
usrDataUser 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().

◆ processSetPlayerControlled()

template<typename SetControllerBase>
virtual void makVre::DtVreSetController< SetControllerBase >::processSetPlayerControlled ( DtSimMessage * msg)
inlinevirtual

Processes a VR-Engage control assignment message.

Parameters
msgThe 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().

◆ updatePlayerControlled()

◆ preFirstTickInit()

template<typename SetControllerBase>
virtual void makVre::DtVreSetController< SetControllerBase >::preFirstTickInit ( )
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().

◆ tick()

template<typename SetControllerBase>
virtual void makVre::DtVreSetController< SetControllerBase >::tick ( )
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().

◆ processSetAltitude()

template<typename SetControllerBase>
virtual void makVre::DtVreSetController< SetControllerBase >::processSetAltitude ( DtSimMessage * msg)
inlinevirtual

Processes altitude setting messages with enhanced terrain handling.

Parameters
msgThe 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.

◆ creator()

template<typename SetControllerBase>
static DtSimComponent * makVre::DtVreSetController< SetControllerBase >::creator ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc = 0,
DtReaderWriterRegistry * parentRegistry = 0 )
inlinestatic

Factory method to create a new instance of this component.

Parameters
nameThe name for the new component
ownerThe local object that will own this component
simManagerThe simulation services manager
descOptional component descriptor
parentRegistryOptional parent registry for reader/writer functionality
Returns
Pointer to the newly created component

Static factory method used by the component creation system to instantiate new instances of this component type.

References DtVreSetController().

◆ operator=()

template<typename SetControllerBase>
const DtVreSetController & makVre::DtVreSetController< SetControllerBase >::operator= ( const DtVreSetController< SetControllerBase > & orig)
private

Assignment operator (not implemented)

Returns
Reference to this object

Assignment operator is private and not implemented to prevent assignment.

References DtVreSetController().

Member Data Documentation

◆ myWarnedAboutResource

template<typename SetControllerBase>
bool makVre::DtVreSetController< SetControllerBase >::myWarnedAboutResource
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().

◆ myPendingControlChanges

template<typename SetControllerBase>
std::list<SetVreControlledContent> makVre::DtVreSetController< SetControllerBase >::myPendingControlChanges
protected

Referenced by processSetPlayerControlled(), and tick().


The documentation for this class was generated from the following file: