From 7dc9eba2d0e98d9f08c7000b9424d28998755211 Mon Sep 17 00:00:00 2001 From: frohlich Date: Sat, 16 May 2009 08:13:52 +0000 Subject: [PATCH] Make SimGear compile with osg trunk Modified Files: simgear/scene/model/SGPagedLOD.cxx simgear/scene/model/SGPagedLOD.hxx simgear/scene/sky/cloud.cxx simgear/scene/sky/moon.cxx simgear/structure/OSGVersion.hxx --- simgear/scene/model/SGPagedLOD.cxx | 2 -- simgear/scene/model/SGPagedLOD.hxx | 16 +++++++++++----- simgear/scene/sky/cloud.cxx | 4 ++++ simgear/scene/sky/moon.cxx | 4 ++++ simgear/structure/OSGVersion.hxx | 24 ++++++++++++++++++++++++ 5 files changed, 43 insertions(+), 7 deletions(-) diff --git a/simgear/scene/model/SGPagedLOD.cxx b/simgear/scene/model/SGPagedLOD.cxx index fee5dee4..b45af204 100644 --- a/simgear/scene/model/SGPagedLOD.cxx +++ b/simgear/scene/model/SGPagedLOD.cxx @@ -75,9 +75,7 @@ void SGPagedLOD::forceLoad(osgDB::DatabasePager *dbp) setTimeStamp(childNum, 0); double priority=1.0; dbp->requestNodeFile(getFileName(childNum),this,priority,0, -#if SG_OSG_VERSION >= 25001 getDatabaseRequest(childNum), -#endif _readerWriterOptions.get()); } diff --git a/simgear/scene/model/SGPagedLOD.hxx b/simgear/scene/model/SGPagedLOD.hxx index 40e59ae7..7bf54266 100644 --- a/simgear/scene/model/SGPagedLOD.hxx +++ b/simgear/scene/model/SGPagedLOD.hxx @@ -17,7 +17,11 @@ #ifndef SGPAGEDLOD_HXX #define SGPAGEDLOD_HXX 1 +#include #include +#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5) +#include +#endif #include #include @@ -44,19 +48,21 @@ public: // reimplemented to notify the loading through ModelData bool addChild(osg::Node *child); - void setReaderWriterOptions(osgDB::ReaderWriter::Options *o) { - _readerWriterOptions=o; - _readerWriterOptions->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE); + void setReaderWriterOptions(osgDB::ReaderWriter::Options *options) { + _readerWriterOptions = options; + options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE); +#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5) + setDatabaseOptions(options); +#endif } - osgDB::ReaderWriter::Options * getReaderWriterOptions() { + osgDB::ReaderWriter::Options* getReaderWriterOptions() { return _readerWriterOptions.get(); } protected: virtual ~SGPagedLOD(); osg::ref_ptr _readerWriterOptions; - SGPropertyNode_ptr _props; }; } #endif diff --git a/simgear/scene/sky/cloud.cxx b/simgear/scene/sky/cloud.cxx index da61f7fc..0addf208 100644 --- a/simgear/scene/sky/cloud.cxx +++ b/simgear/scene/sky/cloud.cxx @@ -30,6 +30,7 @@ #include +#include #include #include #include @@ -43,6 +44,9 @@ #include #include #include +#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5) +#include +#endif #include #include diff --git a/simgear/scene/sky/moon.cxx b/simgear/scene/sky/moon.cxx index 7ad47bba..20e1f2b0 100644 --- a/simgear/scene/sky/moon.cxx +++ b/simgear/scene/sky/moon.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -42,6 +43,9 @@ #include #include #include +#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5) +#include +#endif #include #include diff --git a/simgear/structure/OSGVersion.hxx b/simgear/structure/OSGVersion.hxx index e8dd8e26..46d0187e 100644 --- a/simgear/structure/OSGVersion.hxx +++ b/simgear/structure/OSGVersion.hxx @@ -23,4 +23,28 @@ #define SG_OSG_VERSION \ ((OPENSCENEGRAPH_MAJOR_VERSION*10000)\ + (OPENSCENEGRAPH_MINOR_VERSION*1000) + OPENSCENEGRAPH_PATCH_VERSION) + +#define SG_OSG_VERSION_GREATER_EQUAL(MAJOR, MINOR, PATCH) \ + ((OPENSCENEGRAPH_MAJOR_VERSION > (MAJOR)) || \ + (OPENSCENEGRAPH_MAJOR_VERSION == (MAJOR) && \ + (OPENSCENEGRAPH_MINOR_VERSION > (MINOR) || \ + (OPENSCENEGRAPH_MINOR_VERSION == (MINOR) && \ + OPENSCENEGRAPH_PATCH_VERSION >= (PATCH))))) + +#define SG_OSG_VERSION_GREATER_THAN(MAJOR, MINOR, PATCH) \ + ((OPENSCENEGRAPH_MAJOR_VERSION > (MAJOR)) || \ + (OPENSCENEGRAPH_MAJOR_VERSION == (MAJOR) && \ + (OPENSCENEGRAPH_MINOR_VERSION > (MINOR) || \ + (OPENSCENEGRAPH_MINOR_VERSION == (MINOR) && \ + OPENSCENEGRAPH_PATCH_VERSION > (PATCH))))) + +#define SG_OSG_VERSION_LESS_THAN(MAJOR, MINOR, PATCH) \ + (!SG_OSG_VERSION_GREATER_EQUAL(MAJOR, MINOR, PATCH)) + +#define SG_OSG_VERSION_LESS_EQUAL(MAJOR, MINOR, PATCH) \ + (!SG_OSG_VERSION_GREATER_THAN(MAJOR, MINOR, PATCH)) + +#define SG_OSG_MIN_VERSION_REQUIRED(MAJOR, MINOR, PATCH) \ + SG_OSG_VERSION_GREATER_EQUAL(MAJOR, MINOR, PATCH) + #endif -- 2.39.5