$| = 1; # flush buffers after every write
-$do_demfit = 0;
-$do_triangle_1 = 0;
-$do_fixnode = 0;
-$do_splittris = 0;
+$do_demfit = 1;
+$do_triangle_1 = 1;
+$do_fixnode = 1;
+$do_splittris = 1;
$do_assemtris = 1;
+$do_triangle_2 = 1;
-$do_tri2obj = 0;
-$do_strips = 0;
-$do_fixobj = 0;
+$do_tri2obj = 1;
+$do_strips = 1;
+$do_fixobj = 1;
# return the file name root (ending at last ".")
open(OUT, "$command |");
while ( <OUT> ) {
print $_;
- if ( m/Scenery/ ) {
+ if ( m/^Dir = / ) {
$subdir = $_;
- $subdir =~ s/Dir = //;
+ $subdir =~ s/^Dir = //;
+ chop($subdir);
}
}
close(OUT);
} else {
- $subdir = "../Scenery/w120n030/w111n033";
- printf("WARNING: Hardcoding subdir = $subdir
+ $subdir = "../Scenery/w100n040/w093n045";
+ print "WARNING: Hardcoding subdir = $subdir\n";
}
# 3. triangle -q file (Takes file.node and produces file.1.node and
print $_;
}
close(OUT);
+
+ unlink("$subdir/$file.node");
+ unlink("$subdir/$file.node.orig");
+ unlink("$subdir/$file.ele");
+ }
+ }
+}
+
+
+# 4.2 read in the split of version of the tiles, reconstruct the tile
+# using the proper shared corners and edges. Save as a node file
+# so we can retriangulate.
+
+if ( $do_assemtris ) {
+ @FILES = `ls $subdir`;
+ foreach $file ( @FILES ) {
+ chop($file);
+ if ( $file =~ m/\.1\.body$/ ) {
+ $file =~ s/\.body$//; # strip off the ".node"
+
+ $command = "./AssemTris/assemtris $subdir/$file";
+ print "Running '$command'\n";
+ open(OUT, "$command |");
+ while ( <OUT> ) {
+ print $_;
+ }
+ close(OUT);
}
}
}
-# 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.
+# 4.3 Retriangulate reassembled files (without -q option) so no new
+# nodes are generated.
+if ( $do_triangle_2 ) {
+ @FILES = `ls $subdir`;
+ foreach $file ( @FILES ) {
+ print $file;
+ chop($file);
+ if ( ($file =~ m/\.node$/) && ($file !~ m/\.\d\.node$/) ) {
+ $command = "./Triangle/triangle $subdir/$file";
+ print "Running '$command'\n";
+ open(OUT, "$command |");
+ while ( <OUT> ) {
+ print $_;
+ }
+ close(OUT);
-# 4.3 Retriangulate fixed up files (without -q option)
+ # remove input file.node
+ unlink("$subdir/$file");
+ }
+ }
+}
# 5. tri2obj file (.1.node) (.1.ele)
#
# Take the file.1.node and file.1.ele and produce file.1.obj
+#
+# Extracts normals out of the shared edge/vertex files, and uses
+# the precalcuated normals for these nodes instead of calculating
+# new ones. By sharing normals as well as vertices, not only are
+# the gaps between tiles eliminated, but the colors and lighting
+# transition smoothly across tile boundaries.
if ( $do_tri2obj ) {
@FILES = `ls $subdir`;
}
close(OUT);
- unlink("$subdir/$file.node");
- unlink("$subdir/$file.node.orig");
- unlink("$subdir/$file.ele");
+ # unlink("$subdir/$file.node");
+ # unlink("$subdir/$file.node.orig");
+ # unlink("$subdir/$file.ele");
}
}
}
# 6. strip file.1.obj
#
-# Strip the file.1.obj's
+# 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
#
close(IN);
close(OUT);
- unlink("$subdir/$file");
+ # unlink("$subdir/$file");
}
}
}
#---------------------------------------------------------------------------
# $Log$
+# Revision 1.7 1998/01/19 19:51:06 curt
+# A couple final pre-release tweaks.
+#
+# Revision 1.6 1998/01/15 21:33:33 curt
+# Assembling triangles and building a new .node file with the proper shared
+# vertices now works. Now we just have to use the shared normals and we'll
+# be all set.
+#
+# Revision 1.5 1998/01/15 02:50:08 curt
+# Tweaked to add next stage.
+#
# Revision 1.4 1998/01/14 15:55:34 curt
# Finished splittris, started assemtris.
#