Added groundwork for area lights. Added irony-mode CDB.
This commit is contained in:
@@ -34,7 +34,7 @@ vec3 PathTracer::trace_ray(Ray & r, Scene * s, unsigned int rec_level) const {
|
||||
// Take the intersection point and the normal of the surface at that point.
|
||||
i_pos = r.m_origin + (t * r.m_direction);
|
||||
n = _f->normal_at_int(r, t);
|
||||
|
||||
|
||||
// Check if the material is not reflective/refractive.
|
||||
if (!_f->m_mat->m_refract) {
|
||||
// Calculate the direct lighting.
|
||||
@@ -42,13 +42,18 @@ vec3 PathTracer::trace_ray(Ray & r, Scene * s, unsigned int rec_level) const {
|
||||
// For every light source
|
||||
vis = true;
|
||||
|
||||
// Cast a shadow ray to determine visibility.
|
||||
sr = Ray(s->m_lights[l]->direction(i_pos), i_pos + n * BIAS);
|
||||
for (size_t f = 0; f < s->m_figures.size(); f++) {
|
||||
if (s->m_figures[f]->intersect(sr, _t) && _t < s->m_lights[l]->distance(i_pos)) {
|
||||
vis = false;
|
||||
break;
|
||||
if (s->m_lights[l]->light_type() == Light::INFINITESIMAL) {
|
||||
// Cast a shadow ray to determine visibility.
|
||||
sr = Ray(s->m_lights[l]->direction(i_pos), i_pos + n * BIAS);
|
||||
for (size_t f = 0; f < s->m_figures.size(); f++) {
|
||||
if (s->m_figures[f]->intersect(sr, _t) && _t < s->m_lights[l]->distance(i_pos)) {
|
||||
vis = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (s->m_lights[l]->light_type() == Light::AREA) {
|
||||
// Area lights not supported with Whitted ray tracing.
|
||||
vis = false;
|
||||
}
|
||||
|
||||
// Evaluate the shading model accounting for visibility.
|
||||
|
||||
Reference in New Issue
Block a user