Added direct diffuse lighting.

This commit is contained in:
2016-12-26 19:14:21 -04:00
parent 9ad63d489a
commit d48e8e0ba3
11 changed files with 566 additions and 154 deletions

View File

@@ -4,17 +4,20 @@
#define TOL 1e-6
using std::abs;
using std::fabs;
using glm::dot;
bool Plane::intersect(Ray & r, float & t, vec3 & n) const {
bool Plane::intersect(Ray & r, float & t) const {
float d = dot(r.m_direction, m_normal);
if (abs(d) > TOL) {
if (fabs(d) > TOL) {
t = dot(m_normal, (m_point - r.m_origin)) / d;
n = vec3(m_normal);
return t >= 0.0f;
}
return false;
}
vec3 Plane::normal_at_int(Ray & r, float & t) const {
return vec3(m_normal);
}