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

Comparing ray/src/rt/pmapdata.h (file contents):
Revision 2.10 by rschregle, Tue May 17 17:39:47 2016 UTC vs.
Revision 2.14 by rschregle, Wed Apr 8 15:14:21 2020 UTC

# Line 28 | Line 28
28   #ifndef PMAPDATA_H
29     #define PMAPDATA_H
30  
31 <   #include "ray.h"  
31 >   #ifndef NIX
32 >      #if defined(_WIN32) || defined(_WIN64)
33 >         #define NIX 0
34 >      #else
35 >         #define NIX 1
36 >      #endif
37 >   #endif
38 >
39 >   #if (defined(PMAP_OOC) && !NIX)
40 >      #error "OOC currently only supported on NIX -- tuff luck."
41 >   #endif
42 >
43 >   #ifdef PMAP_CBDM
44 >      /* Enable photon primary hitpoints and incident directions (see struct
45 >       * PhotonPrimary below).  Note this will increase the size of photon
46 >       * primaries 9-fold (10-fold after alignment)!!! */
47 >      #define  PMAP_PRIMARYPOS
48 >      #define  PMAP_PRIMARYDIR
49 >   #endif
50 >
51 >   #include "ray.h"
52     #include "pmaptype.h"
53 +   #include "paths.h"
54     #include "lookup.h"
55     #include <stdint.h>
56  
# Line 39 | Line 60
60     typedef struct {
61        int16    srcIdx;              /* Index of emitting light source */
62                                      /* !!! REDUCED FROM 32 BITS !!! */
63 + #ifdef PMAP_PRIMARYDIR
64        int32    dir;                 /* Encoded ray direction */
65 < #ifdef PMAP_PRIMARYPOS      
65 > #endif
66 > #ifdef PMAP_PRIMARYPOS
67        float    pos [3];             /* Hit point */
68 < #endif      
68 > #endif
69     } PhotonPrimary;
70        
71     #define photonSrcIdx(pm, p)      ((pm)->primaries[(p)->primary].srcIdx)
# Line 50 | Line 73
73  
74  
75     /* Photon primary ray index type and limit */
76 <   typedef  uint32            PhotonPrimaryIdx;      
76 >   typedef  uint32            PhotonPrimaryIdx;
77     #define  PMAP_MAXPRIMARY   UINT32_MAX
78  
79     /* Macros for photon's generating subprocess field */
80 < #ifdef PMAP_OOC        
80 > #ifdef PMAP_OOC
81     #define  PMAP_PROCBITS  7
82 < #else            
83 <   #define  PMAP_PROCBITS  5  
82 > #else
83 >   #define  PMAP_PROCBITS  5
84   #endif
85     #define  PMAP_MAXPROC         (1 << PMAP_PROCBITS)
86     #define  PMAP_GETRAYPROC(r)   ((r) -> crtype >> 8)
# Line 89 | Line 112
112        };
113        
114   #ifdef PMAP_FLOAT_FLUX
115 <      COLOR                flux;          
115 >      COLOR                flux;
116   #else
117 <      COLR                 flux;          
117 >      COLR                 flux;
118   #endif
119        PhotonPrimaryIdx     primary;       /* Index to primary ray */
120     } Photon;
# Line 109 | Line 132
132     #define getPhotonFlux(p,f) colr_color(f, (p) -> flux)
133   #endif
134  
112
135    
136     /* Bias compensation history node */
137 <   typedef struct {                  
137 >   typedef struct {
138        COLOR irrad;
139        float weight;
140     } PhotonBiasCompNode;
# Line 130 | Line 152
152   #endif
153  
154  
155 +   /* Mean size of heapfile write buffer, in number of photons */
156 +   #define PMAP_HEAPBUFSIZE   1e6
157 +  
158 +   /* Mean idle time between heap locking attempts, in usec */
159 +   #define PMAP_HEAPBUFSLEEP  2e6
160 +  
161 +   /* Temporary filename for photon heaps */
162 +   #define PMAP_TMPFNAME      TEMPLATE
163 +   #define PMAP_TMPFNLEN      (TEMPLEN + 1)
164 +
165 +
166     typedef struct PhotonMap {
167        PhotonMapType  type;             /* See pmaptype.h */
168        char           *fileName;        /* Photon map file */
# Line 140 | Line 173
173         * ================================================================ */
174        FILE           *heap;            /* Unsorted photon heap prior to
175                                            construction of store */
176 +      char           heapFname [sizeof(PMAP_TMPFNAME)];      
177        Photon         *heapBuf;         /* Write buffer for above */
178        unsigned long  heapBufLen,       /* Current & max size of heapBuf */
179                       heapBufSize;
180 <      PhotonStorage  store;            /* Photon storage in spacee
181 <                                          subdividing data struct */            
180 >      PhotonStorage  store;            /* Photon storage in space
181 >                                          subdividing data struct */
182        
183        /* ================================================================
184         * PHOTON DISTRIBUTION STUFF
# Line 181 | Line 215
215                      
216        /* ================================================================
217         * BIAS COMPENSATION STUFF
218 <       * ================================================================ */      
218 >       * ================================================================ */
219        PhotonBiasCompNode   *biasCompHist;    /* Bias compensation history */
220        
221  
222        /* ================================================================
223         * STATISTIX
224 <       * ================================================================ */            
224 >       * ================================================================ */
225        unsigned long  totalGathered,    /* Total photons gathered */
226                       numDensity,       /* Num density estimates */
227                       numLookups,       /* Counters for short photon lookups */
# Line 235 | Line 269
269     #define isContribPmap(p)   ((p) -> type == PMAP_TYPE_CONTRIB)
270     #define isVolumePmap(p)    ((p) -> type == PMAP_TYPE_VOLUME)
271  
238   /* Mean size of heapfile write buffer, in number of photons */
239   #define PMAP_HEAPBUFSIZE   1e6
240  
241   /* Mean idle time between heap locking attempts, in usec */
242   #define PMAP_HEAPBUFSLEEP  2e6
243  
244   /* Shared memory file for parallelised photon distribution */
245 #if 0  
246   #define PMAP_SHMFNAME      "/mkpmap-%d"
247 #else
248   #define PMAP_SHMFNAME      "mkpmapXXXXXX"
249 #endif      
272  
273  
274     void initPhotonMap (PhotonMap *pmap, PhotonMapType t);
# Line 295 | Line 317
317        are placed search queue starting with the furthest photon at pmap ->
318        squeue.node, and pmap -> squeue.tail being the number actually found. */
319  
320 <   void find1Photon (PhotonMap *pmap, const RAY *ray, Photon *photon);
321 <   /* Finds single closest photon to ray -> rop with similar normal.
322 <      Returns NULL if none found. */
320 >   Photon *find1Photon (PhotonMap *pmap, const RAY *ray, Photon *photon);
321 >   /* Find single closest photon to ray -> rop with similar normal.
322 >      Return NULL if none found, else the supplied Photon* buffer,
323 >      indicating that it contains a valid photon. */
324  
325     void getPhoton (PhotonMap *pmap, PhotonIdx idx, Photon *photon);
326     /* Retrieve photon referenced by idx from pmap -> store */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines