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/bounds3d.h"
10 #include "core/interaction.h"
11 
12 #include "core/integrator.h"
13 #include "../photon_map.h"
14 
15 namespace spica {
16 
20 class Hierarchy {
21 public:
22  // Public methods
23  Hierarchy(double radius, double maxError);
24  ~Hierarchy();
25 
26  // Private methods
27  Spectrum irradiance(const SurfaceInteraction& po) const;
28 
29  void samplePoints(const Scene& scene, const Point3d& pCamera);
30 
31  void buildOctree(const Scene& scene,
32  RenderParams& params,
33  Sampler& sampler);
34 
35 private:
36  // Private methods
37  Spectrum Li(const Scene& scene,
38  RenderParams& params,
39  const Ray& ray,
40  Sampler& sampler,
41  MemoryArena& arena,
42  int depth) const;
43 
44  // Private fields
45  std::vector<Interaction> points_;
46 
47  class Octree;
48  std::unique_ptr<Octree> octree_;
49  double radius_;
50  std::unique_ptr<PhotonMap> photonmap_;
51 };
52 
56 class SPICA_EXPORTS HierarchicalIntegrator : public SamplerIntegrator {
57 public:
58  // Public methods
59  HierarchicalIntegrator(const std::shared_ptr<Sampler>& smapler,
60  double maxError = 0.05);
61 
63 
65 
66  void initialize(const std::shared_ptr<const Camera> &camera,
67  const Scene& scene,
68  RenderParams& params,
69  Sampler& sampler) override;
70 
71  void loopStarted(const std::shared_ptr<const Camera> &camera,
72  const Scene& scene,
73  RenderParams& params,
74  Sampler& sampler) override;
75 
76  Spectrum Li(const Scene& scene,
77  RenderParams& params,
78  const Ray& ray,
79  Sampler& sampler,
80  MemoryArena& arena,
81  int depth = 0) const override;
82 
83 private:
84  std::unique_ptr<Hierarchy> hi_;
85  double maxError_;
86 
87 }; // class HierarchicalIntegrator
88 
89 SPICA_EXPORT_PLUGIN(HierarchicalIntegrator, "BSSRDF hierarchical integration.");
90 
91 } // namespace spica
92 
93 #endif // _SPICA_SUBSURFACE_INTEGRATOR_H_
Definition: hierarchical.cc:61
Definition: interaction.h:68
Random sampler class.
Definition: sampler.h:24
RGB spectrum.
Definition: spectrum.h:18
Ray class.
Definition: ray.h:24
Definition: renderparams.h:27
Definition: hierarchical.h:20
The sampler integrator interface.
Definition: integrator.h:45
Scene provides the interface for scene graph.
Definition: scene.h:23
Irradiance integrator for subsurface scattering objects.
Definition: hierarchical.h:56