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