| 17 | 
  | 
# boolean rtrace options | 
| 18 | 
  | 
my @boolO = ("-w", "-bv", "-dv", "-i", "-u"); | 
| 19 | 
  | 
# view options and the associated number of arguments | 
| 20 | 
< | 
my %vwraysC = ("-vtv",0, "-vtl",0, "-vth",0, "-vta",0, "-vts",0, "-vtc",0, | 
| 20 | 
> | 
my %vwraysC = ("-vf",1, "-vtv",0, "-vtl",0, "-vth",0, "-vta",0, "-vts",0, "-vtc",0, | 
| 21 | 
  | 
                "-x",1, "-y",1, "-vp",3, "-vd",3, "-vu",3, "-vh",1, "-vv",1, | 
| 22 | 
< | 
                "-vo",1, "-va",1, "-vs",1, "-vl",1, "-pa",1, "-pj",1); | 
| 22 | 
> | 
                "-vo",1, "-va",1, "-vs",1, "-vl",1, "-pa",1, "-pj",1, "-pd",1); | 
| 23 | 
> | 
# options we need to silently ignore | 
| 24 | 
> | 
my %ignoreC = ("-t",1, "-ps",1, "-pt",1, "-pm",1); | 
| 25 | 
  | 
# Starting options for rtrace (rpict values) | 
| 26 | 
  | 
my @rtraceA = split(' ', "rtrace -ffc -u- -dt .05 -dc .5 -ds .25 -dr 1 -aa .2 -ar 64 -ad 512 -as 128 -lr 7 -lw 1e-03"); | 
| 27 | 
  | 
my @vwraysA = ("vwrays", "-ff", "-pj", ".67"); | 
| 32 | 
  | 
