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_PROJECTION_H
00029 #define PBRT_LIGHTS_PROJECTION_H
00030
00031
00032 #include "pbrt.h"
00033 #include "light.h"
00034 #include "shape.h"
00035 #include "mipmap.h"
00036
00037
00038 class ProjectionLight : public Light {
00039 public:
00040
00041 ProjectionLight(const Transform &light2world, const Spectrum &intensity,
00042 const string &texname, float fov);
00043 ~ProjectionLight();
00044 Spectrum Sample_L(const Point &p, float pEpsilon, const LightSample &ls, float time,
00045 Vector *wi, float *pdf, VisibilityTester *vis) const;
00046 bool IsDeltaLight() const { return true; }
00047 Spectrum Projection(const Vector &w) const;
00048 Spectrum Power(const Scene *) const;
00049 Spectrum Sample_L(const Scene *scene, const LightSample &ls, float u1, float u2,
00050 float time, Ray *ray, Normal *Ns, float *pdf) const;
00051 float Pdf(const Point &, const Vector &) const;
00052 private:
00053
00054 MIPMap<RGBSpectrum> *projectionMap;
00055 Point lightPos;
00056 Spectrum Intensity;
00057 Transform lightProjection;
00058 float hither, yon;
00059 float screenX0, screenX1, screenY0, screenY1;
00060 float cosTotalWidth;
00061 };
00062
00063
00064 ProjectionLight *CreateProjectionLight(const Transform &light2world,
00065 const ParamSet ¶mSet);
00066
00067 #endif // PBRT_LIGHTS_PROJECTION_H