00001
00002
00003 #ifndef __PHOTON_MAPPING_ARCHITECTURE_H
00004 #define __PHOTON_MAPPING_ARCHITECTURE_H
00005
00006 #include <gra/arch/RayTrArch.h>
00007 #include <gra/render/RTRender.h>
00008 #include <gra/shader/PhotonMapShader.h>
00009 #include <gra/reflection/Caustics.h>
00010
00011 using namespace esg;
00012
00013 namespace gra {
00014
00019 class GRA_EXPORT PhotonMappingArch : public RayTrArch {
00020 public:
00021 struct Params : public RayTrArch::Params {
00022 unsigned nRaysDiff;
00023 unsigned nRaysSpec;
00024 unsigned photonsPerLight;
00025 PhotonMapShader::Mapping mappingStrategy;
00026 bool userDefinedBehaviour;
00027 unsigned irradError;
00028 unsigned nPhotonsFromMap;
00029 float distPhotonsFromMap;
00030 unsigned preciseRecursionDepth;
00031 double preciseDist;
00032 int stages;
00033 bool importanceSampling;
00034 bool irradianceCaching;
00035
00036 Params()
00037 : nRaysDiff(1),
00038 nRaysSpec(1),
00039 photonsPerLight(50),
00040 mappingStrategy(PhotonMapShader::MAPS_PER_SHAPE),
00041 userDefinedBehaviour(false),
00042 irradError(10),
00043 nPhotonsFromMap(20),
00044 distPhotonsFromMap(sqrt(FLT_MAX-1)),
00045 preciseRecursionDepth(2),
00046 preciseDist(0.05),
00047 stages(PhotonMapping::GLOBAL_ILLUMINATION),
00048 importanceSampling(true),
00049 irradianceCaching(true) {}
00050 };
00051
00052 protected:
00053 PhotonTracing * _pPhotonTracing;
00054 Caustics * _pCausticsEmittion;
00055 unsigned _numPhotonsPerLight;
00056 PhotonMapShader::Mapping _mappingStrategy;
00057 bool _userDefinedBehaviour;
00058
00059 public:
00065 PhotonMappingArch (PhotonMappingArch::Params& params);
00066
00070 virtual ~PhotonMappingArch () {
00071 if (_pPhotonTracing) delete _pPhotonTracing;
00072 if (_pCausticsEmittion) delete _pCausticsEmittion;
00073 }
00074
00078 virtual Shader* createShader (void);
00079 };
00080
00081 }
00082
00083 #endif // __PHOTON_MAPPING_ARCHITECTURE