From a5d12c598a1f26f03288dd066746fbc3c491379c Mon Sep 17 00:00:00 2001 From: Don BURNS Date: Wed, 29 Mar 2006 23:32:51 +0000 Subject: [PATCH] Updates to osgProducer to bring it up to speed with changes in Producer --- applications/osgviewer/osgviewer.cpp | 12 ++++++++++++ include/osgProducer/OsgCameraGroup | 2 +- src/osgProducer/OsgCameraGroup.cpp | 27 +++++++++++++------------- src/osgProducer/Viewer.cpp | 3 ++- src/osgProducer/ViewerEventHandler.cpp | 1 + 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/applications/osgviewer/osgviewer.cpp b/applications/osgviewer/osgviewer.cpp index 133d1935a..71f5d41a4 100644 --- a/applications/osgviewer/osgviewer.cpp +++ b/applications/osgviewer/osgviewer.cpp @@ -14,6 +14,8 @@ #include #include +#include + int main( int argc, char **argv ) { @@ -102,6 +104,16 @@ int main( int argc, char **argv ) // create the windows and run the threads. viewer.realize(); + { + osgProducer::OsgSceneHandler *sh = viewer.getSceneHandlerList().front().get(); + osgUtil::SceneView *sv = sh->getSceneView(); + osg::CullStack::CullingMode cullingMode = sv->getCullingMode(); + cullingMode &= ~(osg::CullStack::SMALL_FEATURE_CULLING); + sv->setCullingMode( cullingMode ); + + + } + while( !viewer.done() ) { // wait for all cull and draw threads to complete. diff --git a/include/osgProducer/OsgCameraGroup b/include/osgProducer/OsgCameraGroup index ff852a21b..1fcdfe49f 100644 --- a/include/osgProducer/OsgCameraGroup +++ b/include/osgProducer/OsgCameraGroup @@ -36,7 +36,7 @@ class OSGPRODUCER_EXPORT OsgCameraGroup : public Producer::CameraGroup { public : - typedef Producer::CameraGroup::ThreadingModel ThreadingModel; + typedef Producer::CameraGroup::ThreadModel ThreadingModel; OsgCameraGroup(); diff --git a/src/osgProducer/OsgCameraGroup.cpp b/src/osgProducer/OsgCameraGroup.cpp index 82313f8a4..146af9f3a 100644 --- a/src/osgProducer/OsgCameraGroup.cpp +++ b/src/osgProducer/OsgCameraGroup.cpp @@ -22,6 +22,7 @@ #include #include +#include #ifdef WIN32 #define WGL_SAMPLE_BUFFERS_ARB 0x2041 @@ -226,14 +227,14 @@ void OsgCameraGroup::_init() if (_cfg.valid()) { // By default select ThreadPerCamera when we have multiple cameras. - _thread_model = (_cfg->getNumberOfCameras()>1) ? ThreadPerCamera : SingleThreaded; + _threadModel = (_cfg->getNumberOfCameras()>1) ? ThreadPerCamera : SingleThreaded; } const char* str = getenv("OSG_CAMERA_THREADING"); if (str) { - if (strcmp(str,"SingleThreaded")==0) _thread_model = SingleThreaded; - else if (strcmp(str,"ThreadPerCamera")==0) _thread_model = ThreadPerCamera; + if (strcmp(str,"SingleThreaded")==0) _threadModel = SingleThreaded; + else if (strcmp(str,"ThreadPerCamera")==0) _threadModel = ThreadPerCamera; } str = getenv("OSG_SHARE_GRAPHICS_CONTEXTS"); @@ -243,7 +244,7 @@ void OsgCameraGroup::_init() else if (strcmp(str,"OFF")==0) Producer::RenderSurface::shareAllGLContexts(false); } - if (_thread_model==ThreadPerCamera && _cfg->getNumberOfCameras()>1) + if (_threadModel==ThreadPerCamera && _cfg->getNumberOfCameras()>1) { // switch on thread safe reference counting by default when running multi-threaded. // osg::Referenced::setThreadSafeReferenceCounting(true); @@ -390,7 +391,7 @@ void OsgCameraGroup::advance() bool OsgCameraGroup::realize( ThreadingModel thread_model ) { if( _realized ) return _realized; - _thread_model = thread_model; + _threadModel = thread_model; return realize(); } @@ -595,7 +596,7 @@ bool OsgCameraGroup::realize() // if we are multi-threaded check to see if particle exists in the scene // if so we need to disable multi-threading of cameras. - if (_thread_model == Producer::CameraGroup::ThreadPerCamera) + if (_threadModel == Producer::CameraGroup::ThreadPerCamera) { if (getTopMostSceneData()) { @@ -605,7 +606,7 @@ bool OsgCameraGroup::realize() { osg::notify(osg::INFO)<<"Warning: disabling multi-threading of cull and draw"< renderSurfaceSet; for( unsigned int i = 0; i < _cfg->getNumberOfCameras(); i++ ) @@ -628,7 +629,7 @@ bool OsgCameraGroup::realize() // running single threaded, to avoid OpenGL threading issues. osg::notify(osg::INFO)<<"Warning: disabling multi-threading of cull and draw to avoid"<1 && RenderSurface::allGLContextsAreShared()) { @@ -636,18 +637,18 @@ bool OsgCameraGroup::realize() // so need to disable multi-threading to prevent problems. osg::notify(osg::INFO)<<"Warning: disabling multi-threading of cull and draw to avoid"< #include +#include #include #include @@ -498,7 +499,7 @@ void Viewer::setViewByMatrix( const Producer::Matrix & pm) bool Viewer::realize( ThreadingModel thread_model ) { if( _realized ) return _realized; - _thread_model = thread_model; + _threadModel = thread_model; return realize(); } diff --git a/src/osgProducer/ViewerEventHandler.cpp b/src/osgProducer/ViewerEventHandler.cpp index ca49b3540..38edef525 100644 --- a/src/osgProducer/ViewerEventHandler.cpp +++ b/src/osgProducer/ViewerEventHandler.cpp @@ -1,3 +1,4 @@ +#include #include #include #include