|
VR-Engage
2.2
|
DtScopeSimLogic manages zoom functionality for weapon scopes, handling both discrete zoom level changes and observer view mode adjustments when aiming. The component responds to zoom increase/decrease messages and automatically configures VR-specific settings such as head orientation smoothing when in VR mode. It also enforces first-person view when aiming through a scope and manages the transition between aiming and non-aiming states.
#include <vreScopeSimLogic.h>
Public Member Functions | |
| DtScopeSimLogic () | |
| virtual | ~DtScopeSimLogic () 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 makVre::DtVreMessageResult | handleScopeIncreaseZoom (makVre::DtVreMessage *msg) |
| virtual makVre::DtVreMessageResult | handleScopeDecreaseZoom (makVre::DtVreMessage *msg) |
| virtual void | onAimingChanged (bool aiming) |
| virtual void | onViewMagnificationChanged (double mag) |
Public Member Functions inherited from makVre::DtPlayerComponent | |
| DtPlayerComponent () | |
| virtual | ~DtPlayerComponent () |
| virtual void | setName (const std::string &name) |
| virtual const std::string & | name () |
| virtual DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () const |
Protected Attributes | |
| double | myMaxViewMagnification |
| makVrv::DtVirtualRealityDriver * | myVrDriver |
| bool | myMrWasActive |
| ObserverAttachMode | myLastObserverAttachMode |
| bool | myHmdSmoothingEnabled |
| double | myHmdSmoothingAlpha |
| double | myHmdSmoothingThreshold |
Protected Attributes inherited from makVre::DtPlayerComponent | |
| std::string | myName |
| DtInitTable | myConfig |
| DtPlayerStation * | myPlayer |
| makVrv::DtDe * | myDe |
| DtEntityResolver * | myResolver |
| DtAttributeCallbackManager | myAttributeCallbacks |
Additional Inherited Members | |
Protected Member Functions inherited from makVre::DtPlayerComponent | |
| virtual void | initializeStateAttributes () |
| makVre::DtScopeSimLogic::DtScopeSimLogic | ( | ) |
Constructor for DtScopeSimLogic.
| className | Class name for identification, defaults to "DtScopeSimLogic" |
Initializes the component with default zoom and smoothing settings
|
overridevirtual |
Virtual destructor for DtScopeSimLogic.
|
overridevirtual |
Initializes the scope simulation logic component.
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing scope settings |
Reads configuration values for HMD smoothing settings, registers message handlers for scope zoom messages, and sets up attribute callbacks for aiming state and view magnification changes
Reimplemented from makVre::DtPlayerComponent.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Performs post-initialization after all components are initialized.
Sets up VR-specific configurations if applicable, including configuring the VR driver's orientation smoothing settings
Reimplemented from makVre::DtPlayerComponent.
|
overridevirtual |
Called every frame to update the component state.
| dt | Delta time since the last frame in seconds |
Current implementation is empty as updates occur through message handlers and attribute change callbacks
Implements makVre::DtPlayerComponent.
|
overridevirtual |
Shuts down the scope simulation logic component.
Removes message handlers and attribute change callbacks
Reimplemented from makVre::DtPlayerComponent.
|
overridevirtual |
Returns the type identifier for this component.
Implements makVre::DtPlayerComponent.
|
virtual |
Handles messages to increase scope zoom level.
| msg | The scope increase zoom message |
Increases the zoom index and updates the view magnification to the next higher zoom level from the configured scopeZoomLevels array
|
virtual |
Handles messages to decrease scope zoom level.
| msg | The scope decrease zoom message |
Decreases the zoom index and updates the view magnification to the next lower zoom level from the configured scopeZoomLevels array
|
virtual |
Callback for when the aiming state changes.
| aiming | New aiming state (true when aiming, false otherwise) |
When entering aiming state, sets initial zoom level, disables third person view, and forces first person observer mode. When exiting aiming state, restores the previous observer attach mode.
|
virtual |
Callback for view magnification attribute changes.
| mag | New magnification value |
Current implementation is empty
|
protected |
Maximum allowed view magnification value.
|
protected |
Pointer to the VR driver if available.
|
protected |
Flag indicating if mixed reality was active before entering aiming mode.
|
protected |
The observer attach mode used before entering aiming mode.
Stored when entering aiming mode so it can be restored when exiting
|
protected |
Flag indicating if HMD orientation smoothing is enabled.
|
protected |
Smoothing alpha parameter for HMD orientation smoothing.
|
protected |
Threshold parameter for HMD orientation smoothing in degrees per second.