| 1 |
greg |
2.1 |
/* |
| 2 |
|
|
================================================================== |
| 3 |
|
|
Photon map interface to RADIANCE raycalls |
| 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: pmapray.c,v 1.3 2014/09/24 10:04:37 taschreg Exp taschreg $ |
| 11 |
|
|
*/ |
| 12 |
|
|
|
| 13 |
|
|
|
| 14 |
|
|
#include "pmapray.h" |
| 15 |
|
|
#include "pmap.h" |
| 16 |
|
|
|
| 17 |
|
|
|
| 18 |
|
|
void ray_init_pmap () |
| 19 |
|
|
/* Interface to ray_init(); init & load photon maps */ |
| 20 |
|
|
{ |
| 21 |
|
|
loadPmaps(photonMaps, pmapParams); |
| 22 |
|
|
} |
| 23 |
|
|
|
| 24 |
|
|
|
| 25 |
|
|
void ray_done_pmap () |
| 26 |
|
|
/* Interface to ray_done(); free photon maps */ |
| 27 |
|
|
{ |
| 28 |
|
|
cleanUpPmaps(photonMaps); |
| 29 |
|
|
} |
| 30 |
|
|
|
| 31 |
|
|
|
| 32 |
|
|
void ray_save_pmap (RAYPARAMS *rp) |
| 33 |
|
|
/* Interface to ray_save(); save photon map params */ |
| 34 |
|
|
{ |
| 35 |
|
|
unsigned t; |
| 36 |
|
|
|
| 37 |
|
|
for (t = 0; t < NUM_PMAP_TYPES; t++) { |
| 38 |
|
|
if (pmapParams [t].fileName) { |
| 39 |
|
|
rp -> pmapParams [t].fileName = |
| 40 |
|
|
(char*)malloc(strlen(pmapParams [t].fileName)); |
| 41 |
|
|
strcpy(rp -> pmapParams [t].fileName, pmapParams [t].fileName); |
| 42 |
|
|
} |
| 43 |
|
|
else rp -> pmapParams [t].fileName = NULL; |
| 44 |
|
|
|
| 45 |
|
|
rp -> pmapParams [t].minGather = pmapParams [t].minGather; |
| 46 |
|
|
rp -> pmapParams [t].maxGather = pmapParams [t].maxGather; |
| 47 |
|
|
} |
| 48 |
|
|
} |
| 49 |
|
|
|
| 50 |
|
|
|
| 51 |
|
|
void ray_restore_pmap (RAYPARAMS *rp) |
| 52 |
|
|
/* Interface to ray_restore(); restore photon mapping params */ |
| 53 |
|
|
{ |
| 54 |
|
|
unsigned t; |
| 55 |
|
|
|
| 56 |
|
|
for (t = 0; t < NUM_PMAP_TYPES; t++) { |
| 57 |
|
|
pmapParams [t].fileName = rp -> pmapParams [t].fileName; |
| 58 |
|
|
pmapParams [t].minGather = rp -> pmapParams [t].minGather; |
| 59 |
|
|
pmapParams [t].maxGather = rp -> pmapParams [t].maxGather; |
| 60 |
|
|
} |
| 61 |
|
|
} |