--- ray/src/rt/pmapsrc.c 2015/05/28 12:27:22 2.6 +++ ray/src/rt/pmapsrc.c 2016/05/17 17:39:47 2.13 @@ -1,3 +1,6 @@ +#ifndef lint +static const char RCSid[] = "$Id: pmapsrc.c,v 2.13 2016/05/17 17:39:47 rschregle Exp $"; +#endif /* ================================================================== Photon map support routines for emission from light sources @@ -7,8 +10,7 @@ (c) Lucerne University of Applied Sciences and Arts, supported by the Swiss National Science Foundation (SNSF, #147053) ================================================================== - - $Id: pmapsrc.c,v 2.6 2015/05/28 12:27:22 greg Exp $ + */ @@ -523,16 +525,21 @@ void getPhotonPorts () /* Find geometry declared as photon ports */ { OBJECT i; - OBJREC* obj; + OBJREC *obj, *mat; /* Check for missing port modifiers */ if (!ambset [0]) - error(USER, "no photon ports found"); + error(USER, "no photon ports"); for (i = 0; i < nobjects; i++) { obj = objptr(i); + mat = findmaterial(obj); - if (inset(ambset, obj -> omod)) { + /* Check if object is a surface and NOT a light source (duh) and + * resolve its material via any aliases, then check for inclusion in + * port modifier list */ + if (issurface(obj -> otype) && mat && !islight(mat -> otype) && + inset(ambset, objndx(mat))) { /* Add photon port */ photonPorts = (SRCREC*)realloc(photonPorts, (numPhotonPorts + 1) * @@ -550,6 +557,9 @@ void getPhotonPorts () numPhotonPorts++; } } + + if (!numPhotonPorts) + error(USER, "no valid photon ports found"); }