Merge remote-tracking branch 'scrawl/osg_34'

move
Marc Zinnschlag 8 years ago
commit 28e3fe837f

@ -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.3.4 REQUIRED osgDB osgViewer osgText osgGA osgAnimation osgParticle ${OSG_QT} osgUtil osgFX)
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})

@ -10,7 +10,6 @@
#include <osg/Geode>
#include <osg/BlendFunc>
#include <osg/Material>
#include <osg/Version>
#include <osgParticle/ParticleSystem>
@ -201,17 +200,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 +231,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)
{

@ -5,7 +5,6 @@
#include <osg/Group>
#include <osg/Geode>
#include <osg/UserDataContainer>
#include <osg/Version>
#include <osgParticle/ParticleSystem>
#include <osgParticle/ParticleProcessor>
@ -43,26 +42,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()
{

@ -11,7 +11,6 @@
#include <osg/Material>
#include <osg/TexEnvCombine>
#include <osg/TexMat>
#include <osg/Version>
#include <osg/OcclusionQueryNode>
#include <osg/ColorMask>
#include <osg/MatrixTransform>
@ -1282,11 +1281,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)))

@ -5,7 +5,6 @@
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/Array>
#include <osg/Version>
#include <osg/LOD>
// resource
@ -934,13 +933,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 +1010,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 +1017,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 +1129,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);
}

@ -2,7 +2,6 @@
#include <osgDB/Registry>
#include <osg/GLExtensions>
#include <osg/Version>
#include <components/vfs/manager.hpp>
@ -62,17 +61,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;

@ -4,7 +4,6 @@
#include <osg/Node>
#include <osg/Geode>
#include <osg/UserDataContainer>
#include <osg/Version>
#include <osgParticle/ParticleSystem>
#include <osgFX/Effect>
@ -52,24 +51,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)
{
@ -84,7 +65,6 @@ namespace
partsys->setNodeMask(mMask);
}
}
#endif
void transformInitialParticles(osgParticle::ParticleSystem* partsys, osg::Node* node)
{

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

@ -5,7 +5,6 @@
#include <osg/Drawable>
#include <osg/Geode>
#include <osg/NodeCallback>
#include <osg/Version>
namespace SceneUtil
{
@ -65,11 +64,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 +91,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);

@ -4,7 +4,6 @@
#include <iostream>
#include <cstdlib>
#include <osg/Version>
#include <osg/MatrixTransform>
#include "skeleton.hpp"
@ -289,11 +288,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();
}

@ -2,8 +2,6 @@
#include <SDL_video.h>
#include <osg/Version>
namespace SDLUtil
{
@ -112,11 +110,7 @@ void GraphicsWindowSDL2::init()
mValid = true;
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,4)
getEventQueue()->syncWindowRectangleWithGraphicsContext();
#else
getEventQueue()->syncWindowRectangleWithGraphcisContext();
#endif
}
@ -133,11 +127,7 @@ bool GraphicsWindowSDL2::realizeImplementation()
SDL_ShowWindow(mWindow);
#if OSG_VERSION_GREATER_OR_EQUAL(3,3,4)
getEventQueue()->syncWindowRectangleWithGraphicsContext();
#else
getEventQueue()->syncWindowRectangleWithGraphcisContext();
#endif
mRealized = true;

@ -19,7 +19,6 @@
#include <osg/Geometry>
#include <osg/Geode>
#include <osg/KdTree>
#include <osg/Version>
#include <osgFX/Effect>
@ -193,13 +192,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