math: Remove SGMath osg dependency.
Move osg dependent stuff from SGMath into simgear/scene/util/OsgMath.hxx. Update includes in simgear to reflect this change. Note that this change also requires an updated flightgear version.
This commit is contained in:
@@ -29,15 +29,14 @@ set(HEADERS
|
||||
leastsqs.hxx
|
||||
sg_geodesy.hxx
|
||||
sg_types.hxx
|
||||
sg_random.h
|
||||
sg_random.h
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
SGGeod.cxx
|
||||
SGGeodesy.cxx
|
||||
interpolater.cxx
|
||||
leastsqs.cxx
|
||||
sg_random.c
|
||||
sg_random.c
|
||||
)
|
||||
|
||||
simgear_component(math math "${SOURCES}" "${HEADERS}")
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
// Copyright (C) 2008 Tim Moore timoore@redhat.com
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <simgear_config.h>
|
||||
#endif
|
||||
|
||||
#include "SGMath.hxx"
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
|
||||
osg::Matrix SGGeod::makeSimulationFrameRelative() const
|
||||
{
|
||||
SGQuatd hlOr = SGQuatd::fromLonLat(*this);
|
||||
return osg::Matrix(toOsg(hlOr));
|
||||
}
|
||||
|
||||
osg::Matrix SGGeod::makeSimulationFrame() const
|
||||
{
|
||||
osg::Matrix result(makeSimulationFrameRelative());
|
||||
SGVec3d coord;
|
||||
SGGeodesy::SGGeodToCart(*this, coord);
|
||||
result.setTrans(toOsg(coord));
|
||||
return result;
|
||||
}
|
||||
|
||||
osg::Matrix SGGeod::makeZUpFrameRelative() const
|
||||
{
|
||||
osg::Matrix result(makeSimulationFrameRelative());
|
||||
// 180 degree rotation around Y axis
|
||||
osg::Quat flip(0.0, 1.0, 0.0, 0.0);
|
||||
result.preMult(osg::Matrix(flip));
|
||||
return result;
|
||||
}
|
||||
|
||||
osg::Matrix SGGeod::makeZUpFrame() const
|
||||
{
|
||||
osg::Matrix result(makeZUpFrameRelative());
|
||||
SGVec3d coord;
|
||||
SGGeodesy::SGGeodToCart(*this, coord);
|
||||
result.setTrans(toOsg(coord));
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -20,10 +20,6 @@
|
||||
|
||||
#include <simgear/constants.h>
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
#include <osg/Matrix>
|
||||
#endif
|
||||
|
||||
// #define SG_GEOD_NATIVE_DEGREE
|
||||
|
||||
/// Class representing a geodetic location
|
||||
@@ -89,19 +85,6 @@ public:
|
||||
// Compare two geodetic positions for equality
|
||||
bool operator == ( const SGGeod & other ) const;
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
// Create a local coordinate frame in the earth-centered frame of
|
||||
// reference. X points north, Z points down.
|
||||
// makeSimulationFrameRelative() only includes rotation.
|
||||
osg::Matrix makeSimulationFrameRelative() const;
|
||||
osg::Matrix makeSimulationFrame() const;
|
||||
|
||||
// Create a Z-up local coordinate frame in the earth-centered frame
|
||||
// of reference. This is what scenery models, etc. expect.
|
||||
// makeZUpFrameRelative() only includes rotation.
|
||||
osg::Matrix makeZUpFrameRelative() const;
|
||||
osg::Matrix makeZUpFrame() const;
|
||||
#endif
|
||||
private:
|
||||
/// This one is private since construction is not unique if you do
|
||||
/// not know the units of the arguments. Use the factory methods for
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef SGIntersect_HXX
|
||||
#define SGIntersect_HXX
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
template<typename T>
|
||||
inline bool
|
||||
intersects(const SGSphere<T>& s1, const SGSphere<T>& s2)
|
||||
|
||||
@@ -26,10 +26,6 @@
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
#include <osg/Quat>
|
||||
#endif
|
||||
|
||||
/// Quaternion Class
|
||||
template<typename T>
|
||||
class SGQuat {
|
||||
@@ -780,16 +776,4 @@ SGQuatd
|
||||
toQuatd(const SGQuatf& v)
|
||||
{ return SGQuatd(v(0), v(1), v(2), v(3)); }
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
inline
|
||||
SGQuatd
|
||||
toSG(const osg::Quat& q)
|
||||
{ return SGQuatd(q[0], q[1], q[2], q[3]); }
|
||||
|
||||
inline
|
||||
osg::Quat
|
||||
toOsg(const SGQuatd& q)
|
||||
{ return osg::Quat(q[0], q[1], q[2], q[3]); }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,11 +18,6 @@
|
||||
#ifndef SGVec2_H
|
||||
#define SGVec2_H
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
#include <osg/Vec2f>
|
||||
#include <osg/Vec2d>
|
||||
#endif
|
||||
|
||||
/// 2D Vector Class
|
||||
template<typename T>
|
||||
class SGVec2 {
|
||||
@@ -371,27 +366,4 @@ SGVec2d
|
||||
toVec2d(const SGVec2f& v)
|
||||
{ return SGVec2d(v(0), v(1)); }
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
inline
|
||||
SGVec2d
|
||||
toSG(const osg::Vec2d& v)
|
||||
{ return SGVec2d(v[0], v[1]); }
|
||||
|
||||
inline
|
||||
SGVec2f
|
||||
toSG(const osg::Vec2f& v)
|
||||
{ return SGVec2f(v[0], v[1]); }
|
||||
|
||||
inline
|
||||
osg::Vec2d
|
||||
toOsg(const SGVec2d& v)
|
||||
{ return osg::Vec2d(v[0], v[1]); }
|
||||
|
||||
inline
|
||||
osg::Vec2f
|
||||
toOsg(const SGVec2f& v)
|
||||
{ return osg::Vec2f(v[0], v[1]); }
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,11 +18,6 @@
|
||||
#ifndef SGVec3_H
|
||||
#define SGVec3_H
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
#include <osg/Vec3f>
|
||||
#include <osg/Vec3d>
|
||||
#endif
|
||||
|
||||
/// 3D Vector Class
|
||||
template<typename T>
|
||||
class SGVec3 {
|
||||
@@ -505,26 +500,4 @@ SGVec3d
|
||||
toVec3d(const SGVec3f& v)
|
||||
{ return SGVec3d(v(0), v(1), v(2)); }
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
inline
|
||||
SGVec3d
|
||||
toSG(const osg::Vec3d& v)
|
||||
{ return SGVec3d(v[0], v[1], v[2]); }
|
||||
|
||||
inline
|
||||
SGVec3f
|
||||
toSG(const osg::Vec3f& v)
|
||||
{ return SGVec3f(v[0], v[1], v[2]); }
|
||||
|
||||
inline
|
||||
osg::Vec3d
|
||||
toOsg(const SGVec3d& v)
|
||||
{ return osg::Vec3d(v[0], v[1], v[2]); }
|
||||
|
||||
inline
|
||||
osg::Vec3f
|
||||
toOsg(const SGVec3f& v)
|
||||
{ return osg::Vec3f(v[0], v[1], v[2]); }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,11 +18,6 @@
|
||||
#ifndef SGVec4_H
|
||||
#define SGVec4_H
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
#include <osg/Vec4f>
|
||||
#include <osg/Vec4d>
|
||||
#endif
|
||||
|
||||
/// 4D Vector Class
|
||||
template<typename T>
|
||||
class SGVec4 {
|
||||
@@ -428,26 +423,4 @@ SGVec4d
|
||||
toVec4d(const SGVec4f& v)
|
||||
{ return SGVec4d(v(0), v(1), v(2), v(3)); }
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
inline
|
||||
SGVec4d
|
||||
toSG(const osg::Vec4d& v)
|
||||
{ return SGVec4d(v[0], v[1], v[2], v[3]); }
|
||||
|
||||
inline
|
||||
SGVec4f
|
||||
toSG(const osg::Vec4f& v)
|
||||
{ return SGVec4f(v[0], v[1], v[2], v[3]); }
|
||||
|
||||
inline
|
||||
osg::Vec4d
|
||||
toOsg(const SGVec4d& v)
|
||||
{ return osg::Vec4d(v[0], v[1], v[2], v[3]); }
|
||||
|
||||
inline
|
||||
osg::Vec4f
|
||||
toOsg(const SGVec4f& v)
|
||||
{ return osg::Vec4f(v[0], v[1], v[2], v[3]); }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user