added refraction computations to Scene::traceRay()

git-svn-id: svn://anubis/fart/trunk@376 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop committed 2010-10-11 16:14:13 +00:00
1 parent 931cde802e
commit 22f4a79671
4 files changed
+21 -8

No files matched your search

+5 -1
View File
@@ -42,7 +42,11 @@ class Material
void setReflectance(double reflectance) { m_reflectance = reflectance; }
double getReflectance() const { return m_reflectance; }
void setRefraction(double refraction) { m_refraction = refraction; }
void setRefraction(double refraction)
{
if (refraction > 0.0)
m_refraction = refraction;
}
double getRefraction() const { return m_refraction; }
void setTransparency(double t) { m_transparency = t; }
+1 -1
View File
@@ -77,7 +77,7 @@ class Vector
const double sinT2 = n * n * (1.0 - cosI * cosI);
if (sinT2 > 1.0)
return Vector(0.0, 0.0, 0.0);
return (*this) * n - target * (n + sqrt(1.0 - sinT2));
return (*this) * n - target * (n * cosI + sqrt(1.0 - sinT2));
}
Vector getPerpendicular() const