#include <AreaLight.h>
Public Member Functions | |
AreaLight (const RGBColor &p, const Point3D &pos, const Vec3D &dir1, const Vec3D &dir2, const Vec3D &no=Vec3D(0)) | |
virtual | ~AreaLight () |
virtual LightSample | illuminate (const Point3D &p, const Vec3D &no) const |
virtual void | illuminate (const Point3D &p, const Vec3D &no, std::vector< LightSample > &samples, const int &noSamples, Scene *s=0) const |
virtual RGBColor | getEmitted (const Vec3D &dir, const Point3D &pos) const |
virtual Object * | getObject () |
virtual void | emitPhoton (Photon *photon) const |
Protected Member Functions | |
Point3D | getRandomPosition () const |
LightSample | getSample (const Point3D &p, const Vec3D &no, const Point3D &pos, Scene *s=0) const |
LightSample | getSample (const Point2D &uv, const Vec3D &no, const Point3D &pos, Scene *s=0) const |
Protected Attributes | |
Point3D | base |
Vec3D | span1 |
Vec3D | span2 |
Vec3D | normal |
float | area |
AffineObject | object |
LightMaterial | material |
Triangle | tri1 |
Triangle | tri2 |
std::vector < Primitive * > | triList |
float | aspect |
Friends | |
class | AreaLightSampler |
Definition at line 13 of file AreaLight.h.
rcrt::AreaLight::AreaLight | ( | const RGBColor & | p, | |
const Point3D & | pos, | |||
const Vec3D & | dir1, | |||
const Vec3D & | dir2, | |||
const Vec3D & | no = Vec3D(0) | |||
) |
Definition at line 10 of file AreaLight.cpp.
References area, aspect, rcrt::Matrix4D::identity(), material, rcrt::Light::minSamples, rcrt::Vec3D::norm(), span1, span2, tri1, tri2, and triList.
rcrt::AreaLight::~AreaLight | ( | ) | [virtual] |
Definition at line 34 of file AreaLight.cpp.
Point3D rcrt::AreaLight::getRandomPosition | ( | ) | const [protected] |
Definition at line 79 of file AreaLight.cpp.
References base, span1, and span2.
Referenced by illuminate().
LightSample rcrt::AreaLight::getSample | ( | const Point3D & | p, | |
const Vec3D & | no, | |||
const Point3D & | pos, | |||
Scene * | s = 0 | |||
) | const [inline, protected] |
Definition at line 51 of file AreaLight.h.
References area, rcrt::Scene::castShadows(), rcrt::Scene::isOccluded(), rcrt::Vec3D::norm(), normal, rcrt::Vec3D::normalize(), rcrt::Vec3D::normalized(), and rcrt::Light::power.
Referenced by getSample(), illuminate(), rcrt::AreaLightSampler::sample(), and rcrt::AreaLightSampler::subdivide().
LightSample rcrt::AreaLight::getSample | ( | const Point2D & | uv, | |
const Vec3D & | no, | |||
const Point3D & | pos, | |||
Scene * | s = 0 | |||
) | const [inline, protected] |
Definition at line 74 of file AreaLight.h.
References base, getSample(), span1, span2, rcrt::Point2D::x(), and rcrt::Point2D::y().
LightSample rcrt::AreaLight::illuminate | ( | const Point3D & | p, | |
const Vec3D & | no | |||
) | const [virtual] |
p | the point to illuminate | |
no | the normal at the point |
Implements rcrt::Light.
Definition at line 41 of file AreaLight.cpp.
References getRandomPosition(), and getSample().
void rcrt::AreaLight::illuminate | ( | const Point3D & | p, | |
const Vec3D & | no, | |||
std::vector< LightSample > & | samples, | |||
const int & | noSamples, | |||
Scene * | s = 0 | |||
) | const [virtual] |
p | the point to illuminate | |
no | the normal at the given point | |
samples | the vector to be filled with samples | |
noSamples | the number of samples to generate | |
s | (Optional) if used, it is up to the light to decide whether to cast shadow rays and what to use to test for occlusion. |
Implements rcrt::Light.
Definition at line 47 of file AreaLight.cpp.
References aspect, base, getSample(), rcrt::LightSample::setWeight(), span1, span2, and rcrt::LightSample::weight().
pos | the position on the light | |
dir | the direction in which to emit |
Implements rcrt::Light.
Definition at line 92 of file AreaLight.cpp.
References area, normal, and rcrt::Light::power.
Object * rcrt::AreaLight::getObject | ( | ) | [virtual] |
Reimplemented from rcrt::Light.
Definition at line 87 of file AreaLight.cpp.
References object.
void rcrt::AreaLight::emitPhoton | ( | Photon * | photon | ) | const [virtual] |
Emits a (random) photon.
photon | the photon in which to store initial position, direction and power |
Implements rcrt::Light.
Definition at line 103 of file AreaLight.cpp.
References area, base, rcrt::Photon::getDir(), normal, rcrt::Vec3D::normalized(), rcrt::Light::power, rcrt::Photon::setDir(), rcrt::Photon::setPos(), rcrt::Photon::setPower(), span1, and span2.
friend class AreaLightSampler [friend] |
Definition at line 15 of file AreaLight.h.
Point3D rcrt::AreaLight::base [protected] |
Definition at line 18 of file AreaLight.h.
Referenced by emitPhoton(), getRandomPosition(), getSample(), illuminate(), and rcrt::AreaLightSampler::sample().
Vec3D rcrt::AreaLight::span1 [protected] |
Definition at line 19 of file AreaLight.h.
Referenced by AreaLight(), emitPhoton(), getRandomPosition(), getSample(), illuminate(), and rcrt::AreaLightSampler::sample().
Vec3D rcrt::AreaLight::span2 [protected] |
Definition at line 20 of file AreaLight.h.
Referenced by AreaLight(), emitPhoton(), getRandomPosition(), getSample(), illuminate(), and rcrt::AreaLightSampler::sample().
Vec3D rcrt::AreaLight::normal [protected] |
Definition at line 21 of file AreaLight.h.
Referenced by emitPhoton(), getEmitted(), and getSample().
float rcrt::AreaLight::area [protected] |
Definition at line 22 of file AreaLight.h.
Referenced by AreaLight(), emitPhoton(), getEmitted(), and getSample().
AffineObject rcrt::AreaLight::object [protected] |
LightMaterial rcrt::AreaLight::material [protected] |
Triangle rcrt::AreaLight::tri1 [protected] |
Triangle rcrt::AreaLight::tri2 [protected] |
std::vector<Primitive*> rcrt::AreaLight::triList [protected] |
float rcrt::AreaLight::aspect [protected] |