| 1 |
greg |
2.4 |
#ifndef lint |
| 2 |
greg |
2.8 |
static const char RCSid[] = "$Id: pmapray.c,v 2.7 2016/11/02 22:09:14 greg 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.8 |
$Id: pmapray.c,v 2.7 2016/11/02 22:09:14 greg Exp $ |
| 16 |
greg |
2.1 |
*/ |
| 17 |
|
|
|
| 18 |
|
|
|
| 19 |
greg |
2.8 |
#include "ray.h" |
| 20 |
greg |
2.1 |
#include "pmapray.h" |
| 21 |
|
|
#include "pmap.h" |
| 22 |
|
|
|
| 23 |
|
|
|
| 24 |
|
|
void ray_init_pmap () |
| 25 |
|
|
/* Interface to ray_init(); init & load photon maps */ |
| 26 |
|
|
{ |
| 27 |
greg |
2.8 |
if (NCSAMP > 3 && photonMapping) |
| 28 |
|
|
error(USER, "photon-mapping not currently supported for > 3 spectral samples"); |
| 29 |
|
|
|
| 30 |
greg |
2.1 |
loadPmaps(photonMaps, pmapParams); |
| 31 |
|
|
} |
| 32 |
|
|
|
| 33 |
|
|
|
| 34 |
|
|
void ray_done_pmap () |
| 35 |
|
|
/* Interface to ray_done(); free photon maps */ |
| 36 |
|
|
{ |
| 37 |
|
|
cleanUpPmaps(photonMaps); |
| 38 |
|
|
} |
| 39 |
|
|
|
| 40 |
|
|
|
| 41 |
|
|
void ray_save_pmap (RAYPARAMS *rp) |
| 42 |
|
|
/* Interface to ray_save(); save photon map params */ |
| 43 |
|
|
{ |
| 44 |
|
|
unsigned t; |
| 45 |
|
|
|
| 46 |
|
|
for (t = 0; t < NUM_PMAP_TYPES; t++) { |
| 47 |
greg |
2.3 |
if (pmapParams [t].fileName) |
| 48 |
|
|
rp -> pmapParams [t].fileName = savqstr(pmapParams [t].fileName); |
| 49 |
|
|
|
| 50 |
greg |
2.1 |
else rp -> pmapParams [t].fileName = NULL; |
| 51 |
|
|
|
| 52 |
|
|
rp -> pmapParams [t].minGather = pmapParams [t].minGather; |
| 53 |
|
|
rp -> pmapParams [t].maxGather = pmapParams [t].maxGather; |
| 54 |
greg |
2.7 |
rp -> pmapParams [t].distribTarget = pmapParams [t].distribTarget; |
| 55 |
greg |
2.1 |
} |
| 56 |
|
|
} |
| 57 |
|
|
|
| 58 |
|
|
|
| 59 |
|
|
void ray_restore_pmap (RAYPARAMS *rp) |
| 60 |
|
|
/* Interface to ray_restore(); restore photon mapping params */ |
| 61 |
|
|
{ |
| 62 |
|
|
unsigned t; |
| 63 |
|
|
|
| 64 |
|
|
for (t = 0; t < NUM_PMAP_TYPES; t++) { |
| 65 |
|
|
pmapParams [t].fileName = rp -> pmapParams [t].fileName; |
| 66 |
|
|
pmapParams [t].minGather = rp -> pmapParams [t].minGather; |
| 67 |
|
|
pmapParams [t].maxGather = rp -> pmapParams [t].maxGather; |
| 68 |
greg |
2.7 |
pmapParams [t].distribTarget = rp -> pmapParams [t].distribTarget; |
| 69 |
|
|
} |
| 70 |
|
|
} |
| 71 |
|
|
|
| 72 |
|
|
void ray_defaults_pmap (RAYPARAMS *rp) |
| 73 |
|
|
/* Interface to ray_defaults(); set photon mapping defaults */ |
| 74 |
|
|
{ |
| 75 |
|
|
unsigned t; |
| 76 |
|
|
|
| 77 |
|
|
for (t = 0; t < NUM_PMAP_TYPES; t++) { |
| 78 |
|
|
rp -> pmapParams [t].fileName = NULL; |
| 79 |
|
|
rp -> pmapParams [t].minGather = 0; |
| 80 |
|
|
rp -> pmapParams [t].maxGather = 0; |
| 81 |
|
|
rp -> pmapParams [t].distribTarget = 0; |
| 82 |
greg |
2.1 |
} |
| 83 |
|
|
} |