--- ray/src/rt/pmapopt.c 2015/05/22 14:12:11 2.4 +++ ray/src/rt/pmapopt.c 2020/06/15 22:18:57 2.10 @@ -1,3 +1,7 @@ +#ifndef lint +static const char RCSid[] = "$Id: pmapopt.c,v 2.10 2020/06/15 22:18:57 rschregle Exp $"; +#endif + /* ================================================================== Photon map interface to RADIANCE render options @@ -8,7 +12,7 @@ supported by the Swiss National Science Foundation (SNSF, #147053) ================================================================== - $Id: pmapopt.c,v 2.4 2015/05/22 14:12:11 greg Exp $ + $Id: pmapopt.c,v 2.10 2020/06/15 22:18:57 rschregle Exp $ */ @@ -33,8 +37,9 @@ int getPmapRenderOpt (int ac, char *av []) case 'a': switch (av [0][2]) { case 'p': /* photon map */ - /* Asking for photon map, ergo ambounce != 0 */ - ambounce += (ambounce == 0); + /* Asking for photon map, ergo ambounce != 0 */ + ambounce += (ambounce == 0); + if (!check(3, "s")) { /* File -> assume bwidth = 1 or precomputed pmap */ if (++t >= NUM_PMAP_TYPES) @@ -55,8 +60,8 @@ int getPmapRenderOpt (int ac, char *av []) return -1; } else { - sprintf(errmsg, "no photon lookup bandwidth specified, " - "using default %d", defaultGather); + sprintf(errmsg, "missing photon lookup bandwidth, " + "defaulting to %d", defaultGather); error(WARNING, errmsg); return 1; } @@ -72,11 +77,28 @@ int getPmapRenderOpt (int ac, char *av []) } else return 2; - case 'm': /* max photon search radius coefficient */ - if (check(3, "f") || (maxDistCoeff = atof(av [1])) <= 0) - error(USER, "invalid max photon search radius coefficient"); + case 'm': /* Fixed max photon search radius */ + if (check(3, "f") || (maxDistFix = atof(av [1])) <= 0) + error(USER, "invalid max photon search radius"); return 1; + +#ifdef PMAP_OOC + case 'c': /* OOC pmap cache page size ratio */ + if (check(3, "f") || (pmapCachePageSize = atof(av [1])) <= 0) + error(USER, "invalid photon cache page size ratio"); + + return 1; + + case 'C': /* OOC pmap cache size (in photons); 0 = no caching */ + if (check(3, "s")) + error(USER, "invalid number of cached photons"); + + /* Parsing failure sets to zero and disables caching */ + pmapCacheSize = parseMultiplier(av [1]); + + return 1; +#endif } } #undef check @@ -90,5 +112,10 @@ int getPmapRenderOpt (int ac, char *av []) void printPmapDefaults () /* Print defaults for photon map render options */ { - printf("-am %.1f\t\t\t# max photon search radius coeff\n", maxDistCoeff); + printf("-am %.1f\t\t\t\t# max photon search radius\n", maxDistFix); +#ifdef PMAP_OOC + printf("-ac %.1f\t\t\t\t# photon cache page size ratio\n", + pmapCachePageSize); + printf("-aC %ld\t\t\t# num cached photons\n", pmapCacheSize); +#endif }