Convert GraphicsThread/GraphicsOperation to more generic OperationsThread/Operation.

This paves the way to running cull traversals in seperate threads.

Updated wrappers
This commit is contained in:
Robert Osfield
2007-02-02 22:30:36 +00:00
parent bee545b82d
commit 69da91620f
28 changed files with 439 additions and 300 deletions

View File

@@ -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"<<std::endl;
@@ -334,7 +343,7 @@ void GraphicsContext::add(GraphicsOperation* operation)
_operationsBlock->set(true);
}
void GraphicsContext::remove(GraphicsOperation* operation)
void GraphicsContext::remove(Operation* operation)
{
osg::notify(osg::INFO)<<"Doing remove operation"<<std::endl;

View File

@@ -19,47 +19,10 @@
using namespace osg;
using namespace OpenThreads;
struct ThreadExitTidyUp
{
ThreadExitTidyUp(osg::GraphicsContext* context, bool closeContextOnExit):
_context(context),
_closeContextOnExit(closeContextOnExit)
{
osg::notify(osg::INFO)<<"starting thread context "<<_context<<std::endl;
}
~ThreadExitTidyUp()
{
osg::notify(osg::INFO)<<"exit thread"<<std::endl;
if (_context)
{
if (_closeContextOnExit)
{
osg::notify(osg::INFO)<<" - close context "<<_context<<std::endl;
_context->closeImplementation();
osg::notify(osg::INFO)<<" - done close context "<<_context<<std::endl;
}
else
{
osg::notify(osg::INFO)<<" - releaseContext "<<_context<<std::endl;
//_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 "<<this<<std::endl;
@@ -93,7 +56,7 @@ GraphicsThread::~GraphicsThread()
//osg::notify(osg::NOTICE)<<"Done Destructing graphics thread "<<this<<std::endl;
}
void GraphicsThread::setDone(bool done)
void OperationsThread::setDone(bool done)
{
if (_done==done) return;
@@ -117,9 +80,9 @@ void GraphicsThread::setDone(bool done)
}
int GraphicsThread::cancel()
int OperationsThread::cancel()
{
osg::notify(osg::INFO)<<"Cancelling graphics thread "<<this<<" isRunning()="<<isRunning()<<std::endl;
osg::notify(osg::INFO)<<"Cancelling OperationsThred "<<this<<" isRunning()="<<isRunning()<<std::endl;
int result = 0;
if( isRunning() )
@@ -159,17 +122,17 @@ int GraphicsThread::cancel()
// commenting out debug info as it was cashing crash on exit, presumable
// due to osg::notify or std::cout destructing earlier than this destructor.
osg::notify(osg::INFO)<<" Waiting for GraphicsThread to cancel "<<this<<std::endl;
osg::notify(osg::INFO)<<" Waiting for OperationsThread to cancel "<<this<<std::endl;
OpenThreads::Thread::YieldCurrentThread();
}
}
osg::notify(osg::INFO)<<" GraphicsThread::cancel() thread cancelled "<<this<<" isRunning()="<<isRunning()<<std::endl;
osg::notify(osg::INFO)<<" OperationsThread::cancel() thread cancelled "<<this<<" isRunning()="<<isRunning()<<std::endl;
return result;
}
void GraphicsThread::add(GraphicsOperation* operation, bool waitForCompletion)
void OperationsThread::add(Operation* operation, bool waitForCompletion)
{
osg::notify(osg::INFO)<<"Doing add"<<std::endl;
@@ -198,7 +161,7 @@ void GraphicsThread::add(GraphicsOperation* operation, bool waitForCompletion)
}
}
void GraphicsThread::remove(GraphicsOperation* operation)
void OperationsThread::remove(Operation* operation)
{
osg::notify(osg::INFO)<<"Doing remove operation"<<std::endl;
@@ -213,7 +176,7 @@ void GraphicsThread::remove(GraphicsOperation* operation)
}
}
void GraphicsThread::remove(const std::string& name)
void OperationsThread::remove(const std::string& name)
{
osg::notify(osg::INFO)<<"Doing remove named operation"<<std::endl;
@@ -234,7 +197,7 @@ void GraphicsThread::remove(const std::string& name)
}
}
void GraphicsThread::removeAllOperations()
void OperationsThread::removeAllOperations()
{
osg::notify(osg::INFO)<<"Doing remove all operations"<<std::endl;
@@ -248,41 +211,17 @@ void GraphicsThread::removeAllOperations()
}
void GraphicsThread::run()
void OperationsThread::run()
{
bool contextRealizedInThisThread = false;
// make the graphics context current.
if (_graphicsContext)
{
if (!_graphicsContext->isRealized())
{
#if 0
osg::notify(osg::NOTICE)<<"Forced to do a realize in GraphicsThread::run."<<std::endl;
_graphicsContext->realize();
contextRealizedInThisThread = true;
#else
while (!_graphicsContext->isRealized() && !_done)
{
osg::notify(osg::INFO)<<"Waiting in GraphicsThread::run for GraphicsContext to realize."<<std::endl;
YieldCurrentThread();
}
osg::notify(osg::INFO)<<"GraphicsThread::run now released as GraphicsContext has been realized."<<std::endl;
#endif
}
osg::notify(osg::INFO)<<"Doing make current"<<std::endl;
_graphicsContext->makeCurrentImplementation();
GraphicsContext* graphicsContext = dynamic_cast<GraphicsContext*>(_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 "<<this<<" isRunning()="<<isRunning()<<std::endl;
bool firstTime = true;
@@ -350,7 +289,7 @@ void GraphicsThread::run()
osg::notify(osg::INFO)<<"Doing op "<<_currentOperation->getName()<<" "<<this<<std::endl;
// call the graphics operation.
(*_currentOperation)(_graphicsContext);
(*_currentOperation)(_parent.get());
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_operationsMutex);
@@ -369,15 +308,19 @@ void GraphicsThread::run()
// osg::notify(osg::NOTICE)<<"operations.size()="<<_operations.size()<<" done="<<_done<<" testCancel()"<<testCancel()<<std::endl;
} while (!testCancel() && !_done);
_graphicsContext->releaseContext();
if (graphicsContext)
{
graphicsContext->releaseContext();
}
osg::notify(osg::INFO)<<"exit loop "<<this<<" isRunning()="<<isRunning()<<std::endl;
}
void SwapBuffersOperation::operator () (GraphicsContext* context)
void SwapBuffersOperation::operator () (Object* object)
{
GraphicsContext* context = dynamic_cast<GraphicsContext*>(object);
if (context)
{
context->swapBuffersImplementation();
@@ -390,7 +333,7 @@ void BarrierOperation::release()
Barrier::release();
}
void BarrierOperation::operator () (GraphicsContext*)
void BarrierOperation::operator () (Object*)
{
if (_preBlockOp==GL_FLUSH) glFlush();
if (_preBlockOp==GL_FINISH) glFinish();
@@ -404,8 +347,9 @@ void ReleaseContext_Block_MakeCurrentOperation::release()
}
void ReleaseContext_Block_MakeCurrentOperation::operator () (GraphicsContext* context)
void ReleaseContext_Block_MakeCurrentOperation::operator () (Object* object)
{
GraphicsContext* context = dynamic_cast<GraphicsContext*>(object);
if (!context) return;
// release the graphics context.

View File

@@ -103,6 +103,29 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset)
if (_mode & COMPILE_STATE_ATTRIBUTES && _renderInfo.getState())
{
stateset.compileGLObjects(*_renderInfo.getState());
osg::Program* program = dynamic_cast<osg::Program*>(stateset.getAttribute(osg::StateAttribute::PROGRAM));
if (program) _lastCompiledProgram = program;
if (_lastCompiledProgram.valid() && !stateset.getUniformList().empty())
{
osg::Program::PerContextProgram* pcp = _lastCompiledProgram->getPCP(_renderInfo.getState()->getContextID());
if (pcp)
{
pcp->useProgram();
_renderInfo.getState()->setLastAppliedProgramObject(pcp);
osg::StateSet::UniformList& ul = stateset.getUniformList();
for(osg::StateSet::UniformList::iterator itr = ul.begin();
itr != ul.end();
++itr)
{
pcp->apply(*(itr->second.first));
}
}
}
}
if (_mode & RELEASE_STATE_ATTRIBUTES)

View File

@@ -2826,6 +2826,7 @@ struct LessGeode
bool operator() (const osg::Geode* lhs,const osg::Geode* rhs) const
{
if (lhs->getStateSet()<rhs->getStateSet()) return true;
if (lhs->getNodeMask()<rhs->getNodeMask()) return true;
return false;
}
};