while ($#ARGV >= 0 && "$ARGV[0]" =~ /^[-\@]/) { | 
| 33 | 
  | 
        # Check for file inclusion | 
| 34 | 
  | 
        if ("$ARGV[0]" =~ /^\@/) { | 
| 35 | 
< | 
                open my $handle, '<', substr("$ARGV[0]", 1); | 
| 35 | 
> | 
                open my $handle, '<', substr($ARGV[0], 1); | 
| 36 | 
  | 
                shift @ARGV; | 
| 37 | 
  | 
                chomp(my @args = <$handle>); | 
| 38 | 
  | 
                close $handle; | 
| 41 | 
  | 
        } | 
| 42 | 
  | 
        # Check booleans | 
| 43 | 
  | 
        for my $boopt (@boolO) { | 
| 44 | 
< | 
                if ("$ARGV[0]" =~ /"^" . $boopt . "[-+01tfynTFYN]$"/) { | 
| 45 | 
< | 
                        push @rtraceA, "$ARGV[0]"; | 
| 44 | 
> | 
                if ("$ARGV[0]" =~ ('^' . $boopt . '[-+01tfynTFYN]$')) { | 
| 45 | 
> | 
                        push @rtraceA, $ARGV[0]; | 
| 46 | 
  | 
                        push @rpictA, shift(@ARGV); | 
| 47 | 
  | 
                        next OPTION; | 
| 48 | 
  | 
                } | 
| 49 | 
  | 
        } | 
| 50 | 
  | 
        # Check view options | 
| 51 | 
  | 
        if (defined $vwraysC{$ARGV[0]}) { | 
| 52 | 
< | 
                push @vwraysA, "$ARGV[0]"; | 
| 52 | 
> | 
                push @vwraysA, $ARGV[0]; | 
| 53 | 
  | 
                my $isvopt = ("$ARGV[0]" =~ /^-v/); | 
| 54 | 
< | 
                push(@vwrightA, "$ARGV[0]") if ($isvopt); | 
| 54 | 
> | 
                push(@vwrightA, $ARGV[0]) if ($isvopt); | 
| 55 | 
  | 
                push @rpictA, shift(@ARGV); | 
| 56 | 
< | 
                for (my $i = $vwraysC{$vwraysA[-1]}; $i-- > 0; ) { | 
| 57 | 
< | 
                        push @vwraysA, "$ARGV[0]"; | 
| 58 | 
< | 
                        push(@vwrightA, "$ARGV[0]") if ($isvopt); | 
| 56 | 
> | 
                for (my $i = $vwraysC{$rpictA[-1]}; $i-- > 0; ) { | 
| 57 | 
> | 
                        push @vwraysA, $ARGV[0]; | 
| 58 | 
> | 
                        push(@vwrightA, $ARGV[0]) if ($isvopt); | 
| 59 | 
  | 
                        push @rpictA, shift(@ARGV); | 
| 60 | 
  | 
                } | 
| 61 | 
  | 
                next OPTION; | 
| 62 | 
  | 
        } | 
| 63 | 
  | 
        # Check rtrace options | 
| 64 | 
  | 
        if (defined $rtraceC{$ARGV[0]}) { | 
| 65 | 
< | 
                push @rtraceA, "$ARGV[0]"; | 
| 65 | 
> | 
                push @rtraceA, $ARGV[0]; | 
| 66 | 
  | 
                push @rpictA, shift(@ARGV); | 
| 67 | 
< | 
                for (my $i = $rtraceC{$rtraceA[-1]}; $i-- > 0; ) { | 
| 68 | 
< | 
                        push @rtraceA, "$ARGV[0]"; | 
| 67 | 
> | 
                for (my $i = $rtraceC{$rpictA[-1]}; $i-- > 0; ) { | 
| 68 | 
> | 
                        push @rtraceA, $ARGV[0]; | 
| 69 | 
  | 
                        push @rpictA, shift(@ARGV); | 
| 70 | 
  | 
                } | 
| 71 | 
  | 
                next OPTION; | 
| 72 | 
  | 
        } | 
| 73 | 
< | 
        # Check for pixel sampling option | 
| 74 | 
< | 
        if ("$ARGV[0]" eq "-ps") { | 
| 75 | 
< | 
                shift @ARGV; | 
| 76 | 
< | 
                die "We only support -ps 1\n" if (shift(@ARGV) > 1); | 
| 73 | 
> | 
        # Check options to ignore | 
| 74 | 
> | 
        if (defined $ignoreC{$ARGV[0]}) { | 
| 75 | 
> | 
                push @rpictA, shift(@ARGV); | 
| 76 | 
> | 
                for (my $i = $ignoreC{$rpictA[-1]}; $i-- > 0; ) { | 
| 77 | 
> | 
                        push @rpictA, shift(@ARGV); | 
| 78 | 
> | 
                } | 
| 79 | 
  | 
                next OPTION; | 
| 80 | 
  | 
        } | 
| 81 | 
  | 
        # Check for output file or number of processes | 
| 86 | 
  | 
                shift @ARGV; | 
| 87 | 
  | 
                $nprocs = shift(@ARGV); | 
| 88 | 
  | 
        } else { | 
| 89 | 
< | 
                die "Unsupported option: " . "$ARGV[0]" . "\n"; | 
| 89 | 
> | 
                die "Unsupported option: " . $ARGV[0] . "\n"; | 
| 90 | 
  | 
        } | 
| 91 | 
  | 
} | 
| 92 | 
  | 
die "Number of processes must be positive" if ($nprocs <= 0); | 
| 94 | 
  | 
        open STDOUT, '>', "$outpic"; | 
| 95 | 
  | 
} | 
| 96 | 
  | 
if ($nprocs == 1) {             # may as well run rpict? | 
| 97 | 
< | 
        push(@rpictA, "$ARGV[0]") if ($#ARGV == 0); | 
| 97 | 
> | 
        push(@rpictA, $ARGV[0]) if ($#ARGV == 0); | 
| 98 | 
  | 
        exec @rpictA ; | 
| 99 | 
  | 
} | 
| 100 | 
  | 
die "Need single octree argument\n" if ($#ARGV != 0); | 
| 101 | 
  | 
push @rtraceA, (`@vwraysA -d`); | 
| 102 | 
  | 
chomp $rtraceA[-1]; | 
| 103 | 
  | 
push @rtraceA, ("-n", "$nprocs"); | 
| 104 | 
< | 
push @rtraceA, "$ARGV[0]"; | 
| 104 | 
> | 
push @rtraceA, $ARGV[0]; | 
| 105 | 
  | 
my @view = (`@vwrightA 0`); | 
| 106 | 
  | 
exec "@vwraysA | @rtraceA | getinfo -a 'VIEW=@view'"; |