diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-25 14:08:45 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-25 14:08:45 +0000 |
commit | 916fafa028b0bc8c8b0abec8c072722907d85f43 (patch) | |
tree | 14e61837722b9dd5404d0dfea9301d6e86615abe /gfx/gl/shadowMapper.cpp | |
parent | Spread the trees out (diff) | |
download | ilt-916fafa028b0bc8c8b0abec8c072722907d85f43.tar.bz2 ilt-916fafa028b0bc8c8b0abec8c072722907d85f43.tar.xz ilt-916fafa028b0bc8c8b0abec8c072722907d85f43.zip |
Send position and rotation matrix to GPU separately in shadowmapper dynamic
Diffstat (limited to 'gfx/gl/shadowMapper.cpp')
-rw-r--r-- | gfx/gl/shadowMapper.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/gfx/gl/shadowMapper.cpp b/gfx/gl/shadowMapper.cpp index 190f20e..4a8d7ec 100644 --- a/gfx/gl/shadowMapper.cpp +++ b/gfx/gl/shadowMapper.cpp @@ -179,7 +179,8 @@ ShadowMapper::FixedPoint::use() const } ShadowMapper::DynamicPoint::DynamicPoint() : - Program {shadowDynamicPoint_vs}, viewProjectionLoc {*this, "viewProjection"}, modelLoc {*this, "model"} + Program {shadowDynamicPoint_vs}, viewProjectionLoc {*this, "viewProjection"}, modelLoc {*this, "model"}, + modelPosLoc {*this, "modelPos"} { } @@ -195,13 +196,11 @@ ShadowMapper::DynamicPoint::use(const Location & location) const { glUseProgram(*this); setModel(location); - const auto model = glm::translate(location.pos) * rotate_ypr(location.rot); - glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model)); } void ShadowMapper::DynamicPoint::setModel(const Location & 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)); } |