| 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 |
|
|
| 68 |
|
#define PMAP_MAXPRIMARY UINT32_MAX |
| 69 |
|
|
| 70 |
|
/* Macros for photon's generating subprocess field */ |
| 71 |
< |
#ifdef PMAP_OOC |
| 71 |
> |
#ifdef PMAP_OOC |
| 72 |
|
#define PMAP_PROCBITS 7 |
| 73 |
|
#else |
| 74 |
|
#define PMAP_PROCBITS 5 |
| 123 |
|
#define getPhotonFlux(p,f) colr_color(f, (p) -> flux) |
| 124 |
|
#endif |
| 125 |
|
|
| 112 |
– |
|
| 126 |
|
|
| 127 |
|
/* Bias compensation history node */ |
| 128 |
|
typedef struct { |
| 143 |
|
#endif |
| 144 |
|
|
| 145 |
|
|
| 146 |
+ |
/* Mean size of heapfile write buffer, in number of photons */ |
| 147 |
+ |
#define PMAP_HEAPBUFSIZE 1e6 |
| 148 |
+ |
|
| 149 |
+ |
/* Mean idle time between heap locking attempts, in usec */ |
| 150 |
+ |
#define PMAP_HEAPBUFSLEEP 2e6 |
| 151 |
+ |
|
| 152 |
+ |
/* Temporary filename for photon heaps */ |
| 153 |
+ |
#define PMAP_TMPFNAME TEMPLATE |
| 154 |
+ |
#define PMAP_TMPFNLEN (TEMPLEN + 1) |
| 155 |
+ |
|
| 156 |
+ |
|
| 157 |
|
typedef struct PhotonMap { |
| 158 |
|
PhotonMapType type; /* See pmaptype.h */ |
| 159 |
|
char *fileName; /* Photon map file */ |
| 164 |
|
* ================================================================ */ |
| 165 |
|
FILE *heap; /* Unsorted photon heap prior to |
| 166 |
|
construction of store */ |
| 167 |
+ |
char heapFname [sizeof(PMAP_TMPFNAME)]; |
| 168 |
|
Photon *heapBuf; /* Write buffer for above */ |
| 169 |
|
unsigned long heapBufLen, /* Current & max size of heapBuf */ |
| 170 |
|
heapBufSize; |
| 171 |
< |
PhotonStorage store; /* Photon storage in spacee |
| 171 |
> |
PhotonStorage store; /* Photon storage in space |
| 172 |
|
subdividing data struct */ |
| 173 |
|
|
| 174 |
|
/* ================================================================ |
| 260 |
|
#define isContribPmap(p) ((p) -> type == PMAP_TYPE_CONTRIB) |
| 261 |
|
#define isVolumePmap(p) ((p) -> type == PMAP_TYPE_VOLUME) |
| 262 |
|
|
| 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 |
| 263 |
|
|
| 264 |
|
|
| 265 |
|
void initPhotonMap (PhotonMap *pmap, PhotonMapType t); |