From 50a438e340a958b4258b731e2ac2a8516d9538bd Mon Sep 17 00:00:00 2001 From: Riyyi Date: Thu, 11 Mar 2021 11:07:50 +0100 Subject: [PATCH] Cleanup --- inferno/src/inferno/render/buffer.cpp | 24 ++++++++++++------------ inferno/src/inferno/render/renderer.h | 2 -- inferno/src/inferno/render/shader.cpp | 4 ++-- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/inferno/src/inferno/render/buffer.cpp b/inferno/src/inferno/render/buffer.cpp index 010ce19..8e0976e 100644 --- a/inferno/src/inferno/render/buffer.cpp +++ b/inferno/src/inferno/render/buffer.cpp @@ -163,23 +163,23 @@ namespace Inferno { VertexBuffer::VertexBuffer(size_t size) { glGenBuffers(1, &m_id); - this->bind(); + bind(); // Reserve data on the GPU glBufferData(GL_ARRAY_BUFFER, size, nullptr, GL_DYNAMIC_DRAW); - this->unbind(); + unbind(); } VertexBuffer::VertexBuffer(float* vertices, size_t size) { glGenBuffers(1, &m_id); - this->bind(); + bind(); // Upload data to the GPU glBufferData(GL_ARRAY_BUFFER, size, vertices, GL_STATIC_DRAW); - this->unbind(); + unbind(); } VertexBuffer::~VertexBuffer() @@ -199,12 +199,12 @@ namespace Inferno { void VertexBuffer::uploadData(const void* data, uint32_t size) { - this->bind(); + bind(); // Upload data to the GPU glBufferSubData(GL_ARRAY_BUFFER, 0, size, data); - this->unbind(); + unbind(); } // ----------------------------------------- @@ -213,12 +213,12 @@ namespace Inferno { m_count(size / sizeof(uint32_t)) { glCreateBuffers(1, &m_id); - this->bind(); + bind(); // Upload data to the GPU glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, indices, GL_STATIC_DRAW); - this->unbind(); + unbind(); } IndexBuffer::~IndexBuffer() @@ -263,7 +263,7 @@ namespace Inferno { const auto& layout = vertexBuffer->getLayout(); ASSERT(layout.getElements().size(), "VertexBuffer has no layout"); - this->bind(); + bind(); vertexBuffer->bind(); uint32_t index = 0; @@ -281,18 +281,18 @@ namespace Inferno { } m_vertexBuffers.push_back(vertexBuffer); - this->unbind(); + unbind(); vertexBuffer->unbind(); } void VertexArray::setIndexBuffer(const std::shared_ptr& indexBuffer) { - this->bind(); + bind(); indexBuffer->bind(); m_indexBuffer = indexBuffer; - this->unbind(); + unbind(); indexBuffer->unbind(); } diff --git a/inferno/src/inferno/render/renderer.h b/inferno/src/inferno/render/renderer.h index 35a5015..19929f0 100644 --- a/inferno/src/inferno/render/renderer.h +++ b/inferno/src/inferno/render/renderer.h @@ -14,10 +14,8 @@ namespace Inferno { - class Camera; class Shader; class Texture; - class Transform; class VertexArray; struct QuadVertex { diff --git a/inferno/src/inferno/render/shader.cpp b/inferno/src/inferno/render/shader.cpp index b564c1b..dfca699 100644 --- a/inferno/src/inferno/render/shader.cpp +++ b/inferno/src/inferno/render/shader.cpp @@ -50,13 +50,13 @@ namespace Inferno { void Shader::setInt(const std::string& name, int value) { - // Set unifrom int + // Set uniform int glUniform1i(findUniform(name), value); } void Shader::setInt(const std::string& name, int* values, uint32_t count) { - // Set unifrom int array + // Set uniform int array glUniform1iv(findUniform(name), count, values); }