Ocean
TrackerTransform.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_SCENEDESCRIPTION_SDX_X3D_TRACKER_TRANSFORM_H
9 #define META_OCEAN_SCENEDESCRIPTION_SDX_X3D_TRACKER_TRANSFORM_H
10 
13 
14 #include "ocean/devices/Tracker.h"
15 
17 
18 namespace Ocean
19 {
20 
21 namespace SceneDescription
22 {
23 
24 namespace SDX
25 {
26 
27 namespace X3D
28 {
29 
30 /**
31  * This class implements an ocean specific X3D node to allow specific tracker system transformations.
32  * @ingroup scenedescriptionsdxx3d
33  */
34 class OCEAN_SCENEDESCRIPTION_SDX_X3D_EXPORT TrackerTransform :
35  virtual public X3DGroupingNode,
36  virtual public SDXUpdateNode
37 {
38  public:
39 
40  /**
41  * Creates a new ocean tracker transform node.
42  * @param environment Node environment
43  */
44  explicit TrackerTransform(const SDXEnvironment* environment);
45 
46  protected:
47 
48  /**
49  * Destructs an ocean tracker transform node.
50  */
51  ~TrackerTransform() override;
52 
53  /**
54  * Specifies the node type and the fields of this node.
55  * @return Unique node specification of this node
56  */
58 
59  /**
60  * Event function to inform the node that it has been initialized and can apply all internal values to corresponding rendering objects.
61  * @see SDXNode::onInitialize().
62  */
63  void onInitialize(const Rendering::SceneRef& scene, const Timestamp timestamp) override;
64 
65  /**
66  * Event function to inform the node about a changed field.
67  * @see SDXNode::onFieldChanged().
68  */
69  void onFieldChanged(const std::string& fieldName) override;
70 
71  /**
72  * Pre update event function.
73  * @see SDXUpdateNode::onPreUpdate().
74  */
75  Timestamp onPreUpdate(const Rendering::ViewRef& view, const Timestamp timestamp) override;
76 
77  /**
78  * Event function of object ids.
79  * @param trackerSender The sender of the event, must be valid
80  * @param found True, if the object ids were found; False if the object ids were lost
81  * @param objectIds The ids of the object which are found or lost, at least one
82  * @param timestamp The timestamp of the event
83  */
84  void onTrackerObjectEvent(const Devices::Tracker* trackerSender, const bool found, const Devices::Tracker::ObjectIdSet& objectIds, const Timestamp& timestamp);
85 
86  /**
87  * Returns the address of the most derived object.
88  * @see Node::objectAddress().
89  */
90  size_t objectAddress() const override;
91 
92  protected:
93 
94  /// True, if the tracker is an inside-out tracker; False, if the tracker is an outside-in tracker.
96 
97  /// The name of the tracker to be used, the first valid name will be used.
99 
100  /// The tracker's input.
102 
103  /// True, if the tracker needs multiple inputs; False, if the tracker needs a single input.
105 
106  /// The name of the object to be tracked.
108 
109  /// The size of the object to be tracked in 3D space.
111 
112  /// True, to keep the child nodes always visible; False, to keep the child nodes only visible when the tracker provides a valid pose (e.g., when actively tracking).
114 
115  /// The tracker which is actually used for tracking.
117 
118  /// Tracker object id.
120 
121  /// The subscription object for tracker object events.
123 
124  /// True, if the tracker object is visible; False, otherwise.
126 };
127 
128 }
129 
130 }
131 
132 }
133 
134 }
135 
136 #endif // META_OCEAN_SCENEDESCRIPTION_SDX_X3D_TRACKER_TRANSFORM_H
unsigned int ObjectId
Definition of an object id.
Definition: Measurement.h:46
std::unordered_set< ObjectId > ObjectIdSet
Definition of an unordered set holding object ids.
Definition: Measurement.h:56
This class manages the lifetime of an event subscription for tracker object events.
Definition: devices/Tracker.h:141
This class implements the base class for all tracker devices.
Definition: devices/Tracker.h:39
This class implements a node specification object.
Definition: scenedescription/Node.h:77
This class implements an ocean specific X3D node to allow specific tracker system transformations.
Definition: TrackerTransform.h:37
MultiString tracker_
The name of the tracker to be used, the first valid name will be used.
Definition: TrackerTransform.h:98
size_t objectAddress() const override
Returns the address of the most derived object.
TrackerTransform(const SDXEnvironment *environment)
Creates a new ocean tracker transform node.
SingleString object_
The name of the object to be tracked.
Definition: TrackerTransform.h:107
Devices::Tracker::ObjectId objectId_
Tracker object id.
Definition: TrackerTransform.h:119
SingleBool insideOut_
True, if the tracker is an inside-out tracker; False, if the tracker is an outside-in tracker.
Definition: TrackerTransform.h:95
SingleBool multiInput_
True, if the tracker needs multiple inputs; False, if the tracker needs a single input.
Definition: TrackerTransform.h:104
SingleVector3 objectSize_
The size of the object to be tracked in 3D space.
Definition: TrackerTransform.h:110
void onInitialize(const Rendering::SceneRef &scene, const Timestamp timestamp) override
Event function to inform the node that it has been initialized and can apply all internal values to c...
bool objectVisible_
True, if the tracker object is visible; False, otherwise.
Definition: TrackerTransform.h:125
~TrackerTransform() override
Destructs an ocean tracker transform node.
void onFieldChanged(const std::string &fieldName) override
Event function to inform the node about a changed field.
MultiString trackerInput_
The tracker's input.
Definition: TrackerTransform.h:101
Devices::TrackerRef trackerRef_
The tracker which is actually used for tracking.
Definition: TrackerTransform.h:116
SingleBool alwaysVisible_
True, to keep the child nodes always visible; False, to keep the child nodes only visible when the tr...
Definition: TrackerTransform.h:113
Timestamp onPreUpdate(const Rendering::ViewRef &view, const Timestamp timestamp) override
Pre update event function.
Devices::Tracker::TrackerObjectEventSubscription trackerObjectEventSubscription_
The subscription object for tracker object events.
Definition: TrackerTransform.h:122
void onTrackerObjectEvent(const Devices::Tracker *trackerSender, const bool found, const Devices::Tracker::ObjectIdSet &objectIds, const Timestamp &timestamp)
Event function of object ids.
NodeSpecification specifyNode()
Specifies the node type and the fields of this node.
This class implements an abstract x3d grouping node.
Definition: X3DGroupingNode.h:34
This class implements a node environment container.
Definition: SDXNode.h:62
This class implements the base class for all nodes needing update calls regularly.
Definition: SDXUpdateNode.h:25
This class implements a timestamp.
Definition: Timestamp.h:36
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15