5 |
|
# |
6 |
|
use strict; |
7 |
|
sub userror { |
8 |
< |
print STDERR "Usage: genambpos [-l lvl][-s scale][-p][-d] scene.amb > ambloc.rad\n"; |
8 |
> |
print STDERR "Usage: genambpos [-l lvl][-w minwt][-s scale][-p][-d] scene.amb > ambloc.rad\n"; |
9 |
|
exit 1; |
10 |
|
} |
11 |
|
my $lvlsel = -1; |
12 |
|
my $scale = 0.25; |
13 |
|
my $doposgrad = 0; |
14 |
|
my $dodirgrad = 0; |
15 |
+ |
my $minwt = 0.5001**6; |
16 |
|
my $savedARGV = "genambpos @ARGV"; |
17 |
|
# Get options |
18 |
|
while ($#ARGV >= 0) { |
23 |
|
} elsif ("$ARGV[0]" =~ /^-l/) { |
24 |
|
$lvlsel = $ARGV[1]; |
25 |
|
shift @ARGV; |
26 |
+ |
} elsif ("$ARGV[0]" =~ /^-w/) { |
27 |
+ |
$minwt = $ARGV[1]; |
28 |
+ |
shift @ARGV; |
29 |
|
} elsif ("$ARGV[0]" =~ /^-s/) { |
30 |
|
$scale = $ARGV[1]; |
31 |
|
shift @ARGV; |
38 |
|
} |
39 |
|
userror() if ($#ARGV != 0); |
40 |
|
my $cmd = "getinfo < $ARGV[0] " . |
41 |
< |
q[| sed -n 's/^.* -aa \([.0-9][.0-9]*\) .*$/\1/p']; |
41 |
> |
q[| sed -n 's/^.* -aa \([.0-9][^ ]*\) .*$/\1/p']; |
42 |
|
my $ambacc=`$cmd`; |
43 |
|
die "Missing -aa setting in header\n" if (! $ambacc ); |
44 |
|
$scale *= $ambacc**.25; |
53 |
|
0 |
54 |
|
4 ${px} ${py} ${pz} ${psiz} |
55 |
|
|
56 |
< |
posglow cone pgarrow${recno} |
56 |
> |
void glow arrglow |
57 |
|
0 |
58 |
|
0 |
59 |
+ |
4 ${wt*agr} ${wt*agg} ${wt*agb} 0 |
60 |
+ |
|
61 |
+ |
arrglow cone pgarrow${recno} |
62 |
+ |
0 |
63 |
+ |
0 |
64 |
|
8 |
65 |
|
${ cx0 } ${ cy0 } ${ cz0 } |
66 |
|
${ cx1 } ${ cy1 } ${ cz1 } |
132 |
|
$outfmt .= $dirgradfmt if ($dodirgrad); |
133 |
|
# Load & convert ambient values |
134 |
|
print "# Output produced by: $savedARGV\n"; |
135 |
< |
system "lookamb -h -d $ARGV[0] | rcalc -e 'LV:$lvlsel;SF:$scale' -f rambpos.cal -o '$outfmt'\n"; |
135 |
> |
system "lookamb -h -d $ARGV[0] | rcalc -e 'LV:$lvlsel;MW:$minwt;SF:$scale'" . |
136 |
> |
" -f rambpos.cal -o '$outfmt'"; |
137 |
|
exit; |