|
VR-Engage
2.2
|
DtHumanObserverUpdater manages the observer (camera) behavior for the human role, including handling different view modes, player postures, attachments, and special effects like NVG and flashlights. It handles positioning, orientation, and updates of the observer based on the player state.
#include <humanObserverUpdater.h>
Classes | |
| struct | Offset |
Public Member Functions | |
| DtHumanObserverUpdater () | |
| virtual | ~DtHumanObserverUpdater () override |
| virtual bool | initialize (DtPlayerStation *player, DtInitTable &config) override |
| virtual bool | postInitialize () override |
| virtual void | tick (double dt) override |
| virtual void | shutdown () override |
| virtual const char * | type () const override |
| virtual ObserverAttachMode | getAttachMode () |
Public Member Functions inherited from makVre::DtObserverUpdater | |
| DtObserverUpdater () | |
| virtual | ~DtObserverUpdater () override |
| virtual void | addChannelToUpdate (const std::string &windowName, const std::string &channelName) |
| virtual void | removeChannelToUpdate (const std::string &windowName, const std::string &channelName, bool restoreInitialSettings=true) |
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 Member Functions | |
| void | updateAttachmentOffset (double dt) |
| double | getPitch () |
| double | getYaw () |
| DtVector | getCameraOffset () |
| virtual void | updateZoomLevel () |
| DtVector | rotateVector (const DtVector &localSpineToCamera, double pitch, double yaw=0.0) |
| void | updateObserverPositionAndOrientation () |
| void | updateScopeObserver (makVrv::DtObserver *observer) |
| void | updateObserverViewMagnification (double dt) |
| virtual void | setDestinationOffset (ObserverAttachMode mode, HumanPosture posture) |
| virtual void | updateFlashlightState () |
| virtual void | updateCompassState () |
| virtual void | onNVGChanged (bool nvg) |
| virtual bool | observerPitchCheck () |
| virtual void | updateStateAttributes () override |
| virtual void | slot_observerModeSettingChanged (int mode, int setting) |
| int | buildOffsetKey (ObserverAttachMode mode, HumanPosture posture) |
Protected Member Functions inherited from makVre::DtObserverUpdater | |
| virtual void | initializeStateAttributes () override |
| virtual void | onSensorModeChanged (std::string sensorMode) |
| virtual void | onObserverModeChanged (std::string observerMode) |
| virtual void | addDefaultChannels () |
| virtual void | addVrChannels () |
| virtual bool | findChannelConfiguration (const std::string &windowName, const std::string &channelName, makVrv::DtChannelConfiguration &config) |
| virtual void | updateAllChannels () |
| virtual void | setShowCockpits (bool show) |
| virtual bool | applyConfigurationToChannel (const std::string &windowName, const std::string &channelName, const makVrv::DtChannelConfiguration &newConfig) |
| bool | firstWindowAndChannelNames (std::string &windowName, std::string &channelName) |
Additional Inherited Members | |
Protected Types inherited from makVre::DtObserverUpdater | |
| using | WindowAndChannelName = std::pair<std::string, std::string> |
| using | ChannelConfigMap = std::map<WindowAndChannelName, makVrv::DtChannelConfiguration> |
| makVre::DtHumanObserverUpdater::DtHumanObserverUpdater | ( | ) |
Default constructor.
|
overridevirtual |
Virtual destructor.
|
overridevirtual |
Initializes the observer updater component.
| player | Pointer to the player station |
| config | Configuration settings for initialization |
Reimplemented from makVre::DtObserverUpdater.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Performs post-initialization setup.
Reimplemented from makVre::DtObserverUpdater.
|
overridevirtual |
Updates the observer for the current frame.
| dt | Delta time since the last frame in seconds |
Reimplemented from makVre::DtObserverUpdater.
|
overridevirtual |
Cleans up resources when the component is being shut down.
Reimplemented from makVre::DtObserverUpdater.
|
overridevirtual |
Returns the component type identifier.
Reimplemented from makVre::DtObserverUpdater.
|
virtual |
Gets the current observer attachment mode.
|
protected |
Updates the observer attachment offset based on current state.
| dt | Delta time since the last frame in seconds |
|
protected |
Gets the current pitch angle of the player.
|
protected |
Gets the current yaw angle of the player.
|
protected |
Gets the current camera offset from the player.
|
protectedvirtual |
Updates the target zoom level based on current observer state and equipment.
This function calculates and sets the appropriate zoom level based on the current observer attach mode, aiming state, and equipped weapon type. When aiming from first person view (and not using VR), it applies equipment-specific zoom levels:
|
protected |
Rotates a vector by the specified pitch and yaw angles.
| localSpineToCamera | Vector to rotate |
| pitch | Pitch angle in radians |
| yaw | Yaw angle in radians |
|
protected |
Updates the observer position and orientation based on current state.
|
protected |
Updates the scope observer properties.
| observer | Pointer to the scope observer to update |
|
protected |
Updates the observer view magnification (zoom)
| dt | Delta time since the last frame in seconds |
|
protectedvirtual |
Sets the destination offset for the observer.
| mode | Observer attachment mode |
| posture | Current human posture |
|
protectedvirtual |
Updates the flashlight state based on current player state.
|
protectedvirtual |
Updates the compass display state.
Updates DisplayCompass state attribute in the DtObserverModeManager, with value of the makVre::DtState attribute "compass". This shows/hides the built-in VR-Vantage compass widget.
|
protectedvirtual |
Handles changes in night vision goggles state.
| nvg | True if NVG is enabled, false otherwise |
|
protectedvirtual |
Checks if the observer pitch is at an angle above the terrain.
|
overrideprotectedvirtual |
Updates state attributes based on current observer state.
Reimplemented from makVre::DtObserverUpdater.
|
protectedvirtual |
Handles observer mode setting changes.
| mode | Observer mode that changed |
| setting | Setting that changed |
Called when an observer mode's setting changes; if it's the mode our observer is using and the setting is DisplayCompass, update corresponding state attribute.
|
inlineprotected |
Builds a lookup key for the offset map from posture and mode.
| mode | Observer attachment mode |
| posture | Human posture |
|
protected |
Pointer to the managed observer.
|
protected |
Unique ID of the player element.
|
protected |
Flag indicating if the observer is currently attached.
|
protected |
Position of the spine end point.
These two should really be pulled from the gun/arms model once vrvDiguy can getLinkPosition
|
protected |
Vector from spine to camera position.
|
protected |
Distance threshold for switching to first-person view.
|
protected |
Speed of posture change transition.
|
protected |
Speed of attachment mode transition.
|
protected |
Speed of third-person aiming transition.
|
protected |
Map of observer offsets indexed by a combined posture and mode key.
|
protected |
Previous observer offset.
|
protected |
Current observer offset.
|
protected |
Target destination observer offset.
|
protected |
Flag indicating if posture has changed this frame.
|
protected |
Target zoom level for the observer.
|
protected |
Interpolator for smooth zoom transitions.
|
protected |
Last known state of the flashlight.
|
protected |
Last known state of the compass.
|
protected |
Last known state of night vision goggles.
|
protected |
Last flashlight pitch angle.
|
protected |
Last flashlight yaw angle.
|
protected |
Flag indicating if using VR mode.
|
protected |
Interpolator for first-person model translation offset.
|
protected |
Interpolator for first-person model rotation offset.
|
protected |
Flag indicating if the player was aiming in the previous frame.
|
protected |
Name of the scope channel.
|
protected |
Scope walking pitch adjustment.
|
protected |
Maximum allowed observer pitch angle.
|
protected |
Name of the observer mode to use for NVG.
DtObserverMode to use for night vision goggles mode