diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-09-20 17:54:09 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-01-13 03:39:32 +0100 |
commit | 6bab0ab86a72881c3e0b88284c211e01fb22435a (patch) | |
tree | 3594305ad612f0e59ee630c2b5a59d974fc8bac5 /src/RendererWorld.cpp | |
parent | 2017-09-19 (diff) | |
download | AltCraft-6bab0ab86a72881c3e0b88284c211e01fb22435a.tar AltCraft-6bab0ab86a72881c3e0b88284c211e01fb22435a.tar.gz AltCraft-6bab0ab86a72881c3e0b88284c211e01fb22435a.tar.bz2 AltCraft-6bab0ab86a72881c3e0b88284c211e01fb22435a.tar.lz AltCraft-6bab0ab86a72881c3e0b88284c211e01fb22435a.tar.xz AltCraft-6bab0ab86a72881c3e0b88284c211e01fb22435a.tar.zst AltCraft-6bab0ab86a72881c3e0b88284c211e01fb22435a.zip |
Diffstat (limited to 'src/RendererWorld.cpp')
-rw-r--r-- | src/RendererWorld.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/RendererWorld.cpp b/src/RendererWorld.cpp index 282d97e..f13011e 100644 --- a/src/RendererWorld.cpp +++ b/src/RendererWorld.cpp @@ -226,8 +226,13 @@ void RendererWorld::Render(RenderState & renderState) { glUniform2f(windowSizeLoc, renderState.WindowWidth, renderState.WindowHeight); glCheckError(); + glBindVertexArray(RendererSection::GetVao()); + + size_t faces = 0; + sectionsMutex.lock(); - for (auto& section : sections) { + for (auto& section : sections) { + faces += section.second.numOfFaces; sectionsMutex.unlock(); std::vector<Vector> sectionCorners = { Vector(0, 0, 0), @@ -258,12 +263,13 @@ void RendererWorld::Render(RenderState & renderState) { sectionsMutex.lock(); continue; } - glm::mat4 transform = glm::translate(glm::mat4(), (section.second.GetPosition() * 16).glm()); - glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(transform)); - section.second.Render(renderState); + + //glDrawArraysInstanced(GL_TRIANGLES, section.second.offset, 6, section.second.numOfFaces); sectionsMutex.lock(); } sectionsMutex.unlock(); + glBindVertexArray(RendererSection::GetVao()); + glDrawArraysInstanced(GL_TRIANGLES, 0, 6, faces); glCheckError(); glLineWidth(3.0); |