From 52901ec10cd0d15731de93be3e46d49eec8fcd05 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 16 Nov 2015 15:11:20 +0100 Subject: [PATCH] Do not create terrain geodes when built with OSG 3.4 --- components/terrain/terraingrid.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/components/terrain/terraingrid.cpp b/components/terrain/terraingrid.cpp index 732936aa99..ceb39a24b0 100644 --- a/components/terrain/terraingrid.cpp +++ b/components/terrain/terraingrid.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -126,10 +127,6 @@ osg::ref_ptr TerrainGrid::buildTerrain (osg::Group* parent, float chu osg::BoundingBox bounds(min, max); geometry->setComputeBoundingBoxCallback(new StaticBoundingBoxCallback(bounds)); - osg::ref_ptr geode (new osg::Geode); - geode->addDrawable(geometry); - - std::vector layerList; std::vector > blendmaps; mStorage->getBlendmaps(chunkSize, chunkCenter, false, blendmaps, layerList); @@ -169,11 +166,20 @@ osg::ref_ptr TerrainGrid::buildTerrain (osg::Group* parent, float chu effect->addCullCallback(new SceneUtil::LightListCallback); transform->addChild(effect); - effect->addChild(geode); + +#if OSG_VERSION_GREATER_OR_EQUAL(3,3,3) + osg::Node* toAttach = geometry.get(); +#else + osg::ref_ptr geode (new osg::Geode); + geode->addDrawable(geometry); + osg::Node* toAttach = geode.get(); +#endif + + effect->addChild(toAttach); if (mIncrementalCompileOperation) { - mIncrementalCompileOperation->add(geode); + mIncrementalCompileOperation->add(toAttach); mIncrementalCompileOperation->add(textureCompileDummy); }