From d09f84c0fc495347e9f73c362819f5b726b23dda Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Sun, 31 Jan 2010 04:45:55 +0100 Subject: [PATCH] drand() needs --- QuadAreaLight.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/QuadAreaLight.cxx b/QuadAreaLight.cxx index ed64910..24e0b8e 100644 --- a/QuadAreaLight.cxx +++ b/QuadAreaLight.cxx @@ -1,4 +1,5 @@ #include +#include #include "QuadAreaLight.hxx" @@ -16,7 +17,7 @@ QuadAreaLight::QuadAreaLight(Scene* scene, { m_n = m_e1.cross(m_e2); m_area = m_n.norm(); - m_n.normalize(); + m_n.normalize(); } QuadAreaLight::QuadAreaLight() @@ -36,21 +37,21 @@ QuadAreaLight::~QuadAreaLight() bool QuadAreaLight::Illuminate(Ray& shadow_ray, Vec3f& intensity) { - // generate random factors + // generate random factors float xi1 = drand48(); float xi2 = drand48(); - + // bilinear interpolation of position Vec3f pos = m_p0 + m_e1 * xi1 + m_e2* xi2; // direction of shadow ray Vec3f dir = pos-shadow_ray.origin(); - + float dist = dir.norm(); float cosN = (dir.dot(m_n)) / dist; if(cosN <= 0.0f ) return false; - + // squared falloff and projected area intensity = m_intensity * ( m_area * cosN / ( dist*dist)); -- 2.20.1