13 |
|
my $ambf = "$td/af$$.amb"; |
14 |
|
my $raddev = "x11"; # default output device. Overwrite with -o |
15 |
|
my $qual = "Low"; |
16 |
< |
my $vw = "def"; |
16 |
> |
my $usetrad = 0; |
17 |
|
|
18 |
|
my $opts = ""; # Options common to rad |
19 |
|
my $rendopts = "-w-"; # For render= line in rif file |
24 |
|
$opts .= " $_"; |
25 |
|
} elsif (m/^-v\b/) { # standard view |
26 |
|
# Let rad do any error handling... |
27 |
< |
$vw = $ARGV[1]; |
27 |
> |
$opts .= qq( -v "$ARGV[1]"); |
28 |
|
shift @ARGV; |
29 |
|
} elsif (m/^-[nN]\b/) { # No. of parallel processes |
30 |
|
$opts .= ' -N ' . $ARGV[1]; |
38 |
|
} elsif ((m/^-V\b/) or (m/^-e\b/)) { # print view, explicate variables |
39 |
|
# Think of those two as '-verbose'. |
40 |
|
$opts .= " $_"; |
41 |
+ |
} elsif (m/^-t\b/) { # start trad instead of rad |
42 |
+ |
$usetrad = 1; |
43 |
|
} elsif (m/^-\w/) { |
44 |
|
die("bsdfview: Bad option: $_\n"); |
45 |
|
} else { |
50 |
|
|
51 |
|
# We need at least one XML or SIR file |
52 |
|
if ($#ARGV < 0) { |
53 |
< |
die("Missing input XML or SIR file(s)\n"); |
53 |
> |
die("bsdfview: missing input XML or SIR file(s)\n"); |
54 |
|
} |
55 |
|
|
56 |
+ |
if (length($opts) and $usetrad) { |
57 |
+ |
die("bsdfview: rad options not supported when calling trad (-t)\n"); |
58 |
+ |
} |
59 |
+ |
|
60 |
|
my @objects = @ARGV; |
61 |
|
|
62 |
|
# Make this work under Windoze |
78 |
|
|
79 |
|
if (-e $rif) { # RIF already exists? |
80 |
|
print "Attempting to run with existing rad input file '$rif'\n"; |
81 |
< |
system "rad -o $raddev -w -v $vw $opts $rif QUA=$qual"; |
81 |
> |
if ($usetrad) { |
82 |
> |
system "trad $rif"; |
83 |
> |
} else { |
84 |
> |
system "rad -o $raddev -w $opts $rif QUA=$qual"; |
85 |
> |
} |
86 |
|
die("\nTry removing '$rif' and starting again\n\n") if $?; |
87 |
|
exit; |
88 |
|
} |
117 |
|
EndOfRif |
118 |
|
close(FH); |
119 |
|
|
120 |
< |
system "rad -o $raddev -v $vw $opts $rif"; |
121 |
< |
|
120 |
> |
if ($usetrad) { |
121 |
> |
system "trad $rif"; |
122 |
> |
} else { |
123 |
> |
system "rad -o $raddev $opts $rif"; |
124 |
> |
} |
125 |
|
#EOF |