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

Comparing ray/src/util/gentregvec.pl (file contents):
Revision 2.1 by greg, Tue Jun 16 04:54:08 2009 UTC vs.
Revision 2.2 by greg, Tue Jun 16 17:18:38 2009 UTC

# Line 21 | Line 21 | my @skydesc;
21   my $lightline;
22   my @sunval;
23   my $sunline;
24 + my $srcmod;     # putting this inside loop breaks code(?!)
25   while (<>) {
25        my $srcmatch = '^WONTMATCHANYTHING$';
26        my $srcmod;
26          push @skydesc, $_;
27          if (/^\w+\s+light\s+/) {
28                  s/\s+$//; s/^.*\s//;
29                  $srcmod = $_;
30                  $lightline = $#skydesc;
31 <                $srcmatch = "^$srcmod\\s+source\\s";
33 <        } elsif (/^solar\s+source\s/) {
31 >        } elsif (defined($srcmod) && /^($srcmod)\s+source\s/) {
32                  @sunval = split(/\s+/, $skydesc[$lightline + 3]);
33                  shift @sunval;
34                  $sunline = $#skydesc;
# Line 43 | Line 41 | if (defined $sunline) {
41          @sundir = split(/\s+/, $skydesc[$sunline + 3]);
42          shift @sundir;
43          undef @sundir if ($sundir[2] <= 0);
44 <        @skydesc[$sunline .. $sunline + 4] = ('', '', '', '', '');
44 >        splice(@skydesc, $sunline, 5);
45   }
46   # Get Tregenza sample file
47   my $found;
# Line 73 | Line 71 | if ($#tregval != 145) {
71          exit 1;
72   }
73   unlink $octree;
74 < # Find closest patches to sun and divvy up direct solar contribution
74 > # Find closest 3 patches to sun and divvy up direct solar contribution
75   my @bestdir;
76   if (@sundir) {
77 <        my $somega = ($sundir[3]/360)^2 * 3.141592654^3;
77 >        my $somega = ($sundir[3]/360)**2 * 3.141592654**3;
78          my @tindex = (30, 60, 84, 108, 126, 138, 144, 145);
79          my @tomega = (0.0435449227, 0.0416418006, 0.0473984151,
80                          0.0406730411, 0.0428934136, 0.0445221864,
# Line 101 | Line 99 | if (@sundir) {
99                  $tregval[$ndx[$i]] = "@scolor\n";
100          }
101   }
102 + # Output our final vector
103   print @tregval;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines