From e6d10933868c47324a233397879a1d13c0be2210 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Mon, 28 Oct 2013 17:21:52 +0100 Subject: [PATCH] [globe] Fix clipping problems when close to the ground --- src/plugins/globe/globe_plugin.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/globe/globe_plugin.cpp b/src/plugins/globe/globe_plugin.cpp index 2ee6a0c9bad2..ecd74ce8a884 100644 --- a/src/plugins/globe/globe_plugin.cpp +++ b/src/plugins/globe/globe_plugin.cpp @@ -60,6 +60,7 @@ #include #include #include +#include using namespace osgEarth::Drivers; using namespace osgEarth::Util; @@ -287,8 +288,13 @@ void GlobePlugin::run() mOsgViewer->addEventHandler( new osgViewer::ThreadingHandler() ); mOsgViewer->addEventHandler( new osgViewer::LODScaleHandler() ); mOsgViewer->addEventHandler( new osgGA::StateSetManipulator( mOsgViewer->getCamera()->getOrCreateStateSet() ) ); +#if OSGEARTH_VERSION_LESS_THAN( 2, 2, 0 ) // add a handler that will automatically calculate good clipping planes - //mOsgViewer->addEventHandler( new osgEarth::Util::AutoClipPlaneHandler() ); + mOsgViewer->addEventHandler( new osgEarth::Util::AutoClipPlaneHandler() ); +#else + mOsgViewer->getCamera()->addCullCallback( new AutoClipPlaneCullCallback( mMapNode ) ); +#endif + // osgEarth benefits from pre-compilation of GL objects in the pager. In newer versions of // OSG, this activates OSG's IncrementalCompileOpeartion in order to avoid frame breaks. mOsgViewer->getDatabasePager()->setDoPreCompile( true );