1
0
Fork 0

Roughing in some initial structure to facilitate runway lighting.

This commit is contained in:
curt 2002-02-27 18:58:06 +00:00
parent 5cbacb4a7a
commit 8f07f918ae
4 changed files with 120 additions and 5 deletions

View file

@ -29,6 +29,7 @@ genapts_SOURCES = \
build.cxx build.hxx \
convex_hull.cxx convex_hull.hxx \
global.hxx \
lights.hxx lights.cxx \
main.cxx \
point2d.cxx point2d.hxx \
poly_extra.cxx poly_extra.hxx \

View file

@ -56,6 +56,7 @@
#include "build.hxx"
#include "convex_hull.hxx"
#include "lights.hxx"
#include "point2d.hxx"
#include "poly_extra.hxx"
#include "runway.hxx"
@ -554,8 +555,10 @@ void build_airport( string airport_raw, string_list& runways_raw,
}
// 5th pass: generate runway/taxiway lights
point_list rwy_lights;
rwy_lights.clear();
for ( i = 0; i < (int)runways.size(); ++i ) {
// gen_runway_lights( runways[i], &rwy_lights );
gen_runway_lights( runways[i], &rwy_lights );
}
// generate convex hull (no longer)
@ -817,12 +820,18 @@ void build_airport( string airport_raw, string_list& runways_raw,
tris_tc.push_back( base_tc );
}
// add lights
FGTriNodes light_nodes;
light_nodes.clear();
for ( i = 0; i < (int)rwy_lights.size(); ++i ) {
light_nodes.simple_add( rwy_lights[i] );
}
// calculate node elevations
point_list geod_nodes = calc_elevations( root, nodes.get_node_list() );
point_list geod_lights = calc_elevations( root, light_nodes.get_node_list() );
cout << "Done with calc_elevations()" << endl;
// #if 0 // testing
// add base skirt (to hide potential cracks)
//
// this has to happen after we've calculated the node elevations
@ -899,8 +908,6 @@ void build_airport( string airport_raw, string_list& runways_raw,
strips_tc.push_back( base_tc );
}
// #endif
// calculate wgs84 mapping of nodes
point_list wgs84_nodes;
for ( i = 0; i < (int)geod_nodes.size(); ++i ) {
@ -909,6 +916,13 @@ void build_airport( string airport_raw, string_list& runways_raw,
p.setz( geod_nodes[i].z() );
wgs84_nodes.push_back( sgGeodToCart( p ) );
}
point_list wgs84_lights;
for ( i = 0; i < (int)geod_lights.size(); ++i ) {
p.setx( geod_lights[i].x() * SGD_DEGREES_TO_RADIANS );
p.sety( geod_lights[i].y() * SGD_DEGREES_TO_RADIANS );
p.setz( geod_lights[i].z() );
wgs84_lights.push_back( sgGeodToCart( p ) );
}
float gbs_radius = sgCalcBoundingRadius( gbs_center, wgs84_nodes );
cout << "Done with wgs84 node mapping" << endl;

View file

@ -0,0 +1,58 @@
// lights.cxx -- Generate runway lighting
//
// Written by Curtis Olson, started February 2002.
//
// Copyright (C) 2002 Curtis L. Olson - curt@flightgear.org
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program 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 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., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
//
#include "lights.hxx"
// generate runway lighting
void gen_runway_lights( const FGRunway& rwy_info, point_list *lights ) {
int i;
// using FGPolygon is a bit innefficient, but that's what the
// routine returns.
FGPolygon poly_corners = gen_runway_area_w_expand( rwy_info, 0.0, 0.0 );
point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
corner.push_back( poly_corners.get_pt( 0, i ) );
}
Point3D inc1 = (corner[3] - corner[0]) / 20.0;
Point3D inc2 = (corner[2] - corner[1]) / 20.0;
Point3D pt1 = corner[0];
Point3D pt2 = corner[1];
lights->push_back( pt1 );
lights->push_back( pt2 );
for ( i = 0; i < 20; ++i ) {
pt1 += inc1;
pt2 += inc2;
lights->push_back( pt1 );
lights->push_back( pt2 );
}
}

View file

@ -0,0 +1,42 @@
// lights.hxx -- Generate runway lighting
//
// Written by Curtis Olson, started February 2002.
//
// Copyright (C) 2002 Curtis L. Olson - curt@flightgear.org
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program 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 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., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
//
#ifndef _RWY_LIGHTS_HXX
#define _RWY_LIGHTS_HXX
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include "runway.hxx"
#include "texparams.hxx"
// generate runway lighting
void gen_runway_lights( const FGRunway& rwy_info,
point_list *lights );
#endif // _RWY_LIGHTS_HXX