From 68a1ed2dcf17efe8637f8fe96a14558edf35314a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 12 May 2010 11:37:27 +0000 Subject: [PATCH] Fixes for building OSG with OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION set to OFF. Fixed copy and paste error in Camera::getImplicitBufferAttachmentResolveMask(). --- examples/osgautocapture/osgautocapture.cpp | 2 +- examples/osgfpdepth/osgfpdepth.cpp | 36 +++++++++---------- examples/osgviewerQT/QOSGWidget.cpp | 2 +- .../osgviewerQtContext/osgviewerQtContext.cpp | 2 +- examples/osgviewerQtWidget/QOSGWidget.cpp | 2 +- include/osg/Camera | 8 ++--- include/osgShadow/ParallelSplitShadowMap | 2 +- src/osgPlugins/osg/XmlStreamOperator.h | 2 +- 8 files changed, 26 insertions(+), 30 deletions(-) diff --git a/examples/osgautocapture/osgautocapture.cpp b/examples/osgautocapture/osgautocapture.cpp index 99dfc6168..75a5b568c 100644 --- a/examples/osgautocapture/osgautocapture.cpp +++ b/examples/osgautocapture/osgautocapture.cpp @@ -229,7 +229,7 @@ int main( int argc, char **argv ) } } if (use_pbuffer) { - osg::DisplaySettings* ds = osg::DisplaySettings::instance(); + osg::DisplaySettings* ds = osg::DisplaySettings::instance().get(); osg::ref_ptr traits = new osg::GraphicsContext::Traits(ds); if (viewer.getCamera()->getGraphicsContext() && viewer.getCamera()->getGraphicsContext()->getTraits()) { diff --git a/examples/osgfpdepth/osgfpdepth.cpp b/examples/osgfpdepth/osgfpdepth.cpp index b9e222c02..b86820617 100644 --- a/examples/osgfpdepth/osgfpdepth.cpp +++ b/examples/osgfpdepth/osgfpdepth.cpp @@ -404,7 +404,7 @@ AppState::AppState(osgViewer::Viewer* viewer_) textInverted = new Geode; textInverted->addDrawable(inverted); textInverted->setNodeMask(~0u); - textProjection->addChild(textInverted); + textProjection->addChild(textInverted.get()); textProjection->getOrCreateStateSet()->setRenderBinDetails(11, "RenderBin"); } @@ -641,7 +641,7 @@ void ResizedCallback::resizedImplementation(GraphicsContext* gc, int x, int y, int width, int height) { gc->resizedImplementation(x, y, width, height); - makeTexturesAndGeometry(width, height, _appState->sw); + makeTexturesAndGeometry(width, height, _appState->sw.get()); _appState->setStateFromConfig(validConfigs[_appState ->currentConfig]); osgViewer::Viewer* viewer = _appState->viewer; @@ -693,9 +693,7 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments) return 0; } - DisplaySettings* ds = viewer.getDisplaySettings(); - if (!ds) - ds = DisplaySettings::instance(); + DisplaySettings* ds = viewer.getDisplaySettings() ? viewer.getDisplaySettings() : DisplaySettings::instance().get(); GraphicsContext::ScreenIdentifier si; si.readDISPLAY(); @@ -769,7 +767,7 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments) BufferConfigList colorConfigs; BufferConfigList depthConfigs; vector coverageConfigs; - getPossibleConfigs(gc, colorConfigs, depthConfigs, coverageConfigs); + getPossibleConfigs(gc.get(), colorConfigs, depthConfigs, coverageConfigs); int coverageSampleConfigs = (coverageConfigs.size() - 4) / 2; cout << "color configs\nname\tbits\n"; for (BufferConfigList::const_iterator colorItr = colorConfigs.begin(), @@ -786,9 +784,9 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments) FboConfig config(root, colorItr->format, depthItr->format, colorItr->bits, depthItr->bits); FboData data; - if (createFBO(gc, config, data)) + if (createFBO(gc.get(), config, data)) validConfigs.push_back(config); - destroyFBO(gc, data); + destroyFBO(gc.get(), data); if (coverageConfigs.size() > 0) { //CSAA provides a list of all supported AA modes for @@ -813,10 +811,10 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments) } config.name = msText.str(); - if (createFBO(gc, config, data)) { + if (createFBO(gc.get(), config, data)) { validConfigs.push_back( config); } - destroyFBO(gc, data); + destroyFBO(gc.get(), data); } } } @@ -885,9 +883,9 @@ void setAttachmentsFromConfig(Camera* camera, const FboConfig& config) if (config.coverageSamples != 0 || config.depthSamples != 0) camera->attach(Camera::DEPTH_BUFFER, config.depthFormat); else if (config.depthFormat == GL_DEPTH_COMPONENT24) - camera->attach(Camera::DEPTH_BUFFER, depthTexture24); + camera->attach(Camera::DEPTH_BUFFER, depthTexture24.get()); else - camera->attach(Camera::DEPTH_BUFFER, depthTexture); + camera->attach(Camera::DEPTH_BUFFER, depthTexture.get()); } // Create the parts of the local scene graph used to display the final @@ -911,9 +909,9 @@ Switch* makeTexturesAndGeometry(int width, int height, Switch* sw) else depthTexture = depthTexture24; sw->removeChildren(0, sw->getNumChildren()); - sw->addChild(createTextureQuad(colorTexture)); - sw->addChild(createTextureQuad(depthTexture)); - sw->addChild(createTextureQuad(depthTexture24)); + sw->addChild(createTextureQuad(colorTexture.get())); + sw->addChild(createTextureQuad(depthTexture.get())); + sw->addChild(createTextureQuad(depthTexture24.get())); sw->setSingleChildOn(0); return sw; } @@ -965,15 +963,15 @@ int main(int argc, char **argv) osgUtil::Optimizer optimizer; optimizer.optimize(loadedModel.get()); // creates texture to be rendered - Switch* sw = makeTexturesAndGeometry(width, height, appState->sw); + Switch* sw = makeTexturesAndGeometry(width, height, appState->sw.get()); ref_ptr rttCamera = makeRttCamera(gc, width, height); rttCamera->setRenderOrder(Camera::PRE_RENDER); - viewer.addSlave(rttCamera); + viewer.addSlave(rttCamera.get()); appState->camera = rttCamera; // geometry and slave camera to display the result Group* displayRoot = new Group; displayRoot->addChild(sw); - displayRoot->addChild(appState->textProjection); + displayRoot->addChild(appState->textProjection.get()); StateSet* displaySS = displayRoot->getOrCreateStateSet(); displaySS->setMode(GL_LIGHTING, StateAttribute::OFF); displaySS->setMode(GL_DEPTH_TEST, StateAttribute::OFF); @@ -990,7 +988,7 @@ int main(int argc, char **argv) texCamera->setCullingMode(CullSettings::NO_CULLING); texCamera->setProjectionResizePolicy(Camera::FIXED); viewer.addSlave(texCamera, Matrixd(), Matrixd(), false); - viewer.addEventHandler(new ConfigHandler(appState)); + viewer.addEventHandler(new ConfigHandler(appState.get())); // add model to the viewer. Group* sceneRoot = new Group; diff --git a/examples/osgviewerQT/QOSGWidget.cpp b/examples/osgviewerQT/QOSGWidget.cpp index e89a5d99d..a0820b652 100644 --- a/examples/osgviewerQT/QOSGWidget.cpp +++ b/examples/osgviewerQT/QOSGWidget.cpp @@ -140,7 +140,7 @@ QOSGWidget::QOSGWidget( QWidget * parent, const char * name, WindowFlags f, bool void QOSGWidget::createContext() { - osg::DisplaySettings* ds = osg::DisplaySettings::instance(); + osg::DisplaySettings* ds = osg::DisplaySettings::instance().get(); osg::ref_ptr traits = new osg::GraphicsContext::Traits; diff --git a/examples/osgviewerQtContext/osgviewerQtContext.cpp b/examples/osgviewerQtContext/osgviewerQtContext.cpp index 2cca33f41..73ad48db4 100644 --- a/examples/osgviewerQtContext/osgviewerQtContext.cpp +++ b/examples/osgviewerQtContext/osgviewerQtContext.cpp @@ -50,7 +50,7 @@ public: osg::Camera* createCamera( int x, int y, int w, int h, const std::string& name="", bool windowDecoration=false ) { - osg::DisplaySettings* ds = osg::DisplaySettings::instance(); + osg::DisplaySettings* ds = osg::DisplaySettings::instance().get(); osg::ref_ptr traits = new osg::GraphicsContext::Traits; traits->windowName = name; traits->windowDecoration = windowDecoration; diff --git a/examples/osgviewerQtWidget/QOSGWidget.cpp b/examples/osgviewerQtWidget/QOSGWidget.cpp index a269a4305..44c2885a0 100644 --- a/examples/osgviewerQtWidget/QOSGWidget.cpp +++ b/examples/osgviewerQtWidget/QOSGWidget.cpp @@ -124,7 +124,7 @@ QOSGWidget::QOSGWidget( QWidget * parent, WindowFlags f) void QOSGWidget::createContext(QWidget * parent) { - osg::DisplaySettings* ds = osg::DisplaySettings::instance(); + osg::DisplaySettings* ds = osg::DisplaySettings::instance().get(); osg::ref_ptr traits = new osg::GraphicsContext::Traits; diff --git a/include/osg/Camera b/include/osg/Camera index 5c733e2b8..d2ae3a50f 100644 --- a/include/osg/Camera +++ b/include/osg/Camera @@ -460,8 +460,7 @@ class OSG_EXPORT Camera : public Transform, public CullSettings { if( effectiveMask && _implicitBufferAttachmentRenderMask == USE_DISPLAY_SETTINGS_MASK ) { - const DisplaySettings * ds = getDisplaySettings(); - if ( !ds ) ds = DisplaySettings::instance(); + const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get(); return ds->getImplicitBufferAttachmentRenderMask(); } else @@ -479,9 +478,8 @@ class OSG_EXPORT Camera : public Transform, public CullSettings { if( effectiveMask && _implicitBufferAttachmentResolveMask == USE_DISPLAY_SETTINGS_MASK ) { - const DisplaySettings * ds = getDisplaySettings(); - if ( !ds ) ds = DisplaySettings::instance(); - return ds->getImplicitBufferAttachmentRenderMask(); + const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get(); + return ds->getImplicitBufferAttachmentResolveMask(); } else { diff --git a/include/osgShadow/ParallelSplitShadowMap b/include/osgShadow/ParallelSplitShadowMap index 93c6a8d03..accde8789 100644 --- a/include/osgShadow/ParallelSplitShadowMap +++ b/include/osgShadow/ParallelSplitShadowMap @@ -97,7 +97,7 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique inline void setUserLight(osg::Light* light) { _userLight = light; } /** get the user defined light for shadow simulation */ - inline const osg::Light* getUserLight() const { return _userLight; } + inline const osg::Light* getUserLight() const { return _userLight.get(); } /** Set the values for the ambient bias the shader will use.*/ void setAmbientBias(const osg::Vec2& ambientBias ); diff --git a/src/osgPlugins/osg/XmlStreamOperator.h b/src/osgPlugins/osg/XmlStreamOperator.h index 51906f1e5..2532daf1a 100644 --- a/src/osgPlugins/osg/XmlStreamOperator.h +++ b/src/osgPlugins/osg/XmlStreamOperator.h @@ -475,7 +475,7 @@ protected: if ( isReadable() ) return true; _sstream.clear(); - osgDB::XmlNode* current = _nodePath.back(); + osgDB::XmlNode* current = _nodePath.back().get(); if ( !current->name.empty() ) { _sstream.str( current->name );