summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-03-04 15:18:32 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-03-04 15:18:32 +0000
commit7fc588638feb1a83ab58f78f9e2a9d0d23a083e0 (patch)
tree6f04693eb61ed14f99b5f4f0ffc3f0b5d9b738a5
parentLoad length, wheelBase and maxSpeed RailVehicleClass properties from XML (diff)
downloadilt-7fc588638feb1a83ab58f78f9e2a9d0d23a083e0.tar.bz2
ilt-7fc588638feb1a83ab58f78f9e2a9d0d23a083e0.tar.xz
ilt-7fc588638feb1a83ab58f78f9e2a9d0d23a083e0.zip
DynamicPoint shadow render now supports updating the position without calling use again
-rw-r--r--gfx/gl/shadowMapper.cpp7
-rw-r--r--gfx/gl/shadowMapper.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/gfx/gl/shadowMapper.cpp b/gfx/gl/shadowMapper.cpp
index 1787ee6..7649a54 100644
--- a/gfx/gl/shadowMapper.cpp
+++ b/gfx/gl/shadowMapper.cpp
@@ -184,6 +184,13 @@ void
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));
}
diff --git a/gfx/gl/shadowMapper.h b/gfx/gl/shadowMapper.h
index b4793ed..a5c2c7b 100644
--- a/gfx/gl/shadowMapper.h
+++ b/gfx/gl/shadowMapper.h
@@ -34,6 +34,7 @@ public:
DynamicPoint();
void setViewProjection(const glm::mat4 &) const;
void use(const Location &) const;
+ void setModel(const Location &) const;
private:
RequiredUniformLocation viewProjectionLoc;