#pragma once #include #include #include #include "benchmarks.hpp" #include "profile_scope.hpp" #include struct MyPoint3D { float x, y, z; }; struct Point3DInput { std::vector positions; std::vector colors; std::vector radii; std::string label; Point3DInput() = default; Point3DInput(Point3DInput&&) = default; }; inline Point3DInput prepare_points3d(int64_t lcg_state, size_t num_points) { PROFILE_FUNCTION(); Point3DInput input; input.positions.resize(num_points); for (auto& pos : input.positions) { pos.x = static_cast(lcg(lcg_state)); pos.y = static_cast(lcg(lcg_state)); pos.z = static_cast(lcg(lcg_state)); } input.colors.resize(num_points); for (auto& color : input.colors) { color = static_cast(lcg(lcg_state)); } input.radii.resize(num_points); for (auto& radius : input.radii) { radius = static_cast(lcg(lcg_state)); } input.label = "some label"; return input; } // TODO(andreas): We want this adapter in rerun, ideally in a generated manner. // Can we do something like a `binary compatible` attribute on fbs that will generate this as well as ctors? template <> struct rerun::CollectionAdapter> { Collection operator()(const std::vector& container) { return Collection::borrow(container.data(), container.size()); } Collection operator()(std::vector&&) { throw std::runtime_error("Not implemented for temporaries"); } }; template <> struct rerun::CollectionAdapter> { Collection operator()(const std::vector& container) { return Collection::borrow(container.data(), container.size()); } Collection operator()(std::vector&&) { throw std::runtime_error("Not implemented for temporaries"); } }; template <> struct rerun::CollectionAdapter { Collection operator()(const MyPoint3D& single) { return Collection::borrow(&single, 1); } Collection operator()(MyPoint3D&&) { throw std::runtime_error("Not implemented for temporaries"); } };