52 |
|
#endif |
53 |
|
OBJECT traset[MAXTSET+1]={0}; /* trace include/exclude set */ |
54 |
|
|
55 |
+ |
static int Tflag = 0; /* source tracing enabled? */ |
56 |
+ |
|
57 |
|
static RAY thisray; /* for our convenience */ |
58 |
|
|
59 |
|
static FILE *inpfp = NULL; /* input stream pointer */ |
121 |
|
} |
122 |
|
|
123 |
|
|
124 |
+ |
static void |
125 |
+ |
trace_sources(void) /* trace rays to light sources, also */ |
126 |
+ |
{ |
127 |
+ |
int sn; |
128 |
+ |
|
129 |
+ |
for (sn = 0; sn < nsources; sn++) |
130 |
+ |
source[sn].sflags |= SFOLLOW; |
131 |
+ |
} |
132 |
+ |
|
133 |
+ |
|
134 |
|
void |
135 |
|
rtrace( /* trace rays from file */ |
136 |
|
char *fname, |
160 |
|
/* set up output */ |
161 |
|
if (castonly || every_out[0] != NULL) |
162 |
|
nproc = 1; /* don't bother multiprocessing */ |
163 |
+ |
if (Tflag && every_out[0] != NULL) |
164 |
+ |
trace_sources(); /* asking to trace light sources */ |
165 |
|
if ((nextflush > 0) & (nproc > nextflush)) { |
166 |
|
error(WARNING, "reducing number of processes to match flush interval"); |
167 |
|
nproc = nextflush; |
168 |
|
} |
155 |
– |
switch (outform) { |
156 |
– |
case 'a': putreal = puta; break; |
157 |
– |
case 'f': putreal = putf; break; |
158 |
– |
case 'd': putreal = putd; break; |
159 |
– |
case 'c': |
160 |
– |
if (outvals[1] || !strchr("vrx", outvals[0])) |
161 |
– |
error(USER, "color format only with -ov, -or, -ox"); |
162 |
– |
putreal = putrgbe; break; |
163 |
– |
default: |
164 |
– |
error(CONSISTENCY, "botched output format"); |
165 |
– |
} |
169 |
|
if (nproc > 1) { /* start multiprocessing */ |
170 |
|
ray_popen(nproc); |
171 |
|
ray_fifo_out = printvals; |
220 |
|
} |
221 |
|
|
222 |
|
|
220 |
– |
static void |
221 |
– |
trace_sources(void) /* trace rays to light sources, also */ |
222 |
– |
{ |
223 |
– |
int sn; |
224 |
– |
|
225 |
– |
for (sn = 0; sn < nsources; sn++) |
226 |
– |
source[sn].sflags |= SFOLLOW; |
227 |
– |
} |
228 |
– |
|
229 |
– |
|
223 |
|
int |
224 |
|
setrtoutput(void) /* set up output tables, return #comp */ |
225 |
|
{ |
230 |
|
if (!*vs) |
231 |
|
error(USER, "empty output specification"); |
232 |
|
|
233 |
+ |
switch (outform) { /* make sure (*putreal)() calls someone! */ |
234 |
+ |
case 'a': putreal = puta; break; |
235 |
+ |
case 'f': putreal = putf; break; |
236 |
+ |
case 'd': putreal = putd; break; |
237 |
+ |
case 'c': |
238 |
+ |
if (outvals[1] || !strchr("vrx", outvals[0])) |
239 |
+ |
error(USER, "color format only with -ov, -or, -ox"); |
240 |
+ |
putreal = putrgbe; break; |
241 |
+ |
default: |
242 |
+ |
error(CONSISTENCY, "botched output format"); |
243 |
+ |
} |
244 |
|
castonly = 1; /* sets castonly as side-effect */ |
245 |
|
do |
246 |
|
switch (*vs) { |
247 |
|
case 'T': /* trace sources */ |
248 |
< |
if (!vs[1]) break; |
245 |
< |
trace_sources(); |
248 |
> |
Tflag++; |
249 |
|
/* fall through */ |
250 |
|
case 't': /* trace */ |
251 |
|
if (!vs[1]) break; |