| 1 |
greg |
2.4 |
#ifndef lint
|
| 2 |
greg |
2.7 |
static const char RCSid[] = "$Id: pmapray.c,v 2.6 2016/05/17 17:39:47 rschregle Exp $";
|
| 3 |
greg |
2.4 |
#endif
|
| 4 |
rschregle |
2.6 |
|
| 5 |
greg |
2.1 |
/*
|
| 6 |
|
|
==================================================================
|
| 7 |
|
|
Photon map interface to RADIANCE raycalls
|
| 8 |
|
|
|
| 9 |
|
|
Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
|
| 10 |
|
|
(c) Fraunhofer Institute for Solar Energy Systems,
|
| 11 |
rschregle |
2.2 |
(c) Lucerne University of Applied Sciences and Arts,
|
| 12 |
|
|
supported by the Swiss National Science Foundation (SNSF, #147053)
|
| 13 |
greg |
2.1 |
==================================================================
|
| 14 |
|
|
|
| 15 |
greg |
2.7 |
$Id: pmapray.c,v 2.6 2016/05/17 17:39:47 rschregle Exp $
|
| 16 |
greg |
2.1 |
*/
|
| 17 |
|
|
|
| 18 |
|
|
|
| 19 |
|
|
#include "pmapray.h"
|
| 20 |
|
|
#include "pmap.h"
|
| 21 |
|
|
|
| 22 |
|
|
|
| 23 |
|
|
void ray_init_pmap ()
|
| 24 |
|
|
/* Interface to ray_init(); init & load photon maps */
|
| 25 |
|
|
{
|
| 26 |
|
|
loadPmaps(photonMaps, pmapParams);
|
| 27 |
|
|
}
|
| 28 |
|
|
|
| 29 |
|
|
|
| 30 |
|
|
void ray_done_pmap ()
|
| 31 |
|
|
/* Interface to ray_done(); free photon maps */
|
| 32 |
|
|
{
|
| 33 |
|
|
cleanUpPmaps(photonMaps);
|
| 34 |
|
|
}
|
| 35 |
|
|
|
| 36 |
|
|
|
| 37 |
|
|
void ray_save_pmap (RAYPARAMS *rp)
|
| 38 |
|
|
/* Interface to ray_save(); save photon map params */
|
| 39 |
|
|
{
|
| 40 |
|
|
unsigned t;
|
| 41 |
|
|
|
| 42 |
|
|
for (t = 0; t < NUM_PMAP_TYPES; t++) {
|
| 43 |
greg |
2.3 |
if (pmapParams [t].fileName)
|
| 44 |
|
|
rp -> pmapParams [t].fileName = savqstr(pmapParams [t].fileName);
|
| 45 |
|
|
|
| 46 |
greg |
2.1 |
else rp -> pmapParams [t].fileName = NULL;
|
| 47 |
|
|
|
| 48 |
|
|
rp -> pmapParams [t].minGather = pmapParams [t].minGather;
|
| 49 |
|
|
rp -> pmapParams [t].maxGather = pmapParams [t].maxGather;
|
| 50 |
greg |
2.7 |
rp -> pmapParams [t].distribTarget = pmapParams [t].distribTarget;
|
| 51 |
greg |
2.1 |
}
|
| 52 |
|
|
}
|
| 53 |
|
|
|
| 54 |
|
|
|
| 55 |
|
|
void ray_restore_pmap (RAYPARAMS *rp)
|
| 56 |
|
|
/* Interface to ray_restore(); restore photon mapping params */
|
| 57 |
|
|
{
|
| 58 |
|
|
unsigned t;
|
| 59 |
|
|
|
| 60 |
|
|
for (t = 0; t < NUM_PMAP_TYPES; t++) {
|
| 61 |
|
|
pmapParams [t].fileName = rp -> pmapParams [t].fileName;
|
| 62 |
|
|
pmapParams [t].minGather = rp -> pmapParams [t].minGather;
|
| 63 |
|
|
pmapParams [t].maxGather = rp -> pmapParams [t].maxGather;
|
| 64 |
greg |
2.7 |
pmapParams [t].distribTarget = rp -> pmapParams [t].distribTarget;
|
| 65 |
|
|
}
|
| 66 |
|
|
}
|
| 67 |
|
|
|
| 68 |
|
|
void ray_defaults_pmap (RAYPARAMS *rp)
|
| 69 |
|
|
/* Interface to ray_defaults(); set photon mapping defaults */
|
| 70 |
|
|
{
|
| 71 |
|
|
unsigned t;
|
| 72 |
|
|
|
| 73 |
|
|
for (t = 0; t < NUM_PMAP_TYPES; t++) {
|
| 74 |
|
|
rp -> pmapParams [t].fileName = NULL;
|
| 75 |
|
|
rp -> pmapParams [t].minGather = 0;
|
| 76 |
|
|
rp -> pmapParams [t].maxGather = 0;
|
| 77 |
|
|
rp -> pmapParams [t].distribTarget = 0;
|
| 78 |
greg |
2.1 |
}
|
| 79 |
|
|
}
|