2 |
|
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
4 |
|
/* |
5 |
< |
* rxtmain.c - main for per-ray calculation program |
5 |
> |
* rxtmain.cpp - main for per-ray calculation program |
6 |
|
*/ |
7 |
|
|
8 |
|
#include "copyright.h" |
12 |
|
#include "rtprocess.h" /* getpid() */ |
13 |
|
#include "platform.h" |
14 |
|
#include "RtraceSimulManager.h" |
15 |
+ |
#include "func.h" |
16 |
|
|
17 |
|
extern char *progname; /* global argv[0] */ |
18 |
|
|
44 |
|
char *tralist[MAXMODLIST]; /* list of modifers to trace (or no) */ |
45 |
|
int traincl = -1; /* include == 1, exclude == 0 */ |
46 |
|
|
47 |
< |
double (*sens_curve)(SCOLOR scol) = NULL; /* spectral conversion for 1-channel */ |
47 |
> |
double (*sens_curve)(const SCOLOR scol) = NULL; /* spectral conversion for 1-channel */ |
48 |
|
double out_scalefactor = 1; /* output calibration scale factor */ |
49 |
|
RGBPRIMP out_prims = stdprims; /* output color primitives (NULL if spectral) */ |
50 |
|
static RGBPRIMS our_prims; /* private output color primitives */ |
53 |
|
static void sigdie(int signo, const char *msg); |
54 |
|
static void printdefaults(void); |
55 |
|
|
56 |
< |
#define RXTRACE_FEATURES "IrradianceCalc\nIrradianceCalc\nDistanceLimiting\n" \ |
56 |
> |
#define RXTRACE_FEATURES "IrradianceCalc\nMultiprocessing\nDistanceLimiting\n" \ |
57 |
|
"HessianAmbientCache\nAmbientAveraging\n" \ |
58 |
|
"AmbientValueSharing\nAdaptiveShadowTesting\n" \ |
59 |
|
"Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" \ |
81 |
|
strcat(RFeatureList, RXTRACE_FEATURES); |
82 |
|
if (argc > 1 && !strcmp(argv[1], "-features")) |
83 |
|
return feature_status(argc-2, argv+2); |
84 |
+ |
/* initialize calcomp routines */ |
85 |
+ |
initfunc(); |
86 |
|
/* add trace notify function */ |
87 |
|
for (i = 0; addobjnotify[i] != NULL; i++) |
88 |
|
; |
145 |
|
break; |
146 |
|
case 'I': /* immed. irradiance */ |
147 |
|
rval = myRTmanager.rtFlags & RTimmIrrad; |
148 |
< |
check_bool(3,rval); |
148 |
> |
check_bool(2,rval); |
149 |
|
if (rval) myRTmanager.rtFlags |= RTimmIrrad; |
150 |
|
else myRTmanager.rtFlags &= ~RTimmIrrad; |
151 |
|
break; |
302 |
|
goto badopt; |
303 |
|
} |
304 |
|
} |
305 |
+ |
/* set/check spectral sampling */ |
306 |
+ |
rval = setspectrsamp(CNDX, WLPART); |
307 |
+ |
if (rval < 0) |
308 |
+ |
error(USER, "unsupported spectral sampling"); |
309 |
+ |
if (sens_curve != NULL) |
310 |
+ |
out_prims = NULL; |
311 |
+ |
else if (out_prims != NULL) { |
312 |
+ |
if (!rval) |
313 |
+ |
error(WARNING, "spectral range incompatible with color output"); |
314 |
+ |
} else if (NCSAMP == 3) |
315 |
+ |
out_prims = stdprims; /* 3 samples do not a spectrum make */ |
316 |
|
/* set up signal handling */ |
317 |
|
sigdie(SIGINT, "Interrupt"); |
318 |
|
#ifdef SIGHUP |
356 |
|
if (outform != 'a') |
357 |
|
SET_FILE_BINARY(stdout); |
358 |
|
if (doheader) { /* print header? */ |
359 |
< |
static char fmt[] = OCTFMT; |
360 |
< |
FILE * octfp = fopen(argv[i], "rb"); |
347 |
< |
if (checkheader(octfp, fmt, stdout) < 0) |
348 |
< |
error(USER, "bad octree header"); |
349 |
< |
fclose(octfp); |
359 |
> |
newheader("RADIANCE", stdout); |
360 |
> |
fputs(myRTmanager.GetHeadStr(), stdout); |
361 |
|
printargs(i, argv, stdout); |
362 |
|
printf("SOFTWARE= %s\n", VersionID); |
363 |
|
fputnow(stdout); |
364 |
|
if (rval > 0) /* saved from setrtoutput() call */ |
365 |
< |
printf("NCOMP=%d\n", rval); |
365 |
> |
fputncomp(rval, stdout); |
366 |
> |
if (NCSAMP > 3) |
367 |
> |
fputwlsplit(WLPART, stdout); |
368 |
> |
if ((out_prims != stdprims) & (out_prims != NULL)) |
369 |
> |
fputprims(out_prims, stdout); |
370 |
|
if ((outform == 'f') | (outform == 'd')) |
371 |
|
fputendian(stdout); |
372 |
|
fputformat(formstr(outform), stdout); |
373 |
< |
putchar('\n'); |
373 |
> |
fputc('\n', stdout); /* end of header */ |
374 |
|
} |
375 |
|
rtrace(NULL, nproc); /* trace rays */ |
376 |
|
quit(0); /* clean up & exit */ |
396 |
|
|
397 |
|
void |
398 |
|
eputs( /* put string to stderr */ |
399 |
< |
char *s |
399 |
> |
const char *s |
400 |
|
) |
401 |
|
{ |
402 |
|
static int midline = 0; |