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

Comparing ray/src/util/bsdfview.pl (file contents):
Revision 2.2 by greg, Sat Aug 12 01:31:29 2017 UTC vs.
Revision 2.7 by greg, Fri Jul 20 00:50:40 2018 UTC

# Line 12 | Line 12 | my $td = tempdir( CLEANUP => 0 );
12   my $octree = "$td/bv$$.oct";
13   my $ambf = "$td/af$$.amb";
14   my $raddev = "x11";     # default output device. Overwrite with -o
15 < my $qual = "Low";
16 < my $vw = "def";
15 > my $qual = "Med";
16 > my $usetrad = 0;
17  
18 < my $opts = "";  # Options common to rad
18 > my @range;              # BSDF min and max range
19 > my $opts = "";          # Options common to rad
20   my $rendopts = "-w-";   # For render= line in rif file
21  
22   while (@ARGV) {
# Line 24 | Line 25 | while (@ARGV) {
25                  $opts .= " $_";
26          } elsif (m/^-v\b/) {    # standard view
27                  # Let rad do any error handling...
28 <                $vw = $ARGV[1];
28 >                $opts .= qq( -v "$ARGV[1]");
29                  shift @ARGV;
30          } elsif (m/^-[nN]\b/) { # No. of parallel processes
31                  $opts .= ' -N ' . $ARGV[1];
# Line 38 | Line 39 | while (@ARGV) {
39          } elsif ((m/^-V\b/) or (m/^-e\b/)) {   # print view, explicate variables
40                  # Think of those two as '-verbose'.
41                  $opts .= " $_";
42 +        } elsif (m/^-t\b/) {    # start trad instead of rad
43 +                $usetrad = 1;
44 +        } elsif (m/^-r/) {      # specified range for BSDF
45 +                @range = ("-r", $ARGV[1], $ARGV[2]);
46 +                shift @ARGV; shift @ARGV;
47          } elsif (m/^-\w/) {
48                  die("bsdfview: Bad option: $_\n");
49          } else {
# Line 48 | Line 54 | while (@ARGV) {
54  
55   # We need at least one XML or SIR file
56   if ($#ARGV < 0) {
57 <        die("Missing input XML or SIR file(s)\n");
57 >        die("bsdfview: missing input XML or SIR file(s)\n");
58   }
59  
60 + if (length($opts) and $usetrad) {
61 +        die("bsdfview: rad options not supported when calling trad (-t)\n");
62 + }
63 +
64   my @objects = @ARGV;
65  
66   # Make this work under Windoze
# Line 72 | Line 82 | my $rif = "$name.rif";
82  
83   if (-e $rif) {                  # RIF already exists?
84          print "Attempting to run with existing rad input file '$rif'\n";
85 <        system "rad -o $raddev -w -v $vw $opts $rif QUA=$qual";
85 >        if ($usetrad) {
86 >                system "trad $rif";
87 >        } else {
88 >                system "rad -o $raddev -w $opts $rif QUA=$qual";
89 >        }
90          die("\nTry removing '$rif' and starting again\n\n") if $?;
91          exit;
92   }
93  
94   print "bsdfview: creating rad input file '$rif'\n";
95  
96 < my $scene = qq("!bsdf2rad @objects");           # let bsdf2rad do complaining
96 > my $scene = qq("!bsdf2rad @range @objects");    # let bsdf2rad do complaining
97  
98   my $objects = join(' ', @objects);
99   open(FH, ">$rif") or
# Line 95 | Line 109 | UP= +Z
109   OCTREE= $octree
110   oconv= -w -f
111   AMBF= $ambf
112 < QUAL = $qual
112 > QUAL= $qual
113   render= $rendopts
114   view= def -vp 0 -50 50 -vd 0 50 -50 -vh 45 -vv 30
115   view= fr -vp 15 -30 30 -vd 0 30 -30
# Line 107 | Line 121 | view= pt -vtl -vp 0 0 -10 -vd 0 0 1 -vu 0 1 0 -vv 35 -
121   EndOfRif
122   close(FH);
123  
124 < system "rad -o $raddev -v $vw $opts $rif";
125 <
124 > if ($usetrad) {
125 >        system "rad -v 0 $rif ; trad $rif";
126 > } else {
127 >        system "rad -o $raddev $opts $rif";
128 > }
129   #EOF

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines