Do not create terrain geodes when built with OSG 3.4

openmw-38
scrawl 9 years ago
parent 71d9e7dc52
commit 52901ec10c

@ -13,6 +13,7 @@
#include <osg/Geometry>
#include <osg/Geode>
#include <osg/KdTree>
#include <osg/Version>
#include <osgFX/Effect>
@ -126,10 +127,6 @@ osg::ref_ptr<osg::Node> TerrainGrid::buildTerrain (osg::Group* parent, float chu
osg::BoundingBox bounds(min, max);
geometry->setComputeBoundingBoxCallback(new StaticBoundingBoxCallback(bounds));
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
geode->addDrawable(geometry);
std::vector<LayerInfo> layerList;
std::vector<osg::ref_ptr<osg::Image> > blendmaps;
mStorage->getBlendmaps(chunkSize, chunkCenter, false, blendmaps, layerList);
@ -169,11 +166,20 @@ osg::ref_ptr<osg::Node> 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<osg::Geode> 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);
}

Loading…
Cancel
Save