ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapmat.h
Revision: 2.3
Committed: Thu May 21 13:54:59 2015 UTC (8 years, 11 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.2: +2 -3 lines
Log Message:
Added calls to findmaterial() and simplified photon map shadow check

File Contents

# User Rev Content
1 greg 2.1 /*
2     ==================================================================
3     Photon map support routines for scattering by materials.
4    
5     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
6     (c) Fraunhofer Institute for Solar Energy Systems,
7 rschregle 2.2 (c) Lucerne University of Applied Sciences and Arts,
8     supported by the Swiss National Science Foundation (SNSF, #147053)
9 greg 2.1 ==================================================================
10    
11 greg 2.3 $Id: pmapmat.h,v 2.2 2015/05/08 13:20:22 rschregle Exp $
12 greg 2.1 */
13    
14    
15     #ifndef PMAPMAT_H
16     #define PMAPMAT_H
17    
18     #include "pmap.h"
19    
20     /*
21     Checks for paths already accounted for in photon map to avoid
22     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.
29    
30     shadowRayInPmap(): Check for DIFFUSE -> SPECULAR -> LIGHT
31     subpaths. These occur during the backward pass
32     when a shadow ray is transferred through a
33     transparent material. These subpaths are already
34     accounted for by caustic photons in the global,
35     contrib, or dedicated caustic photon map.
36     */
37 rschregle 2.2 #define ambRayInPmap(r) ((r) -> crtype & AMBIENT && \
38     ((photonMapping && \
39     (ambounce < 0 || (r) -> rlvl > 1)) || \
40     causticPhotonMapping || contribPhotonMapping))
41 greg 2.1 #define shadowRayInPmap(r) ((r) -> crtype & SHADOW && \
42 greg 2.3 photonMapping)
43 greg 2.1
44     /* Check if scattered ray spawns a caustic photon */
45     #define PMAP_CAUSTICRAY(r) ((r) -> rtype & SPECULAR)
46    
47    
48     /* Scattered photon ray types for photonRay() */
49     #define PMAP_DIFFREFL (REFLECTED | AMBIENT)
50     #define PMAP_DIFFTRANS (REFLECTED | AMBIENT | TRANS)
51     #define PMAP_SPECREFL (REFLECTED | SPECULAR)
52     #define PMAP_SPECTRANS (REFLECTED | SPECULAR | TRANS)
53     #define PMAP_REFRACT (REFRACTED | SPECULAR)
54     #define PMAP_XFER (TRANS)
55    
56    
57    
58     /* Dispatch table for photon scattering functions */
59     extern int (*photonScatter []) (OBJREC*, RAY*);
60    
61     /* List of antimatter sensor modifier names */
62     extern char *photonSensorList [MAXSET + 1];
63    
64    
65    
66     /* Spawn a new photon ray from a previous one; this is effectively a
67     * customised rayorigin(). */
68     void photonRay (const RAY *rayIn, RAY *rayOut, int rayOutType,
69     COLOR fluxAtten);
70    
71     /* Init photonScatter[] dispatch table with material specific scattering
72     routines */
73     void initPhotonScatterFuncs ();
74    
75     /* Find antimatter geometry declared as photon sensors */
76     void getPhotonSensors (char **sensorList);
77    
78     #endif