VR-Engage  2.2
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} // namespace makVre
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.
makVrv::DtObserver * myObserver
Pointer to the observer being managed.
Definition observerUpdater.h:95
void updateObserverOffsets()
Updates the observer offset values.
virtual makVre::DtVreMessageResult handlePlayerReset(makVre::DtVreMessage *msg)
Handles player reset messages.
virtual void tick(double dt) override
Updates observer state each frame.
void resetObserver()
Resets the observer to its default state.
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
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
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.