2017-01-02 04:23:48 -04:00
|
|
|
#include <limits>
|
|
|
|
|
|
2017-01-01 20:57:35 -04:00
|
|
|
#include <glm/glm.hpp>
|
|
|
|
|
#include <glm/gtc/constants.hpp>
|
|
|
|
|
|
|
|
|
|
#include "directional_light.hpp"
|
|
|
|
|
|
2017-01-02 04:23:48 -04:00
|
|
|
using std::numeric_limits;
|
2017-01-01 20:57:35 -04:00
|
|
|
using glm::pi;
|
|
|
|
|
using glm::reflect;
|
|
|
|
|
using glm::dot;
|
2017-01-02 00:23:04 -04:00
|
|
|
using glm::pow;
|
|
|
|
|
using glm::max;
|
2017-01-01 20:57:35 -04:00
|
|
|
|
2017-01-02 04:23:48 -04:00
|
|
|
inline vec3 DirectionalLight::direction(vec3 point) {
|
|
|
|
|
return m_position;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline float DirectionalLight::distance(vec3 point) {
|
|
|
|
|
return numeric_limits<float>::max();
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-11 14:51:21 -04:00
|
|
|
vec3 DirectionalLight::diffuse(vec3 normal, Ray & r, vec3 i_pos, Material & m) const {
|
2017-01-12 13:38:42 -04:00
|
|
|
return m.m_brdf->diffuse(m_position, normal, r, m_diffuse);
|
2017-01-05 06:16:14 -04:00
|
|
|
}
|
|
|
|
|
|
2017-01-11 14:51:21 -04:00
|
|
|
vec3 DirectionalLight::specular(vec3 normal, Ray & r, vec3 i_pos, Material & m) const {
|
2017-01-12 13:38:42 -04:00
|
|
|
return m.m_brdf->specular(m_position, normal, r, m_specular, m.m_shininess);
|
2017-01-01 20:57:35 -04:00
|
|
|
}
|