Added support for an update OperationQueue to Viewer and CompositeViewer to allow asyncrnous adding of operations to be added
to the view to be done during syncronous updateTraversal(). This feature can be used for doing things like merging subgraphs that have been loaded in a background thread.
This commit is contained in:
@@ -109,6 +109,9 @@ class OSG_EXPORT OperationQueue : public Referenced
|
||||
|
||||
/** Remove all operations from OperationQueue.*/
|
||||
void removeAllOperations();
|
||||
|
||||
/** Run the operations. */
|
||||
void runOperations(Object* callingObject=0);
|
||||
|
||||
/** Call release on all operations. */
|
||||
void releaseAllOperations();
|
||||
|
||||
@@ -22,13 +22,17 @@
|
||||
namespace osgViewer {
|
||||
|
||||
/** CompsiteViewer holds a or more views to a one more scenes.*/
|
||||
class OSGVIEWER_EXPORT CompositeViewer : public osg::Referenced
|
||||
class OSGVIEWER_EXPORT CompositeViewer : public osg::Object
|
||||
{
|
||||
public:
|
||||
|
||||
CompositeViewer();
|
||||
|
||||
CompositeViewer(const CompositeViewer&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
CompositeViewer(osg::ArgumentParser& arguments);
|
||||
|
||||
META_Object(osg,CompositeViewer);
|
||||
|
||||
virtual ~CompositeViewer();
|
||||
|
||||
@@ -88,6 +92,18 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Referenced
|
||||
/** Get the end barrier position.*/
|
||||
BarrierPosition getEndBarrierPosition() const { return _endBarrierPosition; }
|
||||
|
||||
|
||||
|
||||
/** Set the EventVisitor. */
|
||||
void setEventVisitor(osgGA::EventVisitor* eventVisitor) { _eventVisitor = eventVisitor; }
|
||||
|
||||
/** Get the EventVisitor. */
|
||||
osgGA::EventVisitor* getEventVisitor() { return _eventVisitor.get(); }
|
||||
|
||||
/** Get the const EventVisitor. */
|
||||
const osgGA::EventVisitor* getEventVisitor() const { return _eventVisitor.get(); }
|
||||
|
||||
|
||||
void setEventQueue(osgGA::EventQueue* eventQueue) { _eventQueue = eventQueue; }
|
||||
osgGA::EventQueue* getEventQueue() { return _eventQueue.get(); }
|
||||
const osgGA::EventQueue* getEventQueue() const { return _eventQueue.get(); }
|
||||
@@ -107,6 +123,34 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Referenced
|
||||
/** @return true if the viewer respond to the QUIT_APPLICATION-event */
|
||||
bool getQuitEventSetsDone() const { return _quitEventSetsDone; }
|
||||
|
||||
|
||||
|
||||
/** Set the UpdateVisitor. */
|
||||
void setUpdateVisitor(osgUtil::UpdateVisitor* updateVisitor) { _updateVisitor = updateVisitor; }
|
||||
|
||||
/** Get the UpdateVisitor. */
|
||||
osgUtil::UpdateVisitor* getUpdateVisitor() { return _updateVisitor.get(); }
|
||||
|
||||
/** Get the const UpdateVisitor. */
|
||||
const osgUtil::UpdateVisitor* getUpdateVisitor() const { return _updateVisitor.get(); }
|
||||
|
||||
|
||||
/** Set the Update OperationQueue. */
|
||||
void setUpdateOperations(osg::OperationQueue* operations) { _updateOperations = operations; }
|
||||
|
||||
/** Get the Update OperationQueue. */
|
||||
osg::OperationQueue* getUpdateOperations() { return _updateOperations.get(); }
|
||||
|
||||
/** Get the const Update OperationQueue. */
|
||||
const osg::OperationQueue* getUpdateOperations() const { return _updateOperations.get(); }
|
||||
|
||||
/** Add an update operation.*/
|
||||
void addUpdateOperation(osg::Operation* operation);
|
||||
|
||||
/** Remove an update operation.*/
|
||||
void removeUpdateOperation(osg::Operation* operation);
|
||||
|
||||
|
||||
/** Execute a main frame loop.
|
||||
* Equivialant to while (!viewer.done()) viewer.frame();
|
||||
* Also calls realize() if the viewer is not already realized,
|
||||
|
||||
@@ -97,6 +97,17 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
|
||||
/** Get the end barrier position.*/
|
||||
BarrierPosition getEndBarrierPosition() const { return _endBarrierPosition; }
|
||||
|
||||
|
||||
|
||||
/** Set the EventVisitor. */
|
||||
void setEventVisitor(osgGA::EventVisitor* eventVisitor) { _eventVisitor = eventVisitor; }
|
||||
|
||||
/** Get the EventVisitor. */
|
||||
osgGA::EventVisitor* getEventVisitor() { return _eventVisitor.get(); }
|
||||
|
||||
/** Get the const EventVisitor. */
|
||||
const osgGA::EventVisitor* getEventVisitor() const { return _eventVisitor.get(); }
|
||||
|
||||
/** Set the key event that the viewer checks on each frame to see if the viewer's done flag should be set to
|
||||
* signal end of viewers main loop.
|
||||
* Default value is Escape (osgGA::GUIEVentAdapter::KEY_Escape).
|
||||
@@ -112,6 +123,36 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
|
||||
/** @return true if the viewer respond to the QUIT_APPLICATION-event */
|
||||
bool getQuitEventSetsDone() const { return _quitEventSetsDone; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** Set the UpdateVisitor. */
|
||||
void setUpdateVisitor(osgUtil::UpdateVisitor* updateVisitor) { _updateVisitor = updateVisitor; }
|
||||
|
||||
/** Get the UpdateVisitor. */
|
||||
osgUtil::UpdateVisitor* getUpdateVisitor() { return _updateVisitor.get(); }
|
||||
|
||||
/** Get the const UpdateVisitor. */
|
||||
const osgUtil::UpdateVisitor* getUpdateVisitor() const { return _updateVisitor.get(); }
|
||||
|
||||
|
||||
/** Set the Update OperationQueue. */
|
||||
void setUpdateOperations(osg::OperationQueue* operations) { _updateOperations = operations; }
|
||||
|
||||
/** Get the Update OperationQueue. */
|
||||
osg::OperationQueue* getUpdateOperations() { return _updateOperations.get(); }
|
||||
|
||||
/** Get the const Update OperationQueue. */
|
||||
const osg::OperationQueue* getUpdateOperations() const { return _updateOperations.get(); }
|
||||
|
||||
/** Add an update operation.*/
|
||||
void addUpdateOperation(osg::Operation* operation);
|
||||
|
||||
/** Remove an update operation.*/
|
||||
void removeUpdateOperation(osg::Operation* operation);
|
||||
|
||||
|
||||
/** Execute a main frame loop.
|
||||
* Equivialant to while (!viewer.done()) viewer.frame();
|
||||
* Also calls realize() if the viewer is not already realized,
|
||||
|
||||
Reference in New Issue
Block a user