00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if defined(_MSC_VER)
00025 #pragma once
00026 #endif
00027
00028 #ifndef PBRT_LIGHTS_DIFFUSE_H
00029 #define PBRT_LIGHTS_DIFFUSE_H
00030
00031
00032 #include "pbrt.h"
00033 #include "light.h"
00034 #include "primitive.h"
00035
00036
00037 class DiffuseAreaLight : public AreaLight {
00038 public:
00039
00040 DiffuseAreaLight(const Transform &light2world,
00041 const Spectrum &Le, int ns, const Reference<Shape> &shape);
00042 ~DiffuseAreaLight();
00043 Spectrum L(const Point &p, const Normal &n, const Vector &w) const {
00044 return Dot(n, w) > 0.f ? Lemit : 0.f;
00045 }
00046 Spectrum Power(const Scene *) const;
00047 bool IsDeltaLight() const { return false; }
00048 float Pdf(const Point &, const Vector &) const;
00049 Spectrum Sample_L(const Point &P, float pEpsilon, const LightSample &ls, float time,
00050 Vector *wo, float *pdf, VisibilityTester *visibility) const;
00051 Spectrum Sample_L(const Scene *scene, const LightSample &ls, float u1, float u2,
00052 float time, Ray *ray, Normal *Ns, float *pdf) const;
00053 protected:
00054
00055 Spectrum Lemit;
00056 ShapeSet *shapeSet;
00057 float area;
00058 };
00059
00060
00061 AreaLight *CreateDiffuseAreaLight(const Transform &light2world, const ParamSet ¶mSet,
00062 const Reference<Shape> &shape);
00063
00064 #endif // PBRT_LIGHTS_DIFFUSE_H