/* RCSid $Id: pmapcontrib.h,v 2.5 2016/05/17 17:39:47 rschregle Exp $ */ /* ========================================================================= Photon map routines for precomputed light source contributions; these routines interface to mkpmap and rcontrib. Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) (c) Lucerne University of Applied Sciences and Arts, supported by the Swiss National Science Foundation (SNSF #147053, "Daylight Redirecting Components", SNSF #179067, "Light Fields for Spatio-Temporal Glare Assessment") ========================================================================= $Id: pmapcontrib.h,v 2.5 2016/05/17 17:39:47 rschregle Exp $ */ #ifndef PMAPCONTRIB_H #define PMAPCONTRIB_H #include "pmapdata.h" #ifndef MAXMODLIST #include "rcontrib.h" #endif /* Filename templates specific to precomputed contrib photon map: -- Binning parameters for rcontrib -- Wavelet compressed contributions (per modifier) */ /* #define PMAP_CONTRIB_PARAMSUFFIX "%s.rc" */ #define PMAP_CONTRIB_WAVELETSUFFIX "%s-%s.wvl" typedef struct { /* Contribution tagged by associated bin; expanded representation of below */ DCOLOR contrib; unsigned bin; } PmapBinnedContrib; typedef union { struct { /* Compressed RGBE representaton of the above for normalised binned contributions and wavelet coefficients, consisting of a 4-bit mantissa + sign per RGB, a common 5-bit exponent, and a 12-bit bin number. */ char r : 5; char g : 5; char b : 5; char e : 5; int16 bin: 12; }; uint32 rgbeBin; } PmapRGBEBin; MODCONT *addSourceModifier( LUTAB *srcContrib, unsigned *numSrcContrib, char *mod, char *binParm, char *binVal, int binCnt ); /* Add light source modifier mod to contribution lookup table srcContribs, and update numSrcContrib. Return initialised contribution data for this modifier. */ void addSourceModfile( LUTAB *srcContrib, unsigned *numSrcContrib, char *modFile, char *binParm, char *binVal, int binCnt ); /* Add light source modifiers from file modFile to contribution lookup * table srcContribs, and update numSrcContrib. */ void initPmapContrib (LUTAB *srcContrib); /* Set up photon map contributions (interface to rcmain.c) */ void distribPhotonContrib ( PhotonMap *pmap, LUTAB *srcContrib, unsigned numSrcContrib, unsigned numProc ); /* Emit photons with binned light source contributions, precompute their contributions and build photon map */ void photonContrib (PhotonMap *pmap, RAY *ray, COLOR irrad); /* Accumulate light source contributions in pmap -> srcMods from * photons, and return cumulative irradiance from density estimate */ #endif