From 9f8ffba6a7101a44f0e95b718acd0c15981244d2 Mon Sep 17 00:00:00 2001 From: curt Date: Wed, 14 Jan 1998 02:15:51 +0000 Subject: [PATCH] Updated front end script to keep plugging away on tile fitting. --- Tools/TODO | 19 +++- Tools/process-dem.pl | 247 ++++++++++++++++++++++++------------------- 2 files changed, 153 insertions(+), 113 deletions(-) diff --git a/Tools/TODO b/Tools/TODO index 6f1f342ed..12d620269 100644 --- a/Tools/TODO +++ b/Tools/TODO @@ -1,6 +1,17 @@ -- Try reversing cw-wound strips rather than calling glFrontFace() in the - display list. +-------------------------------------------------------------------------- +| Done +-------------------------------------------------------------------------- -- Generate a face adjacency matrix +1/10/98 - Split areas into smaller tiles -- Split areas into smaller chunks + +-------------------------------------------------------------------------- +| Todo +-------------------------------------------------------------------------- + +1/12/98 - Try reversing cw-wound strips rather than calling glFrontFace() + in the display list. + +1/12/98 - Generate a face adjacency matrix + +1/12/98 - Don't create shared corners or edges if one already exists. diff --git a/Tools/process-dem.pl b/Tools/process-dem.pl index 7a9842a42..29b95637b 100755 --- a/Tools/process-dem.pl +++ b/Tools/process-dem.pl @@ -28,6 +28,15 @@ $| = 1; # flush buffers after every write +$do_demfit = 0; +$do_triangle_1 = 0; +$do_fixnode = 0; +$do_splittris = 1; + +$do_tri2obj = 0; +$do_strips = 0; +$do_fixobj = 0; + # return the file name root (ending at last ".") sub file_root { @@ -69,20 +78,21 @@ if ( $error < 0.5 ) { # splits dem file into 64 file.node's which contain the # irregularly fitted vertices -$command = "./Dem2node/demfit $ENV{FG_ROOT} $dem_file $error"; +if ( $do_demfit ) { + $command = "./Dem2node/demfit $ENV{FG_ROOT} $dem_file $error"; -print "Running '$command'\n"; + print "Running '$command'\n"; -open(OUT, "$command |"); -while ( ) { - print $_; - if ( m/Scenery/ ) { - $subdir = $_; - $subdir =~ s/Dir = //; + open(OUT, "$command |"); + while ( ) { + print $_; + if ( m/Scenery/ ) { + $subdir = $_; + $subdir =~ s/Dir = //; + } } + close(OUT); } -close(OUT); - # 3. triangle -q file (Takes file.node and produces file.1.node and # file.1.ele) @@ -90,68 +100,78 @@ close(OUT); $subdir = "../Scenery/w120n030/w111n033"; print "Subdirectory for this dem file is $subdir\n"; -@FILES = `ls $subdir`; -foreach $file ( @FILES ) { - print $file; - chop($file); - if ( ($file =~ m/\.node$/) && ($file !~ m/\.\d\.node$/) ) { - $command = "./Triangle/triangle -q $subdir/$file"; - print "Running '$command'\n"; - open(OUT, "$command |"); - while ( ) { - print $_; +if ( $do_triangle_1 ) { + @FILES = `ls $subdir`; + foreach $file ( @FILES ) { + print $file; + chop($file); + if ( ($file =~ m/\.node$/) && ($file !~ m/\.\d\.node$/) ) { + $command = "./Triangle/triangle -q $subdir/$file"; + print "Running '$command'\n"; + open(OUT, "$command |"); + while ( ) { + print $_; + } + close(OUT); + + # remove input file.node + unlink("$subdir/$file"); } - close(OUT); - - # remove input file.node - unlink("$subdir/$file"); } } - # 4. fixnode file.dem subdir # # Take the original .dem file (for interpolating Z values) and the # subdirecotry containing all the file.1.node's and replace with # fixed file.1.node -$command = "./FixNode/fixnode $dem_file $subdir"; -print "Running '$command'\n"; -open(OUT, "$command |"); -while ( ) { - print $_; +if ( $do_fixnode ) { + $command = "./FixNode/fixnode $dem_file $subdir"; + print "Running '$command'\n"; + open(OUT, "$command |"); + while ( ) { + print $_; + } + close(OUT); } -close(OUT); - - -# 4.1 findedges file (.1.node) (.1.ele) -# Extract the edge vertices (in original geodetic coordinates) and -# normals (in cartesian coordinates) and save them in something -# very close to the .obj format as file.north, file.south, -# file.east file.west. -@FILES = `ls $subdir`; -foreach $file ( @FILES ) { - chop($file); - if ( $file =~ m/\.1\.node$/ ) { - $file =~ s/\.node$//; # strip off the ".node" - - $command = "./FindEdges/findedges $subdir/$file"; - print "Running '$command'\n"; - open(OUT, "$command |"); - while ( ) { - print $_; +# 4.1 splittris file (.1.node) (.1.ele) + +# Extract the corner, edge, and body vertices (in original +# geodetic coordinates) and normals (in cartesian coordinates) and +# save them in something very close to the .obj format as file.se, +# file.sw, file.nw, file.ne, file.north, file.south, file.east, +# file.west, and file.body. This way we can reconstruct the +# region using consistant edges and corners. + +# Arbitration rules: If an opposite edge file already exists, +# don't create our matching edge. If a corner already exists, +# don't create ours. Basically, the early bird gets the worm and +# gets to define the edge verticies and normals. All the other +# adjacent tiles must use these. + +if ( $do_splittris ) { + @FILES = `ls $subdir`; + foreach $file ( @FILES ) { + chop($file); + if ( $file =~ m/\.1\.node$/ ) { + $file =~ s/\.node$//; # strip off the ".node" + + $command = "./SplitTris/splittris $subdir/$file"; + print "Running '$command'\n"; + open(OUT, "$command |"); + while ( ) { + print $_; + } + close(OUT); } - close(OUT); } } -exit(1); - - -# 4.2 read in tri files (node/ele) skipping edges, read edges out of +# 4.2 read in tile sections/ele) skipping edges, read edges out of # edge files, save including proper shared edges (as node/ele) # files. If my edge and adjacent edge both exist, use other, # delete mine. If only mine exists, use it. @@ -164,23 +184,25 @@ exit(1); # # Take the file.1.node and file.1.ele and produce file.1.obj -@FILES = `ls $subdir`; -foreach $file ( @FILES ) { - chop($file); - if ( $file =~ m/\.1\.node$/ ) { - $file =~ s/\.node$//; # strip off the ".node" - - $command = "./Tri2obj/tri2obj $subdir/$file"; - print "Running '$command'\n"; - open(OUT, "$command |"); - while ( ) { - print $_; +if ( $do_tri2obj ) { + @FILES = `ls $subdir`; + foreach $file ( @FILES ) { + chop($file); + if ( $file =~ m/\.1\.node$/ ) { + $file =~ s/\.node$//; # strip off the ".node" + + $command = "./Tri2obj/tri2obj $subdir/$file"; + print "Running '$command'\n"; + open(OUT, "$command |"); + while ( ) { + print $_; + } + close(OUT); + + unlink("$subdir/$file.node"); + unlink("$subdir/$file.node.orig"); + unlink("$subdir/$file.ele"); } - close(OUT); - - unlink("$subdir/$file.node"); - unlink("$subdir/$file.node.orig"); - unlink("$subdir/$file.ele"); } } @@ -193,31 +215,33 @@ foreach $file ( @FILES ) { # # strips produces a file called "bands.d" ... copy this to file.2.obj -@FILES = `ls $subdir`; -foreach $file ( @FILES ) { - chop($file); - if ( $file =~ m/\.1\.obj$/ ) { - $command = "./Stripe_u/strips $subdir/$file"; - print "Running '$command'\n"; - open(OUT, "$command |"); - while ( ) { - print $_; +if ( $do_strips ) { + @FILES = `ls $subdir`; + foreach $file ( @FILES ) { + chop($file); + if ( $file =~ m/\.1\.obj$/ ) { + $command = "./Stripe_u/strips $subdir/$file"; + print "Running '$command'\n"; + open(OUT, "$command |"); + while ( ) { + print $_; + } + close(OUT); + + # copy to destination file + $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); + + unlink("$subdir/$file"); } - close(OUT); - - # copy to destination file - $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); - - unlink("$subdir/$file"); } } @@ -226,28 +250,33 @@ foreach $file ( @FILES ) { # # Sort file.2.obj by strip winding -@FILES = `ls $subdir`; -foreach $file ( @FILES ) { - chop($file); - if ( $file =~ m/\.2\.obj$/ ) { - $newfile = $file; - $newfile =~ s/\.2\.obj$/.obj/; - - $command = "./FixObj/fixobj $subdir/$file $subdir/$newfile"; - print "Running '$command'\n"; - open(OUT, "$command |"); - while ( ) { - print $_; +if ( $do_fixobj ) { + @FILES = `ls $subdir`; + foreach $file ( @FILES ) { + chop($file); + if ( $file =~ m/\.2\.obj$/ ) { + $newfile = $file; + $newfile =~ s/\.2\.obj$/.obj/; + + $command = "./FixObj/fixobj $subdir/$file $subdir/$newfile"; + print "Running '$command'\n"; + open(OUT, "$command |"); + while ( ) { + print $_; + } + close(OUT); + + unlink("$subdir/$file"); } - close(OUT); - - unlink("$subdir/$file"); } } #--------------------------------------------------------------------------- # $Log$ +# Revision 1.3 1998/01/14 02:15:52 curt +# Updated front end script to keep plugging away on tile fitting. +# # Revision 1.2 1998/01/12 20:42:08 curt # Working on fitting tiles together in a seamless manner. # -- 2.39.2