ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapio.c
(Generate patch)

Comparing ray/src/rt/pmapio.c (file contents):
Revision 2.3 by greg, Wed May 20 12:58:31 2015 UTC vs.
Revision 2.7 by greg, Tue Sep 1 16:27:52 2015 UTC

# Line 1 | Line 1
1 + #ifndef lint
2 + static const char RCSid[] = "$Id$";
3 + #endif
4   /*
5     ==================================================================
6     Photon map file I/O
# Line 8 | Line 11
11     supported by the Swiss National Science Foundation (SNSF, #147053)
12     ==================================================================
13    
11   $Id$    
14   */
15  
16  
# Line 20 | Line 22
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     }
# Line 61 | Line 63 | void savePhotonMap (const PhotonMap *pmap, const char
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 */
# Line 127 | Line 129 | void savePhotonMap (const PhotonMap *pmap, const char
129          
130           putint(prim -> srcIdx, sizeof(prim -> srcIdx), file);
131  
132 <         for (j = 0; j < 3; j++)
131 <            putflt(prim -> dir [j], file);
132 >         putint(prim -> dir, sizeof(prim -> dir), file);
133              
134           for (j = 0; j < 3; j++)
135              putflt(prim -> pos [j], file);
# Line 249 | Line 250 | PhotonMapType loadPhotonMap (PhotonMap *pmap, const ch
250          
251           prim -> srcIdx = getint(sizeof(prim -> srcIdx), file);
252          
253 <         for (j = 0; j < 3; j++)
253 <            prim -> dir [j] = getflt(file);
253 >         prim -> dir = getint(sizeof(prim -> dir), file);
254              
255           for (j = 0; j < 3; j++)
256              prim -> pos [j] = getflt(file);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines