57 lines
1.3 KiB
C++
57 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include <system_error>
|
|
|
|
#include "assets/data_stores.hpp"
|
|
#include "assets/prefetch_lookup.hpp"
|
|
#include "assets/prefetch_queue.hpp"
|
|
#include "assets/data"
|
|
#include "../data_stores"
|
|
#include "../data_stores"
|
|
#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,
|
|
shader_source_store& store,
|
|
bool pedantic = false
|
|
);
|
|
|
|
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
|
|
);
|
|
};
|