3 #include "raytracer/program.h" 5 #include "core/cl/geometry.h" 6 #include "core/cl/include.h" 7 #include "core/geo/geometric.h" 8 #include "core/spatial_division/scene_buffers.h" 10 #include "utilities/aligned/vector.h" 11 #include "utilities/map_to_vector.h" 13 #include "glm/glm.hpp" 18 template <
typename It>
19 auto get_rays_from_directions(It begin, It end,
const glm::vec3& source) {
20 return util::map_to_vector(begin, end, [&](
const auto& i) {
21 return core::geo::ray{source, i};
27 template <
typename It>
29 const glm::vec3& receiver,
33 , queue_{cc.context, cc.device}
34 , kernel_{
program{cc}.get_kernel()}
36 , rays_(std::distance(b, e))
37 , ray_buffer_{core::load_to_buffer(
42 [](
const auto& i) { return core::convert(i); }),
44 , reflection_buffer_{cc.context,
47 , rng_buffer_{cc.context,
49 rays_ * 2 *
sizeof(cl_float)} {
50 program{cc_}.get_init_reflections_kernel()(
51 cl::EnqueueArgs{queue_, cl::NDRange{rays_}},
55 util::aligned::vector<reflection> run_step(
58 util::aligned::vector<core::ray> get_rays();
59 util::aligned::vector<reflection> get_reflections();
60 util::aligned::vector<cl_float> get_rng();
68 using kernel_t = decltype(std::declval<program>().get_kernel());
71 cl::CommandQueue queue_;
76 cl::Buffer ray_buffer_;
77 cl::Buffer reflection_buffer_;
79 cl::Buffer rng_buffer_;
Definition: geometry_structs.h:11
Definition: reflector.h:25
Definition: conversions.h:10
Definition: scene_buffers.h:12
Definition: pressure.h:22
static constexpr auto get_per_ray_size()
The constant buffer size required per parallel ray.
Definition: reflector.h:63
Definition: capsule_base.h:9
Definition: reflection.h:10
invariant: device is a valid device for the context
Definition: common.h:13