DtVrePlayerLaserController provides an interface for VR-Engage players to control a laser designator. It handles messages from the front-end to activate, deactivate, and update the laser's target. The controller sets appropriate output ports that can be connected to a DtLasingController to actually create the laser designation object in the simulation.
#include <vrePlayerLaserController.h>
|
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| |
| static void | setRestoreCallback (DtSimMessage *msg, void *usrData) |
| |
| static void | setLaserCodeRequestCallback (DtSimMessage *msg, void *usrData) |
| |
◆ DtVrePlayerLaserController() [1/3]
| makVre::DtVrePlayerLaserController::DtVrePlayerLaserController |
( |
| ) |
|
|
private |
Default constructor (not implemented)
Default constructor is private and not implemented to prevent creation of instances without proper initialization.
Referenced by DtVrePlayerLaserController(), and operator=().
◆ DtVrePlayerLaserController() [2/3]
Copy constructor (not implemented)
Copy constructor is private and not implemented to prevent copy construction.
References DtVrePlayerLaserController().
◆ DtVrePlayerLaserController() [3/3]
| makVre::DtVrePlayerLaserController::DtVrePlayerLaserController |
( |
const DtString & | name, |
|
|
DtLocalObject * | owner, |
|
|
DtSimulationServices * | simManager, |
|
|
DtComponentDescriptor * | desc = 0, |
|
|
DtReaderWriterRegistry * | parentRegistry = 0 ) |
Constructor.
- Parameters
-
| 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 player laser controller component with the specified parameters.
◆ ~DtVrePlayerLaserController()
| virtual makVre::DtVrePlayerLaserController::~DtVrePlayerLaserController |
( |
| ) |
|
|
overridevirtual |
Virtual destructor.
Cleans up resources used by the player laser controller component.
◆ operator=()
Assignment operator (not implemented)
- Returns
- Reference to this object
Assignment operator is private and not implemented to prevent assignment.
References DtVrePlayerLaserController().
◆ type()
| virtual const char * makVre::DtVrePlayerLaserController::type |
( |
| ) |
const |
|
overridevirtual |
Gets the type identifier for this component.
- Returns
- String identifying the component type (DtVrePlayerLaserControllerType)
Implements the DtSimComponent::type() method to return the type identifier for this component.
◆ preFirstTickInit()
| virtual void makVre::DtVrePlayerLaserController::preFirstTickInit |
( |
| ) |
|
|
overridevirtual |
Performs initialization before the first simulation tick.
Gets initial laser designator code from the Process State Repository (PSR) and copies it to the state property "laserCode". This ensures that the GUI displays the correct laser code when the simulation starts.
◆ tick()
| virtual void makVre::DtVrePlayerLaserController::tick |
( |
| ) |
|
|
overridevirtual |
Updates the controller state each simulation frame.
Processes laser controller logic each simulation frame, updating output ports based on the current lasing state and target information.
◆ init()
| virtual bool makVre::DtVrePlayerLaserController::init |
( |
| ) |
|
|
overridevirtual |
Initializes the player laser controller.
- Returns
- True if initialization is successful, false otherwise
Sets the state property named "HasLaser" to True. This property is defined in the platform sysdef file under state-data and is used by the VR-Engage menu system to determine whether to show laser designation options in the user interface. Also creates necessary ports and registers message callbacks.
◆ creator()
| static DtSimComponent * makVre::DtVrePlayerLaserController::creator |
( |
const DtString & | name, |
|
|
DtLocalObject * | owner, |
|
|
DtSimulationServices * | simManager, |
|
|
DtComponentDescriptor * | desc = 0, |
|
|
DtReaderWriterRegistry * | parentRegistry = 0 ) |
|
static |
Factory method to create a new instance of this component.
- Parameters
-
| 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 |
- Returns
- Pointer to the newly created component
Static factory method used by the component creation system to instantiate new instances of this component type.
◆ setRestoreCallback()
| static void makVre::DtVrePlayerLaserController::setRestoreCallback |
( |
DtSimMessage * | msg, |
|
|
void * | usrData ) |
|
static |
Callback for entity restoration events.
- Parameters
-
| msg | The message containing restoration information |
| usrData | User data pointer, typically pointing to the instance of this class |
Static callback function invoked when an entity is restored. This function forwards the message to the instance's processSetRestore method to reinitialize state properties.
◆ setLaserCodeRequestCallback()
| static void makVre::DtVrePlayerLaserController::setLaserCodeRequestCallback |
( |
DtSimMessage * | msg, |
|
|
void * | usrData ) |
|
static |
Callback for laser code change requests.
- Parameters
-
| msg | The message containing the new laser code |
| usrData | User data pointer, typically pointing to the instance of this class |
Static callback function invoked when a request to change the laser code is received. This function forwards the message to the instance's processSetLaserCodeRequestMessage method.
◆ handleStartLasing()
Handles messages to start lasing.
- Parameters
-
| msg | The message containing lasing start request |
- Returns
- Message processing result indicating success or failure
Processes StartLasing messages from the front-end, which activate the laser designator. Sets the appropriate output ports to enable the laser in the simulation.
◆ handleStopLasing()
Handles messages to stop lasing.
- Parameters
-
| msg | The message containing lasing stop request |
- Returns
- Message processing result indicating success or failure
Processes StopLasing messages from the front-end, which deactivate the laser designator. Sets the appropriate output ports to disable the laser in the simulation.
◆ handleUpdateLasingState()
Handles messages to update the lasing state.
- Parameters
-
| msg | The message containing updated lasing information |
- Returns
- Message processing result indicating success or failure
Processes UpdateLasingState messages from the front-end, which update the location being designated by the laser. Updates the appropriate output ports with the new target information.
◆ processSetRestore()
| virtual void makVre::DtVrePlayerLaserController::processSetRestore |
( |
DtSimMessage * | msg | ) |
|
|
protectedvirtual |
Processes entity restoration messages.
- Parameters
-
| msg | The message containing restoration information |
Reinitializes the state property "HasLaser" when a set restore operation is executed. This ensures that the entity's laser capabilities are properly restored after entity restoration, allowing the VR-Engage menu to correctly display laser options.
◆ processSetLaserCodeRequestMessage()
| virtual void makVre::DtVrePlayerLaserController::processSetLaserCodeRequestMessage |
( |
DtSimMessage * | msg | ) |
|
|
protectedvirtual |
Processes laser code change requests.
- Parameters
-
| msg | The message containing the new laser code |
Sets the state property for laser code based on the message contents, so the updated code can be reflected in the GUI. This allows users to change laser codes through the user interface, ensuring that laser-guided weapons are properly configured for the selected code.
◆ createPorts()
| virtual bool makVre::DtVrePlayerLaserController::createPorts |
( |
| ) |
|
|
overrideprotectedvirtual |
Creates input and output ports for the component.
- Returns
- True if ports are successfully created, false otherwise
Creates and initializes all the output ports needed by this component, including ports for laser state (on/off), target location, and target object. These ports connect to the actual laser controller component.
◆ getProcessSR()
| void makVre::DtVrePlayerLaserController::getProcessSR |
( |
| ) |
|
|
protected |
Retrieves the process state repository.
Gets the process state repository (PSR) for this component, storing it in the myProcessState member variable for later access. The PSR contains persistent state information for the controller.
◆ myProcessState
| DtLasingPSR* makVre::DtVrePlayerLaserController::myProcessState |
|
protected |
Pointer to the lasing process state repository.
Contains the persistent state information for the laser controller, including the laser code and target information.
◆ myPlayerIsLasing
| bool makVre::DtVrePlayerLaserController::myPlayerIsLasing |
|
protected |
Flag indicating whether the player is currently lasing.
When true, indicates that the player has activated the laser designator and is currently designating a target.
◆ myLasingTargetLastTick
| bool makVre::DtVrePlayerLaserController::myLasingTargetLastTick |
|
protected |
Flag indicating whether the player was lasing a target in the previous tick.
Used to track changes in lasing state between ticks, for determining when state transitions occur.
◆ myLaserOnOutputPort
| DtBooleanOutputPort* makVre::DtVrePlayerLaserController::myLaserOnOutputPort |
|
protected |
Output port for the laser on/off state.
Boolean output port that controls whether the laser is active. When true, the laser is on and designating a target.
◆ myTargetLocationOutputPort
| DtVectorOutputPort* makVre::DtVrePlayerLaserController::myTargetLocationOutputPort |
|
protected |
Output port for the laser target location.
Vector output port that specifies the 3D location being designated by the laser when targeting a location rather than an object.
◆ myTargetObjectOutputPort
| DtStringOutputPort* makVre::DtVrePlayerLaserController::myTargetObjectOutputPort |
|
protected |
Output port for the laser target object.
String output port that specifies the unique identifier of an object being designated by the laser when targeting an object rather than a location.
The documentation for this class was generated from the following file: