Move some OSG-dependant code into scene/util.
This commit is contained in:
parent
75afee59c3
commit
42b7c48671
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
|
@ -48,7 +48,7 @@
|
||||
#endif
|
||||
|
||||
#include <simgear/math/sg_random.h>
|
||||
#include <simgear/misc/PathOptions.hxx>
|
||||
#include <simgear/scene/util/PathOptions.hxx>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/scene/model/model.hxx>
|
||||
#include <simgear/scene/util/RenderConstants.hxx>
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include <simgear/constants.h>
|
||||
#include <simgear/screen/colors.hxx>
|
||||
#include <simgear/scene/model/model.hxx>
|
||||
#include <simgear/misc/PathOptions.hxx>
|
||||
#include <simgear/scene/util/PathOptions.hxx>
|
||||
|
||||
#include "sphere.hxx"
|
||||
#include "moon.hxx"
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <simgear/math/sg_random.h>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/misc/PathOptions.hxx>
|
||||
#include <simgear/scene/util/PathOptions.hxx>
|
||||
#include <simgear/props/props.hxx>
|
||||
#include <simgear/scene/model/model.hxx>
|
||||
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include <osgDB/ReadFile>
|
||||
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
#include <simgear/misc/PathOptions.hxx>
|
||||
#include <simgear/scene/util/PathOptions.hxx>
|
||||
#include <simgear/screen/colors.hxx>
|
||||
#include <simgear/scene/model/model.hxx>
|
||||
#include "oursun.hxx"
|
||||
|
@ -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}")
|
||||
|
@ -21,8 +21,6 @@
|
||||
# include <simgear_config.h>
|
||||
#endif
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
|
||||
#include <osgDB/Registry>
|
||||
|
||||
#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
|
@ -20,7 +20,6 @@
|
||||
#ifndef PATHOPTIONSHXX
|
||||
#define PATHOPTIONSHXX 1
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
#include <osgDB/ReaderWriter>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
@ -28,6 +27,5 @@ namespace simgear
|
||||
{
|
||||
osgDB::ReaderWriter::Options* makeOptionsFromPath(const SGPath&);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -21,45 +21,10 @@
|
||||
# include <simgear_config.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/math/project.hxx>
|
||||
#include <simgear/misc/PathOptions.hxx>
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
|
||||
#include <osg/Math>
|
||||
#include <osg/Matrixd>
|
||||
#include <osgDB/Registry>
|
||||
|
||||
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
|
||||
{
|
||||
|
@ -21,8 +21,6 @@
|
||||
|
||||
#include "project.hxx"
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
|
||||
#include <osg/Math>
|
||||
#include <osg/Matrixd>
|
||||
|
||||
@ -46,7 +44,5 @@ GLint project(GLdouble objX, GLdouble objY, GLdouble objZ,
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // of NO_OPENSCENEGRAPH_INTERFACE
|
||||
} // of namespace simgear
|
||||
|
@ -17,8 +17,6 @@
|
||||
#ifndef SIMGEAR_PROJECT_HXX
|
||||
#define SIMGEAR_PROJECT_HXX 1
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
|
||||
#include <osg/GL>
|
||||
|
||||
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
|
||||
|
@ -144,7 +144,7 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/math/project.hxx>
|
||||
#include <simgear/scene/util/project.hxx>
|
||||
|
||||
#include "tr.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user