VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtHumanVirtualRealityLogic Class Reference

Detailed Description

DtHumanVirtualRealityLogic manages VR-specific interaction for the human role, including processing controller input, head tracking, hand tracking, and providing VR-specific behavior for weapons, movement, and interaction. It translates VR controller input into appropriate simulation actions.

#include <humanVirtualRealityLogic.h>

Inheritance diagram for makVre::DtHumanVirtualRealityLogic:
[legend]

Classes

struct  ControllerIdentifier
 

Public Types

using ControllerStateMap = makVrv::DtVirtualRealityEventManager::ControllerStateMap
 
using Bitfield = makVrv::DtVirtualRealityControllerState::Bitfield
 
using ControllerId = makVrv::DtVirtualRealityControllerState::ControllerId
 
using DtVector2f = makVrv::DtVirtualRealityControllerState::DtVector2f
 
using ControllerState = makVrv::DtVirtualRealityControllerState
 

Public Member Functions

 DtHumanVirtualRealityLogic ()
 
virtual ~DtHumanVirtualRealityLogic () override
 
virtual bool initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
 
virtual bool postInitialize () override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
virtual void processControllerStates (const ControllerStateMap &stateMap)
 
virtual void resetHeadPos ()
 
virtual void handleResetHeadPosInput (int val)
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Member Functions

virtual void startVr ()
 
virtual void stopVr ()
 
