14 |
|
|
15 |
|
#include "pmapdata.h" /* Includes pmapooc.h */ |
16 |
|
#include "source.h" |
17 |
+ |
#include "otspecial.h" |
18 |
|
#include "oocsort.h" |
19 |
|
#include "oocbuild.h" |
20 |
|
|
215 |
|
DOT(filtData->norm, photon->norm) <= PMAP_NORM_TOL * 127 * frandom()) |
216 |
|
return 0; |
217 |
|
|
218 |
< |
if (isContribPmap(pmap) && pmap -> srcContrib) { |
219 |
< |
/* Lookup in contribution photon map */ |
220 |
< |
OBJREC *srcMod; |
221 |
< |
const int srcIdx = photonSrcIdx(pmap, photon); |
218 |
> |
if (isContribPmap(pmap)) { |
219 |
> |
/* Lookup in contribution photon map; filter according to emitting |
220 |
> |
* light source if contrib list set, else accept all */ |
221 |
> |
|
222 |
> |
if (pmap -> srcContrib) { |
223 |
> |
OBJREC *srcMod; |
224 |
> |
const int srcIdx = photonSrcIdx(pmap, photon); |
225 |
|
|
226 |
< |
if (srcIdx < 0 || srcIdx >= nsources) |
227 |
< |
error(INTERNAL, "invalid light source index in photon map"); |
226 |
> |
if (srcIdx < 0 || srcIdx >= nsources) |
227 |
> |
error(INTERNAL, "invalid light source index in photon map"); |
228 |
|
|
229 |
< |
srcMod = findmaterial(source [srcIdx].so); |
229 |
> |
srcMod = findmaterial(source [srcIdx].so); |
230 |
|
|
231 |
< |
/* Reject photon if contributions from light source which emitted it |
232 |
< |
* are not sought */ |
233 |
< |
if (!lu_find(pmap -> srcContrib, srcMod -> oname) -> data) |
234 |
< |
return 0; |
231 |
> |
/* Reject photon if contributions from light source which emitted |
232 |
> |
* it are not sought */ |
233 |
> |
if (!lu_find(pmap -> srcContrib, srcMod -> oname) -> data) |
234 |
> |
return 0; |
235 |
> |
} |
236 |
|
|
237 |
|
/* Reject non-caustic photon if lookup for caustic contribs */ |
238 |
|
if (pmap -> lookupCaustic && !photon -> caustic) |
257 |
|
|
258 |
|
/* Set up filter callback */ |
259 |
|
filtData.pmap = pmap; |
260 |
< |
VCOPY(n, norm); |
261 |
< |
filtData.norm = n; |
260 |
> |
if (norm) |
261 |
> |
VCOPY(n, norm); |
262 |
> |
filtData.norm = norm ? n : NULL; |
263 |
|
filt.data = &filtData; |
264 |
|
filt.func = OOC_FilterPhoton; |
265 |
|
|
288 |
|
|
289 |
|
/* Set up filter callback */ |
290 |
|
filtData.pmap = pmap; |
291 |
< |
VCOPY(n, norm); |
292 |
< |
filtData.norm = n; |
291 |
> |
if (norm) |
292 |
> |
VCOPY(n, norm); |
293 |
> |
filtData.norm = norm ? n : NULL; |
294 |
|
filt.data = &filtData; |
295 |
|
filt.func = OOC_FilterPhoton; |
296 |
|
|