@@ -430,7 +430,7 @@ class BaseObject
430430 * - 40 to 49: windows rendering
431431 * \return Return the rendering priority
432432 */
433- Priority getRenderingPriority () const { return _renderingPriority; }
433+ Priority getRenderingPriority () const { return (Priority)(( int ) _renderingPriority + _priorityShift) ; }
434434
435435 /* *
436436 * \brief Set the rendering priority for this object
@@ -449,11 +449,13 @@ class BaseObject
449449 bool _savable{true }; // !< True if the object should be saved
450450
451451 protected:
452- unsigned long _id{0 }; // !< Internal ID of the object
453- std::string _type{" baseobject" }; // !< Internal type
454- std::string _remoteType{" " }; // !< When the object root is a Scene, this is the type of the corresponding object in the World
455- std::string _name{" " }; // !< Object name
452+ unsigned long _id{0 }; // !< Internal ID of the object
453+ std::string _type{" baseobject" }; // !< Internal type
454+ std::string _remoteType{" " }; // !< When the object root is a Scene, this is the type of the corresponding object in the World
455+ std::string _name{" " }; // !< Object name
456+
456457 Priority _renderingPriority{Priority::NO_RENDER}; // !< Rendering priority, if negative the object won't be rendered
458+ int _priorityShift{0 }; // !< Shift applied to rendering priority
457459
458460 bool _isConnectedToRemote{false }; // !< True if the object gets data from a World object
459461
@@ -593,8 +595,8 @@ class BufferObject : public BaseObject
593595 void updateTimestamp ();
594596
595597 protected:
596- mutable std::mutex _readMutex; // !< Read mutex locked when the object is read from
597- mutable std::mutex _writeMutex; // !< Write mutex locked when the object is written to
598+ mutable Spinlock _readMutex; // !< Read mutex locked when the object is read from
599+ mutable Spinlock _writeMutex; // !< Write mutex locked when the object is written to
598600 std::atomic_bool _serializedObjectWaiting{false }; // !< True if a serialized object has been set and waits for processing
599601 int64_t _timestamp{0 }; // !< Timestamp
600602 bool _updatedBuffer{false }; // !< True if the BufferObject has been updated
@@ -703,6 +705,7 @@ class RootObject : public BaseObject
703705 // Tasks queue
704706 std::recursive_mutex _taskMutex;
705707 std::list<std::function<void ()>> _taskQueue;
708+ std::map<std::string, std::function<void ()>> _recurringTasks;
706709
707710 /* *
708711 * \brief Wait for a BufferObject update. This does not prevent spurious wakeups.
@@ -724,6 +727,19 @@ class RootObject : public BaseObject
724727 */
725728 void addTask (const std::function<void ()>& task);
726729
730+ /* *
731+ * Add a task repeated at each frame
732+ * \param name Task name
733+ * \param task Task function
734+ */
735+ void addRecurringTask (const std::string& name, const std::function<void ()>& task);
736+
737+ /* *
738+ * Remove a recurring task
739+ * \param name Task name
740+ */
741+ void removeRecurringTask (const std::string& name);
742+
727743 /* *
728744 * \brief Execute all the tasks in the queue
729745 */
0 commit comments