--- ray/src/rt/pmap.c 2015/04/22 20:28:16 2.3 +++ ray/src/rt/pmap.c 2015/05/22 14:09:01 2.7 @@ -4,10 +4,11 @@ Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) (c) Fraunhofer Institute for Solar Energy Systems, - Lucerne University of Applied Sciences & Arts + (c) Lucerne University of Applied Sciences and Arts, + supported by the Swiss National Science Foundation (SNSF, #147053) ================================================================== - $Id: pmap.c,v 2.3 2015/04/22 20:28:16 rschregle Exp $ + $Id: pmap.c,v 2.7 2015/05/22 14:09:01 greg Exp $ */ @@ -27,7 +28,7 @@ extern char *octname; -static char PmapRevision [] = "$Revision: 2.3 $"; +static char PmapRevision [] = "$Revision: 2.7 $"; @@ -64,7 +65,8 @@ void loadPmaps (PhotonMap **pmaps, const PhotonMapPara for (t = 0; t < NUM_PMAP_TYPES; t++) if (setPmapParam(&pm, parm + t)) { /* Check if photon map newer than octree */ - if (!stat(pm -> fileName, &pmstat) && !stat(octname, &octstat) && + if (pm -> fileName && octname && + !stat(pm -> fileName, &pmstat) && !stat(octname, &octstat) && octstat.st_mtime > pmstat.st_mtime) { sprintf(errmsg, "photon map in file %s may be stale", pm -> fileName); @@ -99,7 +101,7 @@ void savePmaps (const PhotonMap **pmaps, int argc, cha for (t = 0; t < NUM_PMAP_TYPES; t++) { if (pmaps [t]) - savePhotonMap(pmaps [t], pmaps [t] -> fileName, t, argc, argv); + savePhotonMap(pmaps [t], pmaps [t] -> fileName, argc, argv); } } @@ -204,10 +206,12 @@ void tracePhoton (RAY *ray) OBJREC* mat; if (ray -> rlvl > photonMaxBounce) { +#ifdef PMAP_RUNAWAY_WARN error(WARNING, "runaway photon!"); +#endif return; } - + if (colorAvg(ray -> cext) > FTINY && !photonParticipate(ray)) return; @@ -505,7 +509,7 @@ void distribPhotons (PhotonMap **pmaps) for (srcIdx = 0; srcIdx < nsources; srcIdx++) { unsigned portCnt = 0; emap.src = source + srcIdx; - + do { emap.port = emap.src -> sflags & SDISTANT ? photonPorts + portCnt : NULL;