--- ray/src/rt/rxtmain.cpp 2024/04/30 23:16:23 2.3 +++ ray/src/rt/rxtmain.cpp 2024/08/14 20:05:23 2.7 @@ -1,8 +1,8 @@ #ifndef lint -static const char RCSid[] = "$Id: rxtmain.cpp,v 2.3 2024/04/30 23:16:23 greg Exp $"; +static const char RCSid[] = "$Id: rxtmain.cpp,v 2.7 2024/08/14 20:05:23 greg Exp $"; #endif /* - * rxtmain.c - main for per-ray calculation program + * rxtmain.cpp - main for per-ray calculation program */ #include "copyright.h" @@ -43,7 +43,7 @@ extern void tranotify(OBJECT obj); char *tralist[MAXMODLIST]; /* list of modifers to trace (or no) */ int traincl = -1; /* include == 1, exclude == 0 */ -double (*sens_curve)(SCOLOR scol) = NULL; /* spectral conversion for 1-channel */ +double (*sens_curve)(const SCOLOR scol) = NULL; /* spectral conversion for 1-channel */ double out_scalefactor = 1; /* output calibration scale factor */ RGBPRIMP out_prims = stdprims; /* output color primitives (NULL if spectral) */ static RGBPRIMS our_prims; /* private output color primitives */ @@ -299,6 +299,15 @@ main(int argc, char *argv[]) goto badopt; } } + /* set/check spectral sampling */ + rval = setspectrsamp(CNDX, WLPART); + if (rval < 0) + error(USER, "unsupported spectral sampling"); + if (out_prims != NULL) { + if (!rval) + error(WARNING, "spectral range incompatible with color output"); + } else if (NCSAMP == 3) + out_prims = stdprims; /* 3 samples do not a spectrum make */ /* set up signal handling */ sigdie(SIGINT, "Interrupt"); #ifdef SIGHUP @@ -342,11 +351,8 @@ main(int argc, char *argv[]) if (outform != 'a') SET_FILE_BINARY(stdout); if (doheader) { /* print header? */ - static char fmt[] = OCTFMT; - FILE * octfp = fopen(argv[i], "rb"); - if (checkheader(octfp, fmt, stdout) < 0) - error(USER, "bad octree header"); - fclose(octfp); + newheader("RADIANCE", stdout); + fputs(myRTmanager.GetHeader(), stdout); printargs(i, argv, stdout); printf("SOFTWARE= %s\n", VersionID); fputnow(stdout); @@ -355,7 +361,7 @@ main(int argc, char *argv[]) if ((outform == 'f') | (outform == 'd')) fputendian(stdout); fputformat(formstr(outform), stdout); - putchar('\n'); + fputc('\n', stdout); /* end of header */ } rtrace(NULL, nproc); /* trace rays */ quit(0); /* clean up & exit */