Remove OSG capabilities and libraries.
This commit is contained in:
parent
a5a14e2330
commit
b24bcbb1ee
13 changed files with 1 additions and 294 deletions
|
@ -30,7 +30,6 @@ target_link_libraries(genapts850
|
|||
${SIMGEAR_CORE_LIBRARIES}
|
||||
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
|
||||
${GPC_LIBRARY}
|
||||
${NEWMAT_LIBRARY}
|
||||
osg osgDB osgGA osgUtil osgViewer)
|
||||
${NEWMAT_LIBRARY})
|
||||
|
||||
install(TARGETS genapts850 RUNTIME DESTINATION bin)
|
||||
|
|
|
@ -79,34 +79,6 @@ Airport::Airport( int c, char* def)
|
|||
SG_LOG( SG_GENERAL, SG_DEBUG, "Created airport with icao " << icao << " and description " << description );
|
||||
}
|
||||
|
||||
// TODO: fix OSG - it was nice, but unnecesary...
|
||||
void Airport::BuildOsg( osg::Group* airport )
|
||||
{
|
||||
// draw for OSG
|
||||
int i;
|
||||
|
||||
#if 0
|
||||
for (i=0; i<runways.size(); i++)
|
||||
{
|
||||
runways.at(i)->BuildOsg( airport );
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i=0; i<pavements.size(); i++)
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, " Adding pavement " << i << "to airport");
|
||||
pavements.at(i)->BuildOsg(airport);
|
||||
}
|
||||
|
||||
#if 0
|
||||
for (i=0; i<features.size(); i++)
|
||||
{
|
||||
features.at(i)->Finish(airport);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// TODO: Add to runway object
|
||||
// calculate texture coordinates for runway section using the provided
|
||||
// texturing parameters. Returns a mirror polygon to the runway,
|
||||
|
|
|
@ -97,7 +97,6 @@ public:
|
|||
tm = cleanup_time;
|
||||
}
|
||||
|
||||
void BuildOsg( osg::Group* airport );
|
||||
void BuildBtg( const string& root, const string_list& elev_src );
|
||||
|
||||
private:
|
||||
|
|
|
@ -5,16 +5,9 @@
|
|||
#include <float.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <osg/Vec3d>
|
||||
#include <Geometry/point3d.hxx>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
|
||||
// TODO: where to put this
|
||||
inline osg::Vec3d SGPoint3DtoOSGVec3d( Point3D p )
|
||||
{
|
||||
return osg::Vec3d( p.x(), p.y(), p.z() );
|
||||
}
|
||||
|
||||
// TEMP...
|
||||
inline Point3D CalculateQuadraticLocation( Point3D p0, Point3D cp, Point3D p1, double t )
|
||||
{
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/math/sg_geodesy.hxx>
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/PolygonMode>
|
||||
#include <osgUtil/Tessellator>
|
||||
|
||||
#include <Geometry/poly_support.hxx>
|
||||
|
||||
#include "beznode.hxx"
|
||||
|
@ -394,12 +390,6 @@ void ClosedPoly::ExpandContour( point_list& src, TGPolygon& dst, double dist )
|
|||
{
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "\ntheta is " << theta << " distance is " << o1 << " CLAMPING to " << dist*2 );
|
||||
o1 = dist*2;
|
||||
|
||||
if (o1 > 100)
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "\nClosed POLY " << description << ": theta is " << theta << " distance is " << o1 << " WHAT HAPPENED " );
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
geo_direct_wgs_84( curPoint.y(), curPoint.x(), h1, o1, &expanded_y, &expanded_x, &az2 );
|
||||
|
@ -427,12 +417,6 @@ void ClosedPoly::ExpandContour( point_list& src, TGPolygon& dst, double dist )
|
|||
// calculate the expanded point heading and offset from current point
|
||||
ExpandPoint( &prevPoint, &curPoint, &nextPoint, dist, &h1, &o1 );
|
||||
|
||||
if (o1 > dist*2)
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "\ntheta is " << theta << " distance is " << o1 << " WHAT HAPPENED " );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
geo_direct_wgs_84( curPoint.y(), curPoint.x(), h1, o1, &expanded_y, &expanded_x, &az2 );
|
||||
expanded_point = Point3D( expanded_x, expanded_y, 0.0f );
|
||||
expanded_boundary.push_back( expanded_point );
|
||||
|
@ -442,24 +426,6 @@ void ClosedPoly::ExpandContour( point_list& src, TGPolygon& dst, double dist )
|
|||
dst.add_contour( expanded_boundary, 9 );
|
||||
}
|
||||
|
||||
osg::DrawArrays* ClosedPoly::CreateOsgPrimitive( point_list contour, osg::Vec3Array* vpave )
|
||||
{
|
||||
int i;
|
||||
Point3D p;
|
||||
osg::DrawArrays* primitive;
|
||||
int start_vert = vpave->size();
|
||||
|
||||
for (i=0; i<contour.size(); i++)
|
||||
{
|
||||
p = contour[i];
|
||||
vpave->push_back( osg::Vec3d(p.x(), p.y(), 0.0) );
|
||||
}
|
||||
|
||||
primitive = new osg::DrawArrays(osg::PrimitiveSet::POLYGON, start_vert, vpave->size()-start_vert);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
// finish the poly - convert to TGPolygon, and tesselate
|
||||
int ClosedPoly::Finish()
|
||||
{
|
||||
|
@ -498,87 +464,6 @@ int ClosedPoly::Finish()
|
|||
holes.clear();
|
||||
}
|
||||
|
||||
int ClosedPoly::BuildOsg( osg::Group* airport )
|
||||
{
|
||||
osg::Geode* geode_pave; // has the stateset, and geometry for this poly
|
||||
osg::Geometry* pavement;
|
||||
osg::StateSet* ss_pave; // just a simple stateset for now
|
||||
osg::PolygonMode* polymode;
|
||||
osg::Vec4Array* col_pave; // just grey for now...
|
||||
osg::Vec3Array* v_pave; // ALL verticies (boundary and holes)
|
||||
osg::DrawArrays* primitive; // an index array for boundary / hole
|
||||
int i; // ?
|
||||
|
||||
if ( pre_tess.contours() )
|
||||
{
|
||||
// Setup a polygonmode for wireframe debuging
|
||||
polymode = new osg::PolygonMode;
|
||||
polymode->setMode( osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE );
|
||||
|
||||
// Create a drawable for the pavement poly (boundary and holes)
|
||||
pavement = new osg::Geometry;
|
||||
|
||||
// make pavement grey : do this when reading the poly
|
||||
col_pave = new osg::Vec4Array;
|
||||
col_pave->push_back(osg::Vec4(0.5f,0.5f,0.5f,1.0f));
|
||||
pavement->setColorArray(col_pave);
|
||||
pavement->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
|
||||
// set up pavement stateset
|
||||
geode_pave = new osg::Geode();
|
||||
ss_pave = new osg::StateSet();
|
||||
|
||||
#if WIREFRAME
|
||||
ss_pave->setAttribute( polymode );
|
||||
#endif
|
||||
geode_pave->setStateSet(ss_pave);
|
||||
|
||||
v_pave = new osg::Vec3Array;
|
||||
pavement->setVertexArray(v_pave);
|
||||
|
||||
// create the boundary
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, " Adding pavement boundary");
|
||||
primitive = CreateOsgPrimitive( pre_tess.get_contour( 0 ), v_pave );
|
||||
if (hull.size() > 0)
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, " boundary has " << hull.size() << "verts" );
|
||||
}
|
||||
|
||||
// add the hole contours
|
||||
for (i=1; i<pre_tess.contours(); i++)
|
||||
{
|
||||
primitive = CreateOsgPrimitive( pre_tess.get_contour( i ), v_pave );
|
||||
pavement->addPrimitiveSet(primitive);
|
||||
}
|
||||
|
||||
osgUtil::Tessellator *tess = new osgUtil::Tessellator;
|
||||
tess->setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY);
|
||||
tess->retessellatePolygons(*pavement);
|
||||
|
||||
geode_pave->addDrawable(pavement);
|
||||
airport->addChild(geode_pave);
|
||||
|
||||
#if 0 // debug ExpandPoly
|
||||
TGPolygon base;
|
||||
ExpandPoly( hull, base, 20 );
|
||||
primitive = CreateOsgPrimitive( base.get_contour( 0 ), v_pave );
|
||||
pavement->addPrimitiveSet(primitive);
|
||||
#endif
|
||||
|
||||
geode_pave->addDrawable(pavement);
|
||||
airport->addChild(geode_pave);
|
||||
|
||||
// add the pavement markings
|
||||
#if 0
|
||||
printf("ClosedPoly::Finish - Finish %d linear features\n", features.size());
|
||||
for (int feat=0; feat<features.size(); feat++)
|
||||
{
|
||||
features.at(feat)->Finish(airport);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
int ClosedPoly::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list* texparams, ClipPolyType* accum, TGPolygon* apt_base, TGPolygon* apt_clearing )
|
||||
{
|
||||
TGPolygon base, safe_base;
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
|
||||
#include "texparams.hxx"
|
||||
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Vec3d>
|
||||
|
||||
using std::string;
|
||||
|
||||
class ClosedPoly
|
||||
|
@ -30,8 +27,6 @@ public:
|
|||
int CloseCurContour();
|
||||
int Finish();
|
||||
|
||||
int BuildOsg( osg::Group* airport );
|
||||
|
||||
// Build BTG for airport base for airports with boundary
|
||||
int BuildBtg( float alt_m, TGPolygon* apt_base, TGPolygon* apt_clearing );
|
||||
|
||||
|
@ -44,11 +39,9 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
//osg::DrawArrays* CreatePrimitive( BezContour* contour, osg::Vec3Array* v_pave );
|
||||
// convert the BezierPoly to a normal Poly (adding nodes for the curves)
|
||||
void CreateConvexHull( void );
|
||||
void ConvertContour( BezContour* src, point_list *dst );
|
||||
osg::DrawArrays* CreateOsgPrimitive( point_list contour, osg::Vec3Array* vpave );
|
||||
void ExpandContour( point_list& src, TGPolygon& dst, double dist );
|
||||
|
||||
bool is_pavement;
|
||||
|
|
|
@ -4,12 +4,6 @@
|
|||
#include <simgear/math/SGVec3.hxx>
|
||||
#include <simgear/math/SGMisc.hxx>
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Group>
|
||||
#include <osg/PolygonMode>
|
||||
#include <osg/PolygonOffset>
|
||||
|
||||
#include <Geometry/poly_support.hxx>
|
||||
|
||||
#include "beznode.hxx"
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
#include "texparams.hxx"
|
||||
|
||||
#include <osg/Group>
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
|
@ -92,7 +90,6 @@ public:
|
|||
}
|
||||
|
||||
int Finish();
|
||||
int BuildOsg( osg::Group* airport );
|
||||
int BuildBtg( float alt_m, superpoly_list* line_polys, texparams_list* line_tps, ClipPolyType* line_accum, superpoly_list* lights );
|
||||
|
||||
private:
|
||||
|
@ -129,12 +126,7 @@ private:
|
|||
typedef std::vector <LinearFeature *> FeatureList;
|
||||
|
||||
// add this to the class
|
||||
|
||||
extern double CalcMarkingVerticies( Point3D *prev, Point3D *cur, Point3D *next, double *dist1, double *dist2 );
|
||||
|
||||
// don't know what to do with these
|
||||
extern osg::Geode* FinishMarking( osg::Vec3dArray* verticies );
|
||||
extern osg::Vec3dArray* CheckMarking(int cur_marking, int new_marking, osg::Vec3dArray* v_marking, osg::Group* airport);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -16,43 +16,6 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osg/Billboard>
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/Depth>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Group>
|
||||
#include <osg/GL2Extensions>
|
||||
#include <osg/Material>
|
||||
#include <osg/Math>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/PolygonMode>
|
||||
#include <osg/PolygonOffset>
|
||||
#include <osg/Program>
|
||||
#include <osg/Projection>
|
||||
#include <osg/Shader>
|
||||
#include <osg/ShapeDrawable>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Switch>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/Uniform>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/FileUtils>
|
||||
|
||||
#include <osgUtil/Tessellator>
|
||||
#include <osgUtil/SmoothingVisitor>
|
||||
#include <osgText/Text>
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
#include <osgUtil/Optimizer>
|
||||
|
||||
#include <osgGA/TrackballManipulator>
|
||||
#include <osgGA/FlightManipulator>
|
||||
#include <osgGA/TerrainManipulator>
|
||||
#include <osgGA/StateSetManipulator>
|
||||
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
|
||||
|
@ -155,7 +118,6 @@ int main(int argc, char **argv)
|
|||
float max_lon = 180;
|
||||
float min_lat = -90;
|
||||
float max_lat = 90;
|
||||
bool view_osg = false;
|
||||
long position = 0;
|
||||
|
||||
string_list elev_src;
|
||||
|
@ -246,11 +208,6 @@ int main(int argc, char **argv)
|
|||
{
|
||||
sglog().setLogLevels( SG_GENERAL, SG_BULK );
|
||||
}
|
||||
else if ( arg.find("--view") == 0 )
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "Found --view : view OSG model" );
|
||||
view_osg = true;
|
||||
}
|
||||
else if ( (arg.find("--max-slope=") == 0) )
|
||||
{
|
||||
slope_max = atof( arg.substr(12).c_str() );
|
||||
|
|
|
@ -861,20 +861,3 @@ int Parser::ParseLine(char* line)
|
|||
|
||||
return cur_state;
|
||||
}
|
||||
|
||||
#if 0
|
||||
osg::Group* Parser::CreateOsgGroup( void )
|
||||
{
|
||||
osg::Group* airportNode = new osg::Group();
|
||||
int i;
|
||||
|
||||
for (i=0; i<airports.size(); i++)
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Add airport " << i << " to node");
|
||||
airports[i]->BuildOsg( airportNode );
|
||||
}
|
||||
|
||||
return airportNode;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -85,15 +85,11 @@ public:
|
|||
cur_state = STATE_NONE;
|
||||
}
|
||||
|
||||
// int Parse( char* icao );
|
||||
long FindAirport( string icao );
|
||||
void AddAirport( string icao );
|
||||
void AddAirports( long start_pos, float min_lat, float min_lon, float max_lat, float max_lon );
|
||||
void Parse( void );
|
||||
|
||||
// osg::Group* CreateOsgGroup( void );
|
||||
|
||||
|
||||
private:
|
||||
bool IsAirportDefinition( char* line, string icao );
|
||||
|
||||
|
@ -102,7 +98,6 @@ private:
|
|||
BezNode* ParseNode( int type, char* line, BezNode* prevNode );
|
||||
LinearFeature* ParseFeature( char* line );
|
||||
ClosedPoly* ParsePavement( char* line );
|
||||
osg::Geode* ParseRunway(char* line );
|
||||
ClosedPoly* ParseBoundary( char* line );
|
||||
|
||||
int ParseLine( char* line );
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
#include <simgear/bucket/newbucket.hxx>
|
||||
#include <simgear/math/sg_geodesy.hxx>
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Group>
|
||||
|
||||
#include <Geometry/poly_support.hxx>
|
||||
#include <Polygon/polygon.hxx>
|
||||
|
||||
|
@ -54,54 +50,6 @@ Runway::Runway(char* definition)
|
|||
SG_LOG(SG_GENERAL, SG_DEBUG, "Read runway: (" << rwy.lon[0] << "," << rwy.lat[0] << ") to (" << rwy.lon[1] << "," << rwy.lat[1] << ") heading: " << rwy.heading << " length: " << rwy.length << " width: " << rwy.width );
|
||||
}
|
||||
|
||||
int Runway::BuildOsg ( osg::Group* airport )
|
||||
{
|
||||
// calculated distance, and azimuths
|
||||
double az1, az2, dist;
|
||||
|
||||
// rectangle verticies
|
||||
double v0_lat = 0, v0_lon = 0, v1_lat = 0, v1_lon = 0, v2_lat = 0, v2_lon = 0, v3_lat = 0, v3_lon = 0;
|
||||
|
||||
// Create a node for the runway
|
||||
osg::Geode* geode = new osg::Geode();
|
||||
|
||||
osg::Geometry* geometry = new osg::Geometry;
|
||||
osg::Vec3dArray& v = *(new osg::Vec3dArray(4));
|
||||
|
||||
// first, find the runway direction vector
|
||||
// static int geo_inverse_wgs_84( double lat1, double lon1, double lat2, double lon2, double *az1, double *az2, double *s )
|
||||
geo_inverse_wgs_84( rwy.lat[0], rwy.lon[0], rwy.lat[1], rwy.lon[1], &az1, &az2, &dist);
|
||||
|
||||
// now, need to caculate the 4 verticies
|
||||
// static int geo_direct_wgs_84( double lat1, double lon1, double az1, double s, double *lat2, double *lon2, double *az2 )
|
||||
geo_direct_wgs_84( rwy.lat[0], rwy.lon[0], az1+90, rwy.width/2, &v0_lat, &v0_lon, &az2 );
|
||||
geo_direct_wgs_84( v0_lat, v0_lon, az1, dist, &v1_lat, &v1_lon, &az2 );
|
||||
geo_direct_wgs_84( v1_lat, v1_lon, az1-90, rwy.width, &v2_lat, &v2_lon, &az2 );
|
||||
geo_direct_wgs_84( v2_lat, v2_lon, az1+180, dist, &v3_lat, &v3_lon, &az2 );
|
||||
|
||||
// convert from lat/lon to geodisc
|
||||
// (maybe later) - check some simgear objects...
|
||||
v[0].set(v0_lat, v0_lon, 0.0f);
|
||||
v[1].set(v1_lat, v1_lon, 0.0f);
|
||||
v[2].set(v2_lat, v2_lon, 0.0f);
|
||||
v[3].set(v3_lat, v3_lon, 0.0f);
|
||||
|
||||
geometry->setVertexArray(&v);
|
||||
|
||||
osg::DrawElementsUShort& drawElements = *(new osg::DrawElementsUShort(GL_TRIANGLE_STRIP,4));
|
||||
geometry->addPrimitiveSet(&drawElements);
|
||||
|
||||
drawElements[0] = 3;
|
||||
drawElements[1] = 0;
|
||||
drawElements[2] = 2;
|
||||
drawElements[3] = 1;
|
||||
|
||||
geode->addDrawable(geometry);
|
||||
|
||||
airport->addChild( geode );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WaterRunway::WaterRunway(char* definition)
|
||||
{
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#include "apt_math.hxx"
|
||||
#include "texparams.hxx"
|
||||
|
||||
#include <osg/Group>
|
||||
|
||||
using std::string;
|
||||
|
||||
class Runway
|
||||
|
@ -41,7 +39,6 @@ public:
|
|||
return ( Point3D( (rwy.lon[0]+rwy.lon[1])/2.0f, (rwy.lat[0]+rwy.lat[1])/2.0f, 0.0f) );
|
||||
}
|
||||
|
||||
int BuildOsg( osg::Group* airport );
|
||||
int BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list* texparams, superpoly_list* rwy_lights, ClipPolyType* accum, TGPolygon* apt_base, TGPolygon* apt_clearing );
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Reference in a new issue