68 |
|
extern void tranotify(OBJECT obj); |
69 |
|
static void tabin(RAY *r); |
70 |
|
static RayReportCall ourtrace; |
71 |
– |
static RayReportCall printvals; |
71 |
|
|
72 |
< |
static void putscolor(COLORV *scol); |
72 |
> |
RayReportCall printvals; /* print selected ray values */ |
73 |
|
|
74 |
+ |
void putscolor(COLORV *scol, double sf = 1.); /* convert/print spectral color */ |
75 |
+ |
|
76 |
|
static oputf_t *ray_out[32], *every_out[32]; |
76 |
– |
static putf_t *putreal; |
77 |
|
|
78 |
+ |
putf_t *putreal; /* put out real vector */ |
79 |
+ |
|
80 |
|
void |
81 |
|
quit( /* quit program */ |
82 |
|
int code |
85 |
|
if (ray_pnprocs < 0) |
86 |
|
_exit(code); /* avoid flush in child */ |
87 |
|
|
88 |
< |
int ec = myRTmanager.Cleanup(); |
88 |
> |
if (ray_pnprocs > 1) |
89 |
> |
myRTmanager.SetThreadCount(1); |
90 |
|
|
88 |
– |
if (ec) code = ec; |
89 |
– |
|
91 |
|
exit(code); |
92 |
|
} |
93 |
|
|
237 |
|
pending |= (n > 1); // time to flush output? |
238 |
|
bool atZero = IsZeroVec(ivbuf[2*n-1]); |
239 |
|
if (pending & (atZero | (n == flushIntvl))) { |
240 |
< |
if (!myRTmanager.FlushQueue()) |
240 |
> |
if (myRTmanager.FlushQueue() <= 0) |
241 |
|
error(USER, "ray flush error"); |
242 |
|
fflush(stdout); |
243 |
|
pending = false; |
251 |
|
if (vcount) |
252 |
|
error(WARNING, feof(inpfp) ? "unexpected EOF on input" : |
253 |
|
"input read error"); |
254 |
< |
if (fflush(stdout) < 0) |
255 |
< |
error(SYSTEM, "write error"); |
254 |
> |
if (myRTmanager.FlushQueue() < 0 || fflush(stdout) < 0) |
255 |
> |
error(SYSTEM, "final flush error"); |
256 |
|
if (fname != NULL) { |
257 |
|
fclose(inpfp); |
258 |
|
inpfp = NULL; |
412 |
|
return(ncomp); |
413 |
|
} |
414 |
|
|
415 |
< |
static int |
415 |
> |
int |
416 |
|
printvals( /* print requested ray values */ |
417 |
|
RAY *r, void *cd |
418 |
|
) |
510 |
|
RAY *r |
511 |
|
) |
512 |
|
{ |
513 |
< |
putscolor(r->mcol); |
513 |
> |
putscolor(r->mcol, out_scalefactor); |
514 |
|
} |
515 |
|
|
516 |
|
static void |
531 |
|
copyscolor(cdiff, r->rcol); |
532 |
|
sopscolor(cdiff, -=, r->mcol); |
533 |
|
|
534 |
< |
putscolor(cdiff); |
534 |
> |
putscolor(cdiff, out_scalefactor); |
535 |
|
} |
536 |
|
|
537 |
|
static void |
547 |
|
RAY *r |
548 |
|
) |
549 |
|
{ |
550 |
< |
putscolor(r->rcol); |
550 |
> |
putscolor(r->rcol, out_scalefactor); |
551 |
|
} |
552 |
|
|
553 |
|
static void |
559 |
|
|
560 |
|
raycontrib(contr, r, PRIMARY); |
561 |
|
smultscolor(contr, r->rcol); |
562 |
< |
putscolor(contr); |
562 |
> |
putscolor(contr, out_scalefactor); |
563 |
|
} |
564 |
|
|
565 |
|
static void |
767 |
|
putbinary(cout, sizeof(cout), 1, stdout); |
768 |
|
} |
769 |
|
|
770 |
< |
static void |
771 |
< |
putscolor(COLORV *scol) /* output (spectral) color */ |
770 |
> |
void |
771 |
> |
putscolor(COLORV *scol, double sf) /* output (spectral) color */ |
772 |
|
{ |
773 |
|
static COLORMAT xyz2myrgbmat; |
774 |
|
SCOLOR my_scol; |
775 |
|
COLOR col; |
776 |
|
/* single channel output? */ |
777 |
|
if (sens_curve != NULL) { |
778 |
< |
RREAL v = (*sens_curve)(scol) * out_scalefactor; |
778 |
> |
RREAL v = (*sens_curve)(scol) * sf; |
779 |
|
(*putreal)(&v, 1); |
780 |
|
return; |
781 |
|
} |
782 |
< |
if (out_scalefactor != 1.) { /* apply scalefactor if any */ |
782 |
> |
if (sf != 1.) { /* apply scalefactor if any */ |
783 |
|
copyscolor(my_scol, scol); |
784 |
< |
scalescolor(my_scol, out_scalefactor); |
784 |
> |
scalescolor(my_scol, sf); |
785 |
|
scol = my_scol; |
786 |
|
} |
787 |
|
if (out_prims == NULL) { /* full spectral reporting */ |