ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapsrc.c
(Generate patch)

Comparing ray/src/rt/pmapsrc.c (file contents):
Revision 2.5 by greg, Fri May 22 11:38:26 2015 UTC vs.
Revision 2.14 by rschregle, Fri Feb 2 19:47:55 2018 UTC

# Line 1 | Line 1
1 + #ifndef lint
2 + static const char RCSid[] = "$Id$";
3 + #endif
4   /*
5     ==================================================================
6     Photon map support routines for emission from light sources
# Line 7 | Line 10
10     (c) Lucerne University of Applied Sciences and Arts,
11     supported by the Swiss National Science Foundation (SNSF, #147053)
12     ==================================================================
13 <  
11 <   $Id$
13 >
14   */
15  
16  
# Line 523 | Line 525 | void getPhotonPorts ()
525   /* Find geometry declared as photon ports */
526   {
527     OBJECT i;
528 <   OBJREC* obj;
528 >   OBJREC *obj, *mat;
529    
530     /* Check for missing port modifiers */
531     if (!ambset [0])
532 <      error(USER, "no photon ports found");
532 >      error(USER, "no photon ports");
533    
534     for (i = 0; i < nobjects; i++) {
535        obj = objptr(i);
536 +      mat = findmaterial(obj);
537        
538 <      if (inset(ambset, obj -> omod)) {
538 >      /* Check if object is a surface and NOT a light source (duh) and
539 >       * resolve its material via any aliases, then check for inclusion in
540 >       * port modifier list */
541 >      if (issurface(obj -> otype) && mat && !islight(mat -> otype) &&
542 >          inset(ambset, objndx(mat))) {
543           /* Add photon port */
544           photonPorts = (SRCREC*)realloc(photonPorts,
545                                          (numPhotonPorts + 1) *
# Line 550 | Line 557 | void getPhotonPorts ()
557           numPhotonPorts++;
558        }
559     }
560 +  
561 +   if (!numPhotonPorts)
562 +      error(USER, "no valid photon ports found");
563   }
564  
565  
# Line 747 | Line 757 | void emitPhoton (const EmissionMap* emap, RAY* ray)
757        emitted photon to break up clustering artifacts */
758     photonOrigin [emap -> src -> so -> otype] ((EmissionMap*)emap);
759     /* If we have a local glow source with a maximum radius, then
760 <      restrict our photon to the specified distance (otherwise no limit) */
761 <   if (mod -> otype == MAT_GLOW && emap -> src -> so -> otype != OBJ_SOURCE
760 >      restrict our photon to the specified distance, otherwise we set
761 >      the limit imposed by photonMaxDist (or no limit if 0) */
762 >   if (mod -> otype == MAT_GLOW && !(emap -> src -> sflags & SDISTANT)
763                  && mod -> oargs.farg[3] > FTINY)
764        ray -> rmax = mod -> oargs.farg[3];
765     else
766 <      ray -> rmax = 0;
766 >      ray -> rmax = photonMaxDist;
767     rayorigin(ray, PRIMARY, NULL, NULL);
768    
769     if (!emap -> numSamples) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines