sphere and disk area lights mostly ready (I think :S).

This commit is contained in:
2017-02-09 23:37:40 -04:00
parent 944ae05db7
commit 0cdc7c46ca
30 changed files with 512 additions and 83 deletions

View File

@@ -13,7 +13,7 @@ class Figure {
public:
Material * m_mat;
Figure(Material * mat = NULL) {
Figure(Material * mat = NULL): m_inv_area(0.0f) {
m_mat = mat == NULL ? new Material() : mat;
}
@@ -21,8 +21,18 @@ public:
delete m_mat;
}
virtual float pdf() const {
return m_inv_area;
}
virtual bool intersect(Ray & r, float & t) const = 0;
virtual vec3 normal_at_int(Ray & r, float & t) const = 0;
virtual vec3 sample_at_surface() const = 0;
protected:
float m_inv_area;
virtual void calculate_inv_area() = 0;
};
#endif