@@ -317,14 +317,11 @@ class DistantSensorImpl final : public Sensor<Float, Spectrum> {
317317 auto trafo = m_world_transform->eval (time, active);
318318 Vector3f v0{ 0 .f , 0 .f , 1 .f };
319319
320- if (m_direction_type == RayDirectionType::SampleAll)
320+ if (m_direction_type == RayDirectionType::SampleAll) {
321321 v0 = warp::square_to_uniform_hemisphere (film_sample);
322-
323- else if (m_direction_type == RayDirectionType::SampleWidth) {
322+ } else if (m_direction_type == RayDirectionType::SampleWidth) {
324323 // Sample directions only in plane generated by X and Z axes
325- auto [s, c] = sincos (math::Pi<ScalarFloat> * film_sample.x ());
326- v0.x () = c;
327- v0.z () = s;
324+ std::tie (v0.x (), v0.z ()) = enoki::sincos (math::Pi<ScalarFloat> * film_sample.x ());
328325 }
329326
330327 // By default, rays point inwards the target direction,
@@ -341,25 +338,19 @@ class DistantSensorImpl final : public Sensor<Float, Spectrum> {
341338 if constexpr (TargetType == RayTargetType::Point) {
342339 // Target point selection already handled during init
343340 ray_weight = wav_weight;
344- }
345-
346- else if constexpr (TargetType == RayTargetType::Shape) {
341+ } else if constexpr (TargetType == RayTargetType::Shape) {
347342 // Use area-based sampling of shape
348343 PositionSample3f ps = m_ray_target_shape->sample_position (
349344 time, aperture_sample, active);
350- SurfaceInteraction3f si (ps, zero<Wavelength>());
351- ray_target = si.p ;
352- ray_weight =
353- wav_weight / ps.pdf / m_ray_target_shape->surface_area ();
345+ ray_target = ps.p ;
346+ ray_weight = wav_weight / ps.pdf / m_ray_target_shape->surface_area ();
354347 /* ray_weight *= dot(-ray.d, si.n); */
355- }
356-
357- else { // if constexpr (TargetType == RayTargetType::None) {
348+ } else { // if constexpr (TargetType == RayTargetType::None) {
358349 // Sample target uniformly on bounding sphere cross section
359350 Point2f offset =
360351 warp::square_to_uniform_disk_concentric (aperture_sample);
361352 Vector3f perp_offset =
362- trafo.transform_affine (Vector3f{ offset.x (), offset.y (), 0 .f } );
353+ trafo.transform_affine (Vector3f ( offset.x (), offset.y (), 0 .f ) );
363354 ray_target = m_bsphere.center + perp_offset * m_bsphere.radius ;
364355 ray_weight = wav_weight;
365356 // ray_weight *= math::Pi<Float> * sqr(m_bsphere.radius);
@@ -374,9 +365,7 @@ class DistantSensorImpl final : public Sensor<Float, Spectrum> {
374365 tmp_ray, HitComputeFlags::Minimal, active);
375366 active &= si.is_valid ();
376367 ray.o = si.p ;
377- }
378-
379- else { // if constexpr (OriginType == OriginType::BoundingSphere) {
368+ } else { // if constexpr (OriginType == OriginType::BoundingSphere) {
380369 // Use the scene's bounding sphere to safely position ray origin
381370 if constexpr (TargetType == RayTargetType::None)
382371 ray.o = ray_target - ray.d * m_bsphere.radius ;
0 commit comments