From 52a1d87c1c367e854adb8c89cf11a6ea3a5a058d Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 17 Sep 1998 18:40:15 +0000 Subject: [PATCH] Changes to allow multiple copies of the scenery processing tools to be run concurrently. --- Stripe_w/bands.c | 36 +++++++++++++++++++----------------- Stripe_w/options.c | 2 +- Tools/process-dem.pl | 34 ++++++++++++++++++++-------------- 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/Stripe_w/bands.c b/Stripe_w/bands.c index 981c13255..1992795a6 100644 --- a/Stripe_w/bands.c +++ b/Stripe_w/bands.c @@ -93,7 +93,7 @@ void get_time() int main (int argc,char *argv[]) { - char *fname,*all,buff[255], *ptr, *ptr2; + char *fname, *oname, *all,buff[255], *ptr, *ptr2; FILE *file, *bands; int face_id=0; int vert_count=0; @@ -125,27 +125,29 @@ int main (int argc,char *argv[]) get_time(); - /* File that will contain the triangle strip data */ - bands = fopen("stripe.objf","w"); - /* - Scan the file once to find out the number of vertices, - vertice normals, and faces so we can set up some memory - structures - */ - /* Interpret the options specified */ - norm_difference = get_options(argc,argv,&f,&t,&tr,&g); + Scan the file once to find out the number of vertices, + vertice normals, and faces so we can set up some memory + structures + */ + /* Interpret the options specified */ + norm_difference = get_options(argc,argv,&f,&t,&tr,&g); if (f == BINARY) - file_open = "rb"; + file_open = "rb"; else - file_open = "r"; - - fname = argv[argc-1]; - - printf ("File: %s\n",fname); - printf ("Scanning...%s ",file_open); + file_open = "r"; + + fname = argv[argc-2]; + oname = argv[argc-1]; + + printf ("Input file: %s Output file: %s\n", fname, oname); + printf ("Scanning...%s ",file_open); + /* File that will contain the triangle strip data */ + + bands = fopen(oname, "w"); + /* File can be in binary for faster reading */ if (file = fopen (fname,file_open)) { diff --git a/Stripe_w/options.c b/Stripe_w/options.c index cbc9d4e15..7e1243e24 100644 --- a/Stripe_w/options.c +++ b/Stripe_w/options.c @@ -84,7 +84,7 @@ double get_options(int argc, char **argv, int *f, int *t, int *tr, int *group) /* User has the wrong number of options */ if ((argc > 5) || (argc < 2)) { - printf("Usage: bands -[file_option][ties_option][triangulation_option][normal_difference] file_name\n"); + printf("Usage: bands -[file_option][ties_option][triangulation_option][normal_difference] in_file_name out_file_name\n"); exit(0); } diff --git a/Tools/process-dem.pl b/Tools/process-dem.pl index ad791d10d..d81f53b4a 100755 --- a/Tools/process-dem.pl +++ b/Tools/process-dem.pl @@ -30,7 +30,7 @@ $scenery_format_version = "0.1"; $max_area = 10000; # maximum triangle area -$remove_tmps = 0; +$remove_tmps = 1; $| = 1; # flush buffers after every write @@ -360,16 +360,18 @@ sub tri2obj { # Strip the file.1.obj's. Note, strips doesn't handle the minimal # case of striping a square correctly. # -# 7. cp bands.d file.2.obj +# 7. cp stripe.objf file.2.obj # -# strips produces a file called "bands.d" ... copy this to file.2.obj +# strips produces a file called "stripe.objf" ... copy this to file.2.obj sub strips { @FILES = `ls $subdir`; foreach $file ( @FILES ) { chop($file); if ( $file =~ m/\.1\.obj$/ ) { - $command = "Stripe_w/strips $subdir/$file"; + $newfile = $file; + $newfile =~ s/\.1\.obj$//; + $command = "Stripe_w/strips $subdir/$file $subdir/$newfile.2.obj"; $command = fix_command($command); print "Running '$command'\n"; # $input = ; @@ -380,17 +382,17 @@ sub strips { close(OUT); # copy to destination file - $newfile = $file; - $newfile =~ s/\.1\.obj$//; - print "Copying to $subdir/$newfile.2.obj\n"; + # $newfile = $file; + # $newfile =~ s/\.1\.obj$//; + # print "Copying to $subdir/$newfile.2.obj\n"; # open(IN, "$subdir/$newfile.2.obj"); - while ( ) { - print OUT $_; - } - close(IN); - close(OUT); + # open(IN, "$subdir/$newfile.2.obj"); + # while ( ) { + # print OUT $_; + # } + # close(IN); + # close(OUT); if ( $remove_tmps ) { unlink("$subdir/$file"); @@ -487,6 +489,10 @@ sub install { #--------------------------------------------------------------------------- # $Log$ +# Revision 1.28 1998/09/17 18:40:15 curt +# Changes to allow multiple copies of the scenery processing tools +# to be run concurrently. +# # Revision 1.27 1998/09/09 20:58:35 curt # Fixes and tweaks to handle area cutouts for airports. # -- 2.39.2