summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-11-25 14:08:45 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-11-25 14:08:45 +0000
commit916fafa028b0bc8c8b0abec8c072722907d85f43 (patch)
tree14e61837722b9dd5404d0dfea9301d6e86615abe /gfx
parentSpread the trees out (diff)
downloadilt-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')
-rw-r--r--gfx/gl/shadowMapper.cpp9
-rw-r--r--gfx/gl/shadowMapper.h1
2 files changed, 5 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));
}
diff --git a/gfx/gl/shadowMapper.h b/gfx/gl/shadowMapper.h
index d54734c..b53a7f1 100644
--- a/gfx/gl/shadowMapper.h
+++ b/gfx/gl/shadowMapper.h
@@ -44,6 +44,7 @@ public:
private:
RequiredUniformLocation viewProjectionLoc;
RequiredUniformLocation modelLoc;
+ RequiredUniformLocation modelPosLoc;
};
FixedPoint fixedPoint, dynamicPointInst;