--- ray/src/util/genBSDF.pl 2015/08/26 02:27:09 2.61 +++ ray/src/util/genBSDF.pl 2016/07/13 00:51:17 2.64 @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# RCSid $Id: genBSDF.pl,v 2.61 2015/08/26 02:27:09 greg Exp $ +# RCSid $Id: genBSDF.pl,v 2.64 2016/07/13 00:51:17 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"; @@ -223,7 +229,7 @@ if ( $tensortree ) { } # Output XML # print STDERR "Running: $wrapper\n"; -system "$wrapper -C 'Created by: genBSDF @savedARGV'"; +system "$wrapper -C \"Created by: genBSDF @savedARGV\""; die "Could not wrap BSDF data\n" if ( $? ); # Clean up temporary files and exit exec $rmtmp;