worked on obj and mtl prefetching nad parsing

This commit is contained in:
ZY4N
2024-12-26 20:20:02 +01:00
parent b385b3b1c8
commit 447146b7f5
16 changed files with 606 additions and 376 deletions

View File

@@ -12,30 +12,25 @@
#include "util/string_lookup.hpp"
#include "util/result.hpp"
namespace mtl_loader_error {
namespace mtl_loader_error
{
enum class codes {
ok = 0,
mtl_cannot_open_file,
mtl_cannot_open_texture,
mtl_malformed_ambient_color,
mtl_malformed_diffuse_color,
mtl_malformed_specular_color,
mtl_malformed_specular_exponent,
mtl_malformed_dissolve,
mlt_unknown_line_begin
cannot_open_file,
cannot_open_texture,
malformed_ambient_color,
malformed_diffuse_color,
malformed_specular_color,
malformed_specular_exponent,
malformed_dissolve,
unknown_line_begin
};
} // namespace mtl_loader_error
class mtl_loader {
public:
struct mtl_loader
{
static constexpr auto name = std::string_view("mtl");
std::optional<dynamic_material_store::id_type> find_id(std::string_view name);
void clear_name_lookup();
[[nodiscard]] static std::error_code prefetch(
const file_dir_list& paths,
prefetch_queue& queue
@@ -50,7 +45,12 @@ public:
bool pedantic = false
);
private:
ztu::string_lookup<dynamic_material_store::id_type> m_id_lookup;
protected:
static void find_textures(
std::span<char> buffer,
std::filesystem::path& path_buffer,
const std::filesystem::path& base_directory,
std::ifstream& in,
ztu::string_list& texture_filenames
);
};