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

@@ -14,17 +14,28 @@ public:
vec3 m_point;
vec3 m_normal;
Plane(Material * mat = NULL): Figure(mat), m_point(vec3(0.0f)), m_normal(vec3(0.0f, 0.0f, 1.0f)) { }
Plane(Material * mat = NULL): Figure(mat), m_point(vec3(0.0f)), m_normal(vec3(0.0f, 0.0f, 1.0f)) {
calculate_inv_area();
}
Plane(float x, float y, float z, float nx, float ny, float nz, Material * mat = NULL): Figure(mat), m_point(vec3(x, y, z)), m_normal(normalize(vec3(nx, ny, nz))) { }
Plane(float x, float y, float z, float nx, float ny, float nz, Material * mat = NULL):
Figure(mat),
m_point(vec3(x, y, z)),
m_normal(normalize(vec3(nx, ny, nz)))
{
calculate_inv_area();
}
Plane(vec3 _p, vec3 _n, Material * mat = NULL): Figure(mat), m_point(_p), m_normal(normalize(_n)) { }
virtual ~Plane() { }
virtual bool intersect(Ray & r, float & t) const;
virtual vec3 normal_at_int(Ray & r, float & t) const;
virtual vec3 sample_at_surface() const;
protected:
virtual void calculate_inv_area();
};