diff options
author | epoch <epoch@hacking.allowed.org> | 2016-10-18 20:22:38 -0500 |
---|---|---|
committer | epoch <epoch@hacking.allowed.org> | 2016-10-18 20:22:38 -0500 |
commit | 11844154cb30223fdaa977d659b98626e99f00ce (patch) | |
tree | 4ebc9b0c0267365cb1f96da0ee1c917f2eec0696 /tools | |
parent | bd213282ff7ed8f2854ab7d628a7aabb7efc85d9 (diff) | |
download | hackvr-11844154cb30223fdaa977d659b98626e99f00ce.tar.gz hackvr-11844154cb30223fdaa977d659b98626e99f00ce.zip |
lets see if this works..
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/obj2hackvr.pl | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/obj2hackvr.pl b/tools/obj2hackvr.pl new file mode 100755 index 0000000..610e04e --- /dev/null +++ b/tools/obj2hackvr.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl + +use strict; + +my $i; +my $j; +my $com; +my @vertices; +my @faces; +my @linepart; +my @parts; +my @points; +my @tmp; +my $tmp; +while(<>) { + chomp; + @linepart=split(/ /,$_,2); + $com=$linepart[0]; + if($com eq "v") { + push(@vertices,$linepart[1]); + } + if($com eq "f") { + push(@faces,$linepart[1]); + } +} +#foreach $tmp (@vertices) { +# foreach(@$tmp) { +# print $tmp . "\n"; +# } +#} + +foreach $tmp (@faces) { + @points=split(/ /,$tmp); + @points = map { $_ =~ s/\/.+$//g; $_; } @points; +# print @points; + for($i=2;$i<(@points);$i++) { + print "deer addtriangle "; + print $vertices[$points[0]-1]; + print " "; + print $vertices[$points[$i-1]-1]; + print " "; + print $vertices[$points[$i]-1]; + print "\n"; + } +} |