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,15 +13,25 @@ class Disk : public Plane {
public:
float m_radius;
Disk(Material * mat = NULL): Plane(mat), m_radius(1.0f) { }
Disk(Material * mat = NULL): Plane(mat), m_radius(1.0f) {
calculate_inv_area();
}
Disk(float x, float y, float z, float nx, float ny, float nz, float _r, Material * mat = NULL): Plane(x, y, z, nx, ny, nz, mat), m_radius(_r) { }
Disk(float x, float y, float z, float nx, float ny, float nz, float _r, Material * mat = NULL): Plane(x, y, z, nx, ny, nz, mat), m_radius(_r) {
calculate_inv_area();
}
Disk(vec3 _p, vec3 _n, float _r, Material * mat = NULL): Plane(_p, _n, mat), m_radius(_r) { }
Disk(vec3 _p, vec3 _n, float _r, Material * mat = NULL): Plane(_p, _n, mat), m_radius(_r) {
calculate_inv_area();
}
virtual ~Disk() { }
virtual bool intersect(Ray & r, float & t) const;
virtual vec3 sample_at_surface() const;
protected:
virtual void calculate_inv_area();
};