8#ifndef META_OCEAN_SCENEDESCRIPTION_MANAGER_H
9#define META_OCEAN_SCENEDESCRIPTION_MANAGER_H
98class OCEAN_SCENEDESCRIPTION_EXPORT
Manager :
129 using NameSet = std::unordered_set<std::string>;
134 using EventNodes = std::unordered_map<NodeId, SDXEventNode*>;
274 NodeRef node(
const std::string& library,
const std::string& name)
const;
306 template <
typename T>
392 ocean_assert(library.first);
394 if (library.first->name() == name)
407 ocean_assert(i->first);
409 if (i->first->priority() < newLibrary->priority())
411 libraries_.insert(i, std::make_pair(std::move(newLibrary), 1u));
418 libraries_.emplace_back(std::make_pair(std::move(newLibrary), 1u));
This class implements a scoped lock object that locks two lock objects in a deterministic order based...
Definition Lock.h:341
This class is the base class for all plugin manager able to load and manager files.
Definition FileManager.h:26
std::map< std::string, std::string > FileExtensions
Definition of a map mapping supported file extensions to file type descriptions.
Definition FileManager.h:32
This class implements a recursive lock object.
Definition Lock.h:31
friend class SDXEventNode
Definition scenedescription/Manager.h:104
Lock managerLock_
Manager lock.
Definition scenedescription/Manager.h:370
Timestamp preUpdate(const std::string &library, const Rendering::ViewRef &view, const Timestamp timestamp)
Pre-updates all scene description objects of a specified library only.
std::map< SceneId, SDXSceneRef > PermanentSceneMap
Definition of a set holding permanent scene description objects.
Definition scenedescription/Manager.h:144
friend class SDXUpdateNode
Definition scenedescription/Manager.h:105
Manager()
Creates a new manager.
UpdateNodes updateNodes_
Map holding all update nodes.
Definition scenedescription/Manager.h:367
friend class Library
Definition scenedescription/Manager.h:103
bool unload(const SceneId sceneId)
Unloads a given permanent scene description objects.
bool unregisterLibrary(const std::string &name)
Unregisters a library.
std::unordered_map< NodeId, SDXEventNode * > EventNodes
Definition of a map mapping scene description node ids to event nodes.
Definition scenedescription/Manager.h:134
void mouseEvent(const ButtonType button, const ButtonEvent buttonEvent, const Vector2 &screenPosition, const Vector3 &objectPosition, const Rendering::ObjectId objectId, const Timestamp timestamp)
Sends a mouse event to be handled by the scene description.
void registerEventNode(SDXEventNode &node)
Registers a new event node.
void unregisterUpdateNode(SDXUpdateNode &node)
Unregisters an update node.
void unregisterEventNode(SDXEventNode &node)
Unregisters an event node.
SceneRef load(const std::string &filename, const Rendering::EngineRef &engine, const Timestamp ×tamp, const DescriptionType preferredDescriptionType=TYPE_PERMANENT, float *progress=nullptr, bool *cancel=nullptr)
Loads a new scene and creates a scene description hierarchy.
PermanentSceneMap permanentSceneMap_
Map holding all permanent scene description objects.
Definition scenedescription/Manager.h:361
LibraryNames libraries()
Returns a list of all registered libraries.
NodeRef node(const std::string &library, const std::string &name) const
Returns the node reference of the first available scene description node with a specified name define...
std::unordered_set< std::string > NameSet
Definition of a set holding library names.
Definition scenedescription/Manager.h:129
void keyEvent(const int key, const ButtonEvent buttonEvent, const Rendering::ObjectId objectId, const Timestamp timestamp)
Sends a key event to be handled by the scene description.
std::unordered_map< NodeId, SDXUpdateNode * > UpdateNodes
Definition of a map mapping scene description node ids to update nodes.
Definition scenedescription/Manager.h:139
bool handlesMouseEvents() const
Returns whether currently at least one scene description node handles mouse events.
Definition scenedescription/Manager.h:376
Strings LibraryNames
Definition of a vector holding library names.
Definition scenedescription/Manager.h:112
NodeRefs nodes(const std::string &name) const
Returns all node references of all available scene description nodes with a specified name.
Libraries libraries_
The vector holding all registered scene description libraries.
Definition scenedescription/Manager.h:358
void unloadScenes()
Unloads all permanent scene description objects.
Timestamp preUpdate(const Rendering::ViewRef &view, const Timestamp timestamp)
Pre-updates all scene description objects needing regularly pre updates.
NodeRefs nodes(const std::string &library, const std::string &name) const
Returns all node references of all available scene description nodes with a specified name defined in...
FileExtensions supportedExtensions()
Returns all currently supported file extensions.
void update(const Rendering::ViewRef &view, const Timestamp timestamp)
Updates all scene description objects needing regularly updates.
EventNodes eventNodes_
Map holding all event nodes.
Definition scenedescription/Manager.h:364
std::pair< LibraryRef, unsigned int > LibraryCounterPair
Definition of a pair combining a library with a reference counter.
Definition scenedescription/Manager.h:119
Lock libraryLock_
Library lock.
Definition scenedescription/Manager.h:373
bool registerLibrary(const std::string &name)
Registers a new library.
Definition scenedescription/Manager.h:384
void update(const std::string &library, const Rendering::ViewRef &view, const Timestamp timestamp)
Updates all scene description objects of a specified library only.
NodeRef node(const std::string &name) const
Returns the node reference of the first available scene description node with a specified name.
void registerUpdateNode(SDXUpdateNode &node)
Registers a new update node.
virtual ~Manager()
Destructs a manager.
void release()
Releases all scene library.
std::vector< LibraryCounterPair > Libraries
Definition of a vector holding library pairs.
Definition scenedescription/Manager.h:124
This class implements the base class for all nodes receiving event calls regularly.
Definition SDXEventNode.h:25
This class implements the base class for all nodes needing update calls regularly.
Definition SDXUpdateNode.h:25
This class implements a scoped lock object for recursive lock objects.
Definition Lock.h:147
This class implements a timestamp.
Definition Timestamp.h:64
std::vector< std::string > Strings
Definition of a vector holding strings.
Definition Base.h:162
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition Vector2.h:28
VectorT3< Scalar > Vector3
Definition of a 3D vector.
Definition Vector3.h:29
Ocean::ObjectRef< Engine > EngineRef
Definition of an engine reference object.
Definition Engine.h:30
size_t ObjectId
Definition of a object id.
Definition rendering/Rendering.h:59
SmartObjectRef< View > ViewRef
Definition of a smart object reference holding a view node.
Definition View.h:39
std::vector< NodeRef > NodeRefs
Definition of a vector holding scene description node references.
Definition scenedescription/Node.h:42
ButtonEvent
Definition of different device events.
Definition SceneDescription.h:92
DescriptionType
Definition of different scene description types.
Definition SceneDescription.h:64
SmartObjectRef< Scene, Node > SceneRef
Definition of a smart object reference for scene desciption scenes.
Definition scenedescription/Scene.h:28
Ocean::ObjectRef< Node > NodeRef
Definition of a scene description node reference with an internal reference counter.
Definition scenedescription/Node.h:36
ButtonType
Definition of different button types.
Definition SceneDescription.h:76
@ TYPE_PERMANENT
A scene description holding a permanent scene hierarchy allowing permanent access.
Definition SceneDescription.h:68
Namespace of the SceneDescription library.
Definition DynamicNode.h:21
size_t SceneId
Definition of a unique scene id.
Definition SceneDescription.h:52
The namespace covering the entire Ocean framework.
Definition Accessor.h:15