| 6 |
|
# G. Ward |
| 7 |
|
# |
| 8 |
|
use strict; |
| 9 |
+ |
use File::Temp qw/ :mktemp /; |
| 10 |
|
sub userror { |
| 11 |
< |
print STDERR "Usage: genBSDF [-n Nproc][-c Nsamp][-dim xmin xmax ymin ymax zmin zmax][{+|-}f][{+|-}b][{+|-}mgf][{+|-}geom] [input ..]\n"; |
| 11 |
> |
print STDERR "Usage: genBSDF [-n Nproc][-c Nsamp][-r \"ropts\"][-dim xmin xmax ymin ymax zmin zmax][{+|-}f][{+|-}b][{+|-}mgf][{+|-}geom] [input ..]\n"; |
| 12 |
|
exit 1; |
| 13 |
|
} |
| 14 |
< |
my $td = `mktemp -d /tmp/genBSDF.XXXXXX`; |
| 14 |
> |
my $td = mkdtemp("/tmp/genBSDF.XXXXXX"); |
| 15 |
|
chomp $td; |
| 16 |
|
my $nsamp = 1000; |
| 17 |
|
my $rtargs = "-w -ab 5 -ad 700 -lw 3e-6"; |
| 62 |
|
die "Could not load MGF input\n" if ( $? ); |
| 63 |
|
system "mgf2rad $mgfscn > $radscn"; |
| 64 |
|
} else { |
| 65 |
< |
system "cat @ARGV | xform -e > $radscn"; |
| 65 |
> |
system "xform -e @ARGV > $radscn"; |
| 66 |
|
die "Could not load Radiance input\n" if ( $? ); |
| 67 |
|
system "rad2mgf $radscn > $mgfscn" if ( $geout ); |
| 68 |
|
} |
| 193 |
|
if ( $geout ) { |
| 194 |
|
print "\t\t\t<Geometry format=\"MGF\" unit=\"Meter\">\n"; |
| 195 |
|
printf "xf -t %.6f %.6f 0\n", -($dim[0]+$dim[1])/2, -($dim[2]+$dim[3])/2; |
| 196 |
< |
system "cat $mgfscn"; |
| 196 |
> |
open(MGFSCN, "< $mgfscn"); |
| 197 |
> |
while (<MGFSCN>) { print $_; } |
| 198 |
> |
close MGFSCN; |
| 199 |
|
print "xf\n"; |
| 200 |
|
print "\t\t\t</Geometry>\n"; |
| 201 |
|
} |