1
0
Fork 0

Updated front end script to keep plugging away on tile fitting.

This commit is contained in:
curt 1998-01-14 02:15:51 +00:00
parent 419b95f564
commit 9f8ffba6a7
2 changed files with 149 additions and 109 deletions

View file

@ -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.

View file

@ -28,6 +28,15 @@
$| = 1; # flush buffers after every write $| = 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 ".") # return the file name root (ending at last ".")
sub file_root { sub file_root {
@ -69,6 +78,7 @@ if ( $error < 0.5 ) {
# splits dem file into 64 file.node's which contain the # splits dem file into 64 file.node's which contain the
# irregularly fitted vertices # irregularly fitted vertices
if ( $do_demfit ) {
$command = "./Dem2node/demfit $ENV{FG_ROOT} $dem_file $error"; $command = "./Dem2node/demfit $ENV{FG_ROOT} $dem_file $error";
print "Running '$command'\n"; print "Running '$command'\n";
@ -82,7 +92,7 @@ while ( <OUT> ) {
} }
} }
close(OUT); close(OUT);
}
# 3. triangle -q file (Takes file.node and produces file.1.node and # 3. triangle -q file (Takes file.node and produces file.1.node and
# file.1.ele) # file.1.ele)
@ -90,6 +100,7 @@ close(OUT);
$subdir = "../Scenery/w120n030/w111n033"; $subdir = "../Scenery/w120n030/w111n033";
print "Subdirectory for this dem file is $subdir\n"; print "Subdirectory for this dem file is $subdir\n";
if ( $do_triangle_1 ) {
@FILES = `ls $subdir`; @FILES = `ls $subdir`;
foreach $file ( @FILES ) { foreach $file ( @FILES ) {
print $file; print $file;
@ -107,7 +118,7 @@ foreach $file ( @FILES ) {
unlink("$subdir/$file"); unlink("$subdir/$file");
} }
} }
}
# 4. fixnode file.dem subdir # 4. fixnode file.dem subdir
# #
@ -115,6 +126,7 @@ foreach $file ( @FILES ) {
# subdirecotry containing all the file.1.node's and replace with # subdirecotry containing all the file.1.node's and replace with
# fixed file.1.node # fixed file.1.node
if ( $do_fixnode ) {
$command = "./FixNode/fixnode $dem_file $subdir"; $command = "./FixNode/fixnode $dem_file $subdir";
print "Running '$command'\n"; print "Running '$command'\n";
open(OUT, "$command |"); open(OUT, "$command |");
@ -122,22 +134,32 @@ while ( <OUT> ) {
print $_; print $_;
} }
close(OUT); close(OUT);
}
# 4.1 findedges file (.1.node) (.1.ele) # 4.1 splittris file (.1.node) (.1.ele)
# Extract the edge vertices (in original geodetic coordinates) and # Extract the corner, edge, and body vertices (in original
# normals (in cartesian coordinates) and save them in something # geodetic coordinates) and normals (in cartesian coordinates) and
# very close to the .obj format as file.north, file.south, # save them in something very close to the .obj format as file.se,
# file.east file.west. # 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`; @FILES = `ls $subdir`;
foreach $file ( @FILES ) { foreach $file ( @FILES ) {
chop($file); chop($file);
if ( $file =~ m/\.1\.node$/ ) { if ( $file =~ m/\.1\.node$/ ) {
$file =~ s/\.node$//; # strip off the ".node" $file =~ s/\.node$//; # strip off the ".node"
$command = "./FindEdges/findedges $subdir/$file"; $command = "./SplitTris/splittris $subdir/$file";
print "Running '$command'\n"; print "Running '$command'\n";
open(OUT, "$command |"); open(OUT, "$command |");
while ( <OUT> ) { while ( <OUT> ) {
@ -146,12 +168,10 @@ foreach $file ( @FILES ) {
close(OUT); close(OUT);
} }
} }
}
exit(1); # 4.2 read in tile sections/ele) skipping edges, read edges out of
# 4.2 read in tri files (node/ele) skipping edges, read edges out of
# edge files, save including proper shared edges (as node/ele) # edge files, save including proper shared edges (as node/ele)
# files. If my edge and adjacent edge both exist, use other, # files. If my edge and adjacent edge both exist, use other,
# delete mine. If only mine exists, use it. # delete mine. If only mine exists, use it.
@ -164,6 +184,7 @@ exit(1);
# #
# Take the file.1.node and file.1.ele and produce file.1.obj # Take the file.1.node and file.1.ele and produce file.1.obj
if ( $do_tri2obj ) {
@FILES = `ls $subdir`; @FILES = `ls $subdir`;
foreach $file ( @FILES ) { foreach $file ( @FILES ) {
chop($file); chop($file);
@ -183,6 +204,7 @@ foreach $file ( @FILES ) {
unlink("$subdir/$file.ele"); unlink("$subdir/$file.ele");
} }
} }
}
# 6. strip file.1.obj # 6. strip file.1.obj
@ -193,6 +215,7 @@ foreach $file ( @FILES ) {
# #
# strips produces a file called "bands.d" ... copy this to file.2.obj # strips produces a file called "bands.d" ... copy this to file.2.obj
if ( $do_strips ) {
@FILES = `ls $subdir`; @FILES = `ls $subdir`;
foreach $file ( @FILES ) { foreach $file ( @FILES ) {
chop($file); chop($file);
@ -220,12 +243,14 @@ foreach $file ( @FILES ) {
unlink("$subdir/$file"); unlink("$subdir/$file");
} }
} }
}
# 8. fixobj file-new # 8. fixobj file-new
# #
# Sort file.2.obj by strip winding # Sort file.2.obj by strip winding
if ( $do_fixobj ) {
@FILES = `ls $subdir`; @FILES = `ls $subdir`;
foreach $file ( @FILES ) { foreach $file ( @FILES ) {
chop($file); chop($file);
@ -244,10 +269,14 @@ foreach $file ( @FILES ) {
unlink("$subdir/$file"); unlink("$subdir/$file");
} }
} }
}
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# $Log$ # $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 # Revision 1.2 1998/01/12 20:42:08 curt
# Working on fitting tiles together in a seamless manner. # Working on fitting tiles together in a seamless manner.
# #