In the middle of multithreading parsers.

This commit is contained in:
zy4n
2025-03-30 22:38:06 +02:00
parent d18b40a7fc
commit 144126ee7a
80 changed files with 2904 additions and 1450 deletions

View File

@@ -1,4 +1,4 @@
#include "../../../include/assets/data_parsers"
#include "assets/file_parsers/mtl_loader.hpp"
#include <charconv>
#include <fstream>
@@ -435,15 +435,14 @@ std::error_code mtl_loader::load(
}),
ztu::make_line_parser("Ka ", ztu::is_not_repeating, [&](const auto& param)
{
if (surface_properties_disabled) return codes::ok;
auto& properties = material.initialized_surface_properties();
if (parse_numeric_vector(param, properties.ambient_filter) != std::errc{}) [[unlikely]]
material_components::ambient_filter ambient_filter;
if (parse_numeric_vector(param, ambient_filter) != std::errc{}) [[unlikely]]
{
return codes::malformed_ambient_color;
return codes::malformed_ambient_color; // TODO rename to filter
}
material.components() |= flags::surface_properties;
material.ambient_filter = mbient_filter;
material.components() |= flags::ambient_filter;
return codes::ok;
}),
@@ -511,7 +510,7 @@ std::error_code mtl_loader::load(
if (textures_disabled) return codes::ok;
load_texture(param, "ambient color", [&](const auto id) {
material.ambient_color_texture_id() = id;
material.specular_filter_texture_id() = id;
material.components() |= flags::ambient_filter_texture;
});
@@ -522,7 +521,7 @@ std::error_code mtl_loader::load(
if (textures_disabled) return codes::ok;
load_texture(param, "diffuse color", [&](const auto id) {
material.diffuse_color_texture_id() = id;
material.diffuse_filter_texture_id() = id;
material.components() |= flags::diffuse_filter_texture;
});
@@ -533,7 +532,7 @@ std::error_code mtl_loader::load(
if (textures_disabled) return codes::ok;
load_texture(param, "specular color", [&](const auto id) {
material.specular_color_texture_id() = id;
material.specular_filter_texture_id() = id;
material.components() |= flags::specular_filter_texture;
});