std140 implementation
This commit is contained in:
41
include/opengl/data_managers/material_manager.hpp
Normal file
41
include/opengl/data_managers/material_manager.hpp
Normal 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;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
|
||||
static constexpr std::size_t min_garbage_collection_count = 4;
|
||||
|
||||
void process(const assets::data_stores& stores);
|
||||
void process(const store_type& meshes);
|
||||
|
||||
std::optional<entry_type> get_handle(store_id_type id);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
|
||||
static constexpr std::size_t min_garbage_collection_count = 4;
|
||||
|
||||
void process(const assets::data_stores& stores);
|
||||
void process(const store_type& meshes);
|
||||
|
||||
std::optional<entry_type> get_handle(store_id_type id);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
|
||||
static constexpr std::size_t min_garbage_collection_count = 4;
|
||||
|
||||
void process(const assets::data_stores& stores);
|
||||
void process(const store_type& point_clouds);
|
||||
|
||||
std::optional<entry_type> get_handle(store_id_type id);
|
||||
|
||||
|
||||
@@ -23,15 +23,15 @@ namespace zgl
|
||||
{
|
||||
class shader_manager
|
||||
{
|
||||
public:
|
||||
using store_type = shader_source_manager::store_type;
|
||||
using metadata_type = shader_metadata;
|
||||
using data_type = shader_data;
|
||||
using handle_type = shader_handle;
|
||||
using entry_type = std::pair<metadata_type, data_type>;
|
||||
using entry_view_type = std::pair<metadata_type, handle_type>;
|
||||
|
||||
public:
|
||||
|
||||
void process(const assets::data_stores& stores);
|
||||
void process(const store_type& shader_sources);
|
||||
|
||||
void get_handles(
|
||||
const assets::shader_source_store& shader_sources,
|
||||
|
||||
@@ -12,13 +12,14 @@ namespace zgl
|
||||
class shader_program_manager
|
||||
{
|
||||
public:
|
||||
using store_type = shader_manager::store_type;
|
||||
using metadata_type = shader_program_metadata;
|
||||
using data_type = shader_program_data;
|
||||
using handle_type = shader_program_handle;
|
||||
using entry_type = std::pair<metadata_type, data_type>;
|
||||
using entry_view_type = std::pair<metadata_type, handle_type>;
|
||||
|
||||
void process(const assets::data_stores& stores);
|
||||
void process(const store_type& shader_sources);
|
||||
|
||||
void get_handles(
|
||||
const assets::shader_source_store& shader_sources,
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
using entry_type = std::pair<metadata_type, store_id_type>;
|
||||
using entry_view_type = std::pair<preprocessed_shader_source_metadata, handle_type>;
|
||||
|
||||
void process(const assets::data_stores& stores);
|
||||
void process(const store_type& shader_sources);
|
||||
|
||||
void get_shader_sources(
|
||||
const assets::shader_source_store& shader_sources,
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
|
||||
static constexpr std::size_t min_garbage_collection_count = 4;
|
||||
|
||||
void process(const assets::data_stores& stores);
|
||||
void process(const store_type& textures);
|
||||
|
||||
std::optional<entry_type> get_handle(store_id_type id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user