--- ray/src/rt/rtmain.c 2024/08/20 18:57:11 2.54 +++ ray/src/rt/rtmain.c 2025/06/20 03:43:17 2.60 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rtmain.c,v 2.54 2024/08/20 18:57:11 greg Exp $"; +static const char RCSid[] = "$Id: rtmain.c,v 2.60 2025/06/20 03:43:17 greg Exp $"; #endif /* * rtmain.c - main for rtrace per-ray calculation program @@ -13,16 +13,14 @@ static const char RCSid[] = "$Id: rtmain.c,v 2.54 2024 #include "rtprocess.h" /* getpid() */ #include "resolu.h" #include "ray.h" +#include "func.h" #include "source.h" #include "ambient.h" #include "random.h" -#include "paths.h" #include "pmapray.h" extern char *progname; /* global argv[0] */ -extern char *shm_boundary; /* boundary of shared memory */ - /* persistent processes define */ #ifdef F_SETLKW #define PERSIST 1 /* normal persist */ @@ -116,6 +114,8 @@ main(int argc, char *argv[]) strcat(RFeatureList, RTRACE_FEATURES); if (argc > 1 && !strcmp(argv[1], "-features")) return feature_status(argc-2, argv+2); + /* initialize calcomp routines */ + initfunc(); /* add trace notify function */ for (i = 0; addobjnotify[i] != NULL; i++) ; @@ -350,7 +350,9 @@ main(int argc, char *argv[]) rval = setspectrsamp(CNDX, WLPART); if (rval < 0) error(USER, "unsupported spectral sampling"); - if (out_prims != NULL) { + if (sens_curve != NULL) + out_prims = NULL; + else if (out_prims != NULL) { if (!rval) error(WARNING, "spectral range incompatible with color output"); } else if (NCSAMP == 3) @@ -360,13 +362,7 @@ main(int argc, char *argv[]) /* initialize object types */ initotypes(); /* initialize urand */ - if (rand_samp) { - srandom((long)time(0)); - initurand(0); - } else { - srandom(0L); - initurand(2048); - } + reset_random(); /* set up signal handling */ sigdie(SIGINT, "Interrupt"); #ifdef SIGHUP @@ -453,9 +449,7 @@ main(int argc, char *argv[]) dup2(duped1, fileno(stdout)); close(duped1); if (persist == PARALLEL) { /* multiprocessing */ - preload_objs(); /* preload scene */ - shm_boundary = (char *)malloc(16); - strcpy(shm_boundary, "SHM_BOUNDARY"); + cow_memshare(); /* preloads scene */ while ((rval=fork()) == 0) { /* keep on forkin' */ pflock(1); pfhold(); @@ -512,6 +506,8 @@ wputs( /* warning output function */ ) { int lasterrno = errno; + if (erract[WARNING].pf == NULL) + return; /* called by calcomp or someone */ eputs(s); errno = lasterrno; }