Files
Z3D/include/assets/file_parsers/generic/generic_3dtk_loader.hpp

59 lines
1.3 KiB
C++

#pragma once
#include <filesystem>
#include <charconv>
#include <string_view>
#include "glm/mat4x4.hpp"
#include "util/result.hpp"
#include "util/string_list.hpp"
#include "assets/prefetch_queue.hpp"
#include "../../read_buffers"
#include "../../data_stores"
#include "assets/prefetch_lookup.hpp"
template<bool Normal, bool Color, bool Reflectance>
struct generic_3dtk_loader
{
[[nodiscard]] static std::error_code prefetch(
const ztu::string_list& filenames,
prefetch_queue& queue
);
[[nodiscard]] static std::error_code load(
dynamic_point_cloud_buffer& buffer,
const file_dir_list& paths,
dynamic_point_cloud_store& store,
prefetch_lookup& id_lookup,
bool pedantic = false
);
protected:
[[nodiscard]] static ztu::result<pose_prefetch_lookup::index_type> parse_index(
std::string_view filename
);
ztu::result<std::pair<ztu::u32, std::chars_format>> analyze_component_format(
std::string_view line
);
void transform_point_cloud(
std::span<point_cloud_vertex_components::position::value_type> points,
const glm::mat4& pose
);
private:
std::error_code read_point_file(
const std::filesystem::path& filename,
dynamic_point_cloud_buffer& point_cloud
);
};
#define INCLUDE_GENERIC_3DTK_LOADER_IMPLEMENTATION
#include "../../data_parsers"
#undef INCLUDE_GENERIC_3DTK_LOADER_IMPLEMENTATION