src/rcrt/lights/DirLight.cpp

Go to the documentation of this file.
00001 #include "DirLight.h"
00002 
00003 namespace rcrt
00004 {
00005 
00006 DirLight::DirLight(const RGBColor& p, const Vec3D& dir):Light(p), direction(dir)
00007 {
00008 }
00009 
00010 DirLight::~DirLight()
00011 {
00012 }
00013 
00014 const Vec3D& DirLight::getDirection() const
00015 {
00016         return direction;
00017 }
00018 
00019 LightSample DirLight::illuminate(const Point3D& p, const Vec3D& no) const
00020 {               
00021         float angle = direction * no;
00022         if(angle > 0.0f)
00023                 return LightSample(0,direction*-1,std::numeric_limits<float>::infinity(),0);
00024         
00025         float dist = std::numeric_limits<float>::infinity();
00026         
00027         return LightSample(1, direction, dist, power*angle);
00028 }
00029 
00030 void DirLight::illuminate(const Point3D& p, const Vec3D& no, std::vector<LightSample>& samples,
00031                         const int& noSamples, Scene* s) const
00032 {
00033         samples.push_back(illuminate(p,no));
00034 }
00035 
00036 RGBColor DirLight::getEmitted(const Vec3D& dir, const Point3D& pos) const
00037 {
00038         return power;
00039 }
00040 
00041 void DirLight::emitPhoton(Photon* photon) const
00042 {
00043         //TODO
00044 }
00045 
00046 }

Generated on Thu Jan 31 19:26:19 2008 for RenderingCompetitionRayTracer by  doxygen 1.5.3