|
VR-Engage
2.2
|
DtLookAroundInputLogic provides the capability to look around as a human observer from a point of view on a vehicle (i.e., an open hatch) with options for binoculars and night vision. It handles inputs for view orientation, equipment toggling, and mouse/joystick controls.
Input handler details (for configuring in an SMS input configuration file):
#include <lookAroundInputLogic.h>
Public Member Functions | |
| DtLookAroundInputLogic (makVrv::DtDe &de, DtLookAroundObserverUpdater &updater) | |
| virtual | ~DtLookAroundInputLogic () override |
| virtual void | initialize () override |
| virtual void | shutdown () override |
| virtual void | tick (double dt) |
| virtual void | yaw (double val) |
| virtual void | pitch (double val) |
| virtual void | joystickYaw (double val) |
| virtual void | joystickPitch (double val) |
| virtual void | toggleBinoculars (double val) |
| virtual void | setBinocularsControls (bool enabled) |
| virtual void | zoomOut (double value) |
| virtual void | zoomIn (double value) |
| virtual void | zoom (double value) |
| virtual void | toggleNVG (double val) |
| virtual void | toggleMouseControl (float val) |
| virtual void | enableMouseControl (float val) |
| virtual makVre::DtVreMessageResult | handleFocusMessage (makVre::DtVreMessage *message) |
| virtual void | setMouseControlEnabled (bool enabled) |
| virtual bool | isMouseControlEnabled () |
| virtual bool | isMouseControlSupportAllowed () const |
| virtual void | setMouseControlSupportAllowed (bool enable) |
| virtual void | returnToInitialView (float value) |
| virtual void | freeLook (double val) |
Public Member Functions inherited from makVre::DtInputLogic | |
| DtInputLogic () | |
| virtual | ~DtInputLogic () |
| virtual bool | loadInputConfig (const std::string &config, const std::string &group, bool alwaysOnTop=false, bool alwaysEnabled=false) |
| virtual void | unloadInputConfig (const std::string &category, const std::string &group) |
| virtual void | addActionHandler (const std::string &group, const std::string &action, const DtActionDelegate &handler) |
| virtual void | removeActionGroup (const std::string &group) |
| virtual void | setRawInputHandler (const DtInputDelegate &inputDelegate) |
| virtual void | removeRawInputHandler () |
| virtual void | removeActionHandler (const std::string &group, const std::string &action) |
Protected Member Functions | |
| virtual DtVreMessageResult | handleMenuMessage (makVre::DtVreMessage *msg) |
| void | onBinocularsChanged (bool usingBinoculars) |
Protected Attributes | |
| std::string | myEntityName |
| makVrv::DtDe & | myDe |
| std::string | myClassName |
| std::string | myInputConfigFile |
| bool | myMouseControlEnabled |
| bool | myMouseControlSupportAllowed |
| DtLookAroundObserverUpdater & | myUpdater |
| float | myMouseYawInput |
| float | myMousePitchInput |
| float | myJoystickYawInput |
| float | myJoystickPitchInput |
| bool | myJoystickMoving |
| DtAttributeCallbackManager | myAttributeCallbacks |
Protected Attributes inherited from makVre::DtInputLogic | |
| DtVreInputManager * | myInputManager |
| std::vector< std::pair< std::string, std::string > > | myInputConfigurations |
| std::unordered_map< std::string, std::vector< std::string > > | myActionGroups |
| bool | myHandlingRawInput |
| makVre::DtLookAroundInputLogic::DtLookAroundInputLogic | ( | makVrv::DtDe & | de, |
| DtLookAroundObserverUpdater & | updater ) |
Constructor for DtLookAroundInputLogic.
| de | Reference to the distributed environment |
| updater | Reference to the associated observer updater |
Initializes input state with default values and establishes connection with the corresponding observer updater
References de().
|
overridevirtual |
Virtual destructor for DtLookAroundInputLogic.
|
overridevirtual |
Initializes the look-around input component.
Sets up message handlers, loads input configurations, configures input action handlers, and enables mouse control by default
Reimplemented from makVre::DtInputLogic.
|
overridevirtual |
Shuts down the look-around input component.
Removes message handlers, cleans up input configurations, and disables mouse control
Reimplemented from makVre::DtInputLogic.
|
virtual |
Called every frame to update view orientation based on input.
| dt | Delta time since the last frame in seconds |
Updates state attributes "observerYaw" and "observerPitch" based on mouse and joystick inputs, applying appropriate scaling based on delta time and view magnification
|
virtual |
Handles mouse-based yaw (horizontal rotation) input.
| val | Input value for yaw rate (-1.0 to 1.0) |
Caches the yaw input value to be applied during tick(), but only if the player is not a spectator and look-around mode is active
|
virtual |
Handles mouse-based pitch (vertical rotation) input.
| val | Input value for pitch rate (-1.0 to 1.0) |
Caches the pitch input value to be applied during tick(), but only if the player is not a spectator and look-around mode is active
|
virtual |
Handles joystick-based yaw (horizontal rotation) input.
| val | Input value for yaw rate (-1.0 to 1.0) |
Caches the joystick yaw input value to be applied during tick()
|
virtual |
Handles joystick-based pitch (vertical rotation) input.
| val | Input value for pitch rate (-1.0 to 1.0) |
Caches the joystick pitch input value to be applied during tick()
|
virtual |
Toggles binoculars on or off.
| val | Input value (1.0 to toggle binoculars) |
If incoming value is 1.0, toggles binoculars on/off:
|
virtual |
Enables or disables binocular-specific input controls.
| enabled | True to enable binocular controls, false to disable |
Loads or unloads binocular-specific input configuration based on the enabled state
|
virtual |
Decreases binocular zoom level.
| value | Amount to decrease zoom by |
Sends a BinocularsZoomByMessage with a negative zoom value
|
virtual |
Increases binocular zoom level.
| value | Amount to increase zoom by |
Sends a BinocularsZoomByMessage with a positive zoom value
|
virtual |
Handles continuous zoom level input.
| value | Input value (-1.0 to 1.0) for zoom direction and speed |
Calls zoomIn for positive values or zoomOut for negative values
|
virtual |
Toggles night vision goggles (NVG) on or off.
| val | Input value (1.0 to toggle NVG) |
If incoming value is 1.0, toggles NVG on/off:
|
virtual |
Toggles mouse control on or off.
| val | Input value (1.0 to toggle mouse control) |
Inverts the current mouse control state if the input value is 1.0
|
virtual |
Enables mouse control.
| val | Input value (1.0 to enable mouse control) |
Enables mouse control if it's not already enabled and the input value is 1.0
|
virtual |
Handles focus state change messages.
| message | The focus state message |
Updates mouse control based on application focus state
|
virtual |
Sets the mouse control enabled state.
| enabled | True to enable mouse control, false to disable |
Sends a ToggleMouseControlMessage with the new state
|
virtual |
Checks if mouse control is currently enabled.
|
virtual |
Checks if mouse control support is allowed.
This differs from isMouseControlEnabled() in that it determines whether mouse control is supported at all, not just whether it's currently active
|
virtual |
Sets whether mouse control support is allowed.
| enable | True to allow mouse control support, false to disallow |
Controls whether mouse control functionality is available at all
|
virtual |
Returns the view to its initial orientation.
| value | Input value (1.0 to reset view) |
If the input value is 1.0, resets the observer view to its initial orientation
|
virtual |
Enables or disables free-look mode.
| val | Input value (1.0 to enable, 0.0 to disable) |
Controls whether the player can freely look around, and resets input values when free-look is disabled
|
protectedvirtual |
Handles menu action messages.
| msg | The menu action message |
If the incoming message action is "toggleBinoculars", calls toggleBinoculars(1)
|
protected |
Callback for changes to the usingBinoculars attribute.
| usingBinoculars | New value of the usingBinoculars attribute |
Updates the currentEquipment attribute and binoculars controls based on the new binoculars state
|
protected |
Name of the entity this component is controlling.
|
protected |
Reference to the distributed environment.
|
protected |
Class name for logging and identification.
|
protected |
Path to the input configuration file.
|
protected |
Flag indicating if mouse control is currently enabled.
|
protected |
Flag indicating if mouse control is supported at all.
|
protected |
Reference to the associated look-around observer updater.
Used to communicate with the observer component that this input logic controls
|
protected |
Cached mouse yaw input value.
|
protected |
Cached mouse pitch input value.
|
protected |
Cached joystick yaw input value.
|
protected |
Cached joystick pitch input value.
|
protected |
Flag indicating if joystick input is currently active.
|
protected |
Member-scope instance of Attribute callback manager.
Used to manage Attribute change callback connections and ensure that all callbacks are unregistered when this class instance is destroyed.