View File

@@ -790,15 +790,18 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b
}
}
struct DrawInnerOperation : public osg::GraphicsOperation
struct DrawInnerOperation : public osg::Operation
{
DrawInnerOperation(RenderStage* stage, osg::RenderInfo& renderInfo) :
osg::GraphicsOperation("DrawInnerStage",false),
osg::Operation("DrawInnerStage",false),
_stage(stage),
_renderInfo(renderInfo) {}
virtual void operator() (osg::GraphicsContext* context)
virtual void operator () (osg::Object* object)
{
osg::GraphicsContext* context = dynamic_cast<osg::GraphicsContext*>(object);
if (!context) return;
// osg::notify(osg::NOTICE)<<"DrawInnerOperation operator"<<std::endl;
if (_stage && context)
{
@@ -834,7 +837,7 @@ void RenderStage::draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous)
osg::State* useState = &state;
osg::GraphicsContext* callingContext = state.getGraphicsContext();
osg::GraphicsContext* useContext = callingContext;
osg::GraphicsThread* useThread = 0;
osg::OperationsThread* useThread = 0;
osg::RenderInfo useRenderInfo(renderInfo);
if (_graphicsContext.valid() && _graphicsContext != callingContext)

View File

@@ -208,20 +208,21 @@ void CompositeViewer::stopThreading()
}
// Compile operation, that compile OpenGL objects.
struct CompositeViewerCompileOperation : public osg::GraphicsOperation
struct CompositeViewerCompileOperation : public osg::Operation
{
CompositeViewerCompileOperation():
osg::GraphicsOperation("Compile",false)
osg::Operation("Compile",false)
{
}
virtual void operator () (osg::GraphicsContext* context)
virtual void operator () (osg::Object* object)
{
osg::GraphicsContext* context = dynamic_cast<osg::GraphicsContext*>(object);
if (!context) return;
// OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
// osg::notify(osg::NOTICE)<<"Compile "<<context<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl;
// context->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<osg::GraphicsContext*>(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;

View File

@@ -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<osg::GraphicsContext*>(object);
if (!context) return;
//osg::notify(osg::NOTICE)<<"GraphicsCall "<<std::endl;
// if (_done) return;
@@ -780,16 +783,19 @@ void Viewer::stopThreading()
}
// Compile operation, that compile OpenGL objects.
struct ViewerCompileOperation : public osg::GraphicsOperation
struct ViewerCompileOperation : public osg::Operation
{
ViewerCompileOperation(osg::Node* scene):
osg::GraphicsOperation("Compile",false),
osg::Operation("Compile",false),
_scene(scene)
{
}
virtual void operator () (osg::GraphicsContext* context)
virtual void operator () (osg::Object* object)
{
osg::GraphicsContext* context = dynamic_cast<osg::GraphicsContext*>(object);
if (!context) return;
// OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
// osg::notify(osg::NOTICE)<<"Compile "<<context<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl;
@@ -809,16 +815,19 @@ struct ViewerCompileOperation : public osg::GraphicsOperation
// Draw operation, that does a draw on the scene graph.
struct ViewerRunOperations : public osg::GraphicsOperation
struct ViewerRunOperations : public osg::Operation
{
ViewerRunOperations():
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<osg::GraphicsContext*>(object);
if (!context) return;
context->runOperations();
}
};

View File

@@ -0,0 +1,76 @@
// ***************************************************************************
//
// Generated automatically by genwrapper.
// Please DO NOT EDIT this file!
//
// ***************************************************************************
#include <osgIntrospection/ReflectionMacros>
#include <osgIntrospection/TypedMethodInfo>
#include <osgIntrospection/StaticMethodInfo>
#include <osgIntrospection/Attributes>
#include <osg/DeleteHandler>
#include <osg/Referenced>
// 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 * >);

View File

@@ -34,6 +34,7 @@ CXXFILES =\
CullSettings.cpp\
CullStack.cpp\
CullingSet.cpp\
DeleteHandler.cpp\
Depth.cpp\
DisplaySettings.cpp\
DrawPixels.cpp\

View File

@@ -25,16 +25,18 @@
#include <osg/Camera>
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 > >);

View File

@@ -10,8 +10,8 @@
#include <osgIntrospection/StaticMethodInfo>
#include <osgIntrospection/Attributes>
#include <osg/GraphicsContext>
#include <osg/GraphicsThread>
#include <osg/Object>
// 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

View File

@@ -10,6 +10,7 @@
#include <osgIntrospection/StaticMethodInfo>
#include <osgIntrospection/Attributes>
#include <osg/DeleteHandler>
#include <osg/Referenced>
#include <osg/observer_ptr>
@@ -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,
"",

View File

@@ -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,

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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,

View File

@@ -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,
"",

View File

@@ -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);

View File

@@ -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);