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

Comparing ray/src/rt/pmapmat.h (file contents):
Revision 2.2 by rschregle, Fri May 8 13:20:22 2015 UTC vs.
Revision 2.15 by greg, Tue Sep 17 16:36:05 2024 UTC

# Line 1 | Line 1
1 + /* RCSid $Id$ */
2   /*
3 <   ==================================================================
3 >   ======================================================================
4     Photon map support routines for scattering by materials.
5    
6     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
7     (c) Fraunhofer Institute for Solar Energy Systems,
8 +       supported by the German Research Foundation
9 +       (DFG LU-204/10-2, "Fassadenintegrierte Regelsysteme FARESYS")
10     (c) Lucerne University of Applied Sciences and Arts,
11 <   supported by the Swiss National Science Foundation (SNSF, #147053)
12 <   ==================================================================
11 >       supported by the Swiss National Science Foundation
12 >       (SNSF #147053, "Daylight Redirecting Components")
13 >   ======================================================================
14    
11   $Id$
15   */
16  
17  
# Line 17 | Line 20
20  
21     #include "pmap.h"
22  
23 + #ifdef __cplusplus
24 + extern "C" {
25 + #endif
26 +
27     /*
28 <      Checks for paths already accounted for in photon map to avoid
28 >      Check for paths already accounted for in photon map to avoid
29        double-counting during backward raytracing.
23    
24      ambRayInPmap():      Check for DIFFUSE -> (DIFFUSE|SPECULAR) -> *
25                           subpaths.  These occur during the backward pass
26                           when an ambient ray spawns an indirect diffuse or
27                           specular ray.  These subpaths are already
28                           accounted for in the global photon map.
30        
31 +      ambRayInPmap():      Check for DIFFUSE -> (DIFFUSE|SPECULAR) -> *  
32 +                           subpaths.  These occur during the backward pass      
33 +                           when an ambient ray spawns an indirect diffuse or    
34 +                           specular ray.  These subpaths are already    
35 +                           accounted for in the global photon map.
36 +   */
37 +   #define ambRayInPmap(r) ((r) -> crtype & AMBIENT && photonMapping && \
38 +                              (ambounce < 0 || (r) -> rlvl > 1))
39 +
40 +   /*
41        shadowRayInPmap():   Check for DIFFUSE -> SPECULAR -> LIGHT
42                             subpaths. These occur during the backward pass
43                             when a shadow ray is transferred through a
44                             transparent material. These subpaths are already
45                             accounted for by caustic photons in the global,
46                             contrib, or dedicated caustic photon map.
47 +      
48 +      !!! DISABLED FOR TESTING PENDING REPLACEMENT BY srcRayInPmap() !!!                          
49     */
50 <   #define ambRayInPmap(r)    ((r) -> crtype & AMBIENT && \
51 <                               ((photonMapping && \
52 <                                 (ambounce < 0 || (r) -> rlvl > 1)) || \
53 <                                 causticPhotonMapping || contribPhotonMapping))
54 <   #define shadowRayInPmap(r) ((r) -> crtype & SHADOW && \
55 <                               ((photonMapping && ambounce < 0) || \
56 <                                causticPhotonMapping || contribPhotonMapping))
44 <  
45 <   /* Check if scattered ray spawns a caustic photon */
46 <   #define PMAP_CAUSTICRAY(r) ((r) -> rtype & SPECULAR)
50 > #if 1
51 >   #define shadowRayInPmap(r) 0
52 > #else  
53 >   #define shadowRayInPmap(r) (((globalPmap && ambounce < 0) || \
54 >                                 causticPmap || contribPmap) && \
55 >                                 (r) -> crtype & SHADOW)
56 > #endif
57  
58 +   /* srcRayInPmap():      Check whether a source ray transferred through
59 +    *                      medium (e.g.  glass/dielectric) is already
60 +    *                      accounted for in the photon map.  This is used by
61 +    *                      badcomponent() in source.c when checking source
62 +    *                      hits (glows and lights, hence ambient and shadow
63 +    *                      rays).
64 +    */
65 +   #define srcRayInPmap(r)    (((globalPmap && ambounce < 0) || \
66 +                                 causticPmap || contribPmap) && \
67 +                                 (r) -> crtype & (AMBIENT | SHADOW) && \
68 +                                 (r) -> rtype & (TRANS | REFRACTED))
69  
70 +   /* Check if scattered ray spawns a caustic photon;
71 +    * !!! NOTE this returns a single bit as boolean value (0|1), rather
72 +    * !!! than the original short int, hence the explicit test against zero.
73 +    * !!! This allows the macro the be used in a conditional statement
74 +    * !!! and when setting a photon's caustic flag in newPhoton(). */
75 +   #define PMAP_CAUSTICRAY(r)    (((r) -> rtype & SPECULAR) != 0)
76 +
77 +
78     /* Scattered photon ray types for photonRay() */
79     #define  PMAP_DIFFREFL        (REFLECTED | AMBIENT)
80     #define  PMAP_DIFFTRANS       (REFLECTED | AMBIENT | TRANS)
# Line 75 | Line 104
104  
105     /* Find antimatter geometry declared as photon sensors */  
106     void getPhotonSensors (char **sensorList);
107 <  
107 >
108 > #ifdef __cplusplus
109 > }
110 > #endif
111 >
112   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines