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

Comparing ray/src/util/genskyvec.pl (file contents):
Revision 2.7 by greg, Thu Sep 29 22:36:11 2011 UTC vs.
Revision 2.10 by greg, Mon Dec 12 17:40:07 2016 UTC

# Line 9 | Line 9 | use strict;
9   my $windoz = ($^O eq "MSWin32" or $^O eq "MSWin64");
10   my @skycolor = (0.960, 1.004, 1.118);
11   my $mf = 4;
12 + my $dosky = 1;
13 + my $headout = 1;
14 + my @origARGV = @ARGV;
15   while ($#ARGV >= 0) {
16          if ("$ARGV[0]" eq "-c") {
17                  @skycolor = @ARGV[1..3];
18 <                shift @ARGV; shift @ARGV; shift @ARGV;
18 >                shift @ARGV for (1..3);
19          } elsif ("$ARGV[0]" eq "-m") {
20                  $mf = $ARGV[1];
21                  shift @ARGV;
22 +        } elsif ("$ARGV[0]" eq "-d") {
23 +                $dosky = 0;
24 +        } elsif ("$ARGV[0]" eq "-h") {
25 +                $headout = 0;
26 +        } else {
27 +                die "Unexpected command-line argument: $ARGV[0]\n";
28          }
29          shift @ARGV;
30   }
# Line 104 | Line 113 | if ($windoz) {
113                          q{-e '$1=if(1-dot,acos(dot),0);$2=Romega;$3=recno' };
114          }
115   }
116 < # Create octree for rtrace
117 < open OCONV, "| oconv - > $octree";
118 < print OCONV @skydesc;
119 < print OCONV "skyfunc glow skyglow 0 0 4 @skycolor 0\n";
120 < print OCONV "skyglow source sky 0 0 4 0 0 1 360\n";
121 < close OCONV;
122 < # Run rtrace and average output for every 16 samples
123 < my @tregval = `$tregcommand`;
124 < unlink $octree;
116 > my @tregval;
117 > if ($dosky) {
118 >        # Create octree for rtrace
119 >        open OCONV, "| oconv - > $octree";
120 >        print OCONV @skydesc;
121 >        print OCONV "skyfunc glow skyglow 0 0 4 @skycolor 0\n";
122 >        print OCONV "skyglow source sky 0 0 4 0 0 1 360\n";
123 >        close OCONV;
124 >        # Run rtrace and average output for every 16 samples
125 >        @tregval = `$tregcommand`;
126 >        unlink $octree;
127 > } else {
128 >        push @tregval, "0\t0\t0\n" for (1..$nbins);
129 > }
130   # Find closest 3 patches to sun and divvy up direct solar contribution
131   sub numSort1 {
132          my @a1 = split("\t", $a);
# Line 135 | Line 149 | if (@sundir) {
149                  for my $j (0..2) { $scolor[$j] += $wt * $sunval[$j]; }
150                  $tregval[$ndx[$i]] = "$scolor[0]\t$scolor[1]\t$scolor[2]\n";
151          }
152 + }
153 + # Output header if requested
154 + if ($headout) {
155 +        print "#?RADIANCE\n";
156 +        print "genskyvec @origARGV\n";
157 +        print "NROWS=", $#tregval+1, "\n";
158 +        print "NCOLS=1\nNCOMP=3\n";
159 +        print "FORMAT=ascii\n";
160 +        print "\n";
161   }
162   # Output our final vector
163   print @tregval;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines