1 |
+ |
#ifndef lint |
2 |
+ |
static const char RCSid[] = "$Id$"; |
3 |
+ |
#endif |
4 |
|
/* |
5 |
|
================================================================== |
6 |
|
Photon map file I/O |
11 |
|
supported by the Swiss National Science Foundation (SNSF, #147053) |
12 |
|
================================================================== |
13 |
|
|
11 |
– |
$Id$ |
14 |
|
*/ |
15 |
|
|
16 |
|
|
22 |
|
|
23 |
|
|
24 |
|
void savePhotonMap (const PhotonMap *pmap, const char *fname, |
25 |
< |
PhotonMapType type, int argc, char **argv) |
25 |
> |
int argc, char **argv) |
26 |
|
{ |
27 |
|
unsigned long i, j; |
28 |
|
const Photon* p; |
29 |
|
FILE* file; |
30 |
|
|
31 |
|
if (!pmap || !pmap -> heap || !pmap -> heapSize || |
32 |
< |
!validPmapType(type)) { |
32 |
> |
!validPmapType(pmap -> type)) { |
33 |
|
error(INTERNAL, "attempt to save empty or invalid photon map"); |
34 |
|
return; |
35 |
|
} |
63 |
|
fprintf(file, "%d primary rays\n", pmap -> primaryEnd + 1); |
64 |
|
|
65 |
|
/* Write format */ |
66 |
< |
fputformat((char*)pmapFormat [type], file); |
66 |
> |
fputformat((char*)pmapFormat [pmap -> type], file); |
67 |
|
fprintf(file, "VERSION=%d\n", PMAP_FILEVER); |
68 |
|
|
69 |
|
/* Empty line = end of header */ |
171 |
|
|
172 |
|
/* Identify photon map type from format string */ |
173 |
|
for (ptype = 0; |
174 |
< |
strcmp(pmapFormat [ptype], format) && ptype < NUM_PMAP_TYPES; |
174 |
> |
ptype < NUM_PMAP_TYPES && strcmp(pmapFormat [ptype], format); |
175 |
|
ptype++); |
176 |
|
|
177 |
|
if (!validPmapType(ptype)) { |