--- ray/src/util/genBSDF.pl 2011/05/25 19:24:11 2.15
+++ ray/src/util/genBSDF.pl 2011/06/04 00:33:53 2.20
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
-# RCSid $Id: genBSDF.pl,v 2.15 2011/05/25 19:24:11 greg Exp $
+# RCSid $Id: genBSDF.pl,v 2.20 2011/06/04 00:33:53 greg Exp $
#
# Compute BSDF based on geometry and material description
#
@@ -13,6 +13,7 @@ sub userror {
}
my $td = mkdtemp("/tmp/genBSDF.XXXXXX");
chomp $td;
+my @savedARGV = @ARGV;
my $tensortree = 0;
my $ttlog2 = 4;
my $nsamp = 1000;
@@ -98,7 +99,10 @@ die "Could not compile scene\n" if ( $? );
print
'
-System
+';
+print "\n";
+print
+'System
@@ -139,8 +143,7 @@ print
';
# Clean up temporary files and exit
-if ( $persistfile ) {
- open(PFI, "< $persistfile");
+if ( $persistfile && open(PFI, "< $persistfile") ) {
while () {
s/^[^ ]* //;
kill('ALRM', $_);
@@ -148,8 +151,8 @@ if ( $persistfile ) {
}
close PFI;
}
-system "rm -rf $td";
-exit 0;
+exec("rm -rf $td");
+
#-------------- End of main program segment --------------#
#++++++++++++++ Tensor tree BSDF generation ++++++++++++++#
@@ -204,9 +207,9 @@ out_square_x = (out_square_a + 1)/2;
out_square_y = (out_square_b + 1)/2;
';
# Announce ourselves in XML output
-print " \n";
-print " TensorTree$tensortree\n";
-print " \n";
+print "\t\n";
+print "\t\tTensorTree$tensortree\n";
+print "\t\n";
# Fork parallel rtcontrib processes to compute each side
if ( $doback ) {
for (my $proc = 0; $proc < $nproc; $proc++) {
@@ -249,7 +252,7 @@ sub bg_tree_rtcontrib {
"| rcalc -e 'r1=rand(($pn+.8681)*recno-.673892)' " .
"-e 'r2=rand(($pn-5.37138)*recno+67.1737811)' " .
"-e 'r3=rand(($pn+3.17603772)*recno+83.766771)' " .
- "-e 'Dx=1-($pbeg+\$1+r1)/$ns;Dy:0;Dz=sqrt(1-Dx*Dx)' " .
+ "-e 'Dx=1-2*($pbeg+\$1+r1)/$ns;Dy:0;Dz=sqrt(1-Dx*Dx)' " .
"-e 'xp=(\$3+r2)*(($dim[1]-$dim[0])/$nx)+$dim[0]' " .
"-e 'yp=(\$2+r3)*(($dim[3]-$dim[2])/$ny)+$dim[2]' " .
"-e 'zp=$dim[5-$forw]' -e 'myDz=Dz*($forw*2-1)' " .
@@ -316,8 +319,10 @@ print
CIE Illuminant D65 1nm.ssp
ASTM E308 1931 Y.dsp
- Reflection $side
- LBNL/Shirley-Chiu
+';
+print "\t\t\tReflection $side\n";
+print
+' LBNL/Shirley-Chiu
BRDF
';