X-Git-Url: http://git.rohieb.name/MicroTrace.git/blobdiff_plain/49b259147e3ece2ed0aa4ad72b686970031cfc46..bb70135ac47130d65f8885b9c5fa9fa970b00cae:/PointLight.cxx diff --git a/PointLight.cxx b/PointLight.cxx index 1ce5f0b..7b8c8d2 100644 --- a/PointLight.cxx +++ b/PointLight.cxx @@ -21,7 +21,12 @@ PointLight::PointLight() bool PointLight::Illuminate(Ray& ray, Vec3f& intensity) { + float dist = ((ray.origin() + ray.direction() * ray.t()) - m_pos).norm(); + float c1 = 1, c2 = 0.5, c3 = 0; + float in = 1 / (c1 + c2*dist + c3*dist*dist); + + intensity = Vec3f(in, in, in); return false; }