summaryrefslogtreecommitdiffstats
path: root/src/RendererWorld.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-09-19 17:52:09 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-01-13 03:39:31 +0100
commitd56fa5d68fcdfa2fdfc601d10e9292d6a5883dcd (patch)
tree86133ce5c166d20cc25706b09a81225105a580e2 /src/RendererWorld.cpp
parent2017-09-17 (diff)
downloadAltCraft-d56fa5d68fcdfa2fdfc601d10e9292d6a5883dcd.tar
AltCraft-d56fa5d68fcdfa2fdfc601d10e9292d6a5883dcd.tar.gz
AltCraft-d56fa5d68fcdfa2fdfc601d10e9292d6a5883dcd.tar.bz2
AltCraft-d56fa5d68fcdfa2fdfc601d10e9292d6a5883dcd.tar.lz
AltCraft-d56fa5d68fcdfa2fdfc601d10e9292d6a5883dcd.tar.xz
AltCraft-d56fa5d68fcdfa2fdfc601d10e9292d6a5883dcd.tar.zst
AltCraft-d56fa5d68fcdfa2fdfc601d10e9292d6a5883dcd.zip
Diffstat (limited to '')
-rw-r--r--src/RendererWorld.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/RendererWorld.cpp b/src/RendererWorld.cpp
index a641cf2..282d97e 100644
--- a/src/RendererWorld.cpp
+++ b/src/RendererWorld.cpp
@@ -218,6 +218,7 @@ void RendererWorld::Render(RenderState & renderState) {
GLint projectionLoc = glGetUniformLocation(blockShader->Program, "projection");
GLint viewLoc = glGetUniformLocation(blockShader->Program, "view");
GLint windowSizeLoc = glGetUniformLocation(blockShader->Program, "windowSize");
+ GLint modelLoc = glGetUniformLocation(blockShader->Program, "model");
glm::mat4 projection = glm::perspective(45.0f, (float)renderState.WindowWidth / (float)renderState.WindowHeight, 0.1f, 10000000.0f);
glm::mat4 view = gs->GetViewMatrix();
glUniformMatrix4fv(projectionLoc, 1, GL_FALSE, glm::value_ptr(projection));
@@ -257,6 +258,8 @@ 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);
sectionsMutex.lock();
}
@@ -271,7 +274,7 @@ void RendererWorld::Render(RenderState & renderState) {
glUniformMatrix4fv(projectionLoc, 1, GL_FALSE, glm::value_ptr(projection));
glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(view));
glCheckError();
- GLint modelLoc = glGetUniformLocation(entityShader->Program, "model");
+ modelLoc = glGetUniformLocation(entityShader->Program, "model");
GLint colorLoc = glGetUniformLocation(entityShader->Program, "color");
for (auto& it : entities) {
it.modelLoc = modelLoc;