00001 00005 #include "PointLight.h" 00006 00007 PointLight::PointLight(const Point& position, const Color& color) 00008 : position(position), color(color) 00009 { 00010 } 00011 00012 PointLight::~PointLight() 00013 { 00014 } 00015 00016 void PointLight::preprocess() 00017 { 00018 } 00019 00020 double PointLight::getLight(Color& light_color, Vector& light_direction, 00021 const RenderContext&, const Point& hitpos) const 00022 { 00023 light_color = color; 00024 Vector dir = position-hitpos; 00025 double len = dir.normalize(); 00026 light_direction = dir; 00027 return len; 00028 }