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