Skip to content

Shadows not updating with rotating mapmodels at map load #1354

@Jigoku

Description

@Jigoku

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.

base/src/engine/world.cpp

Lines 422 to 432 in 4c06a3a

#define enteditv(i, f, v) \
{ \
entfocusv(i, \
{ \
removeentityedit(n); \
f; \
if(e.type!=ET_EMPTY) addentityedit(n); \
entities::editent(n, true); \
clearshadowcache(); \
}, v); \
}

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, "");

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions