| 8 |  | #include "copyright.h" | 
| 9 |  |  | 
| 10 |  | #include <signal.h> | 
| 11 | + | #include <time.h> | 
| 12 |  | #include "rcontrib.h" | 
| 13 | < | #include "platform.h" | 
| 13 | < | #include "paths.h" | 
| 13 | > | #include "random.h" | 
| 14 |  | #include "source.h" | 
| 15 |  | #include "ambient.h" | 
| 16 |  |  | 
| 17 | – | char    *shm_boundary = NULL;           /* boundary of shared memory */ | 
| 18 | – |  | 
| 17 |  | int     gargc;                          /* global argc */ | 
| 18 |  | char    **gargv;                        /* global argv */ | 
| 19 |  | char    *octname;                       /* global octree name */ | 
| 44 |  | const char      *modname[MAXMODLIST];   /* ordered modifier name list */ | 
| 45 |  | int             nmods = 0;              /* number of modifiers */ | 
| 46 |  |  | 
| 47 | < | char    RCCONTEXT[] = "RCONTRIB";       /* our special evaluation context */ | 
| 47 | > | void    (*addobjnotify[8])() = {ambnotify, NULL}; | 
| 48 |  |  | 
| 49 | < | void    (*addobjnotify[8])() = {ambnotify, tranotify, NULL}; | 
| 49 | > | char    RCCONTEXT[] = "RC";             /* our special evaluation context */ | 
| 50 |  |  | 
| 51 |  |  | 
| 52 |  | static void | 
| 53 |  | printdefaults(void)                     /* print default values to stdout */ | 
| 54 |  | { | 
| 55 | < | char  *cp; | 
| 56 | < |  | 
| 55 | > | printf("-c %-5d\t\t\t# accumulated rays per record\n", accumulate); | 
| 56 | > | printf("-V%c\t\t\t\t# output %s\n", contrib ? '+' : '-', | 
| 57 | > | contrib ? "contributions" : "coefficients"); | 
| 58 |  | if (imm_irrad) | 
| 59 |  | printf("-I+\t\t\t\t# immediate irradiance on\n"); | 
| 60 |  | printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc); | 
| 168 |  | case 'n': case 'N': case 'f': case 'F': \ | 
| 169 |  | case '-': case '0': var = 0; break; \ | 
| 170 |  | default: goto badopt; } | 
| 172 | – | int     nprocs = 1; | 
| 171 |  | char    *curout = NULL; | 
| 172 | + | char    *prms = NULL; | 
| 173 |  | char    *binval = NULL; | 
| 174 |  | int     bincnt = 0; | 
| 175 |  | int     rval; | 
| 226 |  | yres = atoi(argv[++i]); | 
| 227 |  | break; | 
| 228 |  | case 'w':                       /* warnings */ | 
| 229 | < | rval = erract[WARNING].pf != NULL; | 
| 229 | > | rval = (erract[WARNING].pf != NULL); | 
| 230 |  | bool(2,rval); | 
| 231 |  | if (rval) erract[WARNING].pf = wputs; | 
| 232 |  | else erract[WARNING].pf = NULL; | 
| 269 |  | case 'h':                       /* header output */ | 
| 270 |  | bool(2,header); | 
| 271 |  | break; | 
| 272 | + | case 'p':                       /* parameter setting(s) */ | 
| 273 | + | check(2,"s"); | 
| 274 | + | prms = argv[++i]; | 
| 275 | + | break; | 
| 276 |  | case 'b':                       /* bin expression/count */ | 
| 277 |  | if (argv[i][2] == 'n') { | 
| 278 |  | check(3,"s"); | 
| 284 |  | break; | 
| 285 |  | case 'm':                       /* modifier name */ | 
| 286 |  | check(2,"s"); | 
| 287 | < | addmodifier(argv[++i], curout, binval, bincnt); | 
| 287 | > | addmodifier(argv[++i], curout, prms, binval, bincnt); | 
| 288 |  | break; | 
| 289 |  | case 'M':                       /* modifier file */ | 
| 290 |  | check(2,"s"); | 
| 291 | < | addmodfile(argv[++i], curout, binval, bincnt); | 
| 291 | > | addmodfile(argv[++i], curout, prms, binval, bincnt); | 
| 292 |  | break; | 
| 293 |  | default: | 
| 294 |  | goto badopt; | 
| 295 |  | } | 
| 296 |  | } | 
| 297 | + | if (nmods <= 0) | 
| 298 | + | error(USER, "missing required modifier argument"); | 
| 299 |  | /* override some option settings */ | 
| 300 |  | override_options(); | 
| 301 |  | /* initialize object types */ | 
| 344 |  |  | 
| 345 |  | setambient();                   /* initialize ambient calculation */ | 
| 346 |  |  | 
| 347 | < | if (nproc > 1) { | 
| 343 | < | preload_objs();         /* preload auxiliary data */ | 
| 344 | < | /* set shared memory boundary */ | 
| 345 | < | shm_boundary = strcpy((char *)malloc(16), "SHM_BOUNDARY"); | 
| 346 | < | } | 
| 347 | < | rcontrib();                     /* trace ray contributions */ | 
| 347 | > | rcontrib();                     /* trace ray contributions (loop) */ | 
| 348 |  |  | 
| 349 |  | ambsync();                      /* flush ambient file */ | 
| 350 |  |  | 
| 352 |  |  | 
| 353 |  | badopt: | 
| 354 |  | fprintf(stderr, | 
| 355 | < | "Usage: %s [-n nprocs][-V][-r][-e expr][-f source][-o ospec][-b binv][-bn N] {-m mod | -M file} [rtrace options] octree\n", | 
| 355 | > | "Usage: %s [-n nprocs][-V][-r][-e expr][-f source][-o ospec][-p p1=V1,p2=V2][-b binv][-bn N] {-m mod | -M file} [rtrace options] octree\n", | 
| 356 |  | progname); | 
| 357 |  | sprintf(errmsg, "command line error at '%s'", argv[i]); | 
| 358 |  | error(USER, errmsg); |