28 |
|
#ifndef PMAPDATA_H |
29 |
|
#define PMAPDATA_H |
30 |
|
|
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 |
+ |
|
44 |
|
#include "ray.h" |
45 |
|
#include "pmaptype.h" |
46 |
+ |
#include "paths.h" |
47 |
|
#include "lookup.h" |
48 |
|
#include <stdint.h> |
49 |
|
|
53 |
|
typedef struct { |
54 |
|
int16 srcIdx; /* Index of emitting light source */ |
55 |
|
/* !!! REDUCED FROM 32 BITS !!! */ |
56 |
+ |
#ifdef PMAP_PRIMARYDIR |
57 |
|
int32 dir; /* Encoded ray direction */ |
58 |
+ |
#endif |
59 |
|
#ifdef PMAP_PRIMARYPOS |
60 |
|
float pos [3]; /* Hit point */ |
61 |
|
#endif |
70 |
|
#define PMAP_MAXPRIMARY UINT32_MAX |
71 |
|
|
72 |
|
/* Macros for photon's generating subprocess field */ |
73 |
< |
#ifdef PMAP_OOC |
73 |
> |
#ifdef PMAP_OOC |
74 |
|
#define PMAP_PROCBITS 7 |
75 |
|
#else |
76 |
|
#define PMAP_PROCBITS 5 |
125 |
|
#define getPhotonFlux(p,f) colr_color(f, (p) -> flux) |
126 |
|
#endif |
127 |
|
|
112 |
– |
|
128 |
|
|
129 |
|
/* Bias compensation history node */ |
130 |
|
typedef struct { |
145 |
|
#endif |
146 |
|
|
147 |
|
|
148 |
+ |
/* Mean size of heapfile write buffer, in number of photons */ |
149 |
+ |
#define PMAP_HEAPBUFSIZE 1e6 |
150 |
+ |
|
151 |
+ |
/* Mean idle time between heap locking attempts, in usec */ |
152 |
+ |
#define PMAP_HEAPBUFSLEEP 2e6 |
153 |
+ |
|
154 |
+ |
/* Temporary filename for photon heaps */ |
155 |
+ |
#define PMAP_TMPFNAME TEMPLATE |
156 |
+ |
#define PMAP_TMPFNLEN (TEMPLEN + 1) |
157 |
+ |
|
158 |
+ |
|
159 |
|
typedef struct PhotonMap { |
160 |
|
PhotonMapType type; /* See pmaptype.h */ |
161 |
|
char *fileName; /* Photon map file */ |
166 |
|
* ================================================================ */ |
167 |
|
FILE *heap; /* Unsorted photon heap prior to |
168 |
|
construction of store */ |
169 |
+ |
char heapFname [sizeof(PMAP_TMPFNAME)]; |
170 |
|
Photon *heapBuf; /* Write buffer for above */ |
171 |
|
unsigned long heapBufLen, /* Current & max size of heapBuf */ |
172 |
|
heapBufSize; |
173 |
< |
PhotonStorage store; /* Photon storage in spacee |
173 |
> |
PhotonStorage store; /* Photon storage in space |
174 |
|
subdividing data struct */ |
175 |
|
|
176 |
|
/* ================================================================ |
262 |
|
#define isContribPmap(p) ((p) -> type == PMAP_TYPE_CONTRIB) |
263 |
|
#define isVolumePmap(p) ((p) -> type == PMAP_TYPE_VOLUME) |
264 |
|
|
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 |
265 |
|
|
266 |
|
|
267 |
|
void initPhotonMap (PhotonMap *pmap, PhotonMapType t); |