1
0
Fork 0

Make runway textures work

This commit is contained in:
Christian Schmitt 2011-09-30 18:04:32 +02:00
parent 761a71ba7b
commit b0a1f38ccb
9 changed files with 121 additions and 207 deletions

View file

@ -12,6 +12,9 @@ add_executable(genapts850
point2d.cxx point2d.hxx point2d.cxx point2d.hxx
poly_extra.cxx poly_extra.hxx poly_extra.cxx poly_extra.hxx
runway.cxx runway.hxx runway.cxx runway.hxx
rwy_simple.cxx
rwy_gen.cxx
rwy_common.cxx
texparams.hxx texparams.hxx
) )

View file

@ -624,7 +624,6 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
pvmt_polys[i].set_tris( tri ); pvmt_polys[i].set_tris( tri );
pvmt_polys[i].set_texcoords( tc ); pvmt_polys[i].set_texcoords( tc );
pvmt_polys[i].set_tri_mode( GL_TRIANGLES );
} }
// tesselate the polygons and prepair them for final output // tesselate the polygons and prepair them for final output
@ -642,7 +641,6 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
line_polys[i].set_tris( tri ); line_polys[i].set_tris( tri );
line_polys[i].set_texcoords( tc ); line_polys[i].set_texcoords( tc );
line_polys[i].set_tri_mode( GL_TRIANGLES );
} }
SG_LOG(SG_GENERAL, SG_DEBUG, "Tesselating base"); SG_LOG(SG_GENERAL, SG_DEBUG, "Tesselating base");

View file

@ -232,7 +232,7 @@ void Runway::gen_simple_rwy( double alt_m, const string& material, superpoly_lis
} }
#endif #endif
void Runway::gen_simple_rwy( double alt_m, const string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum ) /*void gen_simple_rwy( double alt_m, const string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum )
{ {
int j, k; int j, k;
@ -327,7 +327,7 @@ void Runway::gen_simple_rwy( double alt_m, const string& material, superpoly_lis
material, material,
rwy_polys, texparams, accum ); rwy_polys, texparams, accum );
#endif #endif
} }*/
#if 0 #if 0
void Runway::gen_marked_rwy( double alt_m, const string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum ) void Runway::gen_marked_rwy( double alt_m, const string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum )
@ -377,11 +377,11 @@ int Runway::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list* te
if ( rwy.surface == 1 /* Asphalt */ ) if ( rwy.surface == 1 /* Asphalt */ )
{ {
material = "pa_tiedown"; material = "pa_";
} }
else if ( rwy.surface == 2 /* Concrete */ ) else if ( rwy.surface == 2 /* Concrete */ )
{ {
material = "pc_tiedown"; material = "pc_";
} }
else if ( rwy.surface == 3 /* Turf/Grass */ ) else if ( rwy.surface == 3 /* Turf/Grass */ )
{ {
@ -411,7 +411,7 @@ int Runway::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list* te
case 1: // asphalt: case 1: // asphalt:
case 2: // concrete case 2: // concrete
SG_LOG( SG_GENERAL, SG_ALERT, "Build Runway: asphalt or concrete" << rwy.surface); SG_LOG( SG_GENERAL, SG_ALERT, "Build Runway: asphalt or concrete" << rwy.surface);
gen_simple_rwy( alt_m, material, rwy_polys, texparams, accum ); gen_rwy( alt_m, material, rwy_polys, texparams, accum );
break; break;
case 3: // Grass case 3: // Grass

View file

@ -76,13 +76,49 @@ private:
// Build Helpers // Build Helpers
TGPolygon gen_wgs84_area( Point3D origin, double length_m, double displ1, double displ2, double width_m, double heading_deg, double alt_m, bool add_mid ); TGPolygon gen_wgs84_area( Point3D origin, double length_m, double displ1, double displ2, double width_m, double heading_deg, double alt_m, bool add_mid );
TGPolygon gen_runway_w_mid( double alt_m, double length_extend_m, double width_extend_m ); TGPolygon gen_runway_w_mid( double alt_m, double length_extend_m, double width_extend_m );
// void gen_runway_section( const TGPolygon& runway, double startl_pct, double endl_pct, double startw_pct, double endw_pct, double minu, double maxu, double minv, double maxv, double heading,
// const string& prefix, const string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum );
// void gen_runway_stopway( const TGPolygon& runway_a, const TGPolygon& runway_b, const string& prefix, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon* accum );
TGPolygon gen_runway_area_w_extend( double alt_m, double length_extend, double displ1, double displ2, double width_extend ); TGPolygon gen_runway_area_w_extend( double alt_m, double length_extend, double displ1, double displ2, double width_extend );
void gen_simple_rwy( double alt_m, const string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum ); void gen_number_block( const std::string& material,
void gen_marked_rwy( double alt_m, const string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum ); TGPolygon poly, double heading, int num,
double start_pct, double end_pct,
superpoly_list *rwy_polys,
texparams_list *texparams,
TGPolygon *accum );
// generate the runway overrun area
void gen_runway_overrun( const TGPolygon& runway_half,
int rwhalf,
const std::string& prefix,
superpoly_list *rwy_polys,
texparams_list *texparams,
TGPolygon* accum );
// generate a section of runway
void gen_runway_section( const TGPolygon& runway,
double startl_pct, double endl_pct,
double startw_pct, double endw_pct,
double minu, double maxu, double minv, double maxv,
double heading,
const std::string& prefix,
const std::string& material,
superpoly_list *rwy_polys,
texparams_list *texparams,
TGPolygon *accum );
void gen_simple_rwy( double alt_m, const string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum );
void gen_rwy( double alt_m,
const std::string& material,
superpoly_list *rwy_polys,
texparams_list *texparams,
TGPolygon *accum );
void gen_rw_marking( const TGPolygon& runway,
double &start1_pct, double &end1_pct,
double heading,
const string& material,
superpoly_list *rwy_polys,
texparams_list *texparams,
TGPolygon *accum, int marking);
}; };
typedef std::vector <Runway *> RunwayList; typedef std::vector <Runway *> RunwayList;

