| 23 |
|
# options we need to silently ignore |
| 24 |
|
my %ignoreC = ("-t",1, "-ps",1, "-pt",1, "-pm",1); |
| 25 |
|
# Starting options for rtrace (rpict values) |
| 26 |
< |
my @rtraceA = split(' ', "rtrace -ffc -u- -dt .05 -dc .5 -ds .25 -dr 1 -aa .2 -ar 64 -ad 512 -as 128 -lr 7 -lw 1e-03"); |
| 26 |
> |
my @rtraceA = split(' ', "rtrace -u- -dt .05 -dc .5 -ds .25 -dr 1 " . |
| 27 |
> |
"-aa .2 -ar 64 -ad 512 -as 128 -lr 7 -lw 1e-03"); |
| 28 |
|
my @vwraysA = ("vwrays", "-ff", "-pj", ".67"); |
| 29 |
|
my @vwrightA = ("vwright", "-vtv"); |
| 30 |
|
my @rpictA = ("rpict"); |
| 31 |
|
my $outpic; |
| 32 |
+ |
my $outzbf; |
| 33 |
|
OPTION: # sort through options |
| 34 |
|
while ($#ARGV >= 0 && "$ARGV[0]" =~ /^[-\@]/) { |
| 35 |
|
# Check for file inclusion |
| 84 |
|
if ("$ARGV[0]" eq "-o") { |
| 85 |
|
shift @ARGV; |
| 86 |
|
$outpic = shift(@ARGV); |
| 87 |
+ |
} elsif ("$ARGV[0]" eq "-z") { |
| 88 |
+ |
push @rpictA, shift(@ARGV); |
| 89 |
+ |
$outzbf = $ARGV[0]; |
| 90 |
+ |
push @rpictA, shift(@ARGV); |
| 91 |
|
} elsif ("$ARGV[0]" eq "-n") { |
| 92 |
|
shift @ARGV; |
| 93 |
|
$nprocs = shift(@ARGV); |
| 96 |
|
} |
| 97 |
|
} |
| 98 |
|
die "Number of processes must be positive" if ($nprocs <= 0); |
| 99 |
< |
if ($outpic) { # redirect output? |
| 99 |
> |
if (defined $outpic) { # redirect output? |
| 100 |
> |
die "File '$outpic' already exists\n" if (-e $outpic); |
| 101 |
|
open STDOUT, '>', "$outpic"; |
| 102 |
|
} |
| 103 |
|
if ($nprocs == 1) { # may as well run rpict? |
| 104 |
|
push(@rpictA, $ARGV[0]) if ($#ARGV == 0); |
| 105 |
|
exec @rpictA ; |
| 106 |
|
} |
| 100 |
– |
die "Need single octree argument\n" if ($#ARGV != 0); |
| 101 |
– |
push @rtraceA, (`@vwraysA -d`); |
| 102 |
– |
chomp $rtraceA[-1]; |
| 107 |
|
push @rtraceA, ("-n", "$nprocs"); |
| 108 |
< |
push @rtraceA, $ARGV[0]; |
| 109 |
< |
my @view = (`@vwrightA 0`); |
| 110 |
< |
exec "@vwraysA | @rtraceA | getinfo -a 'VIEW=@view'"; |
| 108 |
> |
die "Need single octree argument\n" if ($#ARGV != 0); |
| 109 |
> |
my $oct = $ARGV[0]; |
| 110 |
> |
my $view = `@vwrightA 0`; |
| 111 |
> |
my @res = split(/\s/, `@vwraysA -d`); |
| 112 |
> |
if (defined $outzbf) { # generating depth buffer? |
| 113 |
> |
my $tres = "/tmp/rtp$$"; |
| 114 |
> |
system "@vwraysA | @rtraceA -fff -ovl $res[4] $oct > $tres" || exit 1; |
| 115 |
> |
system( q{getinfo -c rcalc -if4 -of -e '$1=$1;$2=$2;$3=$3' < } . |
| 116 |
> |
"$tres | pvalue -r -df -Y $res[3] +X $res[1] | " . |
| 117 |
> |
"getinfo -a 'VIEW=$view'" ); |
| 118 |
> |
system( "getinfo - < $tres | rcalc -if4 -of > $outzbf" . q{ -e '$1=$4'} ); |
| 119 |
> |
unlink $tres; |
| 120 |
> |
exit; |
| 121 |
> |
} |
| 122 |
> |
# no depth buffer, so simpler |
| 123 |
> |
exec "@vwraysA | @rtraceA -ffc @res $oct | getinfo -a 'VIEW=$view'"; |