initial commit

This commit is contained in:
ZY4N
2024-12-10 13:50:21 +01:00
parent 20bbd06a89
commit 275d47b7c6
33 changed files with 1066 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
#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 "assets/dynamic_read_buffers/dynamic_point_cloud_buffer.hpp"
#include "assets/dynamic_data_stores/dynamic_point_cloud_store.hpp"
#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,
prefetch_lookup& asset_lookup,
dynamic_point_cloud_store& store,
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<components::point_cloud_vertex::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 "assets/data_loaders/generic/generic_3dtk_loader.ipp"
#undef INCLUDE_GENERIC_3DTK_LOADER_IMPLEMENTATION