29 #include <osg/MatrixTransform>
30 #include <osg/ShapeDrawable>
32 #include "WGEGroupNode.h"
35 osg::MatrixTransform(),
36 m_childOperationQueueDirty( false ),
39 setDataVariance( osg::Object::DYNAMIC );
94 std::unique_lock<std::shared_mutex> lock;
119 for(
size_t i = 0; i < rootNode->getNumChildren(); )
124 rootNode->removeChild( i );
135 rootNode->removeChild( 0, rootNode->getNumChildren() );
142 rootNode->dirtyBound();
152 traverse( node, nv );
Update callback which inserts and removes nodes from m_childRemovalQueue and m_childInsertionQueue to...
virtual void operator()(osg::Node *node, osg::NodeVisitor *nv)
Callback method called by the NodeVisitor when visiting a node.
Class to wrap around the osg Group node and providing a thread safe add/removal mechanism.
void remove_if(std::shared_ptr< WGEGroupNode::NodePredicate > predicate)
Removes a node if the specified predicate evaluates to true.
bool m_childOperationQueueDirty
Flag denoting whether the m_childOperationQueue should be considered during the next update of the no...
virtual ~WGEGroupNode()
Destructor.
std::queue< std::shared_ptr< ChildOperation > > m_childOperationQueue
Queue of childs that need to be added/removed during the next update cycle.
std::shared_mutex m_childOperationQueueLock
Lock used for inserting and removing childs into the child insertion/removal queue.
void remove(osg::ref_ptr< osg::Node > node)
Removes the specified node from this group in a thread safe manner.
bool m_removeAll
True whenever all child nodes should be removed.
osg::ref_ptr< SafeUpdaterCallback > m_nodeUpdater
Node callback used to update this root node.
WGEGroupNode()
Default constructor.
@ CLEAR
remove all items where the predicate evaluates to true
@ REMOVE_IF
remove the specified node
@ REMOVE
insert the specified node
void clear()
Removes all children from this node.
void insert(osg::ref_ptr< osg::Node > node)
Adds the specified node to the child list of this node in a safe manner.
A struct denoting an operation on this group.