VR-Engage  2.3
Loading...
Searching...
No Matches
observerUpdater.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file observerUpdater.h
7//! \brief Defines the observer updater component for the spectator role
8//! \ingroup vreSpectatorFrontend
9
10#pragma once
11
13
15
17
18namespace makVrv
19{
20//! \brief Forward declaration of the observer class
21class DtObserver;
22} // namespace makVrv
23
24namespace makVre
25{
26//! \brief Type identifier for DtSpectatorObserverUpdater component
27constexpr const char* DtSpectatorObserverUpdaterType = "DtSpectatorObserverUpdater";
28
29//! \brief Observer updater component for the spectator role
30//!
31//! This component manages the spectator's observer (camera) within the simulation,
32//! controlling viewing position, orientation, and behavior. It handles observer
33//! initialization, updates its position and orientation each frame, and responds
34//! to events such as player creation and reset. The observer updater provides
35//! features specific to the spectator role, such as free-camera movement and
36//! point-of-interest focus capabilities.
38{
39public:
40 //! \brief Default constructor
42
43 //! \brief Virtual destructor
44 virtual ~DtSpectatorObserverUpdater() override;
45
46 //! \brief Initializes the observer updater component
47 //! \param player Pointer to the player station
48 //! \param config Reference to the initialization configuration
49 //! \return True if initialization was successful, false otherwise
50 //!
51 //! Sets up the spectator observer and registers message handlers
53
54 //! \brief Updates observer state each frame
55 //! \param dt Delta time since the last update in seconds
56 //!
57 //! Updates the observer's position and orientation based on inputs and simulation state
58 virtual void tick(double dt) override;
59
60 //! \brief Performs cleanup when the component is shut down
61 //!
62 //! Releases resources and unregisters message handlers
63 virtual void shutdown() override;
64
65 //! \brief Returns the component type identifier
66 //! \return The component type string
67 virtual const char* type() const override;
68
69protected:
70 //! \brief Handles player created messages
71 //! \param msg Pointer to the message being processed
72 //! \return Message processing result
73 //!
74 //! Initializes the observer when a new player is created
76
77 //! \brief Handles player reset messages
78 //! \param msg Pointer to the message being processed
79 //! \return Message processing result
80 //!
81 //! Resets the observer when the player is reset
83
84 //! \brief Resets the observer to its default state
85 //!
86 //! Returns the observer to its initial position and orientation
88
89 //! \brief Updates the observer offset values
90 //!
91 //! Adjusts position and orientation offsets based on current observer state
93
94 //! \brief Pointer to the observer being managed
95 makVrv::DtObserver* myObserver;
96
97 //! \brief Attribute handle storing the observer's azimuth angle in radians.
98 //! \vreAttrKey{azimuth}
100
101 //! \brief Attribute handle storing the observer's elevation angle in radians.
102 //! \vreAttrKey{elevation}
104
105 //! \brief Attribute handle storing the observer's distance from the attached entity.
106 //! \vreAttrKey{distance}
108
109 //! \brief Attribute handle storing the observer's height offset above the attached entity.
110 //! \vreAttrKey{height}
112};
113} // namespace makVre
Type-specific handle class for attributes.
Definition attributeHandle.h:229
Table-based access to Lua state for configuration data.
Definition initializer.h:38
Base component for managing observer view parameters and display settings.
Definition observerUpdater.h:83
virtual DtPlayerStation & player()
Gets the player station.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
virtual bool initialize(makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
Initializes the observer updater component.
virtual const char * type() const override
Returns the component type identifier.
DtSpectatorObserverUpdater()
Default constructor.
virtual makVre::DtVreMessageResult handlePlayerCreated(makVre::DtVreMessage *msg)
Handles player created messages.
virtual void shutdown() override
Performs cleanup when the component is shut down.
virtual ~DtSpectatorObserverUpdater() override
Virtual destructor.
DtAttributeHandleType< double > myDistanceAttr
Attribute handle storing the observer's distance from the attached entity.
Definition observerUpdater.h:107
makVrv::DtObserver * myObserver
Pointer to the observer being managed.
Definition observerUpdater.h:95
void updateObserverOffsets()
Updates the observer offset values.
DtAttributeHandleType< double > myElevationAttr
Attribute handle storing the observer's elevation angle in radians.
Definition observerUpdater.h:103
virtual makVre::DtVreMessageResult handlePlayerReset(makVre::DtVreMessage *msg)
Handles player reset messages.
DtAttributeHandleType< double > myAzimuthAttr
Attribute handle storing the observer's azimuth angle in radians.
Definition observerUpdater.h:99
virtual void tick(double dt) override
Updates observer state each frame.
void resetObserver()
Resets the observer to its default state.
DtAttributeHandleType< double > myHeightAttr
Attribute handle storing the observer's height offset above the attached entity.
Definition observerUpdater.h:111
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Base component for managing observer parameters and view settings.
Defines export macros for the Spectator Frontend library.
#define SPECTATOR_DLL
Export/import macro for non-Windows platforms (empty)
Definition export.h:25
!
Definition glsVreMessageUtil.h:50
constexpr const char * DtSpectatorObserverUpdaterType
Type identifier for DtSpectatorObserverUpdater component.
Definition observerUpdater.h:27
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Definition appLauncherComponent.h:28
Defines the base class for all VREngage messages.