75 |
|
/* Assign to appropriate photon map type (deleting previously |
76 |
|
* loaded photon map of same type if necessary) */ |
77 |
|
if (pmaps [type]) { |
78 |
+ |
sprintf(errmsg, "multiple %s photon maps, dropping previous", |
79 |
+ |
pmapName [type]); |
80 |
+ |
error(WARNING, errmsg); |
81 |
|
deletePhotons(pmaps [type]); |
82 |
|
free(pmaps [type]); |
83 |
|
} |
84 |
|
pmaps [type] = pm; |
85 |
|
|
86 |
< |
/* Check for invalid density estimate bandwidth */ |
86 |
> |
/* Check for valid density estimate bandwidths */ |
87 |
> |
if ((pm -> minGather > 1 || pm -> maxGather > 1) && |
88 |
> |
(type == PMAP_TYPE_PRECOMP)) { |
89 |
> |
/* Force bwidth to 1 for precomputed pmap */ |
90 |
> |
error(WARNING, "ignoring bandwidth for precomp photon map"); |
91 |
> |
pm -> minGather = pm -> maxGather = 1; |
92 |
> |
} |
93 |
> |
|
94 |
> |
if ((pm -> maxGather > pm -> minGather) && |
95 |
> |
(type == PMAP_TYPE_VOLUME)) { |
96 |
> |
/* Biascomp for volume pmaps (see volumePhotonDensity() below) |
97 |
> |
is considered redundant, and there's probably no point in |
98 |
> |
recovering by using the lower bandwidth, since it's probably |
99 |
> |
not what the user wants, so bail out. */ |
100 |
> |
sprintf(errmsg, |
101 |
> |
"bias compensation is not available with %s photon maps", |
102 |
> |
pmapName [type]); |
103 |
> |
error(USER, errmsg); |
104 |
> |
} |
105 |
> |
|
106 |
|
if (pm -> maxGather > pm -> numPhotons) { |
107 |
|
error(WARNING, "adjusting density estimate bandwidth"); |
108 |
|
pm -> minGather = pm -> maxGather = pm -> numPhotons; |
109 |
< |
} |
109 |
> |
} |
110 |
|
} |
111 |
|
} |
112 |
|
|
203 |
|
if (r -> ro && islight(objptr(r -> ro -> omod) -> otype)) |
204 |
|
return; |
205 |
|
|
206 |
< |
find1Photon(preCompPmap, r, &p); |
207 |
< |
getPhotonFlux(&p, irrad); |
206 |
> |
if (find1Photon(preCompPmap, r, &p)) |
207 |
> |
/* p contains a found photon, so get its irradiance, otherwise it |
208 |
> |
* remains zero under the assumption all photons are too distant |
209 |
> |
* to contribute significantly */ |
210 |
> |
getPhotonFlux(&p, irrad); |
211 |
|
} |
212 |
|
|
213 |
|
|