1 |
greg |
2.6 |
/* RCSid $Id: pmap.h,v 2.5 2015/08/18 18:45:55 greg Exp $ */ |
2 |
rschregle |
2.7 |
|
3 |
greg |
2.1 |
/* |
4 |
|
|
================================================================== |
5 |
|
|
Photon map main header |
6 |
|
|
|
7 |
|
|
Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) |
8 |
|
|
(c) Fraunhofer Institute for Solar Energy Systems, |
9 |
rschregle |
2.3 |
(c) Lucerne University of Applied Sciences and Arts, |
10 |
|
|
supported by the Swiss National Science Foundation (SNSF, #147053) |
11 |
greg |
2.1 |
================================================================== |
12 |
|
|
|
13 |
rschregle |
2.7 |
$Id: pmap.h,v 4.9 2015/08/10 14:05:35 taschreg Exp taschreg $ |
14 |
greg |
2.1 |
*/ |
15 |
|
|
|
16 |
|
|
|
17 |
|
|
#ifndef PMAP_H |
18 |
|
|
#define PMAP_H |
19 |
|
|
|
20 |
|
|
#include "pmapparm.h" |
21 |
|
|
#include "pmapdata.h" |
22 |
|
|
|
23 |
|
|
|
24 |
greg |
2.2 |
#ifndef min |
25 |
rschregle |
2.7 |
#define min(a, b) ((a) < (b) ? (a) : (b)) |
26 |
greg |
2.2 |
#endif |
27 |
|
|
|
28 |
|
|
#ifndef max |
29 |
rschregle |
2.7 |
#define max(a, b) ((a) > (b) ? (a) : (b)) |
30 |
greg |
2.2 |
#endif |
31 |
|
|
|
32 |
rschregle |
2.7 |
#define sqr(a) ((a) * (a)) |
33 |
greg |
2.1 |
|
34 |
|
|
/* Average over colour channels */ |
35 |
|
|
#define colorAvg(col) ((col [0] + col [1] + col [2]) / 3) |
36 |
|
|
|
37 |
|
|
/* Macros to test for enabled photon maps */ |
38 |
|
|
#define photonMapping (globalPmap || preCompPmap || \ |
39 |
greg |
2.4 |
causticPmap || contribPmap) |
40 |
|
|
#define causticPhotonMapping (causticPmap != NULL) |
41 |
|
|
#define directPhotonMapping (directPmap != NULL) |
42 |
|
|
#define volumePhotonMapping (volumePmap != NULL) |
43 |
greg |
2.1 |
#define contribPhotonMapping (contribPmap && contribPmap -> srcContrib) |
44 |
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
extern void (*pmapLookup [])(PhotonMap*, RAY*, COLOR); |
48 |
|
|
/* Photon map lookup functions per type */ |
49 |
|
|
|
50 |
|
|
void loadPmaps (PhotonMap **pmaps, const PhotonMapParams *params); |
51 |
|
|
/* Load photon and set their respective parameters, checking timestamps |
52 |
|
|
* relative to octree for possible staleness */ |
53 |
|
|
|
54 |
|
|
void savePmaps (const PhotonMap **pmaps, int argc, char **argv); |
55 |
|
|
/* Save all defined photon maps with specified command line */ |
56 |
|
|
|
57 |
|
|
void cleanUpPmaps (PhotonMap **pmaps); |
58 |
|
|
/* Trash all photon maps after processing is complete */ |
59 |
|
|
|
60 |
rschregle |
2.7 |
void distribPhotons (PhotonMap **pmaps, unsigned numProc); |
61 |
greg |
2.1 |
/* Emit photons from light sources and build photon maps for non-NULL |
62 |
|
|
* entries in photon map array */ |
63 |
|
|
|
64 |
|
|
void tracePhoton (RAY*); |
65 |
|
|
/* Follow photon as it bounces around the scene. Analogon to |
66 |
|
|
* raytrace(). */ |
67 |
|
|
|
68 |
|
|
void photonDensity (PhotonMap*, RAY*, COLOR irrad); |
69 |
|
|
/* Perform surface density estimate from incoming photon flux at |
70 |
|
|
ray's intersection point. Returns irradiance from found photons. */ |
71 |
|
|
|
72 |
|
|
void photonPreCompDensity (PhotonMap *pmap, RAY *r, COLOR irrad); |
73 |
|
|
/* Returns precomputed photon density estimate at ray -> rop. */ |
74 |
|
|
|
75 |
|
|
void volumePhotonDensity (PhotonMap*, RAY*, COLOR); |
76 |
|
|
/* Perform volume density estimate from incoming photon flux at |
77 |
|
|
ray's intersection point. Returns irradiance. */ |
78 |
|
|
|
79 |
|
|
void colorNorm (COLOR); |
80 |
|
|
/* Normalise colour channels to average of 1 */ |
81 |
|
|
|
82 |
|
|
#endif |