Finally refactored all stores!
This commit is contained in:
@@ -2,11 +2,10 @@
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#include "assets/prefetch_lookup.hpp"
|
||||
#include "assets/prefetch_queue.hpp"
|
||||
#include "assets/data_stores.hpp"
|
||||
#include "assets/path_id_lookups.hpp"
|
||||
#include "assets/data/pose_data.hpp"
|
||||
#include "util/result.hpp"
|
||||
#include "assets/prefetch_lookups/pose_prefetch_lookup.hpp"
|
||||
|
||||
namespace assets
|
||||
{
|
||||
@@ -14,30 +13,45 @@ namespace assets
|
||||
struct threedtk_pose_loader
|
||||
{
|
||||
static constexpr auto name = std::string_view("3dtk_pose");
|
||||
using data_type = pose_list_data;
|
||||
using store_type = pose_list_store;
|
||||
using lookup_type = pose_list_id_lookup;
|
||||
|
||||
[[nodiscard]] static std::error_code prefetch(
|
||||
const file_dir_list& paths,
|
||||
prefetch_queue& queue
|
||||
[[nodiscard]] std::error_code prefetch(
|
||||
path_id_lookups& lookups
|
||||
);
|
||||
|
||||
[[nodiscard]] static std::error_code load(
|
||||
pose_data& buffer,
|
||||
const file_dir_list& paths,
|
||||
prefetch_lookup& id_lookup,
|
||||
shader_source_store& store,
|
||||
[[nodiscard]] std::error_code load(
|
||||
path_id_lookups& lookups,
|
||||
data_stores& stores,
|
||||
bool pedantic = false
|
||||
);
|
||||
|
||||
protected:
|
||||
static std::error_code parse_transform_info(
|
||||
std::ifstream& in,
|
||||
std::string& line,
|
||||
std::array<glm::vec3, 2>& transform_info
|
||||
class parser_context
|
||||
{
|
||||
public:
|
||||
parser_context(
|
||||
path_id_lookups& pose_list_lookup,
|
||||
data_stores& stores
|
||||
);
|
||||
|
||||
void operator()(lookup_type::const_pointer entry) noexcept;
|
||||
|
||||
private:
|
||||
path_id_lookups* m_id_lookups;
|
||||
data_stores* m_stores;
|
||||
data_type m_pose{};
|
||||
std::string m_line_buffer{};
|
||||
};
|
||||
|
||||
static ztu::result<pose_data> parse_file(
|
||||
const std::filesystem::path& filename,
|
||||
std::string& line_buffer
|
||||
);
|
||||
|
||||
static ztu::result<pose_prefetch_lookup::index_type> parse_index(
|
||||
std::string_view filename
|
||||
);
|
||||
private:
|
||||
std::vector<lookup_type::const_pointer> m_path_buffer;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user