#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, 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 struct mtl_loader { static constexpr auto name = std::string_view("mtl"); [[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 ); protected: static void find_textures( std::span buffer, std::filesystem::path& path_buffer, const std::filesystem::path& base_directory, std::ifstream& in, ztu::string_list& texture_filenames ); };