#pragma once #include #include #include "assets/dynamic_data_store.hpp" #include "assets/prefetch_lookup.hpp" #include "assets/prefetch_queue.hpp" #include "assets/dynamic_read_buffers/dynamic_material_buffer.hpp" #include "assets/dynamic_data_stores/dynamic_material_library_store.hpp" #include "assets/dynamic_data_stores/dynamic_material_store.hpp" #include "util/string_lookup.hpp" #include "util/result.hpp" 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 }; } // namespace mtl_loader_error class mtl_loader { public: static constexpr auto name = std::string_view("mtl"); std::optional find_id(std::string_view name); void clear_name_lookup(); [[nodiscard]] static std::error_code prefetch( const file_dir_list& paths, prefetch_queue& queue ); // THis is not very elegant, but right now I do not see a better solution... [[nodiscard]] static std::error_code load( dynamic_material_library_buffer& material_library_buffer, const file_dir_list& paths, prefetch_lookup& id_lookup, dynamic_data_store& store, bool pedantic = false ); private: ztu::string_lookup m_id_lookup; };