summaryrefslogtreecommitdiff
path: root/gfx/gl/shader.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-03-03 00:08:47 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-03-03 00:08:47 +0000
commit94311f9c4e82b7475802b1934cc0c5b243e0cd2f (patch)
tree5ef23f6c1151917eb723b67c262da0168e42343c /gfx/gl/shader.cpp
parentOur own matrix rotations (diff)
downloadilt-94311f9c4e82b7475802b1934cc0c5b243e0cd2f.tar.bz2
ilt-94311f9c4e82b7475802b1934cc0c5b243e0cd2f.tar.xz
ilt-94311f9c4e82b7475802b1934cc0c5b243e0cd2f.zip
Replace Transform with Location
Simpler, unbinds the transformation matrices for location, now done just in the shader.
Diffstat (limited to 'gfx/gl/shader.cpp')
-rw-r--r--gfx/gl/shader.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/gfx/gl/shader.cpp b/gfx/gl/shader.cpp
index f30af5c..04d5ac6 100644
--- a/gfx/gl/shader.cpp
+++ b/gfx/gl/shader.cpp
@@ -8,6 +8,9 @@
#include <gfx/gl/shaders/vs-landmassShader.h>
#include <gfx/gl/shaders/vs-waterShader.h>
#include <glm/glm.hpp>
+#include <glm/gtx/transform.hpp>
+#include <location.hpp>
+#include <maths.h>
#include <stdexcept>
#include <string>
@@ -67,10 +70,11 @@ Shader::setUniform(const GLchar * uniform, glm::vec3 v) const
}
void
-Shader::setModel(glm::mat4 model, Program pid) const
+Shader::setModel(const Location & loc, Program pid) const
{
auto & prog = programs[(int)pid];
glUseProgram(prog.m_program);
+ const auto model {glm::translate(loc.pos) * rotate_ypr(loc.rot)};
glUniformMatrix4fv(prog.model_uniform, 1, GL_FALSE, &model[0][0]);
}