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.1 by greg, Tue Feb 24 19:39:27 2015 UTC vs.
Revision 2.5 by greg, Fri May 22 14:09:01 2015 UTC

# Line 4 | Line 4
4  
5     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
6     (c) Fraunhofer Institute for Solar Energy Systems,
7 <       Lucerne University of Applied Sciences & Arts
7 >   (c) Lucerne University of Applied Sciences and Arts,
8 >   supported by the Swiss National Science Foundation (SNSF, #147053)
9     ==================================================================
10    
11     $Id$    
# Line 19 | Line 20
20  
21  
22   void savePhotonMap (const PhotonMap *pmap, const char *fname,
23 <                    PhotonMapType type, int argc, char **argv)
23 >                    int argc, char **argv)
24   {
25     unsigned long i, j;
26     const Photon* p;
27     FILE* file;
28  
29     if (!pmap || !pmap -> heap || !pmap -> heapSize ||
30 <       !validPmapType(type)) {
30 >       !validPmapType(pmap -> type)) {
31        error(INTERNAL, "attempt to save empty or invalid photon map");
32        return;
33     }
# Line 60 | Line 61 | void savePhotonMap (const PhotonMap *pmap, const char
61        fprintf(file, "%d primary rays\n", pmap -> primaryEnd + 1);
62    
63     /* Write format */
64 <   fputformat((char*)pmapFormat [type], file);
64 >   fputformat((char*)pmapFormat [pmap -> type], file);
65     fprintf(file, "VERSION=%d\n", PMAP_FILEVER);
66    
67     /* Empty line = end of header */
# Line 126 | Line 127 | void savePhotonMap (const PhotonMap *pmap, const char
127          
128           putint(prim -> srcIdx, sizeof(prim -> srcIdx), file);
129  
130 <         for (j = 0; j < 3; j++)
130 <            putflt(prim -> dir [j], file);
130 >         putint(prim -> dir, sizeof(prim -> dir), file);
131              
132           for (j = 0; j < 3; j++)
133 <            putflt(prim -> org [j], file);
133 >            putflt(prim -> pos [j], file);
134          
135           if (ferror(file))
136              error(SYSTEM, "error writing primary photon rays");
# Line 248 | Line 248 | PhotonMapType loadPhotonMap (PhotonMap *pmap, const ch
248          
249           prim -> srcIdx = getint(sizeof(prim -> srcIdx), file);
250          
251 <         for (j = 0; j < 3; j++)
252 <            prim -> dir [j] = getflt(file);
251 >         prim -> dir = getint(sizeof(prim -> dir), file);
252              
253           for (j = 0; j < 3; j++)
254 <            prim -> org [j] = getflt(file);
254 >            prim -> pos [j] = getflt(file);
255              
256           if (feof(file))
257              error(SYSTEM, "error reading primary photon rays");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines