This commit is contained in:
ZY4N
2025-03-23 21:11:22 +01:00
parent 510398423a
commit c609d49f0d
49 changed files with 1412 additions and 924 deletions

View File

@@ -0,0 +1,41 @@
#pragma once
#include <unordered_map>
#include "assets/dynamic_read_buffers/dynamic_texture_buffer.hpp"
#include "assets/dynamic_data_stores/dynamic_texture_store.hpp"
#include "opengl/handles/texture_handle.hpp"
#include <vector>
#include "opengl/metadata/texture_metadata.hpp"
#include "opengl/resource_management/resource_manager.hpp"
namespace zgl
{
class texture_manager
{
public:
using store_type = dynamic_texture_store;
using store_id_type = store_type::id_type;
using metadata_type = texture_metadata;
using handle_type = texture_handle;
using resource_manager_type = resource_manager<store_id_type, metadata_type>;
using texture_entry_type = std::pair<handle_type, metadata_type>;
static constexpr std::size_t min_garbage_collection_count = 4;
void process(store_type& store);
std::optional<texture_entry_type> get_handle(store_id_type id);
void collect_garbage(bool force = false);
private:
resource_manager_type m_resource_manager;
std::vector<std::pair<dynamic_texture_store::id_type, const dynamic_texture_buffer&>> m_texture_buffer;
std::vector<GLuint> m_texture_id_buffer;
};
}