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.32 by greg, Thu Feb 23 21:28:42 2012 UTC vs.
Revision 2.34 by greg, Thu Mar 15 02:32:19 2012 UTC

# Line 23 | Line 23 | my $geout = 1;
23   my $nproc = 1;
24   my $doforw = 0;
25   my $doback = 1;
26 < my $pctcull = 95;
26 > my $pctcull = 90;
27   my $gunit = "Meter";
28   my @dim;
29   # Get options
# Line 45 | Line 45 | while ($#ARGV >= 0) {
45          } elsif ("$ARGV[0]" =~ /^[-+]b/) {
46                  $doback = ("$ARGV[0]" =~ /^\+/);
47          } elsif ("$ARGV[0]" eq "-t") {
48 +                # Use value < 0 for rttree_reduce bypass
49                  $pctcull = $ARGV[1];
50                  shift @ARGV;
51          } elsif ("$ARGV[0]" =~ /^-t[34]$/) {
# Line 321 | Line 322 | sub bg_tree_rtcontrib {
322   sub ttree_out {
323          my $forw = shift;
324          my $side = ("Back","Front")[$forw];
325 +        my $cmd;
326   # Only output one transmitted distribution, preferring backwards
327   if ( !$forw || !$doback ) {
328   print
# Line 335 | Line 337 | print
337                          <ScatteringDataType>BTDF</ScatteringDataType>
338                          <ScatteringData>
339   ';
340 < system "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " .
341 <        q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' -of } .
342 <        "$td/" . ($bmodnm,$fmodnm)[$forw] . "_???.flt " .
340 > $cmd = "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " .
341 >        q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' };
342 > if ($pctcull >= 0) {
343 >        $cmd .= "-of $td/" . ($bmodnm,$fmodnm)[$forw] . "_???.flt " .
344          "| rttree_reduce -a -h -ff -t $pctcull -r $tensortree -g $ttlog2";
345 < die "Failure running rttree_reduce" if ( $? );
345 >        system "$cmd" || die "Failure running rttree_reduce";
346 > } else {
347 >        $cmd .= "$td/" . ($bmodnm,$fmodnm)[$forw] . "_???.flt";
348 >        print "{\n";
349 >        system "$cmd" || die "Failure running rcalc";
350 >        for (my $i = ($tensortree==3)*$ns*$ns*$ns/2; $i-- > 0; ) {
351 >                print "0\n";
352 >        }
353 >        print "}\n";
354 > }
355   print
356   '                       </ScatteringData>
357                  </WavelengthDataBlock>
# Line 361 | Line 373 | print
373                          <ScatteringDataType>BRDF</ScatteringDataType>
374                          <ScatteringData>
375   ';
376 < system "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " .
377 <        q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' -of } .
378 <        "$td/" . ($fmodnm,$bmodnm)[$forw] . "_???.flt " .
376 > $cmd = "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " .
377 >        q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' };
378 > if ($pctcull >= 0) {
379 >        $cmd .= "-of $td/" . ($fmodnm,$bmodnm)[$forw] . "_???.flt " .
380          "| rttree_reduce -a -h -ff -t $pctcull -r $tensortree -g $ttlog2";
381 < die "Failure running rttree_reduce" if ( $? );
381 >        system "$cmd" || die "Failure running rttree_reduce";
382 > } else {
383 >        $cmd .= "$td/" . ($fmodnm,$bmodnm)[$forw] . "_???.flt";
384 >        print "{\n";
385 >        system "$cmd" || die "Failure running rcalc";
386 >        for (my $i = ($tensortree==3)*$ns*$ns*$ns/2; $i-- > 0; ) {
387 >                print "0\n";
388 >        }
389 >        print "}\n";
390 > }
391   print
392   '                       </ScatteringData>
393                  </WavelengthDataBlock>
# Line 636 | Line 658 | print
658                          <ScatteringDataType>BRDF</ScatteringDataType>
659                          <ScatteringData>
660   ';
661 < # Output back reflection (reciprocity averaging)
661 > # Output back reflection (transposed order)
662   for (my $od = 0; $od < $ndiv; $od++) {
663          for (my $id = 0; $id < $ndiv; $id++) {
664                  print $rbarr[$ndiv*$id + $od], ",\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines