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

Comparing ray/src/util/genBSDF.pl (file contents):
Revision 2.15 by greg, Wed May 25 19:24:11 2011 UTC vs.
Revision 2.20 by greg, Sat Jun 4 00:33:53 2011 UTC

# Line 13 | Line 13 | sub userror {
13   }
14   my $td = mkdtemp("/tmp/genBSDF.XXXXXX");
15   chomp $td;
16 + my @savedARGV = @ARGV;
17   my $tensortree = 0;
18   my $ttlog2 = 4;
19   my $nsamp = 1000;
# Line 98 | Line 99 | die "Could not compile scene\n" if ( $? );
99   print
100   '<?xml version="1.0" encoding="UTF-8"?>
101   <WindowElement xmlns="http://windows.lbl.gov" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://windows.lbl.gov/BSDF-v1.4.xsd">
102 < <WindowElementType>System</WindowElementType>
102 > ';
103 > print "<!-- File produced by: genBSDF @savedARGV -->\n";
104 > print
105 > '<WindowElementType>System</WindowElementType>
106   <Optical>
107   <Layer>
108          <Material>
# Line 139 | Line 143 | print
143   </WindowElement>
144   ';
145   # Clean up temporary files and exit
146 < if ( $persistfile ) {
143 <        open(PFI, "< $persistfile");
146 > if ( $persistfile && open(PFI, "< $persistfile") ) {
147          while (<PFI>) {
148                  s/^[^ ]* //;
149                  kill('ALRM', $_);
# Line 148 | Line 151 | if ( $persistfile ) {
151          }
152          close PFI;
153   }
154 < system "rm -rf $td";
155 < exit 0;
154 > exec("rm -rf $td");
155 >
156   #-------------- End of main program segment --------------#
157  
158   #++++++++++++++ Tensor tree BSDF generation ++++++++++++++#
# Line 204 | Line 207 | out_square_x = (out_square_a + 1)/2;
207   out_square_y = (out_square_b + 1)/2;
208   ';
209   # Announce ourselves in XML output
210 < print "         <DataDefinition>\n";
211 < print "                 <IncidentDataStructure>TensorTree$tensortree</IncidentDataStructure>\n";
212 < print "         </DataDefinition>\n";
210 > print "\t<DataDefinition>\n";
211 > print "\t\t<IncidentDataStructure>TensorTree$tensortree</IncidentDataStructure>\n";
212 > print "\t</DataDefinition>\n";
213   # Fork parallel rtcontrib processes to compute each side
214   if ( $doback ) {
215          for (my $proc = 0; $proc < $nproc; $proc++) {
# Line 249 | Line 252 | sub bg_tree_rtcontrib {
252                          "| rcalc -e 'r1=rand(($pn+.8681)*recno-.673892)' " .
253                          "-e 'r2=rand(($pn-5.37138)*recno+67.1737811)' " .
254                          "-e 'r3=rand(($pn+3.17603772)*recno+83.766771)' " .
255 <                        "-e 'Dx=1-($pbeg+\$1+r1)/$ns;Dy:0;Dz=sqrt(1-Dx*Dx)' " .
255 >                        "-e 'Dx=1-2*($pbeg+\$1+r1)/$ns;Dy:0;Dz=sqrt(1-Dx*Dx)' " .
256                          "-e 'xp=(\$3+r2)*(($dim[1]-$dim[0])/$nx)+$dim[0]' " .
257                          "-e 'yp=(\$2+r3)*(($dim[3]-$dim[2])/$ny)+$dim[2]' " .
258                          "-e 'zp=$dim[5-$forw]' -e 'myDz=Dz*($forw*2-1)' " .
# Line 316 | Line 319 | print
319                  <SourceSpectrum>CIE Illuminant D65 1nm.ssp</SourceSpectrum>
320                  <DetectorSpectrum>ASTM E308 1931 Y.dsp</DetectorSpectrum>
321                  <WavelengthDataBlock>
322 <                        <WavelengthDataDirection>Reflection $side</WavelengthDataDirection>
323 <                        <AngleBasis>LBNL/Shirley-Chiu</AngleBasis>
322 > ';
323 > print "\t\t\t<WavelengthDataDirection>Reflection $side</WavelengthDataDirection>\n";
324 > print
325 > '                       <AngleBasis>LBNL/Shirley-Chiu</AngleBasis>
326                          <ScatteringDataType>BRDF</ScatteringDataType>
327                          <ScatteringData>
328   ';

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines