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