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