| 1 |
+ |
#ifndef lint |
| 2 |
+ |
static const char RCSid[] = "$Id$"; |
| 3 |
+ |
#endif |
| 4 |
+ |
|
| 5 |
|
/* |
| 6 |
|
================================================================== |
| 7 |
|
Photon map interface to RADIANCE ambient calculation |
| 8 |
|
|
| 9 |
|
Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) |
| 10 |
|
(c) Fraunhofer Institute for Solar Energy Systems, |
| 11 |
< |
Lucerne University of Applied Sciences & Arts |
| 11 |
> |
(c) Lucerne University of Applied Sciences and Arts, |
| 12 |
> |
supported by the Swiss National Science Foundation (SNSF, #147053) |
| 13 |
|
================================================================== |
| 14 |
|
|
| 15 |
|
$Id$ |
| 30 |
|
PhotonMap *pmap = contribPhotonMapping ? contribPmap |
| 31 |
|
: preCompPmap ? preCompPmap |
| 32 |
|
: globalPmap; |
| 33 |
< |
|
| 33 |
> |
|
| 34 |
|
/* Get photon irradiance either via 1 ambient bounce (final |
| 35 |
|
* gather) if ambounce > 0, or directly if ambounce < 0. */ |
| 36 |
|
if (pmap && (rdepth || ambounce < 0)) { |
| 62 |
|
/* Handle precedence in case of multiple photon maps: contrib > caustic */ |
| 63 |
|
PhotonMap *pmap = contribPhotonMapping ? contribPmap : causticPmap; |
| 64 |
|
|
| 65 |
< |
/* Get caustic photon density estimate only at primary rays */ |
| 66 |
< |
if (pmap && !rdepth) { |
| 65 |
> |
/* Get caustic photon density estimate at primary rays or when |
| 66 |
> |
* filling in ambient rays that have no global photon map to use */ |
| 67 |
> |
if (pmap && (!rdepth || !globalPmap & !contribPmap & !preCompPmap)) { |
| 68 |
|
/* Temporarily factor ambient value into ray coefficient |
| 69 |
|
* (required for contribution photon map) */ |
| 70 |
|
copycolor(rcoef, r -> rcoef); |
| 71 |
|
multcolor(r -> rcoef, aval); |
| 72 |
|
|
| 73 |
|
/* Set caustic flag and get photon irradiance via callback */ |
| 74 |
< |
pmap -> lookupFlags = PMAP_CAUST_BIT; |
| 74 |
> |
pmap -> lookupCaustic = 1; |
| 75 |
|
(pmap -> lookup)(pmap, r, photonIrrad); |
| 76 |
|
|
| 77 |
|
/* Factor irradiance into ambient value and restore ray coeficient */ |