virtual makVre::DtVreMessageResult handleResetVrHeadPos (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleToggleMixedReality (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleEnterPlayerState (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleExitPlayerState (makVre::DtVreMessage *msg)
 
virtual const ControllerStatefindController (ControllerIdentifier &identifier, const ControllerStateMap &stateMap)
 
virtual void yaw (double val)
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

makVrv::DtVirtualRealityDriver * myVrDriver
 
DtHumanVrEventProcessor * myEventProcessor
 
DtHumanControlLogicmyHumanLogic
 
makVre::DtActionMenuLogicmyMenuLogic
 
makVrv::DtSubmitOverlayCallback * myVrOverlay
 
bool myVrEnabled
 
bool myVrWasEnabled
 
bool myRightHanded
 
bool mySingleHandAiming
 
bool myDidHaveHandMotion
 
bool myDidNoHandMotionReset
 
ControllerIdentifier myHeadId
 
ControllerIdentifier myLeftHandId
 
ControllerIdentifier myRightHandId
 
DtTaitBryan myWeaponOverride
 
int myFramesSinceMenu
 
DtVirtualDpad myVirtualDpad
 
int myLastMainChannelRenderOrder
 
double myCurrentHeading
 
double myYaw
 
double myAimYaw
 
double myAimPitch
 
bool myHasVRInput
 
bool myInitializedHeading
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Member Typedef Documentation

◆ ControllerStateMap

◆ Bitfield

◆ ControllerId

◆ DtVector2f

◆ ControllerState

Constructor & Destructor Documentation

◆ DtHumanVirtualRealityLogic()

makVre::DtHumanVirtualRealityLogic::DtHumanVirtualRealityLogic ( )

Default constructor.

◆ ~DtHumanVirtualRealityLogic()

virtual makVre::DtHumanVirtualRealityLogic::~DtHumanVirtualRealityLogic ( )
overridevirtual

Virtual destructor.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtHumanVirtualRealityLogic::initialize ( makVre::DtPlayerStation * player,
makVre::DtInitTable & config )
overridevirtual

Initializes the VR logic component.

Parameters
playerPointer to the player station
configConfiguration settings for initialization
Returns
True if initialization was successful, false otherwise

Reimplemented from makVre::DtPlayerComponent.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

virtual bool makVre::DtHumanVirtualRealityLogic::postInitialize ( )
overridevirtual

Performs post-initialization setup.

Returns
True if post-initialization was successful, false otherwise

Reimplemented from makVre::DtPlayerComponent.

◆ tick()

virtual void makVre::DtHumanVirtualRealityLogic::tick ( double dt)
overridevirtual

Updates VR processing for the current frame.

Parameters
dtDelta time since the last frame in seconds

Implements makVre::DtPlayerComponent.

◆ shutdown()

virtual void makVre::DtHumanVirtualRealityLogic::shutdown ( )
overridevirtual

Cleans up resources when the component is being shut down.

Reimplemented from makVre::DtPlayerComponent.

◆ type()

virtual const char * makVre::DtHumanVirtualRealityLogic::type ( ) const
overridevirtual

Returns the component type identifier.

Returns
String identifier for this component type

Returns the type identifier string for this component, which is used by the VR-Engage framework for component identification and management. The returned value matches DtHumanVirtualRealityLogicType.

Implements makVre::DtPlayerComponent.

Referenced by makVre::DtHumanVirtualRealityLogic::ControllerIdentifier::ControllerIdentifier().

◆ processControllerStates()

virtual void makVre::DtHumanVirtualRealityLogic::processControllerStates ( const ControllerStateMap & stateMap)
virtual

Processes controller state updates.

Parameters
stateMapMap of controller states to process

◆ resetHeadPos()

virtual void makVre::DtHumanVirtualRealityLogic::resetHeadPos ( )
virtual

Resets the head position in VR.

Recenters the VR view based on the current physical head position

◆ handleResetHeadPosInput()

virtual void makVre::DtHumanVirtualRealityLogic::handleResetHeadPosInput ( int val)
virtual

Input handler for resetting head position.

Parameters
valInput value (1 to trigger reset)

Handles the reset head position input action from bound controls

◆ startVr()

virtual void makVre::DtHumanVirtualRealityLogic::startVr ( )
protectedvirtual

Starts VR mode.

Initializes and enables VR rendering and input

◆ stopVr()

virtual void makVre::DtHumanVirtualRealityLogic::stopVr ( )
protectedvirtual

Stops VR mode.

Disables VR rendering and input

◆ handleResetVrHeadPos()

virtual makVre::DtVreMessageResult makVre::DtHumanVirtualRealityLogic::handleResetVrHeadPos ( makVre::DtVreMessage * msg)
protectedvirtual

Handles VR head position reset messages.

Parameters
msgPointer to the message being processed
Returns
Message processing result

◆ handleToggleMixedReality()

virtual makVre::DtVreMessageResult makVre::DtHumanVirtualRealityLogic::handleToggleMixedReality ( makVre::DtVreMessage * msg)
protectedvirtual

Handles toggle mixed reality messages.

Parameters
msgPointer to the message being processed
Returns
Message processing result

◆ handleEnterPlayerState()

virtual makVre::DtVreMessageResult makVre::DtHumanVirtualRealityLogic::handleEnterPlayerState ( makVre::DtVreMessage * msg)
protectedvirtual

Handles player state enter messages.

Parameters
msgPointer to the message being processed
Returns
Message processing result

If incoming message is for entering the menu state, disables VR

◆ handleExitPlayerState()

virtual makVre::DtVreMessageResult makVre::DtHumanVirtualRealityLogic::handleExitPlayerState ( makVre::DtVreMessage * msg)
protectedvirtual

Handles player state exit messages.

Parameters
msgPointer to the message being processed
Returns
Message processing result

If incoming message is for exiting the menu state, enables VR

◆ findController()

virtual const ControllerState * makVre::DtHumanVirtualRealityLogic::findController ( ControllerIdentifier & identifier,
const ControllerStateMap & stateMap )
protectedvirtual

Finds a controller in the controller state map.

Parameters
identifier[in,out] Identifier of the controller to find
stateMapMap of controller states to search in
Returns
Pointer to the found controller state, or nullptr if not found

◆ yaw()

virtual void makVre::DtHumanVirtualRealityLogic::yaw ( double val)
protectedvirtual

Applies yaw rotation input.

Parameters
valYaw rotation value

Member Data Documentation

◆ myVrDriver

makVrv::DtVirtualRealityDriver* makVre::DtHumanVirtualRealityLogic::myVrDriver
protected

Pointer to the VR driver.

◆ myEventProcessor

DtHumanVrEventProcessor* makVre::DtHumanVirtualRealityLogic::myEventProcessor
protected

Pointer to the VR event processor.

◆ myHumanLogic

DtHumanControlLogic* makVre::DtHumanVirtualRealityLogic::myHumanLogic
protected

Pointer to the human control logic component.

◆ myMenuLogic

makVre::DtActionMenuLogic* makVre::DtHumanVirtualRealityLogic::myMenuLogic
protected

Pointer to the action menu logic component.

◆ myVrOverlay

makVrv::DtSubmitOverlayCallback* makVre::DtHumanVirtualRealityLogic::myVrOverlay
protected

Pointer to the VR overlay callback.

◆ myVrEnabled

bool makVre::DtHumanVirtualRealityLogic::myVrEnabled
protected

Flag indicating if VR is currently enabled.

◆ myVrWasEnabled

bool makVre::DtHumanVirtualRealityLogic::myVrWasEnabled
protected

Flag tracking previous VR enabled state.

◆ myRightHanded

bool makVre::DtHumanVirtualRealityLogic::myRightHanded
protected

Flag indicating if the player is right-handed.

◆ mySingleHandAiming

bool makVre::DtHumanVirtualRealityLogic::mySingleHandAiming
protected

Flag indicating if single-hand aiming is enabled.

◆ myDidHaveHandMotion

bool makVre::DtHumanVirtualRealityLogic::myDidHaveHandMotion
protected

Flag tracking if hand motion was detected.

◆ myDidNoHandMotionReset

bool makVre::DtHumanVirtualRealityLogic::myDidNoHandMotionReset
protected

Flag tracking if a no-motion reset was performed.

◆ myHeadId

ControllerIdentifier makVre::DtHumanVirtualRealityLogic::myHeadId
protected

Identifier for the head/HMD controller.

◆ myLeftHandId

ControllerIdentifier makVre::DtHumanVirtualRealityLogic::myLeftHandId
protected

Identifier for the left hand controller.

◆ myRightHandId

ControllerIdentifier makVre::DtHumanVirtualRealityLogic::myRightHandId
protected

Identifier for the right hand controller.

◆ myWeaponOverride

DtTaitBryan makVre::DtHumanVirtualRealityLogic::myWeaponOverride
protected

Weapon orientation override in Tait-Bryan angles.

◆ myFramesSinceMenu

int makVre::DtHumanVirtualRealityLogic::myFramesSinceMenu
protected

Counter for frames elapsed since menu was active.

◆ myVirtualDpad

DtVirtualDpad makVre::DtHumanVirtualRealityLogic::myVirtualDpad
protected

Virtual direction pad for VR movement.

◆ myLastMainChannelRenderOrder

int makVre::DtHumanVirtualRealityLogic::myLastMainChannelRenderOrder
protected

Last known render order for the main channel.

◆ myCurrentHeading

double makVre::DtHumanVirtualRealityLogic::myCurrentHeading
protected

Current heading angle in radians.

Note
Temporary variable replicating humanControlLogic until proper VR input support (VRE-3178)

◆ myYaw

double makVre::DtHumanVirtualRealityLogic::myYaw
protected

Current yaw angle in radians.

Note
Temporary variable replicating humanControlLogic until proper VR input support (VRE-3178)

◆ myAimYaw

double makVre::DtHumanVirtualRealityLogic::myAimYaw
protected

Current aim yaw angle in radians.

Note
Temporary variable replicating humanControlLogic until proper VR input support (VRE-3178)

◆ myAimPitch

double makVre::DtHumanVirtualRealityLogic::myAimPitch
protected

Current aim pitch angle in radians.

Note
Temporary variable replicating humanControlLogic until proper VR input support (VRE-3178)

◆ myHasVRInput

bool makVre::DtHumanVirtualRealityLogic::myHasVRInput
protected

Flag indicating if VR input is available.

Note
Temporary variable replicating humanControlLogic until proper VR input support (VRE-3178)

◆ myInitializedHeading

bool makVre::DtHumanVirtualRealityLogic::myInitializedHeading
protected

Flag indicating if heading has been initialized.

Note
Temporary variable replicating humanControlLogic until proper VR input support (VRE-3178)

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