diff --git a/VisualStudio/osgWrappers/osg/wrapper_osg.dsp b/VisualStudio/osgWrappers/osg/wrapper_osg.dsp index 2aaadfbf2..4d4f80a02 100644 --- a/VisualStudio/osgWrappers/osg/wrapper_osg.dsp +++ b/VisualStudio/osgWrappers/osg/wrapper_osg.dsp @@ -223,6 +223,10 @@ SOURCE=..\..\..\src\osgWrappers\osg\CullStack.cpp SOURCE=..\..\..\src\osgWrappers\osg\CullingSet.cpp # End Source File +# Begin Source File +SOURCE=..\..\..\src\osgWrappers\osg\DeleteHandler.cpp +# End Source File + # Begin Source File SOURCE=..\..\..\src\osgWrappers\osg\Depth.cpp # End Source File diff --git a/examples/osgcatch/osgcatch.cpp b/examples/osgcatch/osgcatch.cpp index aa2bbb775..3574e3f1f 100644 --- a/examples/osgcatch/osgcatch.cpp +++ b/examples/osgcatch/osgcatch.cpp @@ -1354,20 +1354,21 @@ void GameEventHandler::createNewCatchable() _gameGroup->addChild(catchableObject->_object.get()); } -class CompileStateCallback : public osg::GraphicsOperation +class CompileStateCallback : public osg::Operation { public: CompileStateCallback(GameEventHandler* eh): - osg::GraphicsOperation("CompileStateCallback", false), + osg::Operation("CompileStateCallback", false), _gameEventHandler(eh) {} - virtual void operator()(osg::GraphicsContext* gc) - { - // OpenThreads::ScopedLock lock(_mutex); + virtual void operator () (osg::Object* object) + { + osg::GraphicsContext* context = dynamic_cast(object); + if (!context) return; if (_gameEventHandler) { - _gameEventHandler->compileGLObjects(*gc->getState()); + _gameEventHandler->compileGLObjects(*(context->getState())); } } diff --git a/examples/osgmotionblur/osgmotionblur.cpp b/examples/osgmotionblur/osgmotionblur.cpp index 9dc556682..864c137aa 100644 --- a/examples/osgmotionblur/osgmotionblur.cpp +++ b/examples/osgmotionblur/osgmotionblur.cpp @@ -14,18 +14,21 @@ #include #include -class MotionBlurOperation: public osg::GraphicsOperation +class MotionBlurOperation: public osg::Operation { public: MotionBlurOperation(double persistence): - osg::GraphicsOperation("MotionBlur",true), + osg::Operation("MotionBlur",true), cleared_(false), persistence_(persistence) { } - virtual void operator () (osg::GraphicsContext* gc) + virtual void operator () (osg::Object* object) { + osg::GraphicsContext* gc = dynamic_cast(object); + if (!gc) return; + double t = gc->getState()->getFrameStamp()->getSimulationTime(); if (!cleared_) diff --git a/examples/osgshaderterrain/osgshaderterrain.cpp b/examples/osgshaderterrain/osgshaderterrain.cpp index 6d537e29c..2eb86b672 100644 --- a/examples/osgshaderterrain/osgshaderterrain.cpp +++ b/examples/osgshaderterrain/osgshaderterrain.cpp @@ -240,18 +240,19 @@ osg::Node* createScene() return scene; } -class TestSupportOperation: public osg::GraphicsOperation +class TestSupportOperation: public osg::Operation { public: TestSupportOperation(): - osg::GraphicsOperation("TestSupportOperation",false), + osg::Operation("TestSupportOperation",false), _supported(true), _errorMessage() {} - virtual void operator () (osg::GraphicsContext* gc) + virtual void operator () (osg::Object* object) { - osg::notify(osg::NOTICE)<<"Not called"<(object); + if (!gc) return; OpenThreads::ScopedLock lock(_mutex); @@ -273,10 +274,11 @@ public: _errorMessage = "ERROR: vertex texturing not supported by OpenGL driver."; } } - - _supported = false; - _errorMessage = "ERROR: Pllalalal."; - + else + { + _supported = false; + _errorMessage = "ERROR: GLSL not supported."; + } } OpenThreads::Mutex _mutex; @@ -297,16 +299,10 @@ int main(int, char **) viewer.setUpViewAcrossAllScreens(); osg::ref_ptr testSupportOperation = new TestSupportOperation; - - osgViewer::Viewer::Windows windows; - viewer.getWindows(windows); - for(osgViewer::Viewer::Windows::iterator itr = windows.begin(); - itr != windows.end(); - ++itr) - { - (*itr)->add(testSupportOperation.get()); - } - +#if 0 + // temporily commenting out as its causing the viewer to crash... no clue yet to why + viewer.setRealizeOperation(testSupportOperation.get()); +#endif // create the windows and run the threads. viewer.realize(); diff --git a/include/osg/GraphicsContext b/include/osg/GraphicsContext index 1870a54b1..5955b691b 100644 --- a/include/osg/GraphicsContext +++ b/include/osg/GraphicsContext @@ -23,7 +23,7 @@ namespace osg { class Camera; /** Base class for providing Windowing API agnostic access to creating and managing graphics context.*/ -class OSG_EXPORT GraphicsContext : public Referenced +class OSG_EXPORT GraphicsContext : public Object { public: @@ -162,10 +162,10 @@ class OSG_EXPORT GraphicsContext : public Referenced public: /** Add operation to end of OperationQueue.*/ - void add(GraphicsOperation* operation); + void add(Operation* operation); /** Remove operation from OperationQueue.*/ - void remove(GraphicsOperation* operation); + void remove(Operation* operation); /** Remove named operation from OperationQueue.*/ void remove(const std::string& name); @@ -176,7 +176,7 @@ class OSG_EXPORT GraphicsContext : public Referenced /** Run the operations. */ void runOperations(); - typedef std::list< ref_ptr > OperationQueue; + typedef std::list< ref_ptr > OperationQueue; /** Get the operations queue, not you must use the OperationsMutex when accessing the queue.*/ OperationQueue& getOperationsQueue() { return _operations; } @@ -188,7 +188,7 @@ class OSG_EXPORT GraphicsContext : public Referenced osg::Block* getOperationsBlock() { return _operationsBlock.get(); } /** Get the current operations that is being run.*/ - GraphicsOperation* getCurrentOperation() { return _currentOperation.get(); } + Operation* getCurrentOperation() { return _currentOperation.get(); } public: @@ -271,13 +271,13 @@ class OSG_EXPORT GraphicsContext : public Referenced void createGraphicsThread(); /** Assign a graphics thread to the graphics context, so that the thread handles all OpenGL operations.*/ - void setGraphicsThread(GraphicsThread* gt); + void setGraphicsThread(OperationsThread* gt); /** Get the graphics thread assigned the graphics context.*/ - GraphicsThread* getGraphicsThread() { return _graphicsThread.get(); } + OperationsThread* getGraphicsThread() { return _graphicsThread.get(); } /** Get the const graphics thread assigned the graphics context.*/ - const GraphicsThread* getGraphicsThread() const { return _graphicsThread.get(); } + const OperationsThread* getGraphicsThread() const { return _graphicsThread.get(); } /** Realise the GraphicsContext implementation, @@ -351,9 +351,16 @@ class OSG_EXPORT GraphicsContext : public Referenced protected: GraphicsContext(); + GraphicsContext(const GraphicsContext&, const osg::CopyOp&); virtual ~GraphicsContext(); - + + virtual Object* cloneType() const { return 0; } + virtual Object* clone(const CopyOp&) const { return 0; } + virtual bool isSameKindAs(const Object* object) const { return dynamic_cast(object)!=0; } + virtual const char* libraryName() const { return "osg"; } + virtual const char* className() const { return "GraphicsContext"; } + void addCamera(osg::Camera* camera); void removeCamera(osg::Camera* camera); @@ -372,9 +379,9 @@ class OSG_EXPORT GraphicsContext : public Referenced OpenThreads::Mutex _operationsMutex; osg::ref_ptr _operationsBlock; OperationQueue _operations; - osg::ref_ptr _currentOperation; + osg::ref_ptr _currentOperation; - ref_ptr _graphicsThread; + ref_ptr _graphicsThread; ref_ptr _resizedCallback; diff --git a/include/osg/GraphicsThread b/include/osg/GraphicsThread index 0d7d37987..559b523ea 100644 --- a/include/osg/GraphicsThread +++ b/include/osg/GraphicsThread @@ -14,7 +14,9 @@ #ifndef OSG_GRAPHICSTHREAD #define OSG_GRAPHICSTHREAD 1 -#include +#include +#include + #include #include #include @@ -23,9 +25,6 @@ namespace osg { -// forward declare GraphicsContext -class GraphicsContext; - class Block: virtual public osg::Referenced { public: Block():_released(false) {} @@ -76,13 +75,13 @@ class Block: virtual public osg::Referenced { }; /** Base class for implementing graphics operations.*/ -struct GraphicsOperation : virtual public Referenced +struct Operation : virtual public Referenced { - GraphicsOperation(const std::string& name, bool keep): + Operation(const std::string& name, bool keep): _name(name), _keep(keep) {} - virtual ~GraphicsOperation() {} + virtual ~Operation() {} /** Set the human readable name of the operation.*/ void setName(const std::string& name) { _name = name; } @@ -100,25 +99,31 @@ struct GraphicsOperation : virtual public Referenced virtual void release() {} /** Do the actual task of this operation.*/ - virtual void operator () (GraphicsContext*) {} + virtual void operator () (Object*) = 0; std::string _name; bool _keep; }; /** GraphicsThread is a helper class for running OpenGL GraphicsOperation within a single thread assigned to a specific GraphicsContext.*/ -class OSG_EXPORT GraphicsThread : public Referenced, public OpenThreads::Thread +class OSG_EXPORT OperationsThread : public Referenced, public OpenThreads::Thread { public: - GraphicsThread(); + OperationsThread(); + + void setParent(Object* parent) { _parent = parent; } + + Object* getParent() { return _parent.get(); } + + const Object* getParent() const { return _parent.get(); } /** Add operation to end of OperationQueue, this will be * executed by the graphics thread once this operation gets to the head of the queue.*/ - void add(GraphicsOperation* operation, bool waitForCompletion=false); + void add(Operation* operation, bool waitForCompletion=false); /** Remove operation from OperationQueue.*/ - void remove(GraphicsOperation* operation); + void remove(Operation* operation); /** Remove named operation from OperationQueue.*/ void remove(const std::string& name); @@ -127,7 +132,7 @@ class OSG_EXPORT GraphicsThread : public Referenced, public OpenThreads::Thread void removeAllOperations(); /** Get the operation currently being run.*/ - osg::ref_ptr getCurrentOperation() { return _currentOperation; } + osg::ref_ptr getCurrentOperation() { return _currentOperation; } /** Run does the graphics thread run loop.*/ virtual void run(); @@ -141,34 +146,33 @@ class OSG_EXPORT GraphicsThread : public Referenced, public OpenThreads::Thread protected: - virtual ~GraphicsThread(); + virtual ~OperationsThread(); - friend class GraphicsContext; - GraphicsContext* _graphicsContext; + observer_ptr _parent; - typedef std::list< ref_ptr > OperationQueue; + typedef std::list< ref_ptr > OperationQueue; bool _done; OpenThreads::Mutex _operationsMutex; osg::ref_ptr _operationsBlock; OperationQueue _operations; - osg::ref_ptr _currentOperation; + osg::ref_ptr _currentOperation; }; /** SwapBufferOperation calls swap buffers on the GraphicsContext.*/ -struct OSG_EXPORT SwapBuffersOperation : public GraphicsOperation +struct OSG_EXPORT SwapBuffersOperation : public Operation { SwapBuffersOperation(): - GraphicsOperation("SwapBuffers",true) {} + Operation("SwapBuffers",true) {} - virtual void operator () (GraphicsContext* context); + virtual void operator () (Object* context); }; /** BarrierOperation allows one to syncronize multiple GraphicsThreads with each other.*/ -struct OSG_EXPORT BarrierOperation : public GraphicsOperation, public OpenThreads::Barrier +struct OSG_EXPORT BarrierOperation : public Operation, public OpenThreads::Barrier { enum PreBlockOp { @@ -178,27 +182,27 @@ struct OSG_EXPORT BarrierOperation : public GraphicsOperation, public OpenThread }; BarrierOperation(int numThreads, PreBlockOp op=NO_OPERATION): - GraphicsOperation("Barrier", true), + Operation("Barrier", true), OpenThreads::Barrier(numThreads), _preBlockOp(op) {} virtual void release(); - virtual void operator () (GraphicsContext* context); + virtual void operator () (Object* context); PreBlockOp _preBlockOp; }; /** ReleaseContext_Block_MakeCurrentOperation releases the context for another thread to aquire, * then blocks waiting for context to be released, once the block is release the context is re-aqquired.*/ -struct OSG_EXPORT ReleaseContext_Block_MakeCurrentOperation : public GraphicsOperation, public Block +struct OSG_EXPORT ReleaseContext_Block_MakeCurrentOperation : public Operation, public Block { ReleaseContext_Block_MakeCurrentOperation(): - GraphicsOperation("ReleaseContext_Block_MakeCurrent", false) {} + Operation("ReleaseContext_Block_MakeCurrent", false) {} virtual void release(); - virtual void operator () (GraphicsContext* context); + virtual void operator () (Object* context); }; } diff --git a/include/osgViewer/CompositeViewer b/include/osgViewer/CompositeViewer index b1f7a5482..6075e97fe 100644 --- a/include/osgViewer/CompositeViewer +++ b/include/osgViewer/CompositeViewer @@ -140,10 +140,10 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Referenced /** Set the graphics operation to call on realization of the viewers graphics windows.*/ - void setRealizeOperation(osg::GraphicsOperation* op) { _realizeOperation = op; } + void setRealizeOperation(osg::Operation* op) { _realizeOperation = op; } /** Get the graphics operation to call on realization of the viewers graphics windows.*/ - osg::GraphicsOperation* getRealizeOperation() { return _realizeOperation.get(); } + osg::Operation* getRealizeOperation() { return _realizeOperation.get(); } /** Stop any threads begin run by viewer.*/ void stopThreading(); @@ -151,7 +151,7 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Referenced /** Start any threads required by the viewer, as per viewers ThreadingModel.*/ void startThreading(); - /** Set up the GraphicsOperations to render the various viewer cameras on the viewers graphics windows.*/ + /** Set up the Operations to render the various viewer cameras on the viewers graphics windows.*/ void setUpRenderingSupport(); @@ -191,7 +191,7 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Referenced osg::ref_ptr _eventQueue; osg::ref_ptr _eventVisitor; - osg::ref_ptr _realizeOperation; + osg::ref_ptr _realizeOperation; }; diff --git a/include/osgViewer/Viewer b/include/osgViewer/Viewer index 46b0ce9a9..cbd4ce914 100644 --- a/include/osgViewer/Viewer +++ b/include/osgViewer/Viewer @@ -134,10 +134,10 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View void getCameras(Cameras& cameras, bool onlyActive=true); /** Set the graphics operation to call on realization of the viewers graphics windows.*/ - void setRealizeOperation(osg::GraphicsOperation* op) { _realizeOperation = op; } + void setRealizeOperation(osg::Operation* op) { _realizeOperation = op; } /** Get the graphics operation to call on realization of the viewers graphics windows.*/ - osg::GraphicsOperation* getRealizeOperation() { return _realizeOperation.get(); } + osg::Operation* getRealizeOperation() { return _realizeOperation.get(); } /** Stop any threads begin run by viewer.*/ void stopThreading(); @@ -145,7 +145,7 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View /** Start any threads required by the viewer, as per viewers ThreadingModel.*/ void startThreading(); - /** Set up the GraphicsOperations to render the various viewer cameras on the viewers graphics windows.*/ + /** Set up the Operations to render the various viewer cameras on the viewers graphics windows.*/ void setUpRenderingSupport(); protected: @@ -182,7 +182,7 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View osg::ref_ptr _eventVisitor; - osg::ref_ptr _realizeOperation; + osg::ref_ptr _realizeOperation; }; diff --git a/src/osg/GraphicsContext.cpp b/src/osg/GraphicsContext.cpp index 04a363a22..24d1bdc38 100644 --- a/src/osg/GraphicsContext.cpp +++ b/src/osg/GraphicsContext.cpp @@ -140,6 +140,15 @@ GraphicsContext::GraphicsContext(): _operationsBlock = new Block; } +GraphicsContext::GraphicsContext(const GraphicsContext&, const osg::CopyOp&): + _clearColor(osg::Vec4(0.0f,0.0f,0.0f,1.0f)), + _clearMask(0), + _threadOfLastMakeCurrent(0) +{ + setThreadSafeRefUnref(true); + _operationsBlock = new Block; +} + GraphicsContext::~GraphicsContext() { close(false); @@ -298,11 +307,11 @@ void GraphicsContext::createGraphicsThread() { if (!_graphicsThread) { - setGraphicsThread(new GraphicsThread); + setGraphicsThread(new OperationsThread); } } -void GraphicsContext::setGraphicsThread(GraphicsThread* gt) +void GraphicsContext::setGraphicsThread(OperationsThread* gt) { if (_graphicsThread==gt) return; @@ -310,18 +319,18 @@ void GraphicsContext::setGraphicsThread(GraphicsThread* gt) { // need to kill the thread in some way... _graphicsThread->cancel(); - _graphicsThread->_graphicsContext = 0; + _graphicsThread->setParent(0); } _graphicsThread = gt; if (_graphicsThread.valid()) { - _graphicsThread->_graphicsContext = this; + _graphicsThread->setParent(this); } } -void GraphicsContext::add(GraphicsOperation* operation) +void GraphicsContext::add(Operation* operation) { osg::notify(osg::INFO)<<"Doing add"<set(true); } -void GraphicsContext::remove(GraphicsOperation* operation) +void GraphicsContext::remove(Operation* operation) { osg::notify(osg::INFO)<<"Doing remove operation"<closeImplementation(); - - osg::notify(osg::INFO)<<" - done close context "<<_context<releaseContext(); - } - } - } - - osg::GraphicsContext* _context; - bool _closeContextOnExit; - - -}; - -struct BlockOperation : public GraphicsOperation, public Block +struct BlockOperation : public Operation, public Block { BlockOperation(): - GraphicsOperation("Block",false) + Operation("Block",false) { reset(); } @@ -69,7 +32,7 @@ struct BlockOperation : public GraphicsOperation, public Block Block::release(); } - virtual void operator () (GraphicsContext*) + virtual void operator () (Object*) { glFlush(); Block::release(); @@ -77,14 +40,14 @@ struct BlockOperation : public GraphicsOperation, public Block }; -GraphicsThread::GraphicsThread(): - _graphicsContext(0), +OperationsThread::OperationsThread(): + _parent(0), _done(false) { _operationsBlock = new Block; } -GraphicsThread::~GraphicsThread() +OperationsThread::~OperationsThread() { //osg::notify(osg::NOTICE)<<"Destructing graphics thread "<isRealized()) - { -#if 0 - - osg::notify(osg::NOTICE)<<"Forced to do a realize in GraphicsThread::run."<realize(); - - contextRealizedInThisThread = true; -#else - while (!_graphicsContext->isRealized() && !_done) - { - osg::notify(osg::INFO)<<"Waiting in GraphicsThread::run for GraphicsContext to realize."<makeCurrentImplementation(); + GraphicsContext* graphicsContext = dynamic_cast(_parent.get()); + if (graphicsContext) + { + graphicsContext->makeCurrentImplementation(); } - // _graphicsContext->makeCurrentImplementation(); - - // create a local object to clean up once the thread is cancelled. - ThreadExitTidyUp threadExitTypeUp(_graphicsContext, contextRealizedInThisThread); - osg::notify(osg::INFO)<<"Doing run "<getName()<<" "< lock(_operationsMutex); @@ -369,15 +308,19 @@ void GraphicsThread::run() // osg::notify(osg::NOTICE)<<"operations.size()="<<_operations.size()<<" done="<<_done<<" testCancel()"<releaseContext(); + + if (graphicsContext) + { + graphicsContext->releaseContext(); + } osg::notify(osg::INFO)<<"exit loop "<(object); + if (!context) return; + // osg::notify(osg::NOTICE)<<"DrawInnerOperation operator"<(object); + if (!context) return; + // OpenThreads::ScopedLock lock(mutex); // osg::notify(osg::NOTICE)<<"Compile "<makeCurrentImplementation(); - osgUtil::GLObjectsVisitor compileVisitor; compileVisitor.setState(context->getState()); @@ -238,19 +239,20 @@ struct CompositeViewerCompileOperation : public osg::GraphicsOperation // Draw operation, that does a draw on the scene graph. -struct CompositeViewerRunOperations : public osg::GraphicsOperation +struct CompositeViewerRunOperations : public osg::Operation { CompositeViewerRunOperations(): - osg::GraphicsOperation("RunOperation",true) + osg::Operation("RunOperation",true) { } - virtual void operator () (osg::GraphicsContext* gc) + virtual void operator () (osg::Object* object) { - gc->runOperations(); + osg::GraphicsContext* context = dynamic_cast(object); + if (!context) return; + + context->runOperations(); } - - osg::GraphicsContext* _originalContext; }; unsigned int CompositeViewer::computeNumberOfThreadsIncludingMainRequired() @@ -500,17 +502,17 @@ void CompositeViewer::getScenes(Scenes& scenes, bool onlyValid) // Draw operation, that does a draw on the scene graph. -struct CompositeViewerRenderingOperation : public osg::GraphicsOperation +struct CompositeViewerRenderingOperation : public osg::Operation { CompositeViewerRenderingOperation(osgUtil::SceneView* sceneView, osgDB::DatabasePager* databasePager): - osg::GraphicsOperation("Render",true), + osg::Operation("Render",true), _sceneView(sceneView), _databasePager(databasePager) { _sceneView->getCullVisitor()->setDatabaseRequestHandler(_databasePager.get()); } - virtual void operator () (osg::GraphicsContext*) + virtual void operator () (osg::Object*) { if (!_sceneView) return; diff --git a/src/osgViewer/Viewer.cpp b/src/osgViewer/Viewer.cpp index 8222bd898..69a59f440 100644 --- a/src/osgViewer/Viewer.cpp +++ b/src/osgViewer/Viewer.cpp @@ -124,10 +124,10 @@ public: // Draw operation, that does a draw on the scene graph. -struct ViewerRenderingOperation : public osg::GraphicsOperation, public ViewerQuerySupport +struct ViewerRenderingOperation : public osg::Operation, public ViewerQuerySupport { ViewerRenderingOperation(osgUtil::SceneView* sceneView, osgDB::DatabasePager* databasePager, osg::Timer_t startTick): - osg::GraphicsOperation("Render",true), + osg::Operation("Render",true), ViewerQuerySupport(startTick), _sceneView(sceneView), _databasePager(databasePager) @@ -135,7 +135,7 @@ struct ViewerRenderingOperation : public osg::GraphicsOperation, public ViewerQu _sceneView->getCullVisitor()->setDatabaseRequestHandler(_databasePager.get()); } - virtual void operator () (osg::GraphicsContext*) + virtual void operator () (osg::Object*) { if (!_sceneView) return; @@ -217,10 +217,10 @@ struct ViewerRenderingOperation : public osg::GraphicsOperation, public ViewerQu // Draw operation, that does a draw on the scene graph. -struct ViewerDoubleBufferedRenderingOperation : public osg::GraphicsOperation, public ViewerQuerySupport +struct ViewerDoubleBufferedRenderingOperation : public osg::Operation, public ViewerQuerySupport { ViewerDoubleBufferedRenderingOperation(bool graphicsThreadDoesCull, osgUtil::SceneView* sv0, osgUtil::SceneView* sv1, osgDB::DatabasePager* databasePager, osg::Timer_t startTick): - osg::GraphicsOperation("Render",true), + osg::Operation("Render",true), ViewerQuerySupport(startTick), _graphicsThreadDoesCull(graphicsThreadDoesCull), _done(false), @@ -487,8 +487,11 @@ struct ViewerDoubleBufferedRenderingOperation : public osg::GraphicsOperation, p } } - virtual void operator () (osg::GraphicsContext*) + virtual void operator () (osg::Object* object) { + osg::GraphicsContext* context = dynamic_cast(object); + if (!context) return; + //osg::notify(osg::NOTICE)<<"GraphicsCall "<(object); + if (!context) return; + // OpenThreads::ScopedLock lock(mutex); // osg::notify(osg::NOTICE)<<"Compile "<runOperations(); + osg::GraphicsContext* context = dynamic_cast(object); + if (!context) return; + + context->runOperations(); } }; diff --git a/src/osgWrappers/osg/DeleteHandler.cpp b/src/osgWrappers/osg/DeleteHandler.cpp new file mode 100644 index 000000000..0f9b88ac1 --- /dev/null +++ b/src/osgWrappers/osg/DeleteHandler.cpp @@ -0,0 +1,76 @@ +// *************************************************************************** +// +// Generated automatically by genwrapper. +// Please DO NOT EDIT this file! +// +// *************************************************************************** + +#include +#include +#include +#include + +#include +#include + +// Must undefine IN and OUT macros defined in Windows headers +#ifdef IN +#undef IN +#endif +#ifdef OUT +#undef OUT +#endif + +TYPE_NAME_ALIAS(std::pair< int COMMA const osg::Referenced * >, osg::DeleteHandler::FrameNumberObjectPair); + +TYPE_NAME_ALIAS(std::list< osg::DeleteHandler::FrameNumberObjectPair >, osg::DeleteHandler::ObjectsToDeleteList); + +BEGIN_VALUE_REFLECTOR(osg::DeleteHandler) + I_ConstructorWithDefaults1(IN, int, numberOfFramesToRetainObjects, 0, + ____DeleteHandler__int, + "", + ""); + I_Method1(void, setNumFramesToRetainObjects, IN, int, numberOfFramesToRetainObjects, + __void__setNumFramesToRetainObjects__int, + "Set the number of frames to retain objects that are have been requested for deletion. ", + "When set to zero objects are deleted immediately, by set to 1 there are kept around for an extra frame etc. The ability to retain obejcts for several frames is useful to prevent premature deletion when objects are stil be used the graphics threads that are using double buffering of rendering data structures with non ref_ptr<> pointers to scene graph elements. "); + I_Method0(int, getNumFramesToRetainObjects, + __int__getNumFramesToRetainObjects, + "", + ""); + I_Method1(void, setFrameNumber, IN, int, frameNumber, + __void__setFrameNumber__int, + "Set the current frame numberso that subsequent deletes get tagged as associated with this frame. ", + ""); + I_Method0(int, getFrameNumber, + __int__getFrameNumber, + "Get the current frame number. ", + ""); + I_Method1(void, doDelete, IN, const osg::Referenced *, object, + __void__doDelete__C5_Referenced_P1, + "", + ""); + I_Method0(void, flush, + __void__flush, + "Flush objects that ready to be fully deleted. ", + ""); + I_Method0(void, flushAll, + __void__flushAll, + "Flush all objects that the DeleteHandler holds. ", + "Note, this should only be called if there are no threads running with non ref_ptr<> pointers, such as graphics threads. "); + I_Method1(void, requestDelete, IN, const osg::Referenced *, object, + __void__requestDelete__C5_osg_Referenced_P1, + "Request the deletion of an object. ", + "Depending on users implementation of DeleteHandler, the delete of the object may occur straight away or be delayed until doDelete is called. The default implementation does a delete straight away. "); + I_SimpleProperty(int, FrameNumber, + __int__getFrameNumber, + __void__setFrameNumber__int); + I_SimpleProperty(int, NumFramesToRetainObjects, + 0, + __void__setNumFramesToRetainObjects__int); +END_REFLECTOR + +STD_LIST_REFLECTOR(std::list< osg::DeleteHandler::FrameNumberObjectPair >); + +STD_PAIR_REFLECTOR(std::pair< int COMMA const osg::Referenced * >); + diff --git a/src/osgWrappers/osg/GNUmakefile b/src/osgWrappers/osg/GNUmakefile index 28313e284..04b55de29 100644 --- a/src/osgWrappers/osg/GNUmakefile +++ b/src/osgWrappers/osg/GNUmakefile @@ -34,6 +34,7 @@ CXXFILES =\ CullSettings.cpp\ CullStack.cpp\ CullingSet.cpp\ + DeleteHandler.cpp\ Depth.cpp\ DisplaySettings.cpp\ DrawPixels.cpp\ diff --git a/src/osgWrappers/osg/GraphicsContext.cpp b/src/osgWrappers/osg/GraphicsContext.cpp index 81b2aa7c3..7606665c6 100644 --- a/src/osgWrappers/osg/GraphicsContext.cpp +++ b/src/osgWrappers/osg/GraphicsContext.cpp @@ -25,16 +25,18 @@ #include +TYPE_NAME_ALIAS(std::list< osg::ref_ptr< osg::Operation > >, osg::GraphicsContext::OperationQueue); + TYPE_NAME_ALIAS(std::list< osg::Camera * >, osg::GraphicsContext::Cameras); BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::GraphicsContext) - I_BaseType(osg::Referenced); - I_Method1(void, add, IN, osg::GraphicsOperation *, operation, - __void__add__GraphicsOperation_P1, + I_BaseType(osg::Object); + I_Method1(void, add, IN, osg::Operation *, operation, + __void__add__Operation_P1, "Add operation to end of OperationQueue. ", ""); - I_Method1(void, remove, IN, osg::GraphicsOperation *, operation, - __void__remove__GraphicsOperation_P1, + I_Method1(void, remove, IN, osg::Operation *, operation, + __void__remove__Operation_P1, "Remove operation from OperationQueue. ", ""); I_Method1(void, remove, IN, const std::string &, name, @@ -49,6 +51,22 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::GraphicsContext) __void__runOperations, "Run the operations. ", ""); + I_Method0(osg::GraphicsContext::OperationQueue &, getOperationsQueue, + __OperationQueue_R1__getOperationsQueue, + "Get the operations queue, not you must use the OperationsMutex when accessing the queue. ", + ""); + I_Method0(OpenThreads::Mutex &, getOperationsMutex, + __OpenThreads_Mutex_R1__getOperationsMutex, + "Get the operations queue mutex. ", + ""); + I_Method0(osg::Block *, getOperationsBlock, + __osg_Block_P1__getOperationsBlock, + "Get the operations queue block used to mark an empty queue, if you end items into the empty queu you must release this block. ", + ""); + I_Method0(osg::Operation *, getCurrentOperation, + __Operation_P1__getCurrentOperation, + "Get the current operations that is being run. ", + ""); I_Method0(const osg::GraphicsContext::Traits *, getTraits, __C5_Traits_P1__getTraits, "Get the traits of the GraphicsContext. ", @@ -129,16 +147,16 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::GraphicsContext) __void__createGraphicsThread, "Create a graphics thread to the graphics context, so that the thread handles all OpenGL operations. ", ""); - I_Method1(void, setGraphicsThread, IN, osg::GraphicsThread *, gt, - __void__setGraphicsThread__GraphicsThread_P1, + I_Method1(void, setGraphicsThread, IN, osg::OperationsThread *, gt, + __void__setGraphicsThread__OperationsThread_P1, "Assign a graphics thread to the graphics context, so that the thread handles all OpenGL operations. ", ""); - I_Method0(osg::GraphicsThread *, getGraphicsThread, - __GraphicsThread_P1__getGraphicsThread, + I_Method0(osg::OperationsThread *, getGraphicsThread, + __OperationsThread_P1__getGraphicsThread, "Get the graphics thread assigned the graphics context. ", ""); - I_Method0(const osg::GraphicsThread *, getGraphicsThread, - __C5_GraphicsThread_P1__getGraphicsThread, + I_Method0(const osg::OperationsThread *, getGraphicsThread, + __C5_OperationsThread_P1__getGraphicsThread, "Get the const graphics thread assigned the graphics context. ", ""); I_Method0(bool, realizeImplementation, @@ -234,9 +252,21 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::GraphicsContext) I_SimpleProperty(GLbitfield, ClearMask, __GLbitfield__getClearMask, __void__setClearMask__GLbitfield); - I_SimpleProperty(osg::GraphicsThread *, GraphicsThread, - __GraphicsThread_P1__getGraphicsThread, - __void__setGraphicsThread__GraphicsThread_P1); + I_SimpleProperty(osg::Operation *, CurrentOperation, + __Operation_P1__getCurrentOperation, + 0); + I_SimpleProperty(osg::OperationsThread *, GraphicsThread, + __OperationsThread_P1__getGraphicsThread, + __void__setGraphicsThread__OperationsThread_P1); + I_SimpleProperty(osg::Block *, OperationsBlock, + __osg_Block_P1__getOperationsBlock, + 0); + I_SimpleProperty(OpenThreads::Mutex &, OperationsMutex, + __OpenThreads_Mutex_R1__getOperationsMutex, + 0); + I_SimpleProperty(osg::GraphicsContext::OperationQueue &, OperationsQueue, + __OperationQueue_R1__getOperationsQueue, + 0); I_SimpleProperty(osg::GraphicsContext::ResizedCallback *, ResizedCallback, __ResizedCallback_P1__getResizedCallback, __void__setResizedCallback__ResizedCallback_P1); @@ -340,5 +370,40 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::GraphicsContext::WindowingSystemInterface) ""); END_REFLECTOR +BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osg::Operation >) + I_Constructor0(____ref_ptr, + "", + ""); + I_Constructor1(IN, osg::Operation *, ptr, + ____ref_ptr__T_P1, + "", + ""); + I_Constructor1(IN, const osg::ref_ptr< osg::Operation > &, rp, + ____ref_ptr__C5_ref_ptr_R1, + "", + ""); + I_Method0(osg::Operation *, get, + __T_P1__get, + "", + ""); + I_Method0(bool, valid, + __bool__valid, + "", + ""); + I_Method0(osg::Operation *, release, + __T_P1__release, + "", + ""); + I_Method1(void, swap, IN, osg::ref_ptr< osg::Operation > &, rp, + __void__swap__ref_ptr_R1, + "", + ""); + I_SimpleProperty(osg::Operation *, , + __T_P1__get, + 0); +END_REFLECTOR + STD_LIST_REFLECTOR(std::list< osg::Camera * >); +STD_LIST_REFLECTOR(std::list< osg::ref_ptr< osg::Operation > >); + diff --git a/src/osgWrappers/osg/GraphicsThread.cpp b/src/osgWrappers/osg/GraphicsThread.cpp index 81527a35a..f73a2df13 100644 --- a/src/osgWrappers/osg/GraphicsThread.cpp +++ b/src/osgWrappers/osg/GraphicsThread.cpp @@ -10,8 +10,8 @@ #include #include -#include #include +#include // Must undefine IN and OUT macros defined in Windows headers #ifdef IN @@ -28,7 +28,7 @@ BEGIN_ENUM_REFLECTOR(osg::BarrierOperation::PreBlockOp) END_REFLECTOR BEGIN_OBJECT_REFLECTOR(osg::BarrierOperation) - I_BaseType(osg::GraphicsOperation); + I_BaseType(osg::Operation); I_ConstructorWithDefaults2(IN, int, numThreads, , IN, osg::BarrierOperation::PreBlockOp, op, osg::BarrierOperation::NO_OPERATION, ____BarrierOperation__int__PreBlockOp, "", @@ -63,10 +63,10 @@ BEGIN_OBJECT_REFLECTOR(osg::Block) ""); END_REFLECTOR -BEGIN_OBJECT_REFLECTOR(osg::GraphicsOperation) +BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Operation) I_VirtualBaseType(osg::Referenced); I_Constructor2(IN, const std::string &, name, IN, bool, keep, - ____GraphicsOperation__C5_std_string_R1__bool, + ____Operation__C5_std_string_R1__bool, "", ""); I_Method1(void, setName, IN, const std::string &, name, @@ -99,17 +99,29 @@ BEGIN_OBJECT_REFLECTOR(osg::GraphicsOperation) I_PublicMemberProperty(bool, _keep); END_REFLECTOR -BEGIN_OBJECT_REFLECTOR(osg::GraphicsThread) +BEGIN_OBJECT_REFLECTOR(osg::OperationsThread) I_BaseType(osg::Referenced); - I_Constructor0(____GraphicsThread, + I_Constructor0(____OperationsThread, "", ""); - I_MethodWithDefaults2(void, add, IN, osg::GraphicsOperation *, operation, , IN, bool, waitForCompletion, false, - __void__add__GraphicsOperation_P1__bool, + I_Method1(void, setParent, IN, osg::Object *, parent, + __void__setParent__Object_P1, + "", + ""); + I_Method0(osg::Object *, getParent, + __Object_P1__getParent, + "", + ""); + I_Method0(const osg::Object *, getParent, + __C5_Object_P1__getParent, + "", + ""); + I_MethodWithDefaults2(void, add, IN, osg::Operation *, operation, , IN, bool, waitForCompletion, false, + __void__add__Operation_P1__bool, "Add operation to end of OperationQueue, this will be executed by the graphics thread once this operation gets to the head of the queue. ", ""); - I_Method1(void, remove, IN, osg::GraphicsOperation *, operation, - __void__remove__GraphicsOperation_P1, + I_Method1(void, remove, IN, osg::Operation *, operation, + __void__remove__Operation_P1, "Remove operation from OperationQueue. ", ""); I_Method1(void, remove, IN, const std::string &, name, @@ -120,8 +132,8 @@ BEGIN_OBJECT_REFLECTOR(osg::GraphicsThread) __void__removeAllOperations, "Remove all operations from OperationQueue. ", ""); - I_Method0(osg::ref_ptr< osg::GraphicsOperation >, getCurrentOperation, - __osg_ref_ptrT1_GraphicsOperation___getCurrentOperation, + I_Method0(osg::ref_ptr< osg::Operation >, getCurrentOperation, + __osg_ref_ptrT1_Operation___getCurrentOperation, "Get the operation currently being run. ", ""); I_Method0(void, run, @@ -140,16 +152,19 @@ BEGIN_OBJECT_REFLECTOR(osg::GraphicsThread) __int__cancel, "Cancel this graphics thread. ", ""); - I_SimpleProperty(osg::ref_ptr< osg::GraphicsOperation >, CurrentOperation, - __osg_ref_ptrT1_GraphicsOperation___getCurrentOperation, + I_SimpleProperty(osg::ref_ptr< osg::Operation >, CurrentOperation, + __osg_ref_ptrT1_Operation___getCurrentOperation, 0); I_SimpleProperty(bool, Done, __bool__getDone, __void__setDone__bool); + I_SimpleProperty(osg::Object *, Parent, + __Object_P1__getParent, + __void__setParent__Object_P1); END_REFLECTOR BEGIN_OBJECT_REFLECTOR(osg::ReleaseContext_Block_MakeCurrentOperation) - I_BaseType(osg::GraphicsOperation); + I_BaseType(osg::Operation); I_BaseType(osg::Block); I_Constructor0(____ReleaseContext_Block_MakeCurrentOperation, "", @@ -161,42 +176,9 @@ BEGIN_OBJECT_REFLECTOR(osg::ReleaseContext_Block_MakeCurrentOperation) END_REFLECTOR BEGIN_OBJECT_REFLECTOR(osg::SwapBuffersOperation) - I_BaseType(osg::GraphicsOperation); + I_BaseType(osg::Operation); I_Constructor0(____SwapBuffersOperation, "", ""); END_REFLECTOR -BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osg::GraphicsOperation >) - I_Constructor0(____ref_ptr, - "", - ""); - I_Constructor1(IN, osg::GraphicsOperation *, ptr, - ____ref_ptr__T_P1, - "", - ""); - I_Constructor1(IN, const osg::ref_ptr< osg::GraphicsOperation > &, rp, - ____ref_ptr__C5_ref_ptr_R1, - "", - ""); - I_Method0(osg::GraphicsOperation *, get, - __T_P1__get, - "", - ""); - I_Method0(bool, valid, - __bool__valid, - "", - ""); - I_Method0(osg::GraphicsOperation *, release, - __T_P1__release, - "", - ""); - I_Method1(void, swap, IN, osg::ref_ptr< osg::GraphicsOperation > &, rp, - __void__swap__ref_ptr_R1, - "", - ""); - I_SimpleProperty(osg::GraphicsOperation *, , - __T_P1__get, - 0); -END_REFLECTOR - diff --git a/src/osgWrappers/osg/Referenced.cpp b/src/osgWrappers/osg/Referenced.cpp index 7b68455e3..44a71ddcc 100644 --- a/src/osgWrappers/osg/Referenced.cpp +++ b/src/osgWrappers/osg/Referenced.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -21,24 +22,6 @@ #undef OUT #endif -BEGIN_VALUE_REFLECTOR(osg::DeleteHandler) - I_Constructor0(____DeleteHandler, - "", - ""); - I_Method0(void, flush, - __void__flush, - "flush any cache of objects that need to be deleted by doing an actual delete. ", - ""); - I_Method1(void, doDelete, IN, const osg::Referenced *, object, - __void__doDelete__C5_Referenced_P1, - "", - ""); - I_Method1(void, requestDelete, IN, const osg::Referenced *, object, - __void__requestDelete__C5_Referenced_P1, - "Request the deletion of an object. ", - "Depending on users implementation of DeleteHandler, the delete of the object may occur straight away or be delayed until doDelete is called. The default implementation does a delete straight away. "); -END_REFLECTOR - BEGIN_OBJECT_REFLECTOR(osg::Referenced) I_Constructor0(____Referenced, "", diff --git a/src/osgWrappers/osgProducer/GraphicsContextImplementation.cpp b/src/osgWrappers/osgProducer/GraphicsContextImplementation.cpp index 5e690278c..cdd6cd7da 100644 --- a/src/osgWrappers/osgProducer/GraphicsContextImplementation.cpp +++ b/src/osgWrappers/osgProducer/GraphicsContextImplementation.cpp @@ -21,7 +21,7 @@ #undef OUT #endif -BEGIN_OBJECT_REFLECTOR(osgProducer::GraphicsContextImplementation) +BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgProducer::GraphicsContextImplementation) I_BaseType(osg::GraphicsContext); I_Constructor1(IN, osg::GraphicsContext::Traits *, traits, ____GraphicsContextImplementation__Traits_P1, diff --git a/src/osgWrappers/osgUtil/RenderLeaf.cpp b/src/osgWrappers/osgUtil/RenderLeaf.cpp index 1797ce200..d04d37dfa 100644 --- a/src/osgWrappers/osgUtil/RenderLeaf.cpp +++ b/src/osgWrappers/osgUtil/RenderLeaf.cpp @@ -43,6 +43,17 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::RenderLeaf) __void__render__osg_RenderInfo_R1__RenderLeaf_P1, "", ""); + I_Method0(osg::Drawable *, getDrawable, + __osg_Drawable_P1__getDrawable, + "", + ""); + I_Method0(osg::Drawable *, getDrawable, + __osg_Drawable_P1__getDrawable, + "", + ""); + I_SimpleProperty(osg::Drawable *, Drawable, + __osg_Drawable_P1__getDrawable, + 0); I_PublicMemberProperty(osgUtil::StateGraph *, _parent); I_PublicMemberProperty(osg::Drawable *, _drawable); I_PublicMemberProperty(osg::ref_ptr< osg::RefMatrix >, _projection); diff --git a/src/osgWrappers/osgUtil/SceneView.cpp b/src/osgWrappers/osgUtil/SceneView.cpp index bef438a0c..7919824ab 100644 --- a/src/osgWrappers/osgUtil/SceneView.cpp +++ b/src/osgWrappers/osgUtil/SceneView.cpp @@ -588,6 +588,10 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::SceneView) __void__draw, "Do draw traversal of draw bins generated by cull traversal. ", ""); + I_Method0(unsigned int, getDynamicObjectCount, + __unsigned_int__getDynamicObjectCount, + "Compute the number of dynamic objects that will be held in the rendering backend. ", + ""); I_Method0(void, releaseAllGLObjects, __void__releaseAllGLObjects, "Release all OpenGL objects from the scene graph, such as texture objects, display lists etc. ", @@ -637,6 +641,9 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::SceneView) I_SimpleProperty(GLenum, DrawBufferValue, __GLenum__getDrawBufferValue, __void__setDrawBufferValue__GLenum); + I_SimpleProperty(unsigned int, DynamicObjectCount, + __unsigned_int__getDynamicObjectCount, + 0); I_SimpleProperty(osg::FrameStamp *, FrameStamp, 0, __void__setFrameStamp__osg_FrameStamp_P1); diff --git a/src/osgWrappers/osgViewer/CompositeViewer.cpp b/src/osgWrappers/osgViewer/CompositeViewer.cpp index a23325b1d..dd8f06132 100644 --- a/src/osgWrappers/osgViewer/CompositeViewer.cpp +++ b/src/osgWrappers/osgViewer/CompositeViewer.cpp @@ -204,12 +204,12 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer) __void__getScenes__Scenes_R1__bool, "", ""); - I_Method1(void, setRealizeOperation, IN, osg::GraphicsOperation *, op, - __void__setRealizeOperation__osg_GraphicsOperation_P1, + I_Method1(void, setRealizeOperation, IN, osg::Operation *, op, + __void__setRealizeOperation__osg_Operation_P1, "Set the graphics operation to call on realization of the viewers graphics windows. ", ""); - I_Method0(osg::GraphicsOperation *, getRealizeOperation, - __osg_GraphicsOperation_P1__getRealizeOperation, + I_Method0(osg::Operation *, getRealizeOperation, + __osg_Operation_P1__getRealizeOperation, "Get the graphics operation to call on realization of the viewers graphics windows. ", ""); I_Method0(void, stopThreading, @@ -222,7 +222,7 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer) ""); I_Method0(void, setUpRenderingSupport, __void__setUpRenderingSupport, - "Set up the GraphicsOperations to render the various viewer cameras on the viewers graphics windows. ", + "Set up the Operations to render the various viewer cameras on the viewers graphics windows. ", ""); I_SimpleProperty(osg::Camera *, CameraWithFocus, __osg_Camera_P1__getCameraWithFocus, @@ -245,9 +245,9 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer) I_SimpleProperty(bool, QuitEventSetsDone, __bool__getQuitEventSetsDone, __void__setQuitEventSetsDone__bool); - I_SimpleProperty(osg::GraphicsOperation *, RealizeOperation, - __osg_GraphicsOperation_P1__getRealizeOperation, - __void__setRealizeOperation__osg_GraphicsOperation_P1); + I_SimpleProperty(osg::Operation *, RealizeOperation, + __osg_Operation_P1__getRealizeOperation, + __void__setRealizeOperation__osg_Operation_P1); I_SimpleProperty(double, ReferenceTime, 0, __void__setReferenceTime__double); diff --git a/src/osgWrappers/osgViewer/GraphicsWindow.cpp b/src/osgWrappers/osgViewer/GraphicsWindow.cpp index 0aa9d531d..75aed9b2b 100644 --- a/src/osgWrappers/osgViewer/GraphicsWindow.cpp +++ b/src/osgWrappers/osgViewer/GraphicsWindow.cpp @@ -22,7 +22,7 @@ #undef OUT #endif -BEGIN_OBJECT_REFLECTOR(osgViewer::GraphicsWindow) +BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgViewer::GraphicsWindow) I_BaseType(osg::GraphicsContext); I_BaseType(osgGA::GUIActionAdapter); I_Constructor0(____GraphicsWindow, diff --git a/src/osgWrappers/osgViewer/SimpleViewer.cpp b/src/osgWrappers/osgViewer/SimpleViewer.cpp index eca7b3a4d..577774814 100644 --- a/src/osgWrappers/osgViewer/SimpleViewer.cpp +++ b/src/osgWrappers/osgViewer/SimpleViewer.cpp @@ -28,7 +28,7 @@ TYPE_NAME_ALIAS(std::list< osg::ref_ptr< osgGA::GUIEventHandler > >, osgViewer::SimpleViewer::EventHandlers); -BEGIN_OBJECT_REFLECTOR(osgViewer::SimpleViewer) +BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgViewer::SimpleViewer) I_VirtualBaseType(osgViewer::GraphicsWindow); I_Constructor0(____SimpleViewer, "", diff --git a/src/osgWrappers/osgViewer/View.cpp b/src/osgWrappers/osgViewer/View.cpp index 78d742d11..bfb0de8ba 100644 --- a/src/osgWrappers/osgViewer/View.cpp +++ b/src/osgWrappers/osgViewer/View.cpp @@ -31,7 +31,8 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::EndOfDynamicDrawBlock) I_BaseType(osg::State::DynamicObjectRenderingCompletedCallback); - I_Constructor0(____EndOfDynamicDrawBlock, + I_Constructor1(IN, unsigned, int, + ____EndOfDynamicDrawBlock__unsigned, "", ""); I_Method1(void, completed, IN, osg::State *, state, @@ -42,14 +43,21 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::EndOfDynamicDrawBlock) __void__block, "", ""); + I_Method0(void, reset, + __void__reset, + "", + ""); I_Method0(void, release, __void__release, "", ""); - I_Method1(void, set, IN, unsigned int, blockCount, - __void__set__unsigned_int, + I_Method1(void, setNumOfBlocks, IN, unsigned int, blockCount, + __void__setNumOfBlocks__unsigned_int, "", ""); + I_SimpleProperty(unsigned int, NumOfBlocks, + 0, + __void__setNumOfBlocks__unsigned_int); END_REFLECTOR TYPE_NAME_ALIAS(std::list< osg::ref_ptr< osgGA::GUIEventHandler > >, osgViewer::View::EventHandlers); diff --git a/src/osgWrappers/osgViewer/Viewer.cpp b/src/osgWrappers/osgViewer/Viewer.cpp index 3e8396b2b..37f30228e 100644 --- a/src/osgWrappers/osgViewer/Viewer.cpp +++ b/src/osgWrappers/osgViewer/Viewer.cpp @@ -179,12 +179,12 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer) __void__getCameras__Cameras_R1__bool, "", ""); - I_Method1(void, setRealizeOperation, IN, osg::GraphicsOperation *, op, - __void__setRealizeOperation__osg_GraphicsOperation_P1, + I_Method1(void, setRealizeOperation, IN, osg::Operation *, op, + __void__setRealizeOperation__osg_Operation_P1, "Set the graphics operation to call on realization of the viewers graphics windows. ", ""); - I_Method0(osg::GraphicsOperation *, getRealizeOperation, - __osg_GraphicsOperation_P1__getRealizeOperation, + I_Method0(osg::Operation *, getRealizeOperation, + __osg_Operation_P1__getRealizeOperation, "Get the graphics operation to call on realization of the viewers graphics windows. ", ""); I_Method0(void, stopThreading, @@ -197,7 +197,7 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer) ""); I_Method0(void, setUpRenderingSupport, __void__setUpRenderingSupport, - "Set up the GraphicsOperations to render the various viewer cameras on the viewers graphics windows. ", + "Set up the Operations to render the various viewer cameras on the viewers graphics windows. ", ""); I_SimpleProperty(osg::Camera *, CameraWithFocus, __osg_Camera_P1__getCameraWithFocus, @@ -217,9 +217,9 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer) I_SimpleProperty(bool, QuitEventSetsDone, __bool__getQuitEventSetsDone, __void__setQuitEventSetsDone__bool); - I_SimpleProperty(osg::GraphicsOperation *, RealizeOperation, - __osg_GraphicsOperation_P1__getRealizeOperation, - __void__setRealizeOperation__osg_GraphicsOperation_P1); + I_SimpleProperty(osg::Operation *, RealizeOperation, + __osg_Operation_P1__getRealizeOperation, + __void__setRealizeOperation__osg_Operation_P1); I_SimpleProperty(double, ReferenceTime, 0, __void__setReferenceTime__double);