82 lines
1.7 KiB
C++
82 lines
1.7 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/data_stores.hpp"
|
|
#include "assets/path_id_lookups.hpp"
|
|
|
|
#include "assets/data/point_cloud_data.hpp"
|
|
#include "assets/data_stores/point_cloud_store.hpp"
|
|
|
|
namespace assets::detail
|
|
{
|
|
|
|
template<bool Normal, bool Color, bool Reflectance>
|
|
struct generic_3dtk_loader
|
|
{
|
|
using data_type = point_cloud_data;
|
|
using store_type = point_cloud_data;
|
|
using lookup_type = point_cloud_id_lookup;
|
|
|
|
[[nodiscard]] std::error_code prefetch(
|
|
path_id_lookups& lookups
|
|
);
|
|
|
|
[[nodiscard]] std::error_code load(
|
|
path_id_lookups& lookups,
|
|
data_stores& stores,
|
|
bool pedantic = false
|
|
);
|
|
|
|
protected:
|
|
class parser_context
|
|
{
|
|
public:
|
|
parser_context(
|
|
path_id_lookups& m_id_lookups,
|
|
data_stores& m_stores
|
|
);
|
|
|
|
void operator()(lookup_type::const_pointer entry) noexcept;
|
|
|
|
protected:
|
|
void reset();
|
|
|
|
private:
|
|
path_id_lookups* m_id_lookups;
|
|
data_stores* m_stores;
|
|
data_type m_point_cloud{};
|
|
std::filesystem::path m_last_pose_path{};
|
|
pose_list_view m_last_pose_list{};
|
|
};
|
|
|
|
[[nodiscard]] static ztu::result<std::size_t> parse_scan_index(
|
|
std::string_view filename
|
|
);
|
|
|
|
protected:
|
|
[[nodiscard]] static std::error_code parse_file(
|
|
const std::filesystem::path& filename,
|
|
data_type& point_cloud
|
|
);
|
|
|
|
static void transform_point_cloud(
|
|
std::span<point_cloud_vertex_components::position> points,
|
|
const pose_data& pose
|
|
);
|
|
|
|
private:
|
|
std::vector<lookup_type::const_pointer> m_path_buffer;
|
|
};
|
|
|
|
}
|
|
|
|
#define INCLUDE_GENERIC_3DTK_LOADER_IMPLEMENTATION
|
|
#include "assets/file_parsers/generic/generic_3dtk_loader.ipp"
|
|
#undef INCLUDE_GENERIC_3DTK_LOADER_IMPLEMENTATION
|