tried making naming more uniform and implemented most of the opengl managers

This commit is contained in:
ZY4N
2025-03-25 02:22:44 +01:00
parent c609d49f0d
commit 71ea2d9237
155 changed files with 4097 additions and 2434 deletions

View File

@@ -0,0 +1,82 @@
#pragma once
#include <filesystem>
#include <system_error>
#include <string_view>
#include "../data_loaders"
#include "../data_stores"
#include "assets/prefetch_lookup.hpp"
#include <set>
namespace obj_loader_error {
enum class codes {
ok = 0,
cannot_open_file,
malformed_vertex,
malformed_texture_coordinate,
malformed_normal,
malformed_face,
face_index_out_of_range,
unknown_line_begin,
use_material_without_material_library,
unknown_material_name
};
} // namespace obj_loader_error
struct obj_loader {
static constexpr auto name = std::string_view("obj");
[[nodiscard]] static std::error_code prefetch(
const file_dir_list& paths,
prefetch_queue& queue
);
[[nodiscard]] static std::error_code load(
dynamic_mesh_buffer& buffer,
const file_dir_list& paths,
prefetch_lookup& id_lookup,
dynamic_shader_source_store& store,
bool pedantic = false
);
protected:
using index_type = dynamic_mesh_buffer::index_type;
using vertex_type = std::array<index_type, 3>;
struct indexed_vertex_type
{
vertex_type vertex;
index_type buffer_index;
friend auto operator<=>(const indexed_vertex_type& a, const indexed_vertex_type& b) {
return a.vertex <=> b.vertex;
}
bool operator==(const indexed_vertex_type& other) const noexcept {
return other.vertex == vertex;
}
};
static void find_materials(
std::span<char> buffer,
std::filesystem::path& path_buffer,
const std::filesystem::path& base_directory,
std::ifstream& in,
ztu::string_list& material_filenames
);
[[nodiscard]] static std::error_code obj_loader::parse_file(
dynamic_mesh_buffer& read_buffer,
dynamic_mesh_buffer& mesh_buffer,
std::filesystem::path& path_buffer,
const std::filesystem::path& base_directory,
std::set<indexed_vertex_type>& vertex_ids,
std::ifstream& in,
prefetch_lookup& id_lookup,
dynamic_shader_source_store& store,
bool pedantic
);
};