Shadows not updating with rotating mapmodels at map load
Shadows produced by rotating mapmodels (spinyaw, spinroll, spinpitch etc) do not get updated when a map is loaded.
To test/reproduce the problem, just make a newmap with a spinning mapmodel and a light, save it and reload it.
If you then load the map in editing mode, interacting with the light entity (eg; clicking on it) this calls clearshadowcache(), and the shadows start to update properly for that single entity. https://github.com/redeclipse/base/blob/4c06a3aaa893ccea9bc39b02beedd3798c5a965f/src/engine/world.cpp#L422-L432
I believe that clearshadowcache() needs to be called after genshadowmeshes() inside allchanged(), so that the cache is flushed properly as the map is loaded.
This seems to fix the issues, but would need confirming:
diff --git a/src/engine/octarender.cpp b/src/engine/octarender.cpp
index 3330a195..022c6982 100644
--- a/src/engine/octarender.cpp
+++ b/src/engine/octarender.cpp
@@ -1811,7 +1811,6 @@ void allchanged(bool load)
if(load) precachetextures();
inithaze();
setupmaterials();
- clearshadowcache();
updatevabbs(true);
entities::allchanged(load);
if(load)
@@ -1822,6 +1821,7 @@ void allchanged(bool load)
genenvtexs();
drawminimap();
}
+ clearshadowcache();
}
void recalc()
@@ -1830,4 +1830,3 @@ void recalc()
}
COMMAND(0, recalc, "");