--- ray/src/util/genBSDF.pl 2015/05/29 07:22:33 2.58 +++ ray/src/util/genBSDF.pl 2016/08/18 15:09:29 2.65 @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# RCSid $Id: genBSDF.pl,v 2.58 2015/05/29 07:22:33 greg Exp $ +# RCSid $Id: genBSDF.pl,v 2.65 2016/08/18 15:09:29 greg Exp $ # # Compute BSDF based on geometry and material description # @@ -39,7 +39,7 @@ if ($windoz) { $tbz = "$td\\tbz.dat"; $rbz = "$td\\rbz.dat"; chomp $td; - $rmtmp = "rmdir /S /Q $td"; + $rmtmp = "rd /S /Q $td"; } else { $td = mkdtemp("/tmp/genBSDF.XXXXXX"); chomp $td; @@ -152,8 +152,14 @@ if ( $mgfin ) { if ($#dim != 5) { @dim = split ' ', `getbbox -h $radscn`; } -print STDERR "Warning: Device extends into room\n" if ($dim[5] > 1e-5); -$wrapper .= ' -f "t=' . ($dim[5] - $dim[4]) . ';w=' . ($dim[1] - $dim[0]) . +die "Device entirely inside room!\n" if ($dim[4] >= 0); +if ($dim[5] > 1e-5) { + print STDERR "Warning: Device extends into room\n"; +} elsif ($dim[5]*$dim[5] > .01*($dim[1]-$dim[0])*($dim[3]-$dim[2])) { + print STDERR "Warning: Device far behind Z==0 plane\n"; +} +# Assume Zmax==0 to derive thickness so pkgBSDF will work +$wrapper .= ' -f "t=' . (-$dim[4]) . ';w=' . ($dim[1] - $dim[0]) . ';h=' . ($dim[3] - $dim[2]) . '"'; # Generate octree system "oconv -w $radscn > $octree"; @@ -222,13 +228,8 @@ if ( $tensortree ) { do_matrix_bsdf(); } # Output XML -my $old_fh = select(STDOUT); -$| = 1; -select($old_fh); -print "\n"; -print "\n"; # print STDERR "Running: $wrapper\n"; -system $wrapper; +system "$wrapper -C \"Created by: genBSDF @savedARGV\""; die "Could not wrap BSDF data\n" if ( $? ); # Clean up temporary files and exit exec $rmtmp; @@ -465,7 +466,7 @@ sub matrix_comp { $cmd .= " $src | rcollate -ho -oc 145"; # print STDERR "Running: $cmd\n"; system "$cmd > $dest"; - die "Failure running rttree_reduce" if ( $? ); + die "Failure running rmtxop" if ( $? ); if ( "$spec" ne "$curspec" ) { $wrapper .= " -s $spec"; $curspec = $spec;