VR-Engage  2.3
Loading...
Searching...
No Matches
vrObserverUpdater.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file vrObserverUpdater.h
7//! \brief Defines DtVrObserverUpdater for managing VR-specific observer effects
8//! \ingroup vreHumanFrontend
9
10#pragma once
11
13
15
17
18namespace makVrv
19{
20//! \brief Forward declaration of the display element class
21class DtDe;
22
23//! \brief Forward declaration of the virtual reality driver class
24class DtVirtualRealityDriver;
25}; // namespace makVrv
26
27//! \brief Type identifier constant for DtVrObserverUpdater components
28//!
29//! This constant defines the string identifier used to identify DtVrObserverUpdater
30//! component types within the VR-Engage framework. It is used for component
31//! registration, type checking, and serialization operations.
32constexpr const char* DtVrObserverUpdaterType = "DtVrObserverUpdater";
33
34//! \brief VR observer updater component for visual effects
35//!
36//! DtVrObserverUpdater manages VR-specific visual effects for the observer,
37//! including blood sight effects, aiming effects, and other post-processing
38//! effects that are applied directly to the VR display. It handles enabling
39//! and disabling these effects based on player state.
41{
42public:
43 //! \brief Default constructor
45
46 //! \brief Virtual destructor
47 virtual ~DtVrObserverUpdater() override;
48
49 //! \brief Initializes the VR observer updater component
50 //! \param player Pointer to the player station
51 //! \param config Configuration settings for initialization
52 //! \return True if initialization was successful, false otherwise
54
55 //! \brief Updates VR visual effects for the current frame
56 //! \param dt Delta time since the last frame in seconds
57 virtual void tick(double dt) override;
58
59 //! \brief Cleans up resources when the component is being shut down
60 virtual void shutdown() override;
61
62 //! \brief Returns the component type identifier
63 //! \return String identifier for this component type
64 //!
65 //! Returns the type identifier string for this component, which is used
66 //! by the VR-Engage framework for component identification and management.
67 //! The returned value matches DtVrObserverUpdaterType.
68 virtual const char* type() const override;
69
70protected:
71 //! \brief Updates blood sight effects based on player health
72 //!
73 //! Manages the intensity and visibility of blood overlay effects that
74 //! indicate when the player is taking damage
76
77 //! \brief Updates aiming-related visual effects
78 //!
79 //! Manages visual effects that appear when the player is aiming a weapon
80 virtual void updateAimingEffects();
81
82 //! \brief Sets the enabled state of a named visual effect
83 //! \param effect Name of the effect to control
84 //! \param enabled True to enable the effect, false to disable it
85 virtual void setEffectEnabled(const std::string& effect, bool enabled);
86
87 //! \brief Pointer to the VR driver used to control effects
88 makVrv::DtVirtualRealityDriver* myVrDriver;
89
90 //! \brief Last known aiming state of the player
92
93 //! \brief Attribute handle indicating whether VR mode is enabled for the player.
94 //! \vreAttrKey{vr-enabled}
96
97 //! \brief Attribute handle tracking the current aiming state of the player.
98 //! \vreAttrKey{aiming}
100
101 //! \brief Attribute handle indicating the equipment the player currently has equipped.
102 //! \vreAttrKey{currentEquipment}
104
105 //! \brief Attribute handle storing the current health value of the player.
106 //! \vreAttrKey{health}
108};
makVrv::DtVirtualRealityDriver * myVrDriver
Pointer to the VR driver used to control effects.
Definition vrObserverUpdater.h:88
bool myLastKnownAiming
Last known aiming state of the player.
Definition vrObserverUpdater.h:91
virtual const char * type() const override
Returns the component type identifier.
makVre::DtAttributeHandleType< double > myHealthAttr
Attribute handle storing the current health value of the player.
Definition vrObserverUpdater.h:107
virtual void tick(double dt) override
Updates VR visual effects for the current frame.
makVre::DtAttributeHandleType< bool > myVrEnabledAttr
Attribute handle indicating whether VR mode is enabled for the player.
Definition vrObserverUpdater.h:95
virtual bool initialize(makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
Initializes the VR observer updater component.
virtual void setEffectEnabled(const std::string &effect, bool enabled)
Sets the enabled state of a named visual effect.
DtVrObserverUpdater()
Default constructor.
makVre::DtAttributeHandleType< makVre::Equipment > myCurrentEquipmentAttr
Attribute handle indicating the equipment the player currently has equipped.
Definition vrObserverUpdater.h:103
virtual void updateBloodSightEffects()
Updates blood sight effects based on player health.
virtual void updateAimingEffects()
Updates aiming-related visual effects.
makVre::DtAttributeHandleType< bool > myAimingAttr
Attribute handle tracking the current aiming state of the player.
Definition vrObserverUpdater.h:99
virtual ~DtVrObserverUpdater() override
Virtual destructor.
virtual void shutdown() override
Cleans up resources when the component is being shut down.
Type-specific handle class for attributes.
Definition attributeHandle.h:229
Table-based access to Lua state for configuration data.
Definition initializer.h:38
Base class for all role components in VR-Engage.
Definition playerComponent.h:102
virtual DtPlayerStation & player()
Gets the player station.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
Defines export macros for the Human Frontend library.
#define HUMAN_DLL
Definition export.h:19
Definition appLauncherComponent.h:28
Defines the DtPlayerComponent base class for VR-Engage role components.
Common enumeration definitions used throughout the VREngage system.
constexpr const char * DtVrObserverUpdaterType
Type identifier constant for DtVrObserverUpdater components.
Definition vrObserverUpdater.h:32