From 42b7c486716dbc7c179c5ac57c6b6070fbdcdb9f Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 29 Nov 2011 10:23:09 +0000 Subject: [PATCH] Move some OSG-dependant code into scene/util. --- simgear/math/CMakeLists.txt | 2 -- simgear/misc/CMakeLists.txt | 2 -- simgear/scene/sky/cloud.cxx | 2 +- simgear/scene/sky/moon.cxx | 2 +- simgear/scene/sky/newcloud.cxx | 2 +- simgear/scene/sky/oursun.cxx | 2 +- simgear/scene/util/CMakeLists.txt | 4 +++ simgear/{misc => scene/util}/PathOptions.cxx | 4 --- simgear/{misc => scene/util}/PathOptions.hxx | 2 -- simgear/scene/util/SGCoreOSGDependant.cxx | 35 -------------------- simgear/{math => scene/util}/project.cxx | 6 +--- simgear/{math => scene/util}/project.hxx | 4 --- simgear/screen/tr.cxx | 2 +- 13 files changed, 10 insertions(+), 59 deletions(-) rename simgear/{misc => scene/util}/PathOptions.cxx (94%) rename simgear/{misc => scene/util}/PathOptions.hxx (96%) rename simgear/{math => scene/util}/project.cxx (95%) rename simgear/{math => scene/util}/project.hxx (93%) diff --git a/simgear/math/CMakeLists.txt b/simgear/math/CMakeLists.txt index 91f01dbe..b01f9259 100644 --- a/simgear/math/CMakeLists.txt +++ b/simgear/math/CMakeLists.txt @@ -28,7 +28,6 @@ set(HEADERS beziercurve.hxx interpolater.hxx leastsqs.hxx - project.hxx sg_geodesy.hxx sg_types.hxx sg_random.h @@ -39,7 +38,6 @@ set(SOURCES SGGeodesy.cxx interpolater.cxx leastsqs.cxx - project.cxx sg_random.c ) diff --git a/simgear/misc/CMakeLists.txt b/simgear/misc/CMakeLists.txt index 582f29ec..c4ae64df 100644 --- a/simgear/misc/CMakeLists.txt +++ b/simgear/misc/CMakeLists.txt @@ -2,7 +2,6 @@ include (SimGearComponent) set(HEADERS - PathOptions.hxx ResourceManager.hxx interpolator.hxx sg_dir.hxx @@ -18,7 +17,6 @@ set(HEADERS ) set(SOURCES - PathOptions.cxx ResourceManager.cxx interpolator.cxx sg_dir.cxx diff --git a/simgear/scene/sky/cloud.cxx b/simgear/scene/sky/cloud.cxx index a3cf4ffe..228f0a8c 100644 --- a/simgear/scene/sky/cloud.cxx +++ b/simgear/scene/sky/cloud.cxx @@ -48,7 +48,7 @@ #endif #include -#include +#include #include #include #include diff --git a/simgear/scene/sky/moon.cxx b/simgear/scene/sky/moon.cxx index a5366c71..28275e6a 100644 --- a/simgear/scene/sky/moon.cxx +++ b/simgear/scene/sky/moon.cxx @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include "sphere.hxx" #include "moon.hxx" diff --git a/simgear/scene/sky/newcloud.cxx b/simgear/scene/sky/newcloud.cxx index e05301af..d78380d2 100644 --- a/simgear/scene/sky/newcloud.cxx +++ b/simgear/scene/sky/newcloud.cxx @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include #include diff --git a/simgear/scene/sky/oursun.cxx b/simgear/scene/sky/oursun.cxx index db7e7319..59db466c 100644 --- a/simgear/scene/sky/oursun.cxx +++ b/simgear/scene/sky/oursun.cxx @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include #include "oursun.hxx" diff --git a/simgear/scene/util/CMakeLists.txt b/simgear/scene/util/CMakeLists.txt index d312dfae..f04b77c4 100644 --- a/simgear/scene/util/CMakeLists.txt +++ b/simgear/scene/util/CMakeLists.txt @@ -20,6 +20,8 @@ set(HEADERS StateAttributeFactory.hxx UpdateOnceCallback.hxx VectorArrayAdapter.hxx + PathOptions.hxx + project.hxx ) set(SOURCES @@ -35,6 +37,8 @@ set(SOURCES SplicingVisitor.cxx StateAttributeFactory.cxx UpdateOnceCallback.cxx + PathOptions.cxx + project.cxx ) simgear_scene_component(util scene/util "${SOURCES}" "${HEADERS}") diff --git a/simgear/misc/PathOptions.cxx b/simgear/scene/util/PathOptions.cxx similarity index 94% rename from simgear/misc/PathOptions.cxx rename to simgear/scene/util/PathOptions.cxx index b81600d8..203247b7 100644 --- a/simgear/misc/PathOptions.cxx +++ b/simgear/scene/util/PathOptions.cxx @@ -21,8 +21,6 @@ # include #endif -#ifndef NO_OPENSCENEGRAPH_INTERFACE - #include #include "PathOptions.hxx" @@ -37,5 +35,3 @@ osgDB::ReaderWriter::Options* simgear::makeOptionsFromPath(const SGPath& path) options->setDatabasePath(path.str()); return options; } - -#endif // of NO_OPENSCENEGRAPH_INTERFACE diff --git a/simgear/misc/PathOptions.hxx b/simgear/scene/util/PathOptions.hxx similarity index 96% rename from simgear/misc/PathOptions.hxx rename to simgear/scene/util/PathOptions.hxx index 8d4186a7..5bf3a4b7 100644 --- a/simgear/misc/PathOptions.hxx +++ b/simgear/scene/util/PathOptions.hxx @@ -20,7 +20,6 @@ #ifndef PATHOPTIONSHXX #define PATHOPTIONSHXX 1 -#ifndef NO_OPENSCENEGRAPH_INTERFACE #include #include @@ -28,6 +27,5 @@ namespace simgear { osgDB::ReaderWriter::Options* makeOptionsFromPath(const SGPath&); } -#endif #endif diff --git a/simgear/scene/util/SGCoreOSGDependant.cxx b/simgear/scene/util/SGCoreOSGDependant.cxx index 15853700..b46064e9 100644 --- a/simgear/scene/util/SGCoreOSGDependant.cxx +++ b/simgear/scene/util/SGCoreOSGDependant.cxx @@ -21,45 +21,10 @@ # include #endif -#include -#include #include #include #include -#include - -namespace simgear -{ -GLint project(GLdouble objX, GLdouble objY, GLdouble objZ, - const GLdouble *model, const GLdouble *proj, const GLint *view, - GLdouble* winX, GLdouble* winY, GLdouble* winZ) -{ - using namespace osg; - Vec4d obj(objX, objY, objZ, 1.0); - Matrixd Mmodel(model), Mproj(proj); - Matrixd Mwin = (Matrixd::translate(1.0, 1.0, 1.0) - * Matrixd::scale(0.5 * view[2], 0.5 * view[3], 0.5) - * Matrixd::translate(view[0], view[1], 0.0)); - Vec4d result = obj * Mmodel * Mproj * Mwin; - if (equivalent(result.w(), 0.0)) - return GL_FALSE; - result = result / result.w(); - *winX = result.x(); *winY = result.y(); *winZ = result.z(); - return GL_TRUE; -} - -osgDB::ReaderWriter::Options* makeOptionsFromPath(const SGPath& path) -{ - using namespace osgDB; - ReaderWriter::Options *options - = new ReaderWriter::Options(*(Registry::instance()->getOptions())); - options->setDatabasePath(path.str()); - return options; -} - - -} osg::Matrix SGGeod::makeSimulationFrameRelative() const { diff --git a/simgear/math/project.cxx b/simgear/scene/util/project.cxx similarity index 95% rename from simgear/math/project.cxx rename to simgear/scene/util/project.cxx index c6a4ef73..aff7f0a6 100644 --- a/simgear/math/project.cxx +++ b/simgear/scene/util/project.cxx @@ -21,8 +21,6 @@ #include "project.hxx" -#ifndef NO_OPENSCENEGRAPH_INTERFACE - #include #include @@ -46,7 +44,5 @@ GLint project(GLdouble objX, GLdouble objY, GLdouble objZ, return GL_TRUE; } -} - -#endif // of NO_OPENSCENEGRAPH_INTERFACE +} // of namespace simgear diff --git a/simgear/math/project.hxx b/simgear/scene/util/project.hxx similarity index 93% rename from simgear/math/project.hxx rename to simgear/scene/util/project.hxx index 07a97d79..92506156 100644 --- a/simgear/math/project.hxx +++ b/simgear/scene/util/project.hxx @@ -17,8 +17,6 @@ #ifndef SIMGEAR_PROJECT_HXX #define SIMGEAR_PROJECT_HXX 1 -#ifndef NO_OPENSCENEGRAPH_INTERFACE - #include namespace simgear @@ -30,7 +28,5 @@ extern GLint project(GLdouble objX, GLdouble objY, GLdouble objZ, GLdouble* winX, GLdouble* winY, GLdouble* winZ); } -#endif // of NO_OPENSCENEGRAPH_INTERFACE - #endif diff --git a/simgear/screen/tr.cxx b/simgear/screen/tr.cxx index f1ff29df..fd64d7cb 100644 --- a/simgear/screen/tr.cxx +++ b/simgear/screen/tr.cxx @@ -144,7 +144,7 @@ #include #endif -#include +#include #include "tr.h" -- 2.39.5