Archived
1
Fork 0

Add probe refresh timer (similiar to how shadows work) to generate probes correctly on scene load

This commit is contained in:
redstrate 2021-05-12 10:33:38 -04:00
parent de928a44ce
commit eab8a265f4
2 changed files with 6 additions and 0 deletions

View file

@ -238,6 +238,7 @@ public:
std::array<bool, max_spot_shadows> spot_light_dirty;
int shadow_refresh_timer = 5;
int probe_refresh_timer = 5;
// environment
std::array<bool, max_environment_probes> environment_dirty;

View file

@ -156,6 +156,11 @@ void SceneCapture::create_scene_resources(Scene& scene) {
}
void SceneCapture::render(GFXCommandBuffer* command_buffer, Scene* scene) {
if(scene->probe_refresh_timer > 0) {
scene->probe_refresh_timer--;
return;
}
int last_probe = 0;
auto probes = scene->get_all<EnvironmentProbe>();
for(auto [obj, probe] : probes) {