View file

@ -27,15 +27,14 @@
#include "global.hxx" #include "global.hxx"
#include "poly_extra.hxx" #include "poly_extra.hxx"
#include "rwy_common.hxx" #include "runway.hxx"
#include <stdlib.h> #include <stdlib.h>
using std::string; using std::string;
void gen_number_block( const TGRunway& rwy_info, void Runway::gen_number_block( const string& material,
const string& material,
TGPolygon poly, double heading, int num, TGPolygon poly, double heading, int num,
double start_pct, double end_pct, double start_pct, double end_pct,
superpoly_list *rwy_polys, superpoly_list *rwy_polys,
@ -65,7 +64,7 @@ void gen_number_block( const TGRunway& rwy_info,
// printf("tex1 = '%s' tex2 = '%s'\n", tex1, tex2); // printf("tex1 = '%s' tex2 = '%s'\n", tex1, tex2);
if ( num < 10 || num == 11 ) { if ( num < 10 || num == 11 ) {
gen_runway_section( rwy_info, poly, gen_runway_section( poly,
start_pct, end_pct, start_pct, end_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0,
@ -73,14 +72,14 @@ void gen_number_block( const TGRunway& rwy_info,
material, tex1, material, tex1,
rwy_polys, texparams, accum ); rwy_polys, texparams, accum );
} else { } else {
gen_runway_section( rwy_info, poly, gen_runway_section( poly,
start_pct, end_pct, start_pct, end_pct,
0.0, 0.5, 0.0, 0.5,
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0,
heading, heading,
material, tex1, material, tex1,
rwy_polys, texparams, accum ); rwy_polys, texparams, accum );
gen_runway_section( rwy_info, poly, gen_runway_section( poly,
start_pct, end_pct, start_pct, end_pct,
0.5, 1.0, 0.5, 1.0,
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0,
@ -90,44 +89,42 @@ void gen_number_block( const TGRunway& rwy_info,
} }
} }
// generate the runway stopway // generate the runway overrun area
void gen_runway_stopway( const TGRunway& rwy_info, void Runway::gen_runway_overrun( const TGPolygon& runway_half,
const TGPolygon& runway_half,
int rwhalf, int rwhalf,
const string& prefix, const string& prefix,
superpoly_list *rwy_polys, superpoly_list *rwy_polys,
texparams_list *texparams, texparams_list *texparams,
TGPolygon* accum ) { TGPolygon* accum ) {
const float length = rwy_info.length / 2.0 + 2.0 * SG_FEET_TO_METER; const float length = rwy.length / 2.0 + 2.0 * SG_FEET_TO_METER;
double start1_pct = 0.0; double start1_pct = 0.0;
double end1_pct = 0.0; double end1_pct = 0.0;
double part_len = 0.0; double part_len = 0.0;
double heading = 0.0; double heading = 0.0;
double stopway = 0.0; double overrun = 0.0;
int count=0; int count=0;
int i=0; int i=0;
if (rwhalf == 1) { if (rwhalf == 1) {
heading = rwy_info.heading + 180.0; heading = rwy.heading + 180.0;
stopway = rwy_info.stopway1; overrun = rwy.overrun[0];
} }
else if (rwhalf == 2) { else if (rwhalf == 2) {
heading = rwy_info.heading; heading = rwy.heading;
stopway = rwy_info.stopway2; overrun = rwy.overrun[1];
} }
if (stopway > 0.0) { if (overrun > 0.0) {
/* Generate approach end stopway */ /* Generate approach end overrun */
count = (int) (stopway * 2.0/ rwy_info.width); count = (int) (overrun * 2.0/ rwy.width);
if(count < 1) count = 1; if(count < 1) count = 1;
part_len = stopway / (double) count; part_len = overrun / (double) count;
for(i=0;i<count;i++) for(i=0;i<count;i++)
{ {
start1_pct=end1_pct; start1_pct=end1_pct;
end1_pct = start1_pct + ( part_len / length ); end1_pct = start1_pct + ( part_len / length );
gen_runway_section( rwy_info, gen_runway_section( runway_half,
runway_half,
- end1_pct, -start1_pct, - end1_pct, -start1_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0, //last number is lengthwise 0.0, 1.0, 0.0, 1.0, //last number is lengthwise
@ -143,8 +140,7 @@ void gen_runway_stopway( const TGRunway& rwy_info,
} }
// generate a section of runway // generate a section of runway
void gen_runway_section( const TGRunway& rwy_info, void Runway::gen_runway_section( const TGPolygon& runway,
const TGPolygon& runway,
double startl_pct, double endl_pct, double startl_pct, double endl_pct,
double startw_pct, double endw_pct, double startw_pct, double endw_pct,
double minu, double maxu, double minv, double maxv, double minu, double maxu, double minv, double maxv,
@ -276,13 +272,13 @@ void gen_runway_section( const TGRunway& rwy_info,
// we add 0.5m to the length for texture overlap. This puts the // we add 0.5m to the length for texture overlap. This puts the
// lines on the texture back to the edge of the runway where they // lines on the texture back to the edge of the runway where they
// belong. // belong.
double len = rwy_info.length / 2.0 + 0.5; double len = rwy.length / 2.0 + 0.5;
double sect_len = len * ( endl_pct - startl_pct ); double sect_len = len * ( endl_pct - startl_pct );
// we add 0.5m to both sides of the runway (4' total) for texture // we add 0.5m to both sides of the runway (4' total) for texture
// overlap. This puts the lines on the texture back to the edge // overlap. This puts the lines on the texture back to the edge
// of the runway where they belong. // of the runway where they belong.
double wid = rwy_info.width + 0.5; double wid = rwy.width + 0.5;
double sect_wid = wid * ( endw_pct - startw_pct ); double sect_wid = wid * ( endw_pct - startw_pct );
TGTexParams tp; TGTexParams tp;

View file

@ -1,67 +0,0 @@
// rwy_common.hxx -- Common runway generation routines
//
// Written by Curtis Olson, started February 2002.
//
// Copyright (C) 2002 Curtis L. Olson - http://www.flightgear.org/~curt
//
// 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: rwy_common.hxx,v 1.5 2004-11-19 22:25:49 curt Exp $
//
#ifndef _RWY_COMMON_HXX
#define _RWY_COMMON_HXX
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include "runway.hxx"
#include "texparams.hxx"
void gen_number_block( const TGRunway& rwy_info,
const std::string& material,
TGPolygon poly, double heading, int num,
double start_pct, double end_pct,
superpoly_list *rwy_polys,
texparams_list *texparams,
TGPolygon *accum );
// generate the runway stopway
void gen_runway_stopway( const TGRunway& rwy_info,
const TGPolygon& runway_half,
int rwhalf,
const std::string& prefix,
superpoly_list *rwy_polys,
texparams_list *texparams,
TGPolygon* accum );
// generate a section of runway
void gen_runway_section( const TGRunway& rwy_info,
const TGPolygon& runway,
double startl_pct, double endl_pct,
double startw_pct, double endw_pct,
double minu, double maxu, double minv, double maxv,
double heading,
const std::string& prefix,
const std::string& material,
superpoly_list *rwy_polys,
texparams_list *texparams,
TGPolygon *accum );
#endif // _RWY_COMMON_HXX

View file

@ -22,8 +22,7 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include "runway.hxx"
#include "rwy_common.hxx"
#include <stdlib.h> #include <stdlib.h>
@ -35,8 +34,7 @@ struct sections
int size; int size;
}; };
void gen_rw_marking( const TGRunway& rwy_info, void Runway::gen_rw_marking( const TGPolygon& runway,
const TGPolygon& runway,
double &start1_pct, double &end1_pct, double &start1_pct, double &end1_pct,
double heading, double heading,
const string& material, const string& material,
@ -111,7 +109,7 @@ void gen_rw_marking( const TGRunway& rwy_info,
} }
//Now create the sections of the runway type //Now create the sections of the runway type
double length = rwy_info.length / 2.0 + 0.5; double length = rwy.length / 2.0 + 0.5;
for ( int i=0; i < rw_marking_list.size(); ++i) { for ( int i=0; i < rw_marking_list.size(); ++i) {
SG_LOG(SG_GENERAL, SG_INFO, "Runway section texture = " << rw_marking_list[i].tex << " lenght: " << rw_marking_list[i].size); SG_LOG(SG_GENERAL, SG_INFO, "Runway section texture = " << rw_marking_list[i].tex << " lenght: " << rw_marking_list[i].size);
@ -119,7 +117,7 @@ void gen_rw_marking( const TGRunway& rwy_info,
if ( end1_pct < 1.0 ) { if ( end1_pct < 1.0 ) {
start1_pct = end1_pct; start1_pct = end1_pct;
end1_pct = start1_pct + ( rw_marking_list[i].size / length ); end1_pct = start1_pct + ( rw_marking_list[i].size / length );
gen_runway_section( rwy_info, runway, gen_runway_section( runway,
start1_pct, end1_pct, start1_pct, end1_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0,
@ -137,14 +135,13 @@ void gen_rw_marking( const TGRunway& rwy_info,
// dimensions of precision runway markings, please refer to FAA // dimensions of precision runway markings, please refer to FAA
// document AC 150/5340-1H // document AC 150/5340-1H
void gen_rwy( const TGRunway& rwy_info, void Runway::gen_rwy( double alt_m,
double alt_m,
const string& material, const string& material,
superpoly_list *rwy_polys, superpoly_list *rwy_polys,
texparams_list *texparams, texparams_list *texparams,
TGPolygon *accum ) TGPolygon *accum )
{ {
SG_LOG( SG_GENERAL, SG_INFO, "Building runway = " << rwy_info.rwy_no1 << " / " << rwy_info.rwy_no2); SG_LOG( SG_GENERAL, SG_INFO, "Building runway = " << rwy.rwnum[0] << " / " << rwy.rwnum[1]);
// //
// Generate the basic runway outlines // Generate the basic runway outlines
@ -152,7 +149,7 @@ void gen_rwy( const TGRunway& rwy_info,
int i; int i;
TGPolygon runway = gen_runway_w_mid( rwy_info, alt_m, TGPolygon runway = gen_runway_w_mid( alt_m,
2 * SG_FEET_TO_METER, 2 * SG_FEET_TO_METER,
2 * SG_FEET_TO_METER ); 2 * SG_FEET_TO_METER );
@ -190,11 +187,11 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
// we add 0.5m to the length for texture overlap. This puts the // we add 0.5m to the length for texture overlap. This puts the
// lines on the texture back to the edge of the runway where they // lines on the texture back to the edge of the runway where they
// belong. // belong.
double length = rwy_info.length / 2.0 + 0.5; double length = rwy.length / 2.0 + 0.5;
if ( length < 3075 * SG_FEET_TO_METER ) { if ( length < 3075 * SG_FEET_TO_METER ) {
SG_LOG( SG_GENERAL, SG_ALERT, SG_LOG( SG_GENERAL, SG_ALERT,
"Runway " << rwy_info.rwy_no1 << " is not long enough (" "Runway " << rwy.rwnum[0] << " is not long enough ("
<< rwy_info.length << ") for precision markings!"); << rwy.length << ") for precision markings!");
} }
int marking = 0; int marking = 0;
@ -211,18 +208,18 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
// //
if (rwhalf == 1) { if (rwhalf == 1) {
marking = rwy_info.marking_code1; marking = rwy.marking[0];
disp_thresh = rwy_info.disp_thresh1; disp_thresh = rwy.threshold[0];
heading = rwy_info.heading + 180.0; heading = rwy.heading + 180.0;
rwname = rwy_info.rwy_no1; rwname = rwy.rwnum[0];
stopway = rwy_info.stopway1; stopway = rwy.overrun[0];
} }
else if (rwhalf == 2) { else if (rwhalf == 2) {
marking = rwy_info.marking_code2; marking = rwy.marking[1];
disp_thresh = rwy_info.disp_thresh2; disp_thresh = rwy.threshold[1];
heading = rwy_info.heading; heading = rwy.heading;
rwname = rwy_info.rwy_no2; rwname = rwy.rwnum[1];
stopway = rwy_info.stopway2; stopway = rwy.overrun[1];
} }
SG_LOG( SG_GENERAL, SG_INFO, "runway marking = " << marking ); SG_LOG( SG_GENERAL, SG_INFO, "runway marking = " << marking );
if ( disp_thresh > 0.0 ) { if ( disp_thresh > 0.0 ) {
@ -242,7 +239,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
// starting (possibly partial chunk) // starting (possibly partial chunk)
start1_pct = end1_pct; start1_pct = end1_pct;
end1_pct = start1_pct + ( part_len / length ); end1_pct = start1_pct + ( part_len / length );
gen_runway_section( rwy_info, runway_half, gen_runway_section( runway_half,
start1_pct, end1_pct, start1_pct, end1_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, tex_pct, 1.0, 0.0, 1.0, tex_pct, 1.0,
@ -254,7 +251,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
for ( i = 0; i < count; ++i ) { for ( i = 0; i < count; ++i ) {
start1_pct = end1_pct; start1_pct = end1_pct;
end1_pct = start1_pct + ( 200.0 * SG_FEET_TO_METER / length ); end1_pct = start1_pct + ( 200.0 * SG_FEET_TO_METER / length );
gen_runway_section( rwy_info, runway_half, gen_runway_section( runway_half,
start1_pct, end1_pct, start1_pct, end1_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0,
@ -266,7 +263,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
// final arrows // final arrows
start1_pct = end1_pct; start1_pct = end1_pct;
end1_pct = start1_pct + ( 90.0 * SG_FEET_TO_METER / length ); end1_pct = start1_pct + ( 90.0 * SG_FEET_TO_METER / length );
gen_runway_section( rwy_info, runway_half, gen_runway_section( runway_half,
start1_pct, end1_pct, start1_pct, end1_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0,
@ -282,7 +279,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
start1_pct = end1_pct; start1_pct = end1_pct;
end1_pct = start1_pct + ( 10 / length ); end1_pct = start1_pct + ( 10 / length );
gen_runway_section( rwy_info, runway_half, gen_runway_section( runway_half,
start1_pct, end1_pct, start1_pct, end1_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0,
@ -295,7 +292,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
start1_pct = end1_pct; start1_pct = end1_pct;
end1_pct = start1_pct + ( 202.0 * SG_FEET_TO_METER / length ); end1_pct = start1_pct + ( 202.0 * SG_FEET_TO_METER / length );
gen_runway_section( rwy_info, runway_half, gen_runway_section( runway_half,
start1_pct, end1_pct, start1_pct, end1_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0,
@ -322,14 +319,13 @@ if (!marking == 0){
} }
} }
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation1 = " << rwname); SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation1 = " << rwname);
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation letter1 = " << letter); SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation letter1 = " << letter);
if ( !letter.empty() ) { if ( !letter.empty() ) {
start1_pct = end1_pct; start1_pct = end1_pct;
end1_pct = start1_pct + ( 90.0 * SG_FEET_TO_METER / length ); end1_pct = start1_pct + ( 90.0 * SG_FEET_TO_METER / length );
gen_runway_section( rwy_info, runway_half, gen_runway_section( runway_half,
start1_pct, end1_pct, start1_pct, end1_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0,
@ -360,14 +356,14 @@ if (!marking == 0){
start1_pct = end1_pct; start1_pct = end1_pct;
end1_pct = start1_pct + ( 80.0 * SG_FEET_TO_METER / length ); end1_pct = start1_pct + ( 80.0 * SG_FEET_TO_METER / length );
gen_number_block( rwy_info, material, runway_half, heading, gen_number_block( material, runway_half, heading,
num, start1_pct, end1_pct, rwy_polys, texparams, accum ); num, start1_pct, end1_pct, rwy_polys, texparams, accum );
} }
if (marking > 1){ if (marking > 1){
// Generate remaining markings depending on type of runway // Generate remaining markings depending on type of runway
gen_rw_marking( rwy_info, runway_half, gen_rw_marking( runway_half,
start1_pct, end1_pct, start1_pct, end1_pct,
heading, material, heading, material,
rwy_polys, texparams, accum, marking ); rwy_polys, texparams, accum, marking );
@ -388,7 +384,7 @@ if (!marking == 0){
start1_pct = end1_pct; start1_pct = end1_pct;
end1_pct = start1_pct + rest1_inc; end1_pct = start1_pct + rest1_inc;
gen_runway_section( rwy_info, runway_half, gen_runway_section( runway_half,
start1_pct, end1_pct, start1_pct, end1_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0,
@ -397,7 +393,7 @@ if (!marking == 0){
rwy_polys, texparams, accum ); rwy_polys, texparams, accum );
} }
gen_runway_stopway( rwy_info, runway_half, rwhalf, gen_runway_overrun( runway_half, rwhalf,
material, material,
rwy_polys, texparams, accum ); rwy_polys, texparams, accum );

View file

@ -24,18 +24,16 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <Polygon/superpoly.hxx>
#include "poly_extra.hxx"
#include "rwy_common.hxx"
#include "texparams.hxx" #include "texparams.hxx"
#include "runway.hxx"
using std::string; using std::string;
// generate a simple runway. The routine modifies rwy_polys, // generate a simple runway. The routine modifies rwy_polys,
// texparams, and accum // texparams, and accum
void gen_simple_rwy( const TGRunway& rwy_info, void Runway::gen_simple_rwy( double alt_m,
double alt_m,
const string& material, const string& material,
superpoly_list *rwy_polys, superpoly_list *rwy_polys,
texparams_list *texparams, texparams_list *texparams,
@ -43,7 +41,7 @@ void gen_simple_rwy( const TGRunway& rwy_info,
{ {
int i; int i;
TGPolygon runway = gen_runway_w_mid( rwy_info, alt_m, 0.0, 0.0 ); TGPolygon runway = gen_runway_w_mid( alt_m, 0.0, 0.0 );
TGPolygon runway_half; TGPolygon runway_half;
@ -72,7 +70,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
// we add 0.5m to the length for texture overlap. This puts the // we add 0.5m to the length for texture overlap. This puts the
// lines on the texture back to the edge of the runway where they // lines on the texture back to the edge of the runway where they
// belong. // belong.
double length = rwy_info.length / 2.0 + 0.5; double length = rwy.length / 2.0 + 0.5;
int marking = 0; int marking = 0;
double start1_pct = 0.0; double start1_pct = 0.0;
double end1_pct = 0.0; double end1_pct = 0.0;
@ -87,18 +85,18 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
// //
if (rwhalf == 1) { if (rwhalf == 1) {
marking = rwy_info.marking_code1; marking = rwy.marking[0];
disp_thresh = rwy_info.disp_thresh1; disp_thresh = rwy.threshold[0];
heading = rwy_info.heading + 180.0; heading = rwy.heading + 180.0;
rwname = rwy_info.rwy_no1; rwname = rwy.rwnum[0];
stopway = rwy_info.stopway1; stopway = rwy.overrun[0];
} }
else if (rwhalf == 2) { else if (rwhalf == 2) {
marking = rwy_info.marking_code2; marking = rwy.marking[1];
disp_thresh = rwy_info.disp_thresh2; disp_thresh = rwy.threshold[1];
heading = rwy_info.heading; heading = rwy.heading;
rwname = rwy_info.rwy_no2; rwname = rwy.rwnum[1];
stopway = rwy_info.stopway2; stopway = rwy.overrun[1];
} }
SG_LOG( SG_GENERAL, SG_INFO, "runway marking = " << marking ); SG_LOG( SG_GENERAL, SG_INFO, "runway marking = " << marking );
if ( disp_thresh > 0.0 ) { if ( disp_thresh > 0.0 ) {
@ -118,7 +116,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
// starting (possibly partial chunk) // starting (possibly partial chunk)
start1_pct = end1_pct; start1_pct = end1_pct;
end1_pct = start1_pct + ( part_len / length ); end1_pct = start1_pct + ( part_len / length );
gen_runway_section( rwy_info, runway_half, Runway::gen_runway_section( runway_half,
start1_pct, end1_pct, start1_pct, end1_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, tex_pct, 1.0, 0.0, 1.0, tex_pct, 1.0,
@ -130,7 +128,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
for ( i = 0; i < count; ++i ) { for ( i = 0; i < count; ++i ) {
start1_pct = end1_pct; start1_pct = end1_pct;
end1_pct = start1_pct + ( 200.0 * SG_FEET_TO_METER / length ); end1_pct = start1_pct + ( 200.0 * SG_FEET_TO_METER / length );
gen_runway_section( rwy_info, runway_half, Runway::gen_runway_section( runway_half,
start1_pct, end1_pct, start1_pct, end1_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0,
@ -142,7 +140,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
// final arrows // final arrows
start1_pct = end1_pct; start1_pct = end1_pct;
end1_pct = start1_pct + ( 90.0 * SG_FEET_TO_METER / length ); end1_pct = start1_pct + ( 90.0 * SG_FEET_TO_METER / length );
gen_runway_section( rwy_info, runway_half, Runway::gen_runway_section( runway_half,
start1_pct, end1_pct, start1_pct, end1_pct,
0.0, 1.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0,
@ -151,7 +149,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
rwy_polys, texparams, accum ); rwy_polys, texparams, accum );
} }
gen_runway_section( rwy_info, runway_half, Runway::gen_runway_section( runway_half,
0, 1, 0, 1,
0.0, 1.0, 0.0, 1.0,
0.0, 0.28, 0.0, 1.0, 0.0, 0.28, 0.0, 1.0,

View file

@ -1,46 +0,0 @@
// rwy_simple.hxx -- Build a simple (non-marked) runway
//
// Written by Curtis Olson, started February 2002.
//
// Copyright (C) 2002 Curtis L. Olson - http://www.flightgear.org/~curt
//
// 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: rwy_simple.hxx,v 1.5 2004-11-19 22:25:49 curt Exp $
//
#ifndef _RWY_SIMPLE_HXX
#define _RWY_SIMPLE_HXX
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include "runway.hxx"
#include "texparams.hxx"
// generate a simple runway. The routine modifies rwy_polys,
// texparams, and accum
void gen_simple_rwy( const TGRunway& rwy_info,
double alt_m,
const std::string& material,
superpoly_list *rwy_polys,
texparams_list *texparams,
TGPolygon *accum );
#endif // _RWY_SIMPLE_HXX