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