The spica renderer
hierarchical.h
1 #ifdef _MSC_VER
2 #pragma once
3 #endif
4 
5 #ifndef _SPICA_SUBSURFACE_INTEGRATOR_H_
6 #define _SPICA_SUBSURFACE_INTEGRATOR_H_
7 
8 #include "../core/common.h"
9 #include "../core/forward_decl.h"
10 #include "../core/bounds3d.h"
11 #include "../core/interaction.h"
12 
13 #include "integrator.h"
14 #include "photon_map.h"
15 
16 namespace spica {
17 
21 class Hierarchy {
22 public:
23  // Public methods
24  Hierarchy(double radius, double maxError);
25  ~Hierarchy();
26 
27  // Private methods
28  Spectrum irradiance(const SurfaceInteraction& po) const;
29 
30  void samplePoints(const Scene& scene, const Point3d& pCamera);
31 
32  void buildOctree(const Scene& scene,
33  const RenderParams& params,
34  Sampler& sampler);
35 
36 private:
37  // Private methods
38  Spectrum Li(const Scene& scene,
39  const RenderParams& params,
40  const Ray& ray,
41  Sampler& sampler,
42  MemoryArena& arena,
43  int depth) const;
44 
45  // Private fields
46  std::vector<Interaction> points_;
47 
48  class Octree;
49  std::unique_ptr<Octree> octree_;
50  double radius_;
51  std::unique_ptr<PhotonMap> photonmap_;
52 };
53 
57 class SPICA_EXPORTS HierarchicalIntegrator : public SamplerIntegrator {
58 public:
59  // Public methods
60  HierarchicalIntegrator(const std::shared_ptr<const Camera>& camera,
61  const std::shared_ptr<Sampler>& smapler,
62  double maxError = 0.05);
63  ~HierarchicalIntegrator();
64 
65  void initialize(const Scene& scene,
66  const RenderParams& params,
67  Sampler& sampler) override;
68 
69  void loopStarted(const Scene& scene,
70  const RenderParams& params,
71  Sampler& sampler) override;
72 
73  Spectrum Li(const Scene& scene,
74  const RenderParams& params,
75  const Ray& ray,
76  Sampler& sampler,
77  MemoryArena& arena,
78  int depth = 0) const override;
79 
80 private:
81  std::unique_ptr<Hierarchy> hi_;
82 
83 }; // class HierarchicalIntegrator
84 
85 } // namespace spica
86 
87 #endif // _SPICA_SUBSURFACE_INTEGRATOR_H_