summaryrefslogtreecommitdiff
path: root/bin/dat2hackvr.pl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/dat2hackvr.pl')
-rwxr-xr-xbin/dat2hackvr.pl34
1 files changed, 34 insertions, 0 deletions
diff --git a/bin/dat2hackvr.pl b/bin/dat2hackvr.pl
new file mode 100755
index 0000000..03c5315
--- /dev/null
+++ b/bin/dat2hackvr.pl
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+
+use strict;
+
+die "usage: dat2hackvr.pl name file\n" unless $ARGV[0];
+
+my $line;
+my $prev;
+my $first;
+open(FILE,$ARGV[1]) if $ARGV[1];
+while($line=<FILE>) {
+ chomp $line;
+ if(!($line =~ m/^#/)) {
+ if($line eq "") {
+# print $ARGV[0];
+# print " addtriangle ";
+# print $prev . " 0 " . $first . " 0 " . $first . " 0";
+# print "\n";
+ $first="";
+ } else {
+ if($prev ne "") {
+ print $ARGV[0];
+ print " addshape 2 2 ";
+ print $line . " 0 " . $prev . " 0";
+ print "\n";
+ }
+ $prev="";
+ }
+ if($first eq "") {
+ $first=$line;
+ }
+ $prev=$line;
+ }
+}