--- ray/src/rt/rcmain.c 2012/06/09 07:16:47 2.1 +++ ray/src/rt/rcmain.c 2012/06/22 22:03:02 2.7 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rcmain.c,v 2.1 2012/06/09 07:16:47 greg Exp $"; +static const char RCSid[] = "$Id: rcmain.c,v 2.7 2012/06/22 22:03:02 greg Exp $"; #endif /* * rcmain.c - main for rtcontrib ray contribution tracer @@ -9,13 +9,10 @@ static const char RCSid[] = "$Id: rcmain.c,v 2.1 2012/ #include #include "rcontrib.h" -#include "platform.h" -#include "paths.h" +#include "random.h" #include "source.h" #include "ambient.h" -char *shm_boundary = NULL; /* boundary of shared memory */ - int gargc; /* global argc */ char **gargv; /* global argv */ char *octname; /* global octree name */ @@ -46,16 +43,19 @@ int lim_dist = 0; /* limit distance? */ const char *modname[MAXMODLIST]; /* ordered modifier name list */ int nmods = 0; /* number of modifiers */ +void (*addobjnotify[8])() = {ambnotify, NULL}; + char RCCONTEXT[] = "RCONTRIB"; /* our special evaluation context */ -void (*addobjnotify[8])() = {ambnotify, tranotify, NULL}; - static void printdefaults(void) /* print default values to stdout */ { char *cp; + printf("-c %-5d\t\t\t# accumulated rays per record\n", accumulate); + printf("-V%c\t\t\t\t# output %s\n", contrib ? '+' : '-', + contrib ? "contributions" : "coefficients"); if (imm_irrad) printf("-I+\t\t\t\t# immediate irradiance on\n"); printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc); @@ -169,7 +169,6 @@ main(int argc, char *argv[]) case 'n': case 'N': case 'f': case 'F': \ case '-': case '0': var = 0; break; \ default: goto badopt; } - int nprocs = 1; char *curout = NULL; char *binval = NULL; int bincnt = 0; @@ -227,7 +226,7 @@ main(int argc, char *argv[]) yres = atoi(argv[++i]); break; case 'w': /* warnings */ - rval = erract[WARNING].pf != NULL; + rval = (erract[WARNING].pf != NULL); bool(2,rval); if (rval) erract[WARNING].pf = wputs; else erract[WARNING].pf = NULL; @@ -336,15 +335,12 @@ main(int argc, char *argv[]) nsceneobjs = nobjects; marksources(); /* find and mark sources */ + for (i = 0; i < nsources; i++) /* tracing to sources as well */ + source[i].sflags |= SFOLLOW; setambient(); /* initialize ambient calculation */ - if (nproc > 1) { - preload_objs(); /* preload auxiliary data */ - /* set shared memory boundary */ - shm_boundary = strcpy((char *)malloc(16), "SHM_BOUNDARY"); - } - rcontrib(); /* trace ray contributions */ + rcontrib(); /* trace ray contributions (loop) */ ambsync(); /* flush ambient file */