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.56 by greg, Wed Apr 1 01:38:35 2015 UTC vs.
Revision 2.64 by greg, Wed Jul 13 00:51:17 2016 UTC

# Line 9 | Line 9 | use strict;
9   my $windoz = ($^O eq "MSWin32" or $^O eq "MSWin64");
10   use File::Temp qw/ :mktemp  /;
11   sub userror {
12 <        print STDERR "Usage: genBSDF [-n Nproc][-c Nsamp][-W][-t{3|4} Nlog2][-r \"ropts\"][-f \"x=string;y=string\"][-dim xmin xmax ymin ymax zmin zmax][{+|-}C][{+|-}f][{+|-}b][{+|-}mgf][{+|-}geom units] [input ..]\n";
12 >        print STDERR "Usage: genBSDF [-n Nproc][-c Nsamp][-W][-t{3|4} Nlog2][-r \"ropts\"][-s \"x=string;y=string\"][-dim xmin xmax ymin ymax zmin zmax][{+|-}C][{+|-}f][{+|-}b][{+|-}mgf][{+|-}geom units] [input ..]\n";
13          exit 1;
14   }
15   my ($td,$radscn,$mgfscn,$octree,$fsender,$bsender,$receivers,$facedat,$behinddat,$rmtmp);
# Line 39 | Line 39 | if ($windoz) {
39          $tbz = "$td\\tbz.dat";
40          $rbz = "$td\\rbz.dat";
41          chomp $td;
42 <        $rmtmp = "rmdir /S /Q $td";
42 >        $rmtmp = "rd /S /Q $td";
43   } else {
44          $td = mkdtemp("/tmp/genBSDF.XXXXXX");
45          chomp $td;
# Line 152 | Line 152 | if ( $mgfin ) {
152   if ($#dim != 5) {
153          @dim = split ' ', `getbbox -h $radscn`;
154   }
155 < print STDERR "Warning: Device extends into room\n" if ($dim[5] > 1e-5);
156 < $wrapper .= ' -f "t=' . ($dim[5] - $dim[4]) . ';w=' . ($dim[1] - $dim[0]) .
155 > die "Device entirely inside room!\n" if ($dim[4] >= 0);
156 > if ($dim[5] > 1e-5) {
157 >        print STDERR "Warning: Device extends into room\n";
158 > } elsif ($dim[5]*$dim[5] < .01*($dim[1]-$dim[0])*($dim[3]-$dim[2])) {
159 >        print STDERR "Warning: Device far behind Z==0 plane\n";
160 > }
161 > # Assume Zmax==0 to derive thickness so pkgBSDF will work
162 > $wrapper .= ' -f "t=' . (-$dim[4]) . ';w=' . ($dim[1] - $dim[0]) .
163                  ';h=' . ($dim[3] - $dim[2]) . '"';
164   # Generate octree
165   system "oconv -w $radscn > $octree";
# Line 222 | Line 228 | if ( $tensortree ) {
228          do_matrix_bsdf();
229   }
230   # Output XML
225 my $old_fh = select(STDOUT);
226 $| = 1;
227 select($old_fh);
228 print "<!-- Created by: genBSDF @savedARGV -->\n";
231   # print STDERR "Running: $wrapper\n";
232 < system $wrapper;
232 > system "$wrapper -C \"Created by: genBSDF @savedARGV\"";
233   die "Could not wrap BSDF data\n" if ( $? );
234   # Clean up temporary files and exit
235   exec $rmtmp;
# Line 464 | Line 466 | sub matrix_comp {
466          $cmd .= " $src | rcollate -ho -oc 145";
467          # print STDERR "Running: $cmd\n";
468          system "$cmd > $dest";
469 <        die "Failure running rttree_reduce" if ( $? );
469 >        die "Failure running rmtxop" if ( $? );
470          if ( "$spec" ne "$curspec" ) {
471                  $wrapper .= " -s $spec";
472                  $curspec = $spec;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines