Take two. The ModelRegistry's are already derived from osg::Referenced.
So also introduce the osg dependent version in simgear/scene/util.
if(SIMGEAR_HEADLESS)
message(STATUS "headless mode")
- set(NO_OPENSCENEGRAPH_INTERFACE 1)
else()
find_package(OpenGL REQUIRED)
find_package(OpenAL REQUIRED)
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}")
#include <osgDB/Registry>
#include <simgear/compiler.h>
-#include <simgear/structure/Singleton.hxx>
+#include <simgear/scene/util/OsgSingleton.hxx>
#include <string>
#include <map>
#include <osg/StateSet>
-#include <simgear/structure/Singleton.hxx>
+#include <simgear/scene/util/OsgSingleton.hxx>
#include <simgear/scene/util/SGUpdateVisitor.hxx>
namespace simgear
CopyOp.hxx
NodeAndDrawableVisitor.hxx
OsgMath.hxx
+ OsgSingleton.hxx
PrimitiveUtils.hxx
QuadTreeBuilder.hxx
RenderConstants.hxx
--- /dev/null
+#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
class TexEnv;
}
-#include <simgear/structure/Singleton.hxx>
+#include <simgear/scene/util/OsgSingleton.hxx>
// Return read-only instances of common OSG state attributes.
namespace simgear
#cmakedefine HAVE_LIBSVN_CLIENT_1
#cmakedefine GCC_ATOMIC_BUILTINS_FOUND
-
-// set if building headless (no OSG or OpenGL libs)
-#cmakedefine NO_OPENSCENEGRAPH_INTERFACE
#include "singleton.hpp"
-#ifndef NO_OPENSCENEGRAPH_INTERFACE
-#include <osg/Referenced>
-#include <osg/ref_ptr>
-#endif
-
namespace simgear
{
/**
}
};
-#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