projects
/
MicroTrace.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a813725
)
drand() needs <cstdlib>
author
Roland Hieber
<rohieb@rohieb.name>
Sun, 31 Jan 2010 03:45:55 +0000
(
04:45
+0100)
committer
Roland Hieber
<rohieb@rohieb.name>
Sun, 31 Jan 2010 03:45:55 +0000
(
04:45
+0100)
QuadAreaLight.cxx
patch
|
blob
|
history
diff --git
a/QuadAreaLight.cxx
b/QuadAreaLight.cxx
index
ed64910
..
24e0b8e
100644
(file)
--- a/
QuadAreaLight.cxx
+++ b/
QuadAreaLight.cxx
@@
-1,4
+1,5
@@
#include <cmath>
#include <cmath>
+#include <cstdlib>
#include "QuadAreaLight.hxx"
#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 = m_e1.cross(m_e2);
m_area = m_n.norm();
- m_n.normalize();
+ m_n.normalize();
}
QuadAreaLight::QuadAreaLight()
}
QuadAreaLight::QuadAreaLight()
@@
-36,21
+37,21
@@
QuadAreaLight::~QuadAreaLight()
bool
QuadAreaLight::Illuminate(Ray& shadow_ray, Vec3f& intensity)
{
bool
QuadAreaLight::Illuminate(Ray& shadow_ray, Vec3f& intensity)
{
- // generate random factors
+ // generate random factors
float xi1 = drand48();
float xi2 = drand48();
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();
// 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;
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));
// squared falloff and projected area
intensity = m_intensity * ( m_area * cosN / ( dist*dist));
This page took
0.038097 seconds
and
4
git commands to generate.