summary refs log tree commit diff
path: root/src/GFX
diff options
context:
space:
mode:
Diffstat (limited to 'src/GFX')
-rw-r--r--src/GFX/Binder.cpp8
-rw-r--r--src/GFX/Binder.hpp6
-rw-r--r--src/GFX/Mesh.cpp4
-rw-r--r--src/GFX/Mesh.hpp4
4 files changed, 11 insertions, 11 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;
diff --git a/src/GFX/Binder.hpp b/src/GFX/Binder.hpp
index d8a2be9..92faebe 100644
--- a/src/GFX/Binder.hpp
+++ b/src/GFX/Binder.hpp
@@ -35,14 +35,14 @@ class Binder {
 public:
     Binder() = default;;
 
-    static BindableMesh load(Mesh mesh);
+    static BindableMesh load(const Mesh& mesh);
 
 private:
     static uint32_t create_vao();
     static void unbind_vao();
 
-    static void store_in_attribute_list(uint32_t attribute, int attribute_size, int type_size, void* data, long data_size);
-    static void store_indices(uint32_t* indices, size_t indices_size);
+    static void store_in_attribute_list(uint32_t attribute, int attribute_size, int type_size, const void* data, long data_size);
+    static void store_indices(const uint32_t* indices, size_t indices_size);
 };
 
 }
\ No newline at end of file
diff --git a/src/GFX/Mesh.cpp b/src/GFX/Mesh.cpp
index b0271bb..1869622 100644
--- a/src/GFX/Mesh.cpp
+++ b/src/GFX/Mesh.cpp
@@ -2,11 +2,11 @@
 
 namespace MC::GFX {
 
-std::vector<uint32_t> Mesh::indices() {
+const std::vector<uint32_t>& Mesh::indices() const {
     return m_indices;
 }
 
-std::vector<Mesh::Attribute> Mesh::attributes() {
+const std::vector<Mesh::Attribute>& Mesh::attributes() const {
     return m_attributes;
 }
 
diff --git a/src/GFX/Mesh.hpp b/src/GFX/Mesh.hpp
index bfe8eab..1d14ba2 100644
--- a/src/GFX/Mesh.hpp
+++ b/src/GFX/Mesh.hpp
@@ -49,8 +49,8 @@ public:
     ) : m_attributes(std::move(attributes)),
         m_indices() {};
 
-    std::vector<uint32_t> indices();
-    std::vector<Attribute> attributes();
+    const std::vector<uint32_t>& indices() const;
+    const std::vector<Attribute>& attributes() const;
 
 private:
     std::vector<Attribute> m_attributes;