00001 #include <gra/reflection/Caustics.h>
00002 #include <esg/visitor/PhotonMapBhvVisitor.h>
00003
00004 using namespace gra;
00005
00006 void Caustics::_illuminate(PointEnv& surr,
00007 unsigned actDepth,
00008 bool firstObjHit,
00009 Color3f& unused)
00010 {
00011
00012
00013
00014
00015
00016
00017 _check_point_of_intersection(surr);
00018
00019
00020
00021
00022
00023
00024
00025 MatVisitor* pMatVisitor = _check_material(surr.pVisitableObj, firstObjHit);
00026
00027 const Vector3& refl = pMatVisitor->reflection();
00028 const Vector3& transp = pMatVisitor->transparency();
00029 if (refl.x || refl.y || refl.z || transp.x || transp.y || transp.z) {
00030
00031
00032
00033 if (actDepth < _maxDepth)
00034 _cast_secondary_rays(surr, actDepth, firstObjHit,
00035 unused, *pMatVisitor);
00036 } else {
00037
00038
00039
00040 _store_photon(surr, true);
00041 }
00042 }
00043
00044
00045
00046