3 #include "raytracer/cl/structs.h" 5 #include "core/spatial_division/voxelised_scene_data.h" 6 #include "core/unit_constructor.h" 10 namespace image_source {
14 template <
typename Vertex,
typename Surface>
15 auto get_direct(
const glm::vec3& source,
16 const glm::vec3& receiver,
17 const core::voxelised_scene_data<Vertex, Surface>& scene_data) {
18 constexpr
auto channels =
typename Surface::bands_t{};
20 if (source == receiver) {
21 return std::experimental::optional<impulse<channels>>{};
24 const auto source_to_receiver = receiver - source;
25 const auto source_to_receiver_length = glm::length(source_to_receiver);
26 const auto direction = glm::normalize(source_to_receiver);
27 const core::geo::ray to_receiver{source, direction};
29 const auto intersection = intersects(scene_data, to_receiver);
32 (intersection && intersection->inter.t >= source_to_receiver_length)) {
33 return std::experimental::make_optional(impulse<channels>{
34 core::unit_constructor_v<
35 ::detail::cl_vector_constructor_t<float, channels>>,
36 core::to_cl_float3{}(source),
37 source_to_receiver_length});
40 return std::experimental::optional<impulse<channels>>{};
Definition: pressure.h:22
Definition: capsule_base.h:9