Added groundwork for area lights. Added irony-mode CDB.

This commit is contained in:
Miguel Angel Astor Romero
2017-02-07 16:41:58 -04:00
parent fd1dc0febd
commit 944ae05db7
7 changed files with 76 additions and 19 deletions

View File

@@ -11,6 +11,8 @@ using glm::vec3;
class Light {
public:
typedef enum LIGHT_TYPE { INFINITESIMAL = 0, AREA } ltype_t;
vec3 m_position;
vec3 m_diffuse;
vec3 m_specular;
@@ -21,6 +23,45 @@ public:
virtual ~Light() { }
virtual ltype_t light_type() {
return type;
}
virtual vec3 direction(vec3 point) = 0;
virtual float distance(vec3 point) = 0;
virtual vec3 diffuse(vec3 normal, Ray & r, vec3 i_pos, Material & m) const = 0;
virtual vec3 specular(vec3 normal, Ray & r, vec3 i_pos, Material & m) const = 0;
protected:
ltype_t type;
};
class InfinitesimalLight: public Light {
public:
InfinitesimalLight(): Light() {
type = INFINITESIMAL;
}
InfinitesimalLight(vec3 _p, vec3 _d, vec3 _s): Light(_p, _d, _s) {
type = INFINITESIMAL;
}
virtual vec3 direction(vec3 point) = 0;
virtual float distance(vec3 point) = 0;
virtual vec3 diffuse(vec3 normal, Ray & r, vec3 i_pos, Material & m) const = 0;
virtual vec3 specular(vec3 normal, Ray & r, vec3 i_pos, Material & m) const = 0;
};
class AreaLight: public Light {
public:
AreaLight(): Light() {
type = AREA;
}
AreaLight(vec3 _p, vec3 _d, vec3 _s): Light(_p, _d, _s) {
type = AREA;
}
virtual vec3 direction(vec3 point) = 0;
virtual float distance(vec3 point) = 0;
virtual vec3 diffuse(vec3 normal, Ray & r, vec3 i_pos, Material & m) const = 0;