00001 #include <gra/arch/PhotonMappingArch.h> 00002 00003 using namespace gra; 00004 00005 PhotonMappingArch::PhotonMappingArch(PhotonMappingArch::Params& params) 00006 : RayTrArch(params), 00007 _pPhotonTracing(new PhotonTracing(_pIntersector, 00008 params.maxRecDepth, 00009 params.minRecWeight)), 00010 _pCausticsEmittion(new Caustics(_pIntersector)), 00011 _numPhotonsPerLight(params.photonsPerLight), 00012 _mappingStrategy(params.mappingStrategy), 00013 _userDefinedBehaviour(params.userDefinedBehaviour) 00014 { 00015 if (_pRTReflection) delete _pRTReflection; 00016 00017 _pRTReflection = new PhotonMapping(new AutoPtr<LocalReflection>(new LocalReflection(NULL, NULL, NULL, LocalReflection::SD_GEOMETRY_SAMPLING, params.shadowRays, params.cacheDepth)), 00018 _background, 00019 _pIntersector, 00020 params.maxRecDepth, 00021 params.minRecWeight, 00022 REFR_AIR, 00023 params.nRaysDiff, 00024 params.nRaysSpec, 00025 params.nPhotonsFromMap, 00026 params.distPhotonsFromMap, 00027 params.preciseRecursionDepth, 00028 params.preciseDist, 00029 params.stages, 00030 params.importanceSampling, 00031 params.irradError, 00032 params.irradianceCaching); 00033 } 00034 00035 00036 Shader* PhotonMappingArch::createShader(void) 00037 { 00038 return new PhotonMapShader(_pPhotonTracing, 00039 _pCausticsEmittion, 00040 (PhotonMapping*) _pRTReflection, 00041 _pDefaultDiffuseBRDF, 00042 _pDefaultSpecularBRDF, 00043 _numPhotonsPerLight, 00044 _mappingStrategy, 00045 _userDefinedBehaviour); 00046 }