summary refs log tree commit diff
path: root/src/GFX/Mesh.hpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2023-07-29 03:31:42 +0200
committerMel <einebeere@gmail.com>2023-07-29 03:31:42 +0200
commit6b69d4b5b648253f894707723af0e2eae9f71445 (patch)
tree0cd0b6c7b18c30abbb2618f553f144d1d06dacba /src/GFX/Mesh.hpp
parent2eef7cf49b7a15559ee7bb6719411bcf67386213 (diff)
downloadmeowcraft-6b69d4b5b648253f894707723af0e2eae9f71445.tar.zst
meowcraft-6b69d4b5b648253f894707723af0e2eae9f71445.zip
Move chunk reification to worker threads and set stage for chunk-unbound lighting
Diffstat (limited to 'src/GFX/Mesh.hpp')
-rw-r--r--src/GFX/Mesh.hpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/GFX/Mesh.hpp b/src/GFX/Mesh.hpp
index 69625ff..435afe1 100644
--- a/src/GFX/Mesh.hpp
+++ b/src/GFX/Mesh.hpp
@@ -3,6 +3,8 @@
 #include <utility>
 #include <vector>
 #include <algorithm>
+#include <optional>
+#include <GL/glew.h>
 #include "../Common/Sizes.hpp"
 #include "../Math/Common.hpp"
 
@@ -58,12 +60,24 @@ public:
         std::vector<Attribute> attributes
     ) : m_attributes(std::move(attributes)) {}
 
-    const std::vector<U32>& indices() const;
-    const std::vector<Attribute>& attributes() const;
+    USize size() const;
+
+    void bind();
+    void unbind() const;
 
 private:
+    void upload();
+
+    static GLuint create_vao();
+    static void unbind_vao();
+
+    static void store_in_attribute_list(U32 attribute, Int attribute_size, Int type_size, const void* data, long data_size);
+    static void store_indices(const U32* indices, USize indices_size);
+
     std::vector<Attribute> m_attributes;
     std::vector<U32> m_indices;
+
+    std::optional<GLuint> m_vao;
 };
 
 }
\ No newline at end of file