00001
00002 #ifndef Y_PHOTONINTEGR_H
00003 #define Y_PHOTONINTEGR_H
00004
00005 #include <yafray_config.h>
00006 #include <core_api/environment.h>
00007 #include <core_api/material.h>
00008 #include <core_api/background.h>
00009 #include <core_api/light.h>
00010 #include <core_api/imagefilm.h>
00011 #include <yafraycore/tiledintegrator.h>
00012 #include <yafraycore/photon.h>
00013 #include <yafraycore/old_photonmap.h>
00014 #include <yafraycore/monitor.h>
00015 #include <yafraycore/ccthreads.h>
00016 #include <yafraycore/timer.h>
00017 #include <yafraycore/spectrum.h>
00018 #include <yafraycore/irradiancecache.h>
00019 #include <utilities/sample_utils.h>
00020 #include <integrators/integr_utils.h>
00021
00022
00023 __BEGIN_YAFRAY
00024
00025 class YAFRAYPLUGIN_EXPORT photonIntegrator_t: public tiledIntegrator_t
00026 {
00027 public:
00028 photonIntegrator_t(unsigned int dPhotons, unsigned int cPhotons, bool transpShad=false, int shadowDepth = 4, float dsRad = 0.1f, float cRad = 0.01f);
00029 ~photonIntegrator_t();
00030 virtual bool render(imageFilm_t *image);
00031 virtual bool preprocess();
00032 virtual colorA_t integrate(renderState_t &state, diffRay_t &ray) const;
00033 static integrator_t* factory(paraMap_t ¶ms, renderEnvironment_t &render);
00034 protected:
00035 color_t finalGathering(renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo) const;
00036 void sampleIrrad(renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo, irradSample_t &ir) const;
00037 color_t estimateOneDirect(renderState_t &state, const surfacePoint_t &sp, vector3d_t wo, const std::vector<light_t *> &lights, int d1, int n)const;
00038 bool renderIrradPass();
00039 bool progressiveTile(renderArea_t &a, int log_spacing, bool first, std::vector<irradSample_t> &samples, int threadID) const;
00040 bool progressiveTile2(renderArea_t &a, int log_spacing, bool first, std::vector<irradSample_t> &samples, int threadID) const;
00041 colorA_t fillIrradCache(renderState_t &state, float x, float y, bool first, std::vector<irradSample_t> &samples) const;
00042 colorA_t recFillCache(renderState_t &state, diffRay_t &c_ray, bool first, std::vector<irradSample_t> &samples) const;
00043
00044 background_t *background;
00045 bool trShad;
00046 bool finalGather, showMap;
00047 bool cacheIrrad;
00048 bool prepass;
00049 unsigned int nPhotons;
00050 unsigned int nCausPhotons;
00051 int sDepth, rDepth, maxBounces, nSearch, nCausSearch;
00052 int nPaths, gatherBounces;
00053 float dsRadius;
00054 float cRadius;
00055 float lookupRad;
00056 float gatherDist;
00057 photonMap_t diffuseMap, causticMap;
00058 photonMap_t radianceMap;
00059 pdf1D_t *lightPowerD;
00060 std::vector<light_t*> lights;
00061 irradianceCache_t irCache;
00062 BSDF_t allBSDFIntersect;
00063 friend class prepassWorker_t;
00064 };
00065
00066 __END_YAFRAY
00067
00068 #endif // Y_PHOTONINTEGR_H