tried making naming more uniform and implemented most of the opengl managers
This commit is contained in:
42
include/assets/data_loaders/generic/base_dynamic_loader.hpp
Normal file
42
include/assets/data_loaders/generic/base_dynamic_loader.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <tuple>
|
||||
|
||||
#include "../../data_stores"
|
||||
#include "util/uix.hpp"
|
||||
#include "util/string_lookup.hpp"
|
||||
#include "util/id_type.hpp"
|
||||
#include "util/result.hpp"
|
||||
|
||||
|
||||
|
||||
template<typename C, class... Loaders>
|
||||
class base_dynamic_loader
|
||||
{
|
||||
public:
|
||||
using loader_id_type = ztu::id_type_for<base_dynamic_loader, ztu::u32>;
|
||||
|
||||
explicit base_dynamic_loader(C enabled_components);
|
||||
|
||||
[[nodiscard]] std::optional<loader_id_type> find_loader(std::string_view name);
|
||||
|
||||
[[nodiscard]] static consteval std::optional<loader_id_type> find_loader_static(std::string_view name);
|
||||
|
||||
template<loader_id_type ID>
|
||||
auto& get_loader();
|
||||
|
||||
protected:
|
||||
|
||||
// TODO this seems like I modified this to something that does not make sense
|
||||
template<typename F>
|
||||
ztu::result<dynamic_point_cloud_store::id_type> invoke_with_matching_loader(loader_id_type loader_id, F&& f);
|
||||
|
||||
std::tuple<Loaders...> m_loaders{};
|
||||
ztu::string_lookup<loader_id_type> m_loader_id_lookup{};
|
||||
C m_enabled_components{ 0 };
|
||||
};
|
||||
|
||||
#define INCLUDE_BASE_DYNAMIC_LOADER_IMPLEMENTATION
|
||||
#include "../../data_loaders"
|
||||
#undef INCLUDE_BASE_DYNAMIC_LOADER_IMPLEMENTATION
|
||||
@@ -1,58 +0,0 @@
|
||||
#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,
|
||||
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<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
|
||||
Reference in New Issue
Block a user