diff --git a/src/base/geometry.cpp b/src/base/geometry.cpp index 2ef0cd85..d715fc25 100644 --- a/src/base/geometry.cpp +++ b/src/base/geometry.cpp @@ -128,7 +128,7 @@ void Geometry::_process_shape( // emplace instance here since we need to know the opaque property _accel.emplace_back(*mesh.resource, object_to_world, visible, false); - //(properties & Shape::property_flag_maybe_non_opaque) == 0u); + //(properties & Shape::property_flag_maybe_non_opaque) == 0u); auto light_tag = 0u; auto medium_tag = 0u; @@ -201,14 +201,14 @@ Var Geometry::trace_closest(const Var &ray) const noexcept { $if(it->shape().maybe_non_opaque() & it->shape().has_surface()) { PolymorphicCall call; _pipeline.surfaces().dispatch(it->shape().surface_tag(), [&](auto surface) noexcept { - $if(surface->maybe_non_opaque()) { + if(surface->maybe_non_opaque()) { // TODO: pass the correct time surface->closure(call, *it, _pipeline.spectrum()->sample(.5f), -ray->direction(), 1.f, 0.f); - }; + } else { + compute::unreachable(); + } }); - auto u1 = xxhash32(as(ray->origin())); - auto u2 = xxhash32(as(ray->direction())); - auto u = xxhash32(make_uint2(u1, u2)) * 0x1p-32f; + auto u = xxhash32(make_uint4(hit.inst, hit.prim, compute::as(hit.bary))) * 0x1p-32f; call.execute([&](const Surface::Closure *closure) noexcept { // apply opacity map auto alpha_skip = def(false); @@ -243,14 +243,14 @@ Var Geometry::trace_any(const Var &ray) const noexcept { $if(it->shape().maybe_non_opaque() & it->shape().has_surface()) { PolymorphicCall call; _pipeline.surfaces().dispatch(it->shape().surface_tag(), [&](auto surface) noexcept { - $if(surface->maybe_non_opaque()) { + if(surface->maybe_non_opaque()) { // TODO: pass the correct time surface->closure(call, *it, _pipeline.spectrum()->sample(.5f), -ray->direction(), 1.f, 0.f); - }; + } else { + compute::unreachable(); + } }); - auto u1 = xxhash32(as(ray->origin())); - auto u2 = xxhash32(as(ray->direction())); - auto u = xxhash32(make_uint2(u1, u2)) * 0x1p-32f; + auto u = xxhash32(make_uint4(hit.inst, hit.prim, compute::as(hit.bary))) * 0x1p-32f; call.execute([&](const Surface::Closure *closure) noexcept { // apply opacity map auto alpha_skip = def(false);