summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2016-12-09 15:54:33 -0600
committerepoch <epoch@hacking.allowed.org>2016-12-09 15:54:33 -0600
commitb4dddad64122649d9da6340032275d1756930e74 (patch)
treeafcfff52545fce1c7713f24e7a28904230fa8671 /tools
parentfa1b447ef684e5eadda27d8870de6a6e09292a18 (diff)
downloadhackvr-b4dddad64122649d9da6340032275d1756930e74.tar.gz
hackvr-b4dddad64122649d9da6340032275d1756930e74.zip
LOTS OF SHIT
Diffstat (limited to 'tools')
-rwxr-xr-xtools/dat2hackvr.pl34
-rwxr-xr-xtools/obj2hackvr.pl17
2 files changed, 50 insertions, 1 deletions
diff --git a/tools/dat2hackvr.pl b/tools/dat2hackvr.pl
new file mode 100755
index 0000000..2a2fbe1
--- /dev/null
+++ b/tools/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 ";
+ print $line . " 0 " . $prev . " 0";
+ print "\n";
+ }
+ $prev="";
+ }
+ if($first eq "") {
+ $first=$line;
+ }
+ $prev=$line;
+ }
+}
diff --git a/tools/obj2hackvr.pl b/tools/obj2hackvr.pl
index 793b5ea..d8727e2 100755
--- a/tools/obj2hackvr.pl
+++ b/tools/obj2hackvr.pl
@@ -32,13 +32,28 @@ while(<FILE>) {
# }
#}
+#foreach $tmp (@faces) {
+# @points=split(/ /,$tmp);
+# @points = map { $_ =~ s/\/.+$//g; $_; } @points;
+## print @points;
+# print $ARGV[0];
+# print " addshape ";
+# print @points+0;
+# for($i=0;$i<(@points+0);$i++) {
+# print " ";
+# print $vertices[$points[$i]];
+# }
+# print "\n";
+#}
+
+#convert to triangles
foreach $tmp (@faces) {
@points=split(/ /,$tmp);
@points = map { $_ =~ s/\/.+$//g; $_; } @points;
# print @points;
for($i=2;$i<(@points);$i++) {
print $ARGV[0];
- print " addtriangle ";
+ print " addshape 3 ";
print $vertices[$points[0]-1];
print " ";
print $vertices[$points[$i-1]-1];