Files
Z3D/include/assets/file_parsers/kitti_loader.hpp
2025-03-25 15:57:32 +01:00

60 lines
1.3 KiB
C++

#pragma once
#include <filesystem>
#include <vector>
#include <span>
#include "assets/data_stores.hpp"
#include "assets/components/point_cloud_vertex_components.hpp"
#include "assets/data/point_cloud_data.hpp"
#include "assets/data_stores/point_cloud_store.hpp"
#include "assets/prefetch_lookup.hpp"
#include "assets/prefetch_queue.hpp"
#include "glm/mat4x4.hpp"
#include "util/result.hpp"
namespace assets
{
struct kitti_loader
{
static constexpr auto name = std::string_view("kitti");
[[nodiscard]] static std::error_code prefetch(
const file_dir_list& paths,
prefetch_queue& queue
);
[[nodiscard]] static std::error_code load(
point_cloud_data& buffer,
const file_dir_list& paths,
prefetch_lookup& id_lookup,
shader_source_store& store,
bool pedantic = false
);
private:
inline static constexpr auto frame_folder = "frames";
[[nodiscard]] static ztu::result<std::size_t> frame_id_from_filename(
std::string_view filename
);
[[nodiscard]] static std::error_code load_point_file(
const std::filesystem::path& filename,
dynamic_point_cloud_buffer& point_cloud
);
static void transform_point_cloud(
std::span<point_cloud_vertex_components::position> points,
const glm::mat4& pose
);
[[nodiscard]] static ztu::result<std::string_view> parent_directory(std::string_view path);
};
}