diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-25 13:57:33 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-25 13:57:33 +0000 |
commit | 9bbaa4df842bf350a5d05233140bb4d631212a11 (patch) | |
tree | edd237654fed0e554163d74741bd2bc2f35f92f4 /gfx | |
parent | Switch to millimeters for spatial units (diff) | |
download | ilt-9bbaa4df842bf350a5d05233140bb4d631212a11.tar.bz2 ilt-9bbaa4df842bf350a5d05233140bb4d631212a11.tar.xz ilt-9bbaa4df842bf350a5d05233140bb4d631212a11.zip |
Send position and rotation matrix to GPU separately in basic program
Missed from earlier commit
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/gl/sceneShader.cpp | 9 | ||||
-rw-r--r-- | gfx/gl/sceneShader.h | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/gfx/gl/sceneShader.cpp b/gfx/gl/sceneShader.cpp index 2f391fd..de75814 100644 --- a/gfx/gl/sceneShader.cpp +++ b/gfx/gl/sceneShader.cpp @@ -60,13 +60,16 @@ SceneShader::SceneProgram::setViewPort(const ViewPort & viewPort) const } } -SceneShader::BasicProgram::BasicProgram() : SceneProgram {dynamicPoint_vs, material_fs}, modelLoc {*this, "model"} { } +SceneShader::BasicProgram::BasicProgram() : + SceneProgram {dynamicPoint_vs, material_fs}, modelLoc {*this, "model"}, modelPosLoc {*this, "modelPos"} +{ +} void SceneShader::BasicProgram::setModel(Location const & location) const { - const auto model {glm::translate(location.pos) * rotate_ypr(location.rot)}; - glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model)); + glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(rotate_ypr(location.rot))); + glUniform3fv(modelPosLoc, 1, glm::value_ptr(location.pos)); } void diff --git a/gfx/gl/sceneShader.h b/gfx/gl/sceneShader.h index 154dc17..83c234c 100644 --- a/gfx/gl/sceneShader.h +++ b/gfx/gl/sceneShader.h @@ -32,6 +32,7 @@ class SceneShader { private: RequiredUniformLocation modelLoc; + RequiredUniformLocation modelPosLoc; }; class AbsolutePosProgram : public SceneProgram { |