ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rtpict.pl
(Generate patch)

Comparing ray/src/util/rtpict.pl (file contents):
Revision 2.1 by greg, Mon Mar 19 23:40:33 2018 UTC vs.
Revision 2.7 by greg, Fri Jul 5 00:20:57 2019 UTC

# Line 17 | Line 17 | my %rtraceC = ("-dt",1, "-dc",1, "-dj",1, "-ds",1, "-d
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");
26 > my @rtraceA = split(' ', "rtrace -u- -dt .05 -dc .5 -ds .25 -dr 1 " .
27 >                                "-aa .2 -ar 64 -ad 512 -as 128 -lr 7 -lw 1e-03");
28   my @vwraysA = ("vwrays", "-ff", "-pj", ".67");
29   my @vwrightA = ("vwright", "-vtv");
30   my @rpictA = ("rpict");
31   my $outpic;
32 + my $outzbf;
33   OPTION:                         # sort through options
34   while ($#ARGV >= 0 && "$ARGV[0]" =~ /^[-\@]/) {
35          # Check for file inclusion
36          if ("$ARGV[0]" =~ /^\@/) {
37 <                open my $handle, '<', substr("$ARGV[0]", 1);
37 >                open my $handle, '<', substr($ARGV[0], 1);
38                  shift @ARGV;
39                  chomp(my @args = <$handle>);
40                  close $handle;
# Line 39 | Line 43 | while ($#ARGV >= 0 && "$ARGV[0]" =~ /^[-\@]/) {
43          }
44          # Check booleans
45          for my $boopt (@boolO) {
46 <                if ("$ARGV[0]" =~ /"^" . $boopt . "[-+01tfynTFYN]$"/) {
47 <                        push @rtraceA, "$ARGV[0]";
46 >                if ("$ARGV[0]" =~ ('^' . $boopt . '[-+01tfynTFYN]?$')) {
47 >                        push @rtraceA, $ARGV[0];
48                          push @rpictA, shift(@ARGV);
49                          next OPTION;
50                  }
51          }
52          # Check view options
53          if (defined $vwraysC{$ARGV[0]}) {
54 <                push @vwraysA, "$ARGV[0]";
54 >                push @vwraysA, $ARGV[0];
55                  my $isvopt = ("$ARGV[0]" =~ /^-v/);
56 <                push(@vwrightA, "$ARGV[0]") if ($isvopt);
56 >                push(@vwrightA, $ARGV[0]) if ($isvopt);
57                  push @rpictA, shift(@ARGV);
58 <                for (my $i = $vwraysC{$vwraysA[-1]}; $i-- > 0; ) {
59 <                        push @vwraysA, "$ARGV[0]";
60 <                        push(@vwrightA, "$ARGV[0]") if ($isvopt);
58 >                for (my $i = $vwraysC{$rpictA[-1]}; $i-- > 0; ) {
59 >                        push @vwraysA, $ARGV[0];
60 >                        push(@vwrightA, $ARGV[0]) if ($isvopt);
61                          push @rpictA, shift(@ARGV);
62                  }
63                  next OPTION;
64          }
65          # Check rtrace options
66          if (defined $rtraceC{$ARGV[0]}) {
67 <                push @rtraceA, "$ARGV[0]";
67 >                push @rtraceA, $ARGV[0];
68                  push @rpictA, shift(@ARGV);
69 <                for (my $i = $rtraceC{$rtraceA[-1]}; $i-- > 0; ) {
70 <                        push @rtraceA, "$ARGV[0]";
69 >                for (my $i = $rtraceC{$rpictA[-1]}; $i-- > 0; ) {
70 >                        push @rtraceA, $ARGV[0];
71                          push @rpictA, shift(@ARGV);
72                  }
73                  next OPTION;
74          }
75 <        # Check for pixel sampling option
76 <        if ("$ARGV[0]" eq "-ps") {
77 <                shift @ARGV;
78 <                die "We only support -ps 1\n" if (shift(@ARGV) > 1);
75 >        # Check options to ignore
76 >        if (defined $ignoreC{$ARGV[0]}) {
77 >                push @rpictA, shift(@ARGV);
78 >                for (my $i = $ignoreC{$rpictA[-1]}; $i-- > 0; ) {
79 >                        push @rpictA, shift(@ARGV);
80 >                }
81                  next OPTION;
82          }
83          # Check for output file or number of processes
84          if ("$ARGV[0]" eq "-o") {
85                  shift @ARGV;
86                  $outpic = shift(@ARGV);
87 +        } elsif ("$ARGV[0]" eq "-z") {
88 +                push @rpictA, shift(@ARGV);
89 +                $outzbf = $ARGV[0];
90 +                push @rpictA, shift(@ARGV);
91          } elsif ("$ARGV[0]" eq "-n") {
92                  shift @ARGV;
93                  $nprocs = shift(@ARGV);
94          } else {
95 <                die "Unsupported option: " . "$ARGV[0]" . "\n";
95 >                die "Unsupported option: " . $ARGV[0] . "\n";
96          }
97   }
98   die "Number of processes must be positive" if ($nprocs <= 0);
99 < if ($outpic) {                  # redirect output?
99 > if (defined $outpic) {          # redirect output?
100 >        die "File '$outpic' already exists\n" if (-e $outpic);
101          open STDOUT, '>', "$outpic";
102   }
103   if ($nprocs == 1) {             # may as well run rpict?
104 <        push(@rpictA, "$ARGV[0]") if ($#ARGV == 0);
104 >        push(@rpictA, $ARGV[0]) if ($#ARGV == 0);
105          exec @rpictA ;
106   }
96 die "Need single octree argument\n" if ($#ARGV != 0);
97 push @rtraceA, (`@vwraysA -d`);
98 chomp $rtraceA[-1];
107   push @rtraceA, ("-n", "$nprocs");
108 < push @rtraceA, "$ARGV[0]";
109 < my @view = (`@vwrightA 0`);
110 < exec "@vwraysA | @rtraceA | getinfo -a 'VIEW=@view'";
108 > die "Need single octree argument\n" if ($#ARGV != 0);
109 > my $oct = $ARGV[0];
110 > my $view = `@vwrightA 0`;
111 > my @res = split(/\s/, `@vwraysA -d`);
112 > if (defined $outzbf) {          # generating depth buffer?
113 >        exec "@vwraysA | @rtraceA -fff -olv @res $oct | " .
114 >                "rsplit -ih -iH -f " .
115 >                        "-of $outzbf " .
116 >                        "-oh -oH -of3 '!pvalue -r -df' | " .
117 >                "getinfo -a 'VIEW=$view'";
118 > }
119 >                                # no depth buffer, so simpler
120 > exec "@vwraysA | @rtraceA -ffc @res $oct | getinfo -a 'VIEW=$view'";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines