VR-Engage  2.2
Loading...
Searching...
No Matches
weaponPoseUpdater.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file weaponPoseUpdater.h
7//! \brief Component that updates weapon position and orientation based on observer position
8//! \ingroup vreCommonComponents
9
10#pragma once
11
13
15
16namespace makVrv
17{
18class DtObserver;
19}
20
21namespace makVre
22{
23//! \brief Type identifier for DtWeaponPoseUpdater component
24constexpr const char* DtWeaponPoseUpdaterType = "DtWeaponPoseUpdater";
25
26//! \brief Component that updates weapon position and orientation based on observer view
27//!
28//! DtWeaponPoseUpdater tracks the observer's position and orientation and updates
29//! corresponding weapon pose attributes. It maintains the weapon's geocentric position
30//! and orientation for use by other components, performing coordinate transformations
31//! from local to network coordinates. The component also validates whether the pose
32//! is currently valid based on scene visibility status.
34{
35public:
36 //! \brief Constructor for DtWeaponPoseUpdater
37 //!
38 //! Initializes the component with default values
40
41 //! \brief Virtual destructor for DtWeaponPoseUpdater
42 virtual ~DtWeaponPoseUpdater() override;
43
44 //! \brief Initializes the weapon pose updater component
45 //! \param player Pointer to the player station this component belongs to
46 //! \param config Configuration table containing component settings
47 //! \return True if initialization succeeded, false otherwise
48 //!
49 //! Connects to the renderer's post-update signal, finds the observer, and initializes
50 //! weapon pose state attributes with default values
51 virtual bool initialize(DtPlayerStation* player, DtInitTable& config) override;
52 //! \brief Called every frame to update component state
53 //! \param dt Delta time since the last frame in seconds
54 //!
55 //! This implementation is currently empty as the actual updates
56 //! occur in the updateWeaponPosition method connected to the renderer's post-update signal
57 virtual void tick(double dt) override;
58 //! \brief Shuts down the weapon pose updater component
59 //!
60 //! Disconnects from the renderer's post-update signal
61 virtual void shutdown() override;
62
63 //! \brief Returns the type identifier for this component
64 //! \return The type string for DtWeaponPoseUpdater
65 virtual const char* type() const override;
66
67protected:
68 //! \brief Updates the weapon position and orientation based on observer state
69 //!
70 //! Gets the current observer position and orientation, transforms them from local
71 //! to geocentric coordinates, and updates the weaponLocation and weaponOrientation
72 //! attributes. Also updates the weaponPoseValid flag based on scene visibility.
74
75 //! \brief Pointer to the observer being used to determine weapon pose
76 makVrv::DtObserver* myObserver;
77};
78} // namespace makVre
Table-based access to Lua state for configuration data.
Definition initializer.h:38
virtual DtPlayerStation & player()
Gets the player station.
DtPlayerComponent()
Constructor.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
DtWeaponPoseUpdater()
Constructor for DtWeaponPoseUpdater.
virtual const char * type() const override
Returns the type identifier for this component.
virtual ~DtWeaponPoseUpdater() override
Virtual destructor for DtWeaponPoseUpdater.
void updateWeaponPosition()
Updates the weapon position and orientation based on observer state.
makVrv::DtObserver * myObserver
Pointer to the observer being used to determine weapon pose.
Definition weaponPoseUpdater.h:76
virtual void tick(double dt) override
Called every frame to update component state.
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the weapon pose updater component.
virtual void shutdown() override
Shuts down the weapon pose updater component.
Defines export/import macros for the vreCommonComponents library.
#define VRECOMMONCOMPONENTS_DLL
DLL export/import macro for the vreCommonComponents library.
Definition export.h:28
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
constexpr const char * DtWeaponPoseUpdaterType
Type identifier for DtWeaponPoseUpdater component.
Definition weaponPoseUpdater.h:24
Definition appLauncherComponent.h:28
Defines the DtPlayerComponent base class for VR-Engage role components.