Archived
1
Fork 0

Delay static shadowmap generation by five frames to prevent them from "sticking"

This commit is contained in:
redstrate 2021-04-18 22:14:19 -04:00
parent 0861278ae5
commit 069cf3e84c
2 changed files with 7 additions and 0 deletions

View file

@ -236,6 +236,8 @@ public:
bool sun_light_dirty = false;
std::array<bool, max_point_shadows> point_light_dirty;
std::array<bool, max_spot_shadows> spot_light_dirty;
int shadow_refresh_timer = 5;
// environment
std::array<bool, max_environment_probes> environment_dirty;

View file

@ -87,6 +87,11 @@ void ShadowPass::create_scene_resources(Scene& scene) {
void ShadowPass::render(GFXCommandBuffer* command_buffer, Scene& scene) {
last_spot_light = 0;
last_point_light = 0;
if(scene.shadow_refresh_timer > 0) {
scene.shadow_refresh_timer--;
return;
}
auto lights = scene.get_all<Light>();
for(auto [obj, light] : lights) {