diff options
author | epoch <epoch@hacking.allowed.org> | 2017-01-03 00:30:28 -0600 |
---|---|---|
committer | epoch <epoch@hacking.allowed.org> | 2017-01-03 00:30:28 -0600 |
commit | ebde46bc82bebf478db67abef5b7dc88c014706b (patch) | |
tree | 77121f0c18b1845b8c3cfdfec962e9c5b2ec7e67 /tools | |
parent | f7353ec277198b295c6c842a4a4a07b403b2a572 (diff) | |
download | hackvr-ebde46bc82bebf478db67abef5b7dc88c014706b.tar.gz hackvr-ebde46bc82bebf478db67abef5b7dc88c014706b.zip |
lots and lots of shit. opengl shit is barely worked on. new pl script to obj2hackvr using more than just triangles.http://hackaday.com/blog/http://hackaday.com/blog/
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/obj2hackvr.pl | 2 | ||||
-rwxr-xr-x | tools/obj2hackvr2.pl | 49 |
2 files changed, 50 insertions, 1 deletions
diff --git a/tools/obj2hackvr.pl b/tools/obj2hackvr.pl index d8727e2..8173eee 100755 --- a/tools/obj2hackvr.pl +++ b/tools/obj2hackvr.pl @@ -16,7 +16,7 @@ my @tmp; my $tmp; open(FILE,$ARGV[1]) if $ARGV[1]; while(<FILE>) { - chomp; + $_ =~ s/[\n\r]//g; @linepart=split(/ /,$_,2); $com=$linepart[0]; if($com eq "v") { diff --git a/tools/obj2hackvr2.pl b/tools/obj2hackvr2.pl new file mode 100755 index 0000000..92d16a7 --- /dev/null +++ b/tools/obj2hackvr2.pl @@ -0,0 +1,49 @@ +#!/usr/bin/perl + +use strict; + +die "usage: obj2hackvr.pl name file\n" unless $ARGV[0]; + +my $i; +my $j; +my $com; +my @vertices; +my @faces; +my @linepart; +my @parts; +my @points; +my @tmp; +my $tmp; +open(FILE,$ARGV[1]) if $ARGV[1]; +while(<FILE>) { + chomp; + $_ =~ s/[\r\n]//g; + @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; + print $ARGV[0]; + print " addshape "; + print @points+0; + for($i=0;$i<(@points);$i++) { + print " "; + print $vertices[$points[$i]-1]; + } + print "\n"; +} |