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