ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/genambpos.pl
(Generate patch)

Comparing ray/src/util/genambpos.pl (file contents):
Revision 2.3 by greg, Sat Apr 26 04:02:03 2014 UTC vs.
Revision 2.5 by greg, Thu May 1 04:51:12 2014 UTC

# Line 5 | Line 5
5   #
6   use strict;
7   sub userror {
8 <        print STDERR "Usage: genambpos [-l lvl][-w minwt][-s scale][-p][-d] scene.amb > ambloc.rad\n";
8 >        print STDERR "Usage: genambpos [-l lvl][-w minwt][-r rad][-s sf][-p][-d] scene.amb > ambloc.rad\n";
9          exit 1;
10   }
11   my $lvlsel = -1;
# Line 13 | Line 13 | my $scale = 0.25;
13   my $doposgrad = 0;
14   my $dodirgrad = 0;
15   my $minwt = 0.5001**6;
16 + my $fixedrad="";
17   my $savedARGV = "genambpos @ARGV";
18   # Get options
19   while ($#ARGV >= 0) {
# Line 29 | Line 30 | while ($#ARGV >= 0) {
30          } elsif ("$ARGV[0]" =~ /^-s/) {
31                  $scale = $ARGV[1];
32                  shift @ARGV;
33 +        } elsif ("$ARGV[0]" =~ /^-r/) {
34 +                $fixedrad = "-e psiz:$ARGV[1]";
35 +                shift @ARGV;
36          } elsif ("$ARGV[0]" =~ /^-./) {
37                  userror();
38          } else {
# Line 41 | Line 45 | my $cmd = "getinfo < $ARGV[0] " .
45                  q[| sed -n 's/^.* -aa \([.0-9][^ ]*\) .*$/\1/p'];
46   my $ambacc=`$cmd`;
47   die "Missing -aa setting in header\n" if (! $ambacc );
48 < $scale *= $ambacc**.25;
49 < my $outfmt = '
48 > $scale *= $ambacc;
49 > my $ambfmt = '
50   void glow posglow
51   0
52   0
# Line 52 | Line 56 | posglow sphere position${recno}
56   0
57   0
58   4 ${px} ${py} ${pz} ${psiz}
59 <
59 > ';
60 > my $posgradfmt = '
61   void glow arrglow
62   0
63   0
# Line 65 | Line 70 | arrglow cone pgarrow${recno}
70          ${ cx0 }        ${ cy0 }        ${ cz0 }
71          ${ cx1 }        ${ cy1 }        ${ cz1 }
72          ${ cr0 }        0
73 < ';
69 < my $posgradfmt = '
73 >
74   void brightfunc pgpat
75   2 posfunc ambpos.cal
76   0
# Line 91 | Line 95 | pgeval polygon pgellipse${recno}
95          ${ px3 } ${ py3 } ${ pz3 }
96          ${ px4 } ${ py4 } ${ pz4 }
97   ';
98 < $outfmt .= $posgradfmt if ($doposgrad);
95 < my $dirgradfmt='
98 > $posgradfmt .= '
99   void glow tipglow
100   0
101   0
# Line 102 | Line 105 | tipglow sphere atip
105   0
106   0
107   4 ${ cx1 } ${ cy1 } ${ cz1 } ${psiz/7}
108 <
108 > ' if ($dodirgrad);
109 > my $dirgradfmt='
110   void brightfunc dgpat
111   2 dirfunc ambpos.cal
112   0
# Line 117 | Line 121 | dgval ring dgdisk${recno}a
121   0
122   0
123   8
124 <        ${ px+dgx*.0001 } ${ py+dgy*.0001 } ${ pz+dgz*.0001 }
124 >        ${ px+dgx*.001 } ${ py+dgy*.001 } ${ pz+dgz*.001 }
125          ${ dgx } ${ dgy } ${ dgz }
126          0       ${ r0/2 }
127  
# Line 125 | Line 129 | dgval ring dgdisk${recno}b
129   0
130   0
131   8
132 <        ${ px-dgx*.0001 } ${ py-dgy*.0001 } ${ pz-dgz*.0001 }
132 >        ${ px-dgx*.001 } ${ py-dgy*.001 } ${ pz-dgz*.001 }
133          ${ -dgx } ${ -dgy } ${ -dgz }
134          0       ${ r0/2 }
135   ';
132 $outfmt .= $dirgradfmt if ($dodirgrad);
136   # Load & convert ambient values
137   print "# Output produced by: $savedARGV\n";
138   system "lookamb -h -d $ARGV[0] | rcalc -e 'LV:$lvlsel;MW:$minwt;SF:$scale'" .
139 <                " -f rambpos.cal -o '$outfmt'";
139 >                " -f rambpos.cal -e cond=acond $fixedrad -o '$ambfmt'";
140 > if ($doposgrad) {
141 >        system "lookamb -h -d $ARGV[0] " .
142 >                "| rcalc -e 'LV:$lvlsel;MW:$minwt;SF:$scale'" .
143 >                " -f rambpos.cal -e cond=pcond $fixedrad -o '$posgradfmt'";
144 > }
145 > if ($dodirgrad) {
146 >        system "lookamb -h -d $ARGV[0] " .
147 >                "| rcalc -e 'LV:$lvlsel;MW:$minwt;SF:$scale'" .
148 >                " -f rambpos.cal -e cond=dcond -o '$dirgradfmt'";
149 > }
150   exit;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines