summary refs log tree commit diff
path: root/src/GFX/Binder.cpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2023-06-30 15:15:00 +0200
committerMel <einebeere@gmail.com>2023-06-30 15:15:00 +0200
commit424d00eaf7335e1c6427f40260d55782c3fd902c (patch)
tree62550b085078d84c8a48cbb01f4f7738bfeeb3da /src/GFX/Binder.cpp
parent6d61b17c4289185d59d37caae8070a40e91fba40 (diff)
downloadmeowcraft-424d00eaf7335e1c6427f40260d55782c3fd902c.tar.zst
meowcraft-424d00eaf7335e1c6427f40260d55782c3fd902c.zip
Avoid per-frame chunk copies and don't render block faces between chunks
Diffstat (limited to 'src/GFX/Binder.cpp')
-rw-r--r--src/GFX/Binder.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/GFX/Binder.cpp b/src/GFX/Binder.cpp
index 0dce06d..e8fc559 100644
--- a/src/GFX/Binder.cpp
+++ b/src/GFX/Binder.cpp
@@ -4,7 +4,7 @@
 
 namespace MC::GFX {
 
-BindableMesh Binder::load(Mesh mesh) {
+BindableMesh Binder::load(const Mesh& mesh) {
     auto vao = create_vao();
     if (!mesh.indices().empty()) {
         store_indices(mesh.indices().data(), mesh.indices().size());
@@ -30,14 +30,14 @@ uint32_t Binder::create_vao() {
     glGenVertexArrays(1, &vao);
     glBindVertexArray(vao);
 
-    return static_cast<uint32_t>(vao);
+    return vao;
 }
 
 void Binder::unbind_vao() {
     glBindVertexArray(0);
 }
 
-void Binder::store_indices(uint32_t* indices, size_t indices_size) {
+void Binder::store_indices(const uint32_t* indices, size_t indices_size) {
     GLuint ebo;
     glGenBuffers(1, &ebo);
 
@@ -46,7 +46,7 @@ void Binder::store_indices(uint32_t* indices, size_t indices_size) {
 }
 
 
-void Binder::store_in_attribute_list(uint32_t attribute, int attribute_size, int type_size, void* data, long data_size) {
+void Binder::store_in_attribute_list(uint32_t attribute, int attribute_size, int type_size, const void* data, long data_size) {
     assert(type_size == sizeof(float));
 
     GLuint vbo;