Additional tweaks to runway lighting (these have been sitting around
for a couple weeks ... I must have forgotten to commit.)
This commit is contained in:
parent
3ace596df0
commit
6bd8a08f8b
2 changed files with 22 additions and 16 deletions
|
@ -169,8 +169,9 @@ static FGPolygon rwy_section_tex_coords( const FGPolygon& in_poly,
|
|||
}
|
||||
|
||||
|
||||
// fix node elevations
|
||||
point_list calc_elevations( const string& root, const point_list& geod_nodes ) {
|
||||
// fix node elevations. Offset is added to the final elevation
|
||||
point_list calc_elevations( const string& root, const point_list& geod_nodes,
|
||||
double offset ) {
|
||||
bool done = false;
|
||||
point_list result = geod_nodes;
|
||||
int i, j;
|
||||
|
@ -223,7 +224,7 @@ point_list calc_elevations( const string& root, const point_list& geod_nodes ) {
|
|||
elev = array.interpolate_altitude( result[j].x() * 3600.0,
|
||||
result[j].y() * 3600.0 );
|
||||
if ( elev > -9000 ) {
|
||||
result[j].setz( elev );
|
||||
result[j].setz( elev + offset );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -855,7 +856,7 @@ void build_airport( string airport_raw, string_list& runways_raw,
|
|||
}
|
||||
|
||||
// calculate node elevations
|
||||
point_list geod_nodes = calc_elevations( root, nodes.get_node_list() );
|
||||
point_list geod_nodes = calc_elevations( root, nodes.get_node_list(), 0.0 );
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Done with calc_elevations()");
|
||||
|
||||
// add base skirt (to hide potential cracks)
|
||||
|
@ -954,7 +955,7 @@ void build_airport( string airport_raw, string_list& runways_raw,
|
|||
|
||||
// calculate light node elevations
|
||||
point_list geod_light_nodes
|
||||
= calc_elevations( root, light_nodes.get_node_list() );
|
||||
= calc_elevations( root, light_nodes.get_node_list(), 0.5 );
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Done with (light) calc_elevations()");
|
||||
|
||||
// this is a little round about, but what we want to calculate the
|
||||
|
@ -965,7 +966,6 @@ void build_airport( string airport_raw, string_list& runways_raw,
|
|||
pt_v.clear();
|
||||
for ( i = 0; i < (int)geod_light_nodes.size(); ++i ) {
|
||||
p = geod_light_nodes[i];
|
||||
p.setz( p.z() + 0.5 );
|
||||
index = nodes.simple_add( p );
|
||||
pt_v.push_back( index );
|
||||
geod_nodes.push_back( p );
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
|
||||
#include "lights.hxx"
|
||||
|
||||
#define FG_DIVS 40
|
||||
|
||||
|
||||
// calculate the runway light direction vector. I don't want to think
|
||||
// about matrix transformations tonight, so instead I can take the
|
||||
|
@ -57,25 +55,28 @@ Point3D gen_runway_light_vector( const FGRunway& rwy_info ) {
|
|||
}
|
||||
|
||||
|
||||
// generate runway lighting
|
||||
|
||||
void gen_runway_lights( const FGRunway& rwy_info,
|
||||
point_list *lights, point_list *normals ) {
|
||||
// generate runway edge lighting
|
||||
// 60 meters spacing or the next number down that divides evenly.
|
||||
void gen_runway_edge_lights( const FGRunway& rwy_info,
|
||||
point_list *lights, point_list *normals ) {
|
||||
int i;
|
||||
|
||||
double len = rwy_info.length * SG_FEET_TO_METER;
|
||||
int divs = (int)(len / 60.0) + 1;
|
||||
|
||||
Point3D normal = gen_runway_light_vector( rwy_info );
|
||||
|
||||
// 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 );
|
||||
FGPolygon poly_corners = gen_runway_area_w_expand( rwy_info, 2.0, 2.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]) / FG_DIVS;
|
||||
Point3D inc2 = (corner[2] - corner[1]) / FG_DIVS;
|
||||
Point3D inc1 = (corner[3] - corner[0]) / divs;
|
||||
Point3D inc2 = (corner[2] - corner[1]) / divs;
|
||||
|
||||
Point3D pt1 = corner[0];
|
||||
Point3D pt2 = corner[1];
|
||||
|
@ -84,7 +85,7 @@ void gen_runway_lights( const FGRunway& rwy_info,
|
|||
lights->push_back( pt2 );
|
||||
normals->push_back( normal );
|
||||
|
||||
for ( i = 0; i < FG_DIVS; ++i ) {
|
||||
for ( i = 0; i < divs; ++i ) {
|
||||
pt1 += inc1;
|
||||
pt2 += inc2;
|
||||
lights->push_back( pt1 );
|
||||
|
@ -95,3 +96,8 @@ void gen_runway_lights( const FGRunway& rwy_info,
|
|||
}
|
||||
|
||||
|
||||
void gen_runway_lights( const FGRunway& rwy_info,
|
||||
point_list *lights, point_list *normals ) {
|
||||
// Make edge lighting
|
||||
gen_runway_edge_lights( rwy_info, lights, normals );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue