From 411435a48f9b7846bba40e3ab736fd005a0a0056 Mon Sep 17 00:00:00 2001 From: timoore Date: Thu, 4 Oct 2007 20:40:29 +0000 Subject: [PATCH] Make comparisons against OSG version less flakey Turn OPENSCENEGRAPH_MAJOR_VERSION, OPENSCENEGRAPH_MINOR_VERSION and OPENSCENEGRAPH_PATCH_VERSION into a single number for comparisons in the preprocessor. --- src/Environment/fgclouds.cxx | 4 +++- src/Include/general.hxx | 5 +++++ src/Instrumentation/wxradar.cxx | 3 ++- src/Main/fg_os_osgviewer.cxx | 7 ++----- src/Main/renderer.cxx | 4 ++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Environment/fgclouds.cxx b/src/Environment/fgclouds.cxx index dfb884c07..1104f7678 100644 --- a/src/Environment/fgclouds.cxx +++ b/src/Environment/fgclouds.cxx @@ -410,7 +410,9 @@ void FGClouds::buildScenario( const string& scenario ) { } for(int iLayer = 0 ; iLayer < thesky->get_cloud_layer_count(); iLayer++) { - thesky->get_cloud_layer(iLayer)->get_layer3D()->clear(); + thesky->get_cloud_layer(iLayer) + ->setCoverage(SGCloudLayer::SG_CLOUD_CLEAR); + thesky->get_cloud_layer(iLayer)->get_layer3D()->clear(); } station += " 011000Z "; diff --git a/src/Include/general.hxx b/src/Include/general.hxx index 1c33c5c59..0001e232e 100644 --- a/src/Include/general.hxx +++ b/src/Include/general.hxx @@ -31,6 +31,11 @@ # error This library requires C++ #endif +#include + +#define FG_OSG_VERSION \ + ((OPENSCENEGRAPH_MAJOR_VERSION*10000)\ + + (OPENSCENEGRAPH_MINOR_VERSION*1000) + OPENSCENEGRAPH_PATCH_VERSION) // #define FANCY_FRAME_COUNTER #ifdef FANCY_FRAME_COUNTER diff --git a/src/Instrumentation/wxradar.cxx b/src/Instrumentation/wxradar.cxx index e4a96b3bf..b83278cb3 100644 --- a/src/Instrumentation/wxradar.cxx +++ b/src/Instrumentation/wxradar.cxx @@ -61,6 +61,7 @@ SG_USING_STD(setfill); #include #include +#include #include "instrument_mgr.hxx" #include "od_gauge.hxx" #include "wxradar.hxx" @@ -869,7 +870,7 @@ wxRadarBg::updateFont() } else { tpath = path; } -#if OSG_VERSION_MAJOR > 2 || (OSG_VERSION_MAJOR == 2 && OSG_VERSION_MINOR > 0) +#if (FG_OSG_VERSION >= 21000) osg::ref_ptr fontOptions = new osgDB::ReaderWriter::Options("monochrome"); osg::ref_ptr font = osgText::readFontFile(tpath.c_str(), fontOptions.get()); #else diff --git a/src/Main/fg_os_osgviewer.cxx b/src/Main/fg_os_osgviewer.cxx index afd55c976..71600824d 100644 --- a/src/Main/fg_os_osgviewer.cxx +++ b/src/Main/fg_os_osgviewer.cxx @@ -18,17 +18,14 @@ #include #include +#include #include "fg_os.hxx" #include "fg_props.hxx" #include "util.hxx" #include "globals.hxx" #include "renderer.hxx" -#if ((2 <= OSG_VERSION_MAJOR) || \ - (1 == OSG_VERSION_MAJOR) && (9 == OSG_VERSION_MINOR) && \ - (8 <= OSG_VERSION_PATCH)) || \ - ((1 == OSG_VERSION_MAJOR) && (9 < OSG_VERSION_MINOR)) || \ - (1 < OSG_VERSION_MAJOR) +#if (FG_OSG_VERSION >= 19008) #define OSG_HAS_MOUSE_CURSOR_PATCH #endif diff --git a/src/Main/renderer.cxx b/src/Main/renderer.cxx index bbb7557e2..59b879743 100644 --- a/src/Main/renderer.cxx +++ b/src/Main/renderer.cxx @@ -98,13 +98,13 @@ #include #include +#include #include "splash.hxx" #include "renderer.hxx" #include "main.hxx" // XXX Make this go away when OSG 2.2 is released. -#if ((2 <= OSG_VERSION_MAJOR) && (1 <= OSG_VERSION_MINOR) \ - && (4 <= OSG_VERSION_PATCH)) +#if (FG_OSG_VERSION >= 21004) #define UPDATE_VISITOR_IN_VIEWER 1 #endif