@@ -112,8 +112,8 @@ void add_sample(
112112template <bool FLAT_SHADING, std::size_t N, typename T, typename Color>
113113void walk (
114114 const bool camera_path,
115- const Scene<N, T, Color>& scene,
116- const LightDistribution<N, T, Color>& light_distribution,
115+ const Scene<N, T, Color>* const scene,
116+ const LightDistribution<N, T, Color>* const light_distribution,
117117 Color beta,
118118 const T pdf,
119119 numerical::Ray<N, T> ray,
@@ -128,7 +128,7 @@ void walk(
128128 std::tie (surface, normals) = [&]
129129 {
130130 static constexpr std::optional<numerical::Vector<N, T>> GEOMETRIC_NORMAL;
131- return com::scene_intersect<FLAT_SHADING, N, T, Color>(scene, GEOMETRIC_NORMAL, ray);
131+ return com::scene_intersect<FLAT_SHADING, N, T, Color>(* scene, GEOMETRIC_NORMAL, ray);
132132 }();
133133
134134 T pdf_forward = pdf;
@@ -140,8 +140,8 @@ void walk(
140140 if (camera_path)
141141 {
142142 path->emplace_back (
143- std::in_place_type<vertex::InfiniteLight<N, T, Color>>, & scene,
144- & light_distribution, ray, beta, pdf_forward);
143+ std::in_place_type<vertex::InfiniteLight<N, T, Color>>, scene,
144+ light_distribution, ray, beta, pdf_forward);
145145 }
146146 return ;
147147 }
@@ -170,14 +170,14 @@ void walk(
170170
171171 ray = {surface.point (), sample->l };
172172 std::tie (surface, normals) =
173- com::scene_intersect<FLAT_SHADING, N, T, Color>(scene, normals.geometric , ray);
173+ com::scene_intersect<FLAT_SHADING, N, T, Color>(* scene, normals.geometric , ray);
174174 }
175175}
176176
177177template <bool FLAT_SHADING, std::size_t N, typename T, typename Color>
178178void generate_camera_path (
179- const Scene<N, T, Color>& scene,
180- const LightDistribution<N, T, Color>& light_distribution,
179+ const Scene<N, T, Color>* const scene,
180+ const LightDistribution<N, T, Color>* const light_distribution,
181181 const numerical::Ray<N, T>& ray,
182182 PCG& engine,
183183 std::vector<vertex::Vertex<N, T, Color>>* const path)
@@ -195,14 +195,14 @@ void generate_camera_path(
195195
196196template <bool FLAT_SHADING, std::size_t N, typename T, typename Color>
197197void generate_light_path (
198- const Scene<N, T, Color>& scene,
199- LightDistribution<N, T, Color>& light_distribution,
198+ const Scene<N, T, Color>* const scene,
199+ LightDistribution<N, T, Color>* const light_distribution,
200200 PCG& engine,
201201 std::vector<vertex::Vertex<N, T, Color>>* const path)
202202{
203203 path->clear ();
204204
205- const LightDistributionSample distribution = light_distribution. sample (engine);
205+ const LightDistributionSample distribution = light_distribution-> sample (engine);
206206 const LightSourceLeaveSample sample = distribution.light ->leave_sample (engine);
207207
208208 if (!(sample.pdf_pos > 0 && sample.pdf_dir > 0 && !sample.radiance .is_black ()))
@@ -236,7 +236,7 @@ std::optional<Color> bpt(
236236 thread_local std::vector<vertex::Vertex<N, T, Color>> camera_path;
237237 thread_local std::vector<vertex::Vertex<N, T, Color>> light_path;
238238
239- generate_camera_path<FLAT_SHADING>(scene, light_distribution, ray, engine, &camera_path);
239+ generate_camera_path<FLAT_SHADING>(& scene, & light_distribution, ray, engine, &camera_path);
240240
241241 if (camera_path.size () == 1 )
242242 {
@@ -248,7 +248,7 @@ std::optional<Color> bpt(
248248 return {};
249249 }
250250
251- generate_light_path<FLAT_SHADING>(scene, light_distribution, engine, &light_path);
251+ generate_light_path<FLAT_SHADING>(& scene, & light_distribution, engine, &light_path);
252252
253253 const int camera_size = camera_path.size ();
254254 const int light_size = light_path.size ();
0 commit comments