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 |
|
|
Lucerne University of Applied Sciences & Arts |
8 |
|
|
================================================================== |
9 |
|
|
|
10 |
|
|
$Id: pmapmat.h,v 4.11 2015/01/29 13:09:17 taschreg Exp taschreg $ |
11 |
|
|
*/ |
12 |
|
|
|
13 |
|
|
|
14 |
|
|
#ifndef PMAPMAT_H |
15 |
|
|
#define PMAPMAT_H |
16 |
|
|
|
17 |
|
|
#include "pmap.h" |
18 |
|
|
|
19 |
|
|
/* |
20 |
|
|
Checks for paths already accounted for in photon map to avoid |
21 |
|
|
double-counting during backward raytracing. |
22 |
|
|
|
23 |
|
|
ambRayInPmap(): Check for DIFFUSE -> (DIFFUSE|SPECULAR) -> * |
24 |
|
|
subpaths. These occur during the backward pass |
25 |
|
|
when an ambient ray spawns an indirect diffuse or |
26 |
|
|
specular ray. These subpaths are already |
27 |
|
|
accounted for in the global photon map. |
28 |
|
|
|
29 |
|
|
shadowRayInPmap(): Check for DIFFUSE -> SPECULAR -> LIGHT |
30 |
|
|
subpaths. These occur during the backward pass |
31 |
|
|
when a shadow ray is transferred through a |
32 |
|
|
transparent material. These subpaths are already |
33 |
|
|
accounted for by caustic photons in the global, |
34 |
|
|
contrib, or dedicated caustic photon map. |
35 |
|
|
*/ |
36 |
|
|
#define ambRayInPmap(r) ((r) -> crtype & AMBIENT && photonMapping) |
37 |
|
|
|
38 |
|
|
#define shadowRayInPmap(r) ((r) -> crtype & SHADOW && \ |
39 |
|
|
((photonMapping && ambounce < 0) || \ |
40 |
|
|
(causticPhotonMapping || \ |
41 |
|
|
contribPhotonMapping))) |
42 |
|
|
|
43 |
|
|
/* Check if scattered ray spawns a caustic photon */ |
44 |
|
|
#define PMAP_CAUSTICRAY(r) ((r) -> rtype & SPECULAR) |
45 |
|
|
|
46 |
|
|
|
47 |
|
|
/* Scattered photon ray types for photonRay() */ |
48 |
|
|
#define PMAP_DIFFREFL (REFLECTED | AMBIENT) |
49 |
|
|
#define PMAP_DIFFTRANS (REFLECTED | AMBIENT | TRANS) |
50 |
|
|
#define PMAP_SPECREFL (REFLECTED | SPECULAR) |
51 |
|
|
#define PMAP_SPECTRANS (REFLECTED | SPECULAR | TRANS) |
52 |
|
|
#define PMAP_REFRACT (REFRACTED | SPECULAR) |
53 |
|
|
#define PMAP_XFER (TRANS) |
54 |
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
/* Dispatch table for photon scattering functions */ |
58 |
|
|
extern int (*photonScatter []) (OBJREC*, RAY*); |
59 |
|
|
|
60 |
|
|
/* List of antimatter sensor modifier names */ |
61 |
|
|
extern char *photonSensorList [MAXSET + 1]; |
62 |
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
/* Spawn a new photon ray from a previous one; this is effectively a |
66 |
|
|
* customised rayorigin(). */ |
67 |
|
|
void photonRay (const RAY *rayIn, RAY *rayOut, int rayOutType, |
68 |
|
|
COLOR fluxAtten); |
69 |
|
|
|
70 |
|
|
/* Init photonScatter[] dispatch table with material specific scattering |
71 |
|
|
routines */ |
72 |
|
|
void initPhotonScatterFuncs (); |
73 |
|
|
|
74 |
|
|
/* Find antimatter geometry declared as photon sensors */ |
75 |
|
|
void getPhotonSensors (char **sensorList); |
76 |
|
|
|
77 |
|
|
#endif |