std140 implementation

This commit is contained in:
ZY4N
2025-03-27 19:47:32 +01:00
parent 70893c083b
commit 6f60cc11c8
45 changed files with 789 additions and 234 deletions

View File

@@ -0,0 +1,41 @@
#pragma once
#include "assets/data/material_data.hpp"
#include "assets/data_stores/material_store.hpp"
#include "opengl/handles/material_handle.hpp"
#include <vector>
#include "assets/data_stores.hpp"
#include "opengl/metadata/material_metadata.hpp"
#include "opengl/resource_management/resource_manager.hpp"
namespace zgl
{
class material_manager
{
public:
using store_type = assets::material_store;
using store_id_type = store_type::id_type;
using metadata_type = material_metadata;
using handle_type = material_handle;
using resource_manager_type = resource_manager<store_id_type, metadata_type>;
// TODO add reference and const_reference
using entry_type = std::pair<const handle_type&, const metadata_type&>;
static constexpr std::size_t min_garbage_collection_count = 4;
void process(const store_type& materials);
std::optional<entry_type> get_handle(store_id_type id);
void collect_garbage(bool force = false);
protected:
resource_manager_type m_resource_manager;
private:
std::vector<std::pair<store_id_type, const assets::material_data&>> m_material_buffer;
std::vector<GLuint> m_material_id_buffer;
};
}