55 |
|
static RAY thisray; /* for our convenience */ |
56 |
|
|
57 |
|
typedef void putf_t(RREAL *v, int n); |
58 |
< |
static putf_t puta, putd, putf; |
58 |
> |
static putf_t puta, putd, putf, putrgbe; |
59 |
|
|
60 |
|
typedef void oputf_t(RAY *r); |
61 |
|
static oputf_t oputo, oputd, oputv, oputV, oputl, oputL, oputc, oputp, |
146 |
|
case 'f': putreal = putf; break; |
147 |
|
case 'd': putreal = putd; break; |
148 |
|
case 'c': |
149 |
< |
if (strcmp(outvals, "v")) |
150 |
< |
error(USER, "color format with value output only"); |
151 |
< |
break; |
149 |
> |
if (outvals[0] && (outvals[1] || !strchr("vrx", outvals[0]))) |
150 |
> |
error(USER, "color format only with -ov, -or, -ox"); |
151 |
> |
putreal = putrgbe; break; |
152 |
|
default: |
153 |
|
error(CONSISTENCY, "botched output format"); |
154 |
|
} |
301 |
|
case 'W': /* coefficient */ |
302 |
|
*table++ = oputW; |
303 |
|
castonly = 0; |
304 |
< |
if (ambounce > 0 && (ambacc > FTINY || ambssamp > 0)) |
304 |
> |
if (ambounce > 0 && (ambacc > FTINY) | (ambssamp > 0)) |
305 |
|
error(WARNING, |
306 |
|
"-otW accuracy depends on -aa 0 -as 0"); |
307 |
|
break; |
316 |
|
break; |
317 |
|
} |
318 |
|
*table = NULL; |
319 |
+ |
/* compatibility */ |
320 |
+ |
for (table = ray_out; *table != NULL; table++) { |
321 |
+ |
if ((*table == oputV) | (*table == oputW)) |
322 |
+ |
error(WARNING, "-oVW options require trace mode"); |
323 |
+ |
if ((do_irrad | imm_irrad) && |
324 |
+ |
(*table == oputr) | (*table == oputR) | |
325 |
+ |
(*table == oputx) | (*table == oputX)) |
326 |
+ |
error(WARNING, "-orRxX options incompatible with -I+ and -i+"); |
327 |
+ |
} |
328 |
|
} |
329 |
|
|
330 |
|
|
595 |
|
{ |
596 |
|
RREAL cval[3]; |
597 |
|
|
589 |
– |
if (outform == 'c') { |
590 |
– |
COLR cout; |
591 |
– |
setcolr(cout, colval(r->rcol,RED), |
592 |
– |
colval(r->rcol,GRN), |
593 |
– |
colval(r->rcol,BLU)); |
594 |
– |
putbinary(cout, sizeof(cout), 1, stdout); |
595 |
– |
return; |
596 |
– |
} |
598 |
|
cval[0] = colval(r->rcol,RED); |
599 |
|
cval[1] = colval(r->rcol,GRN); |
600 |
|
cval[2] = colval(r->rcol,BLU); |
785 |
|
|
786 |
|
|
787 |
|
static void |
788 |
< |
putd(RREAL *v, int n) /* print binary double(s) */ |
788 |
> |
putd(RREAL *v, int n) /* output binary double(s) */ |
789 |
|
{ |
790 |
|
#ifdef SMLFLT |
791 |
|
double da[3]; |
803 |
|
|
804 |
|
|
805 |
|
static void |
806 |
< |
putf(RREAL *v, int n) /* print binary float(s) */ |
806 |
> |
putf(RREAL *v, int n) /* output binary float(s) */ |
807 |
|
{ |
808 |
|
#ifndef SMLFLT |
809 |
|
float fa[3]; |
817 |
|
#else |
818 |
|
putbinary(v, sizeof(RREAL), n, stdout); |
819 |
|
#endif |
820 |
+ |
} |
821 |
+ |
|
822 |
+ |
|
823 |
+ |
static void |
824 |
+ |
putrgbe(RREAL *v, int n) /* output RGBE color */ |
825 |
+ |
{ |
826 |
+ |
COLR cout; |
827 |
+ |
|
828 |
+ |
if (n != 3) |
829 |
+ |
error(INTERNAL, "putrgbe() not called with 3 components"); |
830 |
+ |
setcolr(cout, v[0], v[1], v[2]); |
831 |
+ |
putbinary(cout, sizeof(cout), 1, stdout); |
832 |
|
} |