From 6ed978051668c08f5a957c97570f364dd580c807 Mon Sep 17 00:00:00 2001 From: Mel Date: Fri, 21 Oct 2022 01:03:18 +0200 Subject: Namespace and Folder refactor --- src/GFX/Binder.hpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/GFX/Binder.hpp (limited to 'src/GFX/Binder.hpp') diff --git a/src/GFX/Binder.hpp b/src/GFX/Binder.hpp new file mode 100644 index 0000000..99f9791 --- /dev/null +++ b/src/GFX/Binder.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include +#include "Mesh.hpp" + +namespace MC::GFX { + +class BindableMesh { +public: + void bind() const; + void unbind(); + + size_t size() const; + +private: + BindableMesh(uint32_t vao, size_t vertex_count) : m_vao(vao), m_vertex_count(vertex_count) {}; + + uint32_t m_vao; + size_t m_vertex_count; + + friend class Binder; +}; + +class Binder { +public: + Binder() = default;; + + static BindableMesh load(Mesh& mesh); + +private: + static uint32_t create_vao(); + static void unbind_vao(); + + static void store_in_attribute_list(uint32_t attribute, size_t size, float* data, size_t data_size); + static void store_indices(uint32_t* indices, size_t indices_size); +}; + +} \ No newline at end of file -- cgit 1.4.1