Remove support for OSG 3.2

Since commit e8662bea31, we're using OSG functionality that contains an unfixed crash bug in version 3.2. The bug is fixed in version 3.4 (OSG commit 6351e5020371b0b72b300088a5c6772f58379b84)
pull/895/head
scrawl 9 years ago
parent 48ac0bef3e
commit 8b596dfcbe

@ -233,7 +233,7 @@ if (USE_QT)
set (OSG_QT osgQt)
endif()
find_package(OpenSceneGraph 3.2.0 REQUIRED osgDB osgViewer osgText osgGA osgAnimation osgParticle ${OSG_QT} osgUtil osgFX)
find_package(OpenSceneGraph 3.4.0 REQUIRED osgDB osgViewer osgText osgGA osgAnimation osgParticle ${OSG_QT} osgUtil osgFX)
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})

@ -201,17 +201,10 @@ namespace
class RemoveDrawableVisitor : public RemoveVisitor
{
public:
virtual void apply(osg::Geode &geode)
{
applyImpl(geode);
}
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,3)
virtual void apply(osg::Drawable& drw)
{
applyImpl(drw);
}
#endif
void applyImpl(osg::Node& node)
{
@ -239,17 +232,10 @@ namespace
class RemoveTriBipVisitor : public RemoveVisitor
{
public:
virtual void apply(osg::Geode &node)
{
applyImpl(node);
}
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,3)
virtual void apply(osg::Drawable& drw)
{
applyImpl(drw);
}
#endif
void applyImpl(osg::Node& node)
{

@ -43,26 +43,11 @@ namespace
traverse(node);
}
virtual void apply(osg::Geode& geode)
{
std::vector<osgParticle::ParticleSystem*> partsysVector;
for (unsigned int i=0; i<geode.getNumDrawables(); ++i)
{
osg::Drawable* drw = geode.getDrawable(i);
if (osgParticle::ParticleSystem* partsys = dynamic_cast<osgParticle::ParticleSystem*>(drw))
partsysVector.push_back(partsys);
}
for (std::vector<osgParticle::ParticleSystem*>::iterator it = partsysVector.begin(); it != partsysVector.end(); ++it)
geode.removeDrawable(*it);
}
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,3)
virtual void apply(osg::Drawable& drw)
{
if (osgParticle::ParticleSystem* partsys = dynamic_cast<osgParticle::ParticleSystem*>(&drw))
mToRemove.push_back(partsys);
}
#endif
void remove()
{

@ -1282,11 +1282,7 @@ public:
if (stateset->getAttribute(osg::StateAttribute::MATERIAL))
{
SceneUtil::CompositeStateSetUpdater* composite = NULL;
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,3)
osg::Callback* callback = node.getUpdateCallback();
#else
osg::NodeCallback* callback = node.getUpdateCallback();
#endif
while (callback)
{
if ((composite = dynamic_cast<SceneUtil::CompositeStateSetUpdater*>(callback)))

@ -934,13 +934,7 @@ namespace NifOsg
updater->addParticleSystem(partsys);
parentNode->addChild(updater);
#if OSG_VERSION_LESS_THAN(3,3,3)
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
geode->addDrawable(partsys);
osg::Node* toAttach = geode.get();
#else
osg::Node* toAttach = partsys.get();
#endif
if (rf == osgParticle::ParticleProcessor::RELATIVE_RF)
parentNode->addChild(toAttach);
@ -1017,11 +1011,6 @@ namespace NifOsg
triShapeToGeometry(triShape, geometry, parentNode, composite, boundTextures, animflags);
}
#if OSG_VERSION_LESS_THAN(3,3,3)
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
geode->addDrawable(geometry);
#endif
if (geometry->getDataVariance() == osg::Object::DYNAMIC)
{
// Add a copy, we will alternate between the two copies every other frame using the FrameSwitch
@ -1029,24 +1018,14 @@ namespace NifOsg
geometry->setDataVariance(osg::Object::STATIC);
osg::ref_ptr<FrameSwitch> frameswitch = new FrameSwitch;
#if OSG_VERSION_LESS_THAN(3,3,3)
osg::ref_ptr<osg::Geode> geode2 = static_cast<osg::Geode*>(osg::clone(geode.get(), osg::CopyOp::DEEP_COPY_NODES|osg::CopyOp::DEEP_COPY_DRAWABLES));
frameswitch->addChild(geode);
frameswitch->addChild(geode2);
#else
osg::ref_ptr<osg::Geometry> geom2 = static_cast<osg::Geometry*>(osg::clone(geometry.get(), osg::CopyOp::DEEP_COPY_NODES|osg::CopyOp::DEEP_COPY_DRAWABLES));
frameswitch->addChild(geometry);
frameswitch->addChild(geom2);
#endif
parentNode->addChild(frameswitch);
}
else
#if OSG_VERSION_LESS_THAN(3,3,3)
parentNode->addChild(geode);
#else
parentNode->addChild(geometry);
#endif
}
osg::ref_ptr<osg::Geometry> handleMorphGeometry(const Nif::NiGeomMorpherController* morpher, const Nif::NiTriShape *triShape, osg::Node* parentNode, SceneUtil::CompositeStateSetUpdater* composite, const std::vector<int>& boundTextures, int animflags)
@ -1151,21 +1130,10 @@ namespace NifOsg
osg::ref_ptr<FrameSwitch> frameswitch = new FrameSwitch;
#if OSG_VERSION_LESS_THAN(3,3,3)
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
geode->addDrawable(rig);
osg::Geode* geode2 = static_cast<osg::Geode*>(osg::clone(geode.get(), osg::CopyOp::DEEP_COPY_NODES|
osg::CopyOp::DEEP_COPY_DRAWABLES));
frameswitch->addChild(geode);
frameswitch->addChild(geode2);
#else
SceneUtil::RigGeometry* rig2 = static_cast<SceneUtil::RigGeometry*>(osg::clone(rig.get(), osg::CopyOp::DEEP_COPY_NODES|
osg::CopyOp::DEEP_COPY_DRAWABLES));
frameswitch->addChild(rig);
frameswitch->addChild(rig2);
#endif
parentNode->addChild(frameswitch);
}

@ -62,17 +62,10 @@ namespace Resource
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
{
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,3)
osg::GLExtensions* exts = osg::GLExtensions::Get(0, false);
if (exts && !exts->isTextureCompressionS3TCSupported
// This one works too. Should it be included in isTextureCompressionS3TCSupported()? Submitted as a patch to OSG.
&& !osg::isGLExtensionSupported(0, "GL_S3_s3tc"))
#else
osg::Texture::Extensions* exts = osg::Texture::getExtensions(0, false);
if (exts && !exts->isTextureCompressionS3TCSupported()
// This one works too. Should it be included in isTextureCompressionS3TCSupported()? Submitted as a patch to OSG.
&& !osg::isGLExtensionSupported(0, "GL_S3_s3tc"))
#endif
{
std::cerr << "Error loading " << filename << ": no S3TC texture compression support installed" << std::endl;
return false;

@ -52,23 +52,6 @@ namespace
&& partsys->getUserDataContainer()->getDescriptions()[0] == "worldspace");
}
void apply(osg::Geode& geode)
{
for (unsigned int i=0;i<geode.getNumDrawables();++i)
{
if (osgParticle::ParticleSystem* partsys = dynamic_cast<osgParticle::ParticleSystem*>(geode.getDrawable(i)))
{
if (isWorldSpaceParticleSystem(partsys))
{
// HACK: Ignore the InverseWorldMatrix transform the geode is attached to
if (geode.getNumParents() && geode.getParent(0)->getNumParents())
transformInitialParticles(partsys, geode.getParent(0)->getParent(0));
}
geode.setNodeMask(mMask);
}
}
}
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,3)
// in OSG 3.3 and up Drawables can be directly in the scene graph without a Geode decorating them.
void apply(osg::Drawable& drw)

@ -81,11 +81,6 @@ namespace SceneUtil
#endif
osg::Drawable* cloned = osg::clone(drawable, copyop);
#if OSG_VERSION_LESS_THAN(3,3,3)
// work around OSG 3.2 not respecting the DEEP_COPY_CALLBACK flag
if (cloned->getUpdateCallback())
cloned->setUpdateCallback(osg::clone(cloned->getUpdateCallback(), *this));
#endif
return cloned;
}
if (dynamic_cast<const SceneUtil::RigGeometry*>(drawable))

@ -65,11 +65,7 @@ namespace SceneUtil
void ControllerVisitor::apply(osg::Node &node)
{
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,3)
osg::Callback* callback = node.getUpdateCallback();
#else
osg::NodeCallback* callback = node.getUpdateCallback();
#endif
while (callback)
{
if (Controller* ctrl = dynamic_cast<Controller*>(callback))
@ -96,11 +92,7 @@ namespace SceneUtil
{
osg::Drawable* drw = geode.getDrawable(i);
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,3)
osg::Callback* callback = drw->getUpdateCallback();
#else
osg::Drawable::UpdateCallback* callback = drw->getUpdateCallback();
#endif
if (Controller* ctrl = dynamic_cast<Controller*>(callback))
visit(geode, *ctrl);

@ -289,11 +289,9 @@ void RigGeometry::updateBounds(osg::NodeVisitor *nv)
_boundingBox = box;
_boundingBoxComputed = true;
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,3)
// in OSG 3.3.3 and up Drawable inherits from Node, so has a bounding sphere as well.
_boundingSphere = osg::BoundingSphere(_boundingBox);
_boundingSphereComputed = true;
#endif
for (unsigned int i=0; i<getNumParents(); ++i)
getParent(i)->dirtyBound();
}

@ -112,11 +112,7 @@ void GraphicsWindowSDL2::init()
mValid = true;
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,4)
getEventQueue()->syncWindowRectangleWithGraphicsContext();
#else
getEventQueue()->syncWindowRectangleWithGraphcisContext();
#endif
}
@ -133,11 +129,7 @@ bool GraphicsWindowSDL2::realizeImplementation()
SDL_ShowWindow(mWindow);
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,4)
getEventQueue()->syncWindowRectangleWithGraphicsContext();
#else
getEventQueue()->syncWindowRectangleWithGraphcisContext();
#endif
mRealized = true;

@ -193,13 +193,7 @@ osg::ref_ptr<osg::Node> TerrainGrid::buildTerrain (osg::Group* parent, float chu
transform->addChild(effect);
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,3)
osg::Node* toAttach = geometry.get();
#else
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
geode->addDrawable(geometry);
osg::Node* toAttach = geode.get();
#endif
effect->addChild(toAttach);

Loading…
Cancel
Save