--- ray/src/util/rtpict.pl 2019/08/14 22:18:03 2.10 +++ ray/src/util/rtpict.pl 2020/03/15 16:54:19 2.15 @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# RCSid $Id: rtpict.pl,v 2.10 2019/08/14 22:18:03 greg Exp $ +# RCSid $Id: rtpict.pl,v 2.15 2020/03/15 16:54:19 greg Exp $ # # Run rtrace in parallel mode to simulate rpict -n option # May also be used to render layered images with -o* option @@ -20,9 +20,9 @@ my @boolO = ('-w', '-bv', '-dv', '-i', '-u'); # view options and the associated number of arguments my %vwraysC = ('-vf',1, '-vtv',0, '-vtl',0, '-vth',0, '-vta',0, '-vts',0, '-vtc',0, '-x',1, '-y',1, '-vp',3, '-vd',3, '-vu',3, '-vh',1, '-vv',1, - '-vo',1, '-va',1, '-vs',1, '-vl',1, '-pa',1, '-pj',1, '-pd',1); + '-vo',1, '-va',1, '-vs',1, '-vl',1, '-pa',1, '-pj',1); # options we need to silently ignore -my %ignoreC = ('-t',1, '-ps',1, '-pt',1, '-pm',1); +my %ignoreC = ('-t',1, '-ps',1, '-pt',1, '-pm',1, '-pd',1); # Starting options for rtrace (rpict values) my @rtraceA = split(' ', 'rtrace -u- -dt .05 -dc .5 -ds .25 -dr 1 ' . '-aa .2 -ar 64 -ad 512 -as 128 -lr 7 -lw 1e-03'); @@ -40,7 +40,7 @@ OPTION: # sort through options while ($#ARGV >= 0 && "$ARGV[0]" =~ /^[-\@]/) { # Check for file inclusion if ("$ARGV[0]" =~ /^\@/) { - open my $handle, '<', substr($ARGV[0], 1); + open my $handle, '<', substr($ARGV[0], 1) or die "No file for $ARGV[0]\n"; shift @ARGV; chomp(my @args = <$handle>); close $handle; @@ -138,16 +138,14 @@ my @res = split(/\s/, `@vwraysA -d`); ##################################################################### ##### Generating picture with depth buffer? if (defined $outzbf) { - exec "@vwraysA | @rtraceA -fff -olv @res $oct | " . - "rsplit -ih -iH -f " . - "-of $outzbf " . - "-oh -oH -of3 '!pvalue -r -df' | " . - "getinfo -a 'VIEW=$view'"; + exec "@vwraysA | @rtraceA -fff -olv @res '$oct' | " . + "rsplit -ih -iH -f -of '$outzbf' -oh -oH -of3 - | " . + "pvalue -r -df | getinfo -a 'VIEW=$view'"; } ##################################################################### ##### Base case with output picture only? if (! defined $outdir) { - exec "@vwraysA | @rtraceA -ffc @res $oct | getinfo -a 'VIEW=$view'"; + exec "@vwraysA | @rtraceA -ffc @res '$oct' | getinfo -a 'VIEW=$view'"; } ##################################################################### ##### Layered image output case @@ -188,10 +186,12 @@ if (! -d $outdir) { foreach my $oval (split //, $outlyr) { die "Duplicate or unsupported type '$oval' in -o$outlyr\n" if (!defined $rtoutC{$oval}); + my $outfile = "$outdir/$rtoutC{$oval}"; + die "File '$outfile' already exists\n" if (-e $outfile); my ($otyp) = ($rtoutC{$oval} =~ /(\.[^.]+)$/); push @rsplitA, $rcodeC{$otyp}[0]; - push @rsplitA, qq{'$rcodeC{$otyp}[1] > "$outdir/$rtoutC{$oval}"'}; + push @rsplitA, qq{'$rcodeC{$otyp}[1] > "$outfile"'}; delete $rtoutC{$oval}; } # call rtrace + rsplit -exec "@vwraysA | @rtraceA -fff @res $oct | getinfo -a 'VIEW=$view' | @rsplitA"; +exec "@vwraysA | @rtraceA -fff @res '$oct' | getinfo -a 'VIEW=$view' | @rsplitA";