8 #ifndef META_OCEAN_INTERACTION_EXPERIENCES_ANCHORED_CONTENT_MANAGER_H
9 #define META_OCEAN_INTERACTION_EXPERIENCES_ANCHORED_CONTENT_MANAGER_H
52 static constexpr
inline ContentId invalidContentId();
84 inline bool isTracked()
const;
110 inline bool isValid()
const;
149 bool isTracked_ =
false;
178 typedef std::unordered_map<ContentId, SharedContentObject>
ContentMap;
193 typedef std::pair<Devices::Tracker::TrackerObjectEventSubscription, unsigned int>
SubscriptionPair;
290 explicit inline operator bool()
const;
318 unsigned int contentIdCounter_ = 0u;
342 ocean_assert(isValid());
344 return renderingObjectNode_;
349 ocean_assert(isValid());
356 ocean_assert(isValid());
363 return bool(renderingObjectNode_);
371 inline AnchoredContentManager::operator bool()
const
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 implements the base class for all tracker devices.
Definition: devices/Tracker.h:39
This class implements a container for anchored content.
Definition: AnchoredContentManager.h:61
Lock lock_
The content's lock.
Definition: AnchoredContentManager.h:155
void setRenderingObjectNode(Rendering::NodeRef renderingObjectNode)
Updates or changes the rendering node holding the content to be rendered.
Devices::Tracker6DOF::ObjectId devicesObjectId_
The tracker object id of the anchor.
Definition: AnchoredContentManager.h:140
Rendering::NodeRef renderingObjectNode_
The rendering node holding the content to be rendered.
Definition: AnchoredContentManager.h:131
bool isValid() const
Returns whether this content object is valid.
Definition: AnchoredContentManager.h:361
Rendering::TransformRef renderingAnchorTransform_
The transform between scene and rendering node which will receive constant transformation updates fro...
Definition: AnchoredContentManager.h:134
Scalar sqrDistance() const
Returns the current square distance to the anchor.
Definition: AnchoredContentManager.h:354
Devices::Tracker6DOFRef devicesTracker_
The tracker providing the pose updates for the anchor.
Definition: AnchoredContentManager.h:137
Rendering::NodeRef renderingObjectNode() const
Returns the rendering node holding the content to be rendered.
Definition: AnchoredContentManager.h:340
bool isTracked() const
Returns whether the anchor is currently tracked.
Definition: AnchoredContentManager.h:347
ContentObject(const Rendering::NodeRef &renderingObjectNode, const Devices::Tracker6DOFRef &devicesTracker, const Devices::Tracker6DOF::ObjectId &devicesObjectId, const ContentId contentId, const Scalar visibilityRadius, const Scalar engagementRadius)
Creates a new content object.
ContentId contentId_
The object's unique content id.
Definition: AnchoredContentManager.h:128
ContentId contentId() const
Returns the unique id of this content object.
Definition: AnchoredContentManager.h:335
HomogenousMatrix4 world_T_object() const
Returns the transformation between object and world.
This class implements a manager for anchored content and allows to simplify creating experiences inte...
Definition: AnchoredContentManager.h:40
std::shared_ptr< ContentObject > SharedContentObject
Definition of a shared content object.
Definition: AnchoredContentManager.h:161
unsigned int ContentId
Definition of an id defining anchored content.
Definition: AnchoredContentManager.h:46
bool initialize(RemovedContentCallbackFunction removedContentCallbackFunction, const Rendering::SceneRef &scene)
Initializes the manager.
bool removeContent(const ContentId contentId)
Removes a content object from this manager.
static constexpr ContentId invalidContentId()
Returns an invalid content id.
Definition: AnchoredContentManager.h:330
TrackerToContentObjectMap trackerToContentObjectMap_
The tracker mapping trackers to content objects.
Definition: AnchoredContentManager.h:312
std::unordered_map< Devices::Tracker6DOF *, SubscriptionPair > SubscriptionMap
Definition of an unordered map mapping trackers to subscription pairs.
Definition: AnchoredContentManager.h:198
SharedContentObjectSet closeContents(const Scalar maxSqrDistance) const
Returns all contents which is closer than a given distance.
bool removeAllContent()
Removes all content object currently managed by this manager.
Timestamp preUpdate(const Rendering::EngineRef &engine, const Rendering::ViewRef &view, const Timestamp timestamp)
Pre update event function in which all visibility and pose updates will be handled.
~AnchoredContentManager()
Destructs the manager and releases all resources.
ContentMap contentMap_
The map containing the currently managed content objects.
Definition: AnchoredContentManager.h:306
Lock lock_
The manager's lock.
Definition: AnchoredContentManager.h:327
std::pair< Devices::Tracker::TrackerObjectEventSubscription, unsigned int > SubscriptionPair
Definition of pair combining a subscription id and a usage counter.
Definition: AnchoredContentManager.h:193
Rendering::SceneRef renderingScene_
The scene to which all rendering nodes will be added.
Definition: AnchoredContentManager.h:321
SharedContentObject content(const ContentId contentId) const
Returns a specific content.
std::unordered_set< SharedContentObject > SharedContentObjectSet
Definition of an unordered set holding content objects.
Definition: AnchoredContentManager.h:166
RemovedContentCallbackFunction removedContentCallbackFunction_
The callback function for removed content events.
Definition: AnchoredContentManager.h:324
AnchoredContentManager()
Creates a new manager object.
std::unordered_map< const Devices::Tracker6DOF *, SharedContentObject > TrackerToContentObjectMap
Definition of an unordered map mapping trackers to content objects.
Definition: AnchoredContentManager.h:188
std::unordered_multimap< Devices::Measurement::ObjectId, SharedContentObject > ObjectIdToContentObjectMultiMap
Definition of an unordered multimap mapping object ids to content objects.
Definition: AnchoredContentManager.h:183
ContentId addContent(const Rendering::NodeRef &renderingObjectNode, const Devices::Tracker6DOFRef &devicesTracker, const Devices::Tracker6DOF::ObjectId &devicesObjectId, const Scalar visibilityRadius, const Scalar engagementRadius)
Adds a new anchored content so that the manager will take care of visibility and pose updates.
ObjectIdToContentObjectMultiMap objectIdToContentObjectMultiMap_
The multi map mapping tracker object ids to content objects.
Definition: AnchoredContentManager.h:309
void release()
Releases this manager explicitly before.
Rendering::SceneRef scene() const
Returns the scene to which the rendering objects of new content will be added.
Definition: AnchoredContentManager.h:366
std::unordered_map< ContentId, SharedContentObject > ContentMap
Definition of an unordered map mapping content ids to content objects.
Definition: AnchoredContentManager.h:178
SharedContentObjectSet visibleContents() const
Returns all contents which are currently visible.
SubscriptionMap subscriptionMap_
The map mapping trackers to subscription ids.
Definition: AnchoredContentManager.h:315
void onTrackerObjects(const Devices::Tracker *tracker, const bool found, const Devices::Measurement::ObjectIdSet &objectIds, const Timestamp ×tamp)
Internal event function for tracker object events.
std::function< void(SharedContentObjectSet &&)> RemovedContentCallbackFunction
Definition of a callback function for removed object events.
Definition: AnchoredContentManager.h:171
This class implements a recursive lock object.
Definition: Lock.h:31
This class implements a timestamp.
Definition: Timestamp.h:36
unsigned int sqrDistance(const char first, const char second)
Returns the square distance between two values.
Definition: base/Utilities.h:1089
float Scalar
Definition of a scalar type.
Definition: Math.h:128
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15