|
VR-Engage
2.3
|
This component demonstrates how to:
The component inherits from DtQtQuickOverlay and combines QML overlay rendering with entity tracking logic. Each frame, it:
#include <entityOverlayComponent.h>
Public Member Functions | |
| DtEntityOverlayComponent () | |
| virtual | ~DtEntityOverlayComponent () override |
| virtual const char * | type () const override |
| virtual bool | initialize (DtPlayerStation *player, DtInitTable &config) override |
| virtual bool | postInitialize () override |
| virtual void | tick (double dt) override |
| virtual void | shutdown () override |
| virtual void | initdoc (QQuickItem *rootItem) override |
Public Member Functions inherited from makVre::DtQtQuickOverlay | |
| DtQtQuickOverlay () | |
| virtual | ~DtQtQuickOverlay () override |
| virtual void | setRoot (QQuickItem *root) |
| virtual DtVreMessageResult | handleEnterPlayerState (DtVreMessage *msg) |
| virtual DtVreMessageResult | handleExitPlayerState (DtVreMessage *msg) |
| virtual void | setVisibility (bool visible) |
| virtual bool | isVisible () |
| virtual void | setMenuState (bool on) |
Public Member Functions inherited from makVre::DtPlayerComponent | |
| DtPlayerComponent () | |
| virtual | ~DtPlayerComponent () |
| bool | componentReady () const |
| void | setComponentReady (bool ready) |
| virtual DtInitTickStatus | finalizeInitTick (double dt) |
| virtual void | setName (const std::string &name) |
| virtual const std::string & | name () |
| virtual DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () const |
| virtual const DtAttributeHandle & | ownshipState () const |
| virtual void | setExtendedData (const std::string &key, const std::string &value, DtEntityIdentifier entity=DtEntityIdentifier::nullId()) |
Protected Member Functions | |
| virtual void | updateEntityData () |
| virtual void | populateEntityData (EntityOverlayInfo &info, DtAttributeHandle &entityRootAttr) |
| virtual void | ensureEntityTracked (const DtUUID &uuid, const std::string &entityIdStr) |
| virtual void | getEntityTopWorldPosition (DtAttributeHandle &entityAttrRoot, makVrv::DtSceneObject *sceneObj, DtVector &sceneObjPoint, DtVector &worldPoint) const |
| virtual void | removeStaleTrackedEntities (const SensorContactsMap &contacts) |
| virtual double | computeScreenHeightOffset (const DtVector &sceneObjPoint, double heightAboveEntity, makVrv::DtSceneObject *sceneObj, double baseScreenY) const |
| virtual void | onOverlayEnabledChanged (bool enabled) |
Protected Member Functions inherited from makVre::DtQtQuickOverlay | |
| virtual void | updateVals (double dt) |
| virtual void | disconnect () |
| virtual bool | buildConnections (DtInitTable &connections) |
| virtual void | onVisibilityAttributeChanged (bool on) |
| virtual void | removeModelSetAndSkyFromChannel () |
| virtual void | restoreModelSetAndSkyToChannel () |
Protected Member Functions inherited from makVre::DtPlayerComponent | |
| virtual void | initializeStateAttributes () |
| makVre::DtEntityOverlayComponent::DtEntityOverlayComponent | ( | ) |
Constructor.
|
overridevirtual |
Destructor.
|
overridevirtual |
Returns the component type identifier.
Reimplemented from makVre::DtQtQuickOverlay.
|
overridevirtual |
Initializes the component with player and configuration.
| player | Pointer to the player station |
| config | Configuration table with component settings |
Reimplemented from makVre::DtQtQuickOverlay.
Reimplemented in DtEntityHealthBarOverlay.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Performs post-initialization after all components are created.
Sets up the QML overlay and discovers entities to track
Reimplemented from makVre::DtQtQuickOverlay.
|
overridevirtual |
Per-frame update called by the player station.
| dt | Delta time since last tick in seconds |
Updates entity positions and projects them to screen coordinates
Reimplemented from makVre::DtQtQuickOverlay.
|
overridevirtual |
Cleanup when component is being destroyed.
Reimplemented from makVre::DtQtQuickOverlay.
|
overridevirtual |
Called when QML root item is loaded.
| rootItem | The root QML item |
Overridden to get a reference to the QML data object for direct property setting
Reimplemented from makVre::DtQtQuickOverlay.
|
protectedvirtual |
Discovers and updates entity-specific data each frame (proof of concept)
Queries EntityResolver each frame to rebuild the list of entities to track and fetches entity-specific information from the simulation (health, position, etc.)
|
protectedvirtual |
Populates overlay-specific data fields for a tracked entity.
| info | Overlay info structure to populate |
| entityRootAttr | Root attribute handle for the tracked entity |
Reimplemented in DtEntityHealthBarOverlay.
|
protectedvirtual |
Ensures an entity is registered in the tracked entities cache.
| uuid | The entity's UUID from the sensor contacts |
| entityIdStr | The entity identifier string for attribute store lookup |
|
protectedvirtual |
Computes the world-space position of the top center of an entity's bounding volume.
| entityAttrRoot | Root attribute handle for the entity | |
| sceneObj | The entity's scene object for coordinate transformation | |
| [out] | sceneObjPoint | The resulting scene-object-space position |
| [out] | worldPoint | The resulting world (database) coordinates |
|
protectedvirtual |
Removes tracked entities that are no longer present in the sensor contacts.
| contacts | The current sensor contacts to check against |
|
protectedvirtual |
Converts a world-space height offset above an entity into a screen-space pixel offset.
| sceneObjPoint | The entity's position in scene-object coordinates |
| heightAboveEntity | The height offset in meters to convert |
| sceneObj | The scene object used for coordinate transformation |
| baseScreenY | The base screen Y coordinate (OpenGL convention) of the entity |
|
protectedvirtual |
Responds to runtime overlay visibility changes from the player attribute store.
| enabled | True to show overlays, false to hide them |
|
protected |
Sensor contacts used to discover entities that should receive overlays.
| Attribute Store Key | sensors.annotation-proximity-sensor.contacts |
|---|
|
protected |
Cached per-entity attribute handles for currently tracked contacts.
|
protected |
Attribute paths to keep synchronized for tracked external entities.
|
protected |
Pointer to the QML data object for direct property updates.
|
protected |
Base world-space height offset in meters applied above each entity.
|
protected |
Name of the sensor to read contacts from in the attribute store.
|
protected |
Player attribute controlling whether entity overlays are visible.
| Attribute Store Key | showEntityOverlays |
|---|