--- ray/src/rt/pmapsrc.c 2015/08/18 18:45:55 2.7 +++ ray/src/rt/pmapsrc.c 2015/10/27 19:06:54 2.11 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: pmapsrc.c,v 2.7 2015/08/18 18:45:55 greg Exp $"; +static const char RCSid[] = "$Id: pmapsrc.c,v 2.11 2015/10/27 19:06:54 rschregle Exp $"; #endif /* ================================================================== @@ -10,8 +10,7 @@ static const char RCSid[] = "$Id: pmapsrc.c,v 2.7 2015 (c) Lucerne University of Applied Sciences and Arts, supported by the Swiss National Science Foundation (SNSF, #147053) ================================================================== - - $Id: pmapsrc.c,v 2.7 2015/08/18 18:45:55 greg Exp $ + */ @@ -526,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) && !islight(mat -> otype) && + inset(ambset, objndx(mat))) { /* Add photon port */ photonPorts = (SRCREC*)realloc(photonPorts, (numPhotonPorts + 1) * @@ -553,6 +557,9 @@ void getPhotonPorts () numPhotonPorts++; } } + + if (!numPhotonPorts) + error(USER, "no valid photon ports found"); }