Browse Source

Render: Update getter to match naming convention

master
Riyyi 3 months ago
parent
commit
d63dfe2f9f
  1. 2
      src/inferno/render/buffer.cpp
  2. 6
      src/inferno/render/buffer.h
  3. 2
      src/inferno/render/render-command.cpp
  4. 2
      src/inferno/render/renderer.cpp

2
src/inferno/render/buffer.cpp

@ -303,7 +303,7 @@ void VertexArray::unbind() const
void VertexArray::addVertexBuffer(std::shared_ptr<VertexBuffer> vertexBuffer)
{
const auto& layout = vertexBuffer->getLayout();
const auto& layout = vertexBuffer->layout();
VERIFY(layout.elements().size(), "VertexBuffer has no layout");
bind();

6
src/inferno/render/buffer.h

@ -104,7 +104,7 @@ public:
void uploadData(const void* data, uint32_t size);
const BufferLayout& getLayout() const { return m_layout; }
const BufferLayout& layout() const { return m_layout; }
void setLayout(const BufferLayout& layout) { m_layout = layout; }
@ -126,7 +126,7 @@ public:
void uploadData(const void* data, uint32_t size);
uint32_t getCount() const { return m_count; }
uint32_t count() const { return m_count; }
private:
uint32_t m_id { 0 };
@ -148,7 +148,7 @@ public:
void setIndexBuffer(std::shared_ptr<IndexBuffer> indexBuffer);
std::shared_ptr<VertexBuffer> at(size_t i) const { return m_vertexBuffers.at(i); }
std::shared_ptr<IndexBuffer> getIndexBuffer() const { return m_indexBuffer; }
std::shared_ptr<IndexBuffer> indexBuffer() const { return m_indexBuffer; }
private:
uint32_t m_id { 0 };

2
src/inferno/render/render-command.cpp

@ -42,7 +42,7 @@ void RenderCommand::clearColor(const glm::vec4& color)
void RenderCommand::drawIndexed(std::shared_ptr<VertexArray> vertexArray, uint32_t indexCount)
{
uint32_t count = indexCount ? indexCount : vertexArray->getIndexBuffer()->getCount();
uint32_t count = indexCount ? indexCount : vertexArray->indexBuffer()->count();
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, nullptr);
}

2
src/inferno/render/renderer.cpp

@ -548,7 +548,7 @@ void Renderer3D::createElementBuffer()
void Renderer3D::uploadElementBuffer()
{
m_vertexArray->getIndexBuffer()->uploadData(m_elementBufferBase, m_elementIndex * sizeof(uint32_t));
m_vertexArray->indexBuffer()->uploadData(m_elementBufferBase, m_elementIndex * sizeof(uint32_t));
}
void Renderer3D::loadShader()

Loading…
Cancel
Save