Delay static shadowmap generation by five frames to prevent them from "sticking"
This commit is contained in:
parent
0861278ae5
commit
069cf3e84c
2 changed files with 7 additions and 0 deletions
|
@ -237,6 +237,8 @@ public:
|
||||||
std::array<bool, max_point_shadows> point_light_dirty;
|
std::array<bool, max_point_shadows> point_light_dirty;
|
||||||
std::array<bool, max_spot_shadows> spot_light_dirty;
|
std::array<bool, max_spot_shadows> spot_light_dirty;
|
||||||
|
|
||||||
|
int shadow_refresh_timer = 5;
|
||||||
|
|
||||||
// environment
|
// environment
|
||||||
std::array<bool, max_environment_probes> environment_dirty;
|
std::array<bool, max_environment_probes> environment_dirty;
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,11 @@ void ShadowPass::render(GFXCommandBuffer* command_buffer, Scene& scene) {
|
||||||
last_spot_light = 0;
|
last_spot_light = 0;
|
||||||
last_point_light = 0;
|
last_point_light = 0;
|
||||||
|
|
||||||
|
if(scene.shadow_refresh_timer > 0) {
|
||||||
|
scene.shadow_refresh_timer--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto lights = scene.get_all<Light>();
|
auto lights = scene.get_all<Light>();
|
||||||
for(auto [obj, light] : lights) {
|
for(auto [obj, light] : lights) {
|
||||||
switch(light.type) {
|
switch(light.type) {
|
||||||
|
|
Reference in a new issue