The spica renderer
area.h
1 #ifdef _MSC_VER
2 #pragma once
3 #endif
4 
5 #ifndef _SPICA_AREA_LIGHT_H_
6 #define _SPICA_AREA_LIGHT_H_
7 
8 #include <vector>
9 #include <memory>
10 
11 #include "core/light.h"
12 #include "core/shape.h"
13 
14 namespace spica {
15 
19 class SPICA_EXPORTS AreaLight : public Light {
20 public:
21  AreaLight(const std::shared_ptr<Shape>& shape,
22  const Transform& lightToWorld,
23  const Spectrum& Lemit,
24  int numSamples = 1);
25 
26  AreaLight(RenderParams &params);
27 
28  virtual ~AreaLight();
29 
30  Spectrum L(const Interaction& pLight, const Vector3d& dir) const override;
31 
32  Spectrum sampleLi(const Interaction& isect, const Point2d& rands,
33  Vector3d* dir, double* pdf,
34  VisibilityTester* vis) const override;
35 
36  double pdfLi(const Interaction& pObj, const Vector3d& dir) const override;
37 
38  Spectrum sampleLe(const Point2d& rand1, const Point2d& rand2,
39  Ray* ray, Normal3d* nLight, double* pdfPos,
40  double* pdfDir) const override;
41  void pdfLe(const Ray& ray, const Normal3d& nLight, double* pdfPos,
42  double* pdfDir) const override;
43 
44  Spectrum power() const override;
45  Light* clone() const override;
46 
47  inline double area() const {
48  return shape_->area();
49  }
50 
51 protected:
52  std::shared_ptr<Shape> shape_;
53  const Spectrum Lemit_;
54 };
55 
56 SPICA_EXPORT_PLUGIN(AreaLight, "Area light");
57 
58 } // namespace spica
59 
60 #endif // _SPICA_AREA_LIGHT_H_
RGB spectrum.
Definition: spectrum.h:18
Ray class.
Definition: ray.h:24
The transformation operator class.
Definition: transform.h:17
Definition: renderparams.h:27
The base class for the lights.
Definition: light.h:80
Definition: visibility_tester.h:15
Definition: interaction.h:23
Area light class.
Definition: area.h:19