]> git.mxchange.org Git - simgear.git/commitdiff
Untangle osg singleton dependencies.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Sat, 3 Mar 2012 17:57:48 +0000 (18:57 +0100)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Sat, 3 Mar 2012 17:57:48 +0000 (18:57 +0100)
Take two. The ModelRegistry's are already derived from osg::Referenced.
So also introduce the osg dependent version in simgear/scene/util.

CMakeLists.txt
simgear/CMakeLists.txt
simgear/scene/model/ModelRegistry.hxx
simgear/scene/tgdb/GroundLightManager.hxx
simgear/scene/util/CMakeLists.txt
simgear/scene/util/OsgSingleton.hxx [new file with mode: 0644]
simgear/scene/util/StateAttributeFactory.hxx
simgear/simgear_config_cmake.h.in
simgear/structure/Singleton.hxx

index f1e985adbf15f4850ba2c9830d23cba50f8e2074..281b366f5c3a984bfb5c161622cf25d527061566 100644 (file)
@@ -115,7 +115,6 @@ find_package(Threads REQUIRED)
 
 if(SIMGEAR_HEADLESS)
     message(STATUS "headless mode")
-    set(NO_OPENSCENEGRAPH_INTERFACE 1)
 else()
     find_package(OpenGL REQUIRED)
     find_package(OpenAL REQUIRED)
index 954ed6f0deba36800338a4d9f37201a36f838bb2..7612bb8da3c69e8e5ae05478205e18ae7d567b34 100644 (file)
@@ -46,7 +46,6 @@ if(SIMGEAR_SHARED)
     get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
 
     add_library(SimGearCore SHARED ${coreSources})
-    set_property(TARGET SimGearCore PROPERTY COMPILE_FLAGS "-DNO_OPENSCENEGRAPH_INTERFACE=1")
 
   # set_property(TARGET SimGearCore PROPERTY FRAMEWORK 1)
   #  message(STATUS "public header: ${publicHeaders}")
index 5e30390564007758a47b18aa6cb8d4961ab11b47..e048f187a47c03a46a1a9150d5711555bcd9e296 100644 (file)
@@ -27,7 +27,7 @@
 #include <osgDB/Registry>
 
 #include <simgear/compiler.h>
-#include <simgear/structure/Singleton.hxx>
+#include <simgear/scene/util/OsgSingleton.hxx>
 
 #include <string>
 #include <map>
index 92130db0a4637e1c2571bceeebe9be74e4795d1f..2da72bc4f6242a7345411611fc5bfaf2f2d9fdeb 100644 (file)
@@ -24,7 +24,7 @@
 #include <osg/StateSet>
 
 
-#include <simgear/structure/Singleton.hxx>
+#include <simgear/scene/util/OsgSingleton.hxx>
 #include <simgear/scene/util/SGUpdateVisitor.hxx>
 
 namespace simgear
index 1b833484e6cb181e63a94442461af58afe173bc1..8d5e84a2496888fc944c1c0234719e30433f216c 100644 (file)
@@ -4,6 +4,7 @@ set(HEADERS
     CopyOp.hxx
     NodeAndDrawableVisitor.hxx
     OsgMath.hxx
+    OsgSingleton.hxx
     PrimitiveUtils.hxx
     QuadTreeBuilder.hxx
     RenderConstants.hxx
diff --git a/simgear/scene/util/OsgSingleton.hxx b/simgear/scene/util/OsgSingleton.hxx
new file mode 100644 (file)
index 0000000..c9c40e1
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef SIMGEAR_OSGSINGLETON_HXX
+#define SIMGEAR_OSGSINGLETON_HXX 1
+
+#include <simgear/structure/Singleton.hxx>
+
+#include <osg/Referenced>
+#include <osg/ref_ptr>
+
+namespace simgear {
+
+template <typename RefClass>
+class SingletonRefPtr
+{
+public:
+    SingletonRefPtr()
+    {
+        ptr = new RefClass;
+    }
+    static RefClass* instance()
+    {
+        SingletonRefPtr& singleton
+            = boost::details::pool::singleton_default<SingletonRefPtr>::instance();
+        return singleton.ptr.get();
+    }
+private:
+    osg::ref_ptr<RefClass> ptr;
+};
+
+template <typename RefClass>
+class ReferencedSingleton : public virtual osg::Referenced
+{
+public:
+    static RefClass* instance()
+    {
+        return SingletonRefPtr<RefClass>::instance();
+    }
+};
+
+}
+
+#endif
index 47603e7b70d2a8ab64486657547113cb548688df..12b6840b144dab1982ffa9e5563f8a8380286c2b 100644 (file)
@@ -37,7 +37,7 @@ class Texture2D;
 class TexEnv;
 }
 
-#include <simgear/structure/Singleton.hxx>
+#include <simgear/scene/util/OsgSingleton.hxx>
 
 // Return read-only instances of common OSG state attributes.
 namespace simgear
index a1192283281103dd0525e9338a46b9f73aa8181f..563f9f7355416c0387883bbd6a6a3734a0c55e5b 100644 (file)
@@ -17,6 +17,3 @@
 #cmakedefine HAVE_LIBSVN_CLIENT_1
 
 #cmakedefine GCC_ATOMIC_BUILTINS_FOUND
-
-// set if building headless (no OSG or OpenGL libs)
-#cmakedefine NO_OPENSCENEGRAPH_INTERFACE
index 35c712a28f66c0194f4fec8b8f3c9e26bb1001c2..0db235fec976aa7646ecf105b58d878fe43ce5c4 100644 (file)
@@ -3,11 +3,6 @@
 
 #include "singleton.hpp"
 
-#ifndef NO_OPENSCENEGRAPH_INTERFACE
-#include <osg/Referenced>
-#include <osg/ref_ptr>
-#endif
-
 namespace simgear
 {
 /**
@@ -29,35 +24,5 @@ public:
     }
 };
 
-#ifndef NO_OPENSCENEGRAPH_INTERFACE
-template <typename RefClass>
-class SingletonRefPtr
-{
-public:
-    SingletonRefPtr()
-    {
-        ptr = new RefClass;
-    }
-    static RefClass* instance()
-    {
-        SingletonRefPtr& singleton
-            = boost::details::pool::singleton_default<SingletonRefPtr>::instance();
-        return singleton.ptr.get();
-    }
-private:
-    osg::ref_ptr<RefClass> ptr;
-};
-
-template <typename RefClass>
-class ReferencedSingleton : public virtual osg::Referenced
-{
-public:
-    static RefClass* instance()
-    {
-        return SingletonRefPtr<RefClass>::instance();
-    }
-};
-#endif // of NO_OPENSCENEGRAPH_INTERFACE
-
 }
 #endif