1 |
greg |
2.8 |
/* RCSid $Id$ */ |
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 |
greg |
2.8 |
$Id: pmapmat.h,v 2.7 2015/07/29 18:54:20 rschregle Exp $ |
13 |
greg |
2.1 |
*/ |
14 |
|
|
|
15 |
|
|
|
16 |
|
|
#ifndef PMAPMAT_H |
17 |
|
|
#define PMAPMAT_H |
18 |
|
|
|
19 |
|
|
#include "pmap.h" |
20 |
|
|
|
21 |
|
|
/* |
22 |
greg |
2.5 |
Check for paths already accounted for in photon map to avoid |
23 |
greg |
2.1 |
double-counting during backward raytracing. |
24 |
|
|
|
25 |
|
|
shadowRayInPmap(): Check for DIFFUSE -> SPECULAR -> LIGHT |
26 |
|
|
subpaths. These occur during the backward pass |
27 |
|
|
when a shadow ray is transferred through a |
28 |
|
|
transparent material. These subpaths are already |
29 |
|
|
accounted for by caustic photons in the global, |
30 |
|
|
contrib, or dedicated caustic photon map. |
31 |
|
|
*/ |
32 |
rschregle |
2.7 |
/* |
33 |
|
|
#define ambRayInPmap(r) ((r) -> crtype & AMBIENT && \ |
34 |
|
|
((photonMapping && \ |
35 |
|
|
(ambounce < 0 || (r) -> rlvl > 1)) || \ |
36 |
|
|
causticPhotonMapping || contribPhotonMapping)) |
37 |
|
|
*/ |
38 |
|
|
#define ambRayInPmap(r) 0 |
39 |
greg |
2.1 |
#define shadowRayInPmap(r) ((r) -> crtype & SHADOW && \ |
40 |
greg |
2.6 |
(ambounce < 0 || ((r) -> crtype & AMBIENT ? \ |
41 |
|
|
photonMapping : causticPhotonMapping))) |
42 |
greg |
2.1 |
|
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 |