Fixes for building OSG with OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION set to OFF.

Fixed copy and paste error in Camera::getImplicitBufferAttachmentResolveMask().
This commit is contained in:
Robert Osfield 2010-05-12 11:37:27 +00:00
parent e91557fe1d
commit 68a1ed2dcf
8 changed files with 26 additions and 30 deletions

View File

@ -229,7 +229,7 @@ int main( int argc, char **argv )
} }
} }
if (use_pbuffer) { if (use_pbuffer) {
osg::DisplaySettings* ds = osg::DisplaySettings::instance(); osg::DisplaySettings* ds = osg::DisplaySettings::instance().get();
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits(ds); osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits(ds);
if (viewer.getCamera()->getGraphicsContext() && viewer.getCamera()->getGraphicsContext()->getTraits()) { if (viewer.getCamera()->getGraphicsContext() && viewer.getCamera()->getGraphicsContext()->getTraits()) {

View File

@ -404,7 +404,7 @@ AppState::AppState(osgViewer::Viewer* viewer_)
textInverted = new Geode; textInverted = new Geode;
textInverted->addDrawable(inverted); textInverted->addDrawable(inverted);
textInverted->setNodeMask(~0u); textInverted->setNodeMask(~0u);
textProjection->addChild(textInverted); textProjection->addChild(textInverted.get());
textProjection->getOrCreateStateSet()->setRenderBinDetails(11, "RenderBin"); textProjection->getOrCreateStateSet()->setRenderBinDetails(11, "RenderBin");
} }
@ -641,7 +641,7 @@ void ResizedCallback::resizedImplementation(GraphicsContext* gc, int x, int y,
int width, int height) int width, int height)
{ {
gc->resizedImplementation(x, y, width, height); gc->resizedImplementation(x, y, width, height);
makeTexturesAndGeometry(width, height, _appState->sw); makeTexturesAndGeometry(width, height, _appState->sw.get());
_appState->setStateFromConfig(validConfigs[_appState _appState->setStateFromConfig(validConfigs[_appState
->currentConfig]); ->currentConfig]);
osgViewer::Viewer* viewer = _appState->viewer; osgViewer::Viewer* viewer = _appState->viewer;
@ -693,9 +693,7 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
return 0; return 0;
} }
DisplaySettings* ds = viewer.getDisplaySettings(); DisplaySettings* ds = viewer.getDisplaySettings() ? viewer.getDisplaySettings() : DisplaySettings::instance().get();
if (!ds)
ds = DisplaySettings::instance();
GraphicsContext::ScreenIdentifier si; GraphicsContext::ScreenIdentifier si;
si.readDISPLAY(); si.readDISPLAY();
@ -769,7 +767,7 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
BufferConfigList colorConfigs; BufferConfigList colorConfigs;
BufferConfigList depthConfigs; BufferConfigList depthConfigs;
vector<int> coverageConfigs; vector<int> coverageConfigs;
getPossibleConfigs(gc, colorConfigs, depthConfigs, coverageConfigs); getPossibleConfigs(gc.get(), colorConfigs, depthConfigs, coverageConfigs);
int coverageSampleConfigs = (coverageConfigs.size() - 4) / 2; int coverageSampleConfigs = (coverageConfigs.size() - 4) / 2;
cout << "color configs\nname\tbits\n"; cout << "color configs\nname\tbits\n";
for (BufferConfigList::const_iterator colorItr = colorConfigs.begin(), 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, FboConfig config(root, colorItr->format, depthItr->format,
colorItr->bits, depthItr->bits); colorItr->bits, depthItr->bits);
FboData data; FboData data;
if (createFBO(gc, config, data)) if (createFBO(gc.get(), config, data))
validConfigs.push_back(config); validConfigs.push_back(config);
destroyFBO(gc, data); destroyFBO(gc.get(), data);
if (coverageConfigs.size() > 0) if (coverageConfigs.size() > 0)
{ {
//CSAA provides a list of all supported AA modes for //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(); config.name = msText.str();
if (createFBO(gc, config, data)) { if (createFBO(gc.get(), config, data)) {
validConfigs.push_back( config); 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) if (config.coverageSamples != 0 || config.depthSamples != 0)
camera->attach(Camera::DEPTH_BUFFER, config.depthFormat); camera->attach(Camera::DEPTH_BUFFER, config.depthFormat);
else if (config.depthFormat == GL_DEPTH_COMPONENT24) else if (config.depthFormat == GL_DEPTH_COMPONENT24)
camera->attach(Camera::DEPTH_BUFFER, depthTexture24); camera->attach(Camera::DEPTH_BUFFER, depthTexture24.get());
else 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 // 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 else
depthTexture = depthTexture24; depthTexture = depthTexture24;
sw->removeChildren(0, sw->getNumChildren()); sw->removeChildren(0, sw->getNumChildren());
sw->addChild(createTextureQuad(colorTexture)); sw->addChild(createTextureQuad(colorTexture.get()));
sw->addChild(createTextureQuad(depthTexture)); sw->addChild(createTextureQuad(depthTexture.get()));
sw->addChild(createTextureQuad(depthTexture24)); sw->addChild(createTextureQuad(depthTexture24.get()));
sw->setSingleChildOn(0); sw->setSingleChildOn(0);
return sw; return sw;
} }
@ -965,15 +963,15 @@ int main(int argc, char **argv)
osgUtil::Optimizer optimizer; osgUtil::Optimizer optimizer;
optimizer.optimize(loadedModel.get()); optimizer.optimize(loadedModel.get());
// creates texture to be rendered // creates texture to be rendered
Switch* sw = makeTexturesAndGeometry(width, height, appState->sw); Switch* sw = makeTexturesAndGeometry(width, height, appState->sw.get());
ref_ptr<Camera> rttCamera = makeRttCamera(gc, width, height); ref_ptr<Camera> rttCamera = makeRttCamera(gc, width, height);
rttCamera->setRenderOrder(Camera::PRE_RENDER); rttCamera->setRenderOrder(Camera::PRE_RENDER);
viewer.addSlave(rttCamera); viewer.addSlave(rttCamera.get());
appState->camera = rttCamera; appState->camera = rttCamera;
// geometry and slave camera to display the result // geometry and slave camera to display the result
Group* displayRoot = new Group; Group* displayRoot = new Group;
displayRoot->addChild(sw); displayRoot->addChild(sw);
displayRoot->addChild(appState->textProjection); displayRoot->addChild(appState->textProjection.get());
StateSet* displaySS = displayRoot->getOrCreateStateSet(); StateSet* displaySS = displayRoot->getOrCreateStateSet();
displaySS->setMode(GL_LIGHTING, StateAttribute::OFF); displaySS->setMode(GL_LIGHTING, StateAttribute::OFF);
displaySS->setMode(GL_DEPTH_TEST, 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->setCullingMode(CullSettings::NO_CULLING);
texCamera->setProjectionResizePolicy(Camera::FIXED); texCamera->setProjectionResizePolicy(Camera::FIXED);
viewer.addSlave(texCamera, Matrixd(), Matrixd(), false); viewer.addSlave(texCamera, Matrixd(), Matrixd(), false);
viewer.addEventHandler(new ConfigHandler(appState)); viewer.addEventHandler(new ConfigHandler(appState.get()));
// add model to the viewer. // add model to the viewer.
Group* sceneRoot = new Group; Group* sceneRoot = new Group;

View File

@ -140,7 +140,7 @@ QOSGWidget::QOSGWidget( QWidget * parent, const char * name, WindowFlags f, bool
void QOSGWidget::createContext() void QOSGWidget::createContext()
{ {
osg::DisplaySettings* ds = osg::DisplaySettings::instance(); osg::DisplaySettings* ds = osg::DisplaySettings::instance().get();
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;

View File

@ -50,7 +50,7 @@ public:
osg::Camera* createCamera( int x, int y, int w, int h, const std::string& name="", bool windowDecoration=false ) 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<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->windowName = name; traits->windowName = name;
traits->windowDecoration = windowDecoration; traits->windowDecoration = windowDecoration;

View File

@ -124,7 +124,7 @@ QOSGWidget::QOSGWidget( QWidget * parent, WindowFlags f)
void QOSGWidget::createContext(QWidget * parent) void QOSGWidget::createContext(QWidget * parent)
{ {
osg::DisplaySettings* ds = osg::DisplaySettings::instance(); osg::DisplaySettings* ds = osg::DisplaySettings::instance().get();
osg::ref_ptr<osg::GraphicsContext::Traits> traits = osg::ref_ptr<osg::GraphicsContext::Traits> traits =
new osg::GraphicsContext::Traits; new osg::GraphicsContext::Traits;

View File

@ -460,8 +460,7 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
{ {
if( effectiveMask && _implicitBufferAttachmentRenderMask == USE_DISPLAY_SETTINGS_MASK ) if( effectiveMask && _implicitBufferAttachmentRenderMask == USE_DISPLAY_SETTINGS_MASK )
{ {
const DisplaySettings * ds = getDisplaySettings(); const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get();
if ( !ds ) ds = DisplaySettings::instance();
return ds->getImplicitBufferAttachmentRenderMask(); return ds->getImplicitBufferAttachmentRenderMask();
} }
else else
@ -479,9 +478,8 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
{ {
if( effectiveMask && _implicitBufferAttachmentResolveMask == USE_DISPLAY_SETTINGS_MASK ) if( effectiveMask && _implicitBufferAttachmentResolveMask == USE_DISPLAY_SETTINGS_MASK )
{ {
const DisplaySettings * ds = getDisplaySettings(); const DisplaySettings * ds = _displaySettings.valid() ? _displaySettings.get() : DisplaySettings::instance().get();
if ( !ds ) ds = DisplaySettings::instance(); return ds->getImplicitBufferAttachmentResolveMask();
return ds->getImplicitBufferAttachmentRenderMask();
} }
else else
{ {

View File

@ -97,7 +97,7 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
inline void setUserLight(osg::Light* light) { _userLight = light; } inline void setUserLight(osg::Light* light) { _userLight = light; }
/** get the user defined light for shadow simulation */ /** 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.*/ /** Set the values for the ambient bias the shader will use.*/
void setAmbientBias(const osg::Vec2& ambientBias ); void setAmbientBias(const osg::Vec2& ambientBias );

View File

@ -475,7 +475,7 @@ protected:
if ( isReadable() ) return true; if ( isReadable() ) return true;
_sstream.clear(); _sstream.clear();
osgDB::XmlNode* current = _nodePath.back(); osgDB::XmlNode* current = _nodePath.back().get();
if ( !current->name.empty() ) if ( !current->name.empty() )
{ {
_sstream.str( current->name ); _sstream.str( current->name );