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.6 by greg, Tue Aug 18 18:45:55 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 20 | Line 23
23  
24  
25   void savePhotonMap (const PhotonMap *pmap, const char *fname,
26 <                    PhotonMapType type, int argc, char **argv)
26 >                    int argc, char **argv)
27   {
28     unsigned long i, j;
29     const Photon* p;
30     FILE* file;
31  
32     if (!pmap || !pmap -> heap || !pmap -> heapSize ||
33 <       !validPmapType(type)) {
33 >       !validPmapType(pmap -> type)) {
34        error(INTERNAL, "attempt to save empty or invalid photon map");
35        return;
36     }
# Line 61 | Line 64 | void savePhotonMap (const PhotonMap *pmap, const char
64        fprintf(file, "%d primary rays\n", pmap -> primaryEnd + 1);
65    
66     /* Write format */
67 <   fputformat((char*)pmapFormat [type], file);
67 >   fputformat((char*)pmapFormat [pmap -> type], file);
68     fprintf(file, "VERSION=%d\n", PMAP_FILEVER);
69    
70     /* Empty line = end of header */
# Line 127 | Line 130 | void savePhotonMap (const PhotonMap *pmap, const char
130          
131           putint(prim -> srcIdx, sizeof(prim -> srcIdx), file);
132  
133 <         for (j = 0; j < 3; j++)
131 <            putflt(prim -> dir [j], file);
133 >         putint(prim -> dir, sizeof(prim -> dir), file);
134              
135           for (j = 0; j < 3; j++)
136              putflt(prim -> pos [j], file);
# Line 249 | Line 251 | PhotonMapType loadPhotonMap (PhotonMap *pmap, const ch
251          
252           prim -> srcIdx = getint(sizeof(prim -> srcIdx), file);
253          
254 <         for (j = 0; j < 3; j++)
253 <            prim -> dir [j] = getflt(file);
254 >         prim -> dir = getint(sizeof(prim -> dir), file);
255              
256           for (j = 0; j < 3; j++)
257              prim -> pos [j] = getflt(file);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines