]> git.mxchange.org Git - flightgear.git/blobdiff - Tools/process-dem.pl
Adopted Gnu automake/autoconf system.
[flightgear.git] / Tools / process-dem.pl
index a9c0ba05eeb73b77435832c8669d565581ae92e5..a9454b0b8439f2c3cdcd26866cd48ed9dc57008e 100755 (executable)
@@ -28,7 +28,7 @@
 
 $| = 1;                         # flush buffers after every write
 
-$do_demfit =     1;
+$do_dem2node =     1;
 $do_triangle_1 = 1;
 $do_fixnode =    1;
 $do_splittris =  1;
@@ -69,8 +69,8 @@ while ( $dem_file = shift(@ARGV) ) {
     }
 
 
-    if ( $do_demfit ) {
-       demfit() ;
+    if ( $do_dem2node ) {
+       dem2node() ;
     } else {
        $subdir = "../Scenery/w100n040/w093n045";
        print "WARNING:  Hardcoding subdir = $subdir\n";
@@ -91,6 +91,21 @@ while ( $dem_file = shift(@ARGV) ) {
 exit(0);
 
 
+# fix command to work with windoze, replaces first "/" with "\\"
+sub fix_command {
+    my($in) = @_;
+
+    $system = `uname -s`;
+    chop($system);
+
+    if ( $system =~ m/CYGWIN32/ ) { 
+       $in =~ s/\//\\\\/;
+    }
+
+    return($in);
+}
+
+
 # return the file name root (ending at last ".")
 sub file_root {
     my($file) = @_;
@@ -108,13 +123,13 @@ sub file_root {
 #     splits dem file into 64 file.node's which contain the
 #     irregularly fitted vertices
 
-sub demfit {
+sub dem2node {
     if ( $dem_file =~ m/.gz$/ ) {
-       $command = "gzip -dc $dem_file | ./Dem2node/dem2node $ENV{FG_ROOT} - $error";
+       $command = "gzip -dc $dem_file | Dem2node/dem2node $ENV{FG_ROOT} - $error";
     } else {
-       $command = "./Dem2node/dem2node $ENV{FG_ROOT} $dem_file $error";
+       $command = "Dem2node/dem2node $ENV{FG_ROOT} $dem_file $error";
     }
-
+    $command = fix_command($command);
     print "Running '$command'\n";
 
     open(OUT, "$command |");
@@ -141,7 +156,8 @@ sub triangle_1 {
        print $file;
        chop($file);
        if ( ($file =~ m/\.node$/) && ($file !~ m/\.\d\.node$/) ) {
-           $command = "./Triangle/triangle -q $subdir/$file";
+           $command = "Triangle/triangle -q $subdir/$file";
+           $command = fix_command($command);
            print "Running '$command'\n";
            open(OUT, "$command |");
            while ( <OUT> ) {
@@ -164,10 +180,11 @@ sub triangle_1 {
 
 sub fixnode {
     if ( $dem_file =~ m/.gz$/ ) {
-       $command = "gzip -dc $dem_file | ./FixNode/fixnode - $subdir";
+       $command = "gzip -dc $dem_file | FixNode/fixnode - $subdir";
     } else {
-       $command = "./FixNode/fixnode $dem_file $subdir";
+       $command = "FixNode/fixnode $dem_file $subdir";
     }
+    $command = fix_command($command);
     print "Running '$command'\n";
     open(OUT, "$command |");
     while ( <OUT> ) {
@@ -199,7 +216,8 @@ sub splittris {
        if ( $file =~ m/\.1\.node$/ ) {
            $file =~ s/\.node$//;  # strip off the ".node"
        
-           $command = "./SplitTris/splittris $subdir/$file";
+           $command = "SplitTris/splittris $subdir/$file";
+           $command = fix_command($command);
            print "Running '$command'\n";
            open(OUT, "$command |");
            while ( <OUT> ) {
@@ -226,7 +244,8 @@ sub assemtris {
        if ( $file =~ m/\.1\.body$/ ) {
            $file =~ s/\.body$//;  # strip off the ".body"
        
-           $command = "./AssemTris/assemtris $subdir/$file";
+           $command = "AssemTris/assemtris $subdir/$file";
+           $command = fix_command($command);
            print "Running '$command'\n";
            open(OUT, "$command |");
            while ( <OUT> ) {
@@ -248,7 +267,8 @@ sub triangle_2 {
        print $file;
        chop($file);
        if ( ($file =~ m/\.node$/) && ($file !~ m/\.\d\.node$/) ) {
-           $command = "./Triangle/triangle $subdir/$file";
+           $command = "Triangle/triangle $subdir/$file";
+           $command = fix_command($command);
            print "Running '$command'\n";
            open(OUT, "$command |");
            while ( <OUT> ) {
@@ -280,7 +300,8 @@ sub tri2obj {
        if ( $file =~ m/\.1\.node$/ ) {
            $file =~ s/\.node$//;  # strip off the ".node"
            
-           $command = "./Tri2obj/tri2obj $subdir/$file";
+           $command = "Tri2obj/tri2obj $subdir/$file";
+           $command = fix_command($command);
            print "Running '$command'\n";
            open(OUT, "$command |");
            while ( <OUT> ) {
@@ -310,7 +331,8 @@ sub strips {
     foreach $file ( @FILES ) {
        chop($file);
        if ( $file =~ m/\.1\.obj$/ ) {
-           $command = "./Stripe_u/strips $subdir/$file";
+           $command = "Stripe_u/strips $subdir/$file";
+           $command = fix_command($command);
            print "Running '$command'\n";
            open(OUT, "$command |");
            while ( <OUT> ) {
@@ -348,7 +370,8 @@ sub fixobj {
            $newfile = $file;
            $newfile =~ s/\.2\.obj$/.obj/;
            
-           $command = "./FixObj/fixobj $subdir/$file $subdir/$newfile";
+           $command = "FixObj/fixobj $subdir/$file $subdir/$newfile";
+           $command = fix_command($command);
            print "Running '$command'\n";
            open(OUT, "$command |");
            while ( <OUT> ) {
@@ -364,6 +387,14 @@ sub fixobj {
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.15  1998/04/08 23:24:07  curt
+# Adopted Gnu automake/autoconf system.
+#
+# Revision 1.14  1998/04/06 21:09:38  curt
+# Additional win32 support.
+# Fixed a bad bug in dem file parsing that was causing the output to be
+# flipped about x = y.
+#
 # Revision 1.13  1998/03/19 02:52:52  curt
 # Updated to reflect some minor tool reorganization and the creation of class
 # to handle DEM processing needs.