mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
Reset SDFGI when changing editor scene tabs
This commit is contained in:
parent
bc88dca176
commit
836705d7a9
@ -137,4 +137,7 @@ uint32_t GI::voxel_gi_get_version(RID p_voxel_gi) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GI::sdfgi_reset() {
|
||||
}
|
||||
|
||||
#endif // GLES3_ENABLED
|
||||
|
@ -90,6 +90,8 @@ public:
|
||||
virtual bool voxel_gi_is_using_two_bounces(RID p_voxel_gi) const override;
|
||||
|
||||
virtual uint32_t voxel_gi_get_version(RID p_voxel_gi) const override;
|
||||
|
||||
virtual void sdfgi_reset() override;
|
||||
};
|
||||
|
||||
}; // namespace GLES3
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include "servers/display_server.h"
|
||||
#include "servers/navigation_server_3d.h"
|
||||
#include "servers/physics_server_2d.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
#include "editor/audio_stream_preview.h"
|
||||
#include "editor/debugger/editor_debugger_node.h"
|
||||
@ -3463,6 +3464,9 @@ void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) {
|
||||
ScriptEditor::get_singleton()->set_scene_root_script(editor_data.get_scene_root_script(editor_data.get_edited_scene()));
|
||||
editor_data.notify_edited_scene_changed();
|
||||
emit_signal(SNAME("scene_changed"));
|
||||
|
||||
// Reset SDFGI after everything else so that any last-second scene modifications will be processed.
|
||||
RenderingServer::get_singleton()->sdfgi_reset();
|
||||
}
|
||||
|
||||
bool EditorNode::is_changing_scene() const {
|
||||
|
@ -78,6 +78,8 @@ public:
|
||||
virtual bool voxel_gi_is_using_two_bounces(RID p_voxel_gi) const override { return false; }
|
||||
|
||||
virtual uint32_t voxel_gi_get_version(RID p_voxel_gi) const override { return 0; }
|
||||
|
||||
virtual void sdfgi_reset() override {}
|
||||
};
|
||||
|
||||
} // namespace RendererDummy
|
||||
|
@ -79,6 +79,8 @@ public:
|
||||
virtual bool voxel_gi_is_using_two_bounces(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual uint32_t voxel_gi_get_version(RID p_probe) const = 0;
|
||||
|
||||
virtual void sdfgi_reset() = 0;
|
||||
};
|
||||
|
||||
#endif // RENDERER_GI_H
|
||||
|
@ -392,6 +392,10 @@ Dependency *GI::voxel_gi_get_dependency(RID p_voxel_gi) const {
|
||||
return &voxel_gi->dependency;
|
||||
}
|
||||
|
||||
void GI::sdfgi_reset() {
|
||||
sdfgi_current_version++;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// SDFGI
|
||||
|
||||
@ -416,6 +420,7 @@ void GI::SDFGI::create(RID p_env, const Vector3 &p_world_position, uint32_t p_re
|
||||
y_scale_mode = RendererSceneRenderRD::get_singleton()->environment_get_sdfgi_y_scale(p_env);
|
||||
static const float y_scale[3] = { 2.0, 1.5, 1.0 };
|
||||
y_mult = y_scale[y_scale_mode];
|
||||
version = gi->sdfgi_current_version;
|
||||
cascades.resize(num_cascades);
|
||||
probe_axis_count = SDFGI::PROBE_DIVISOR + 1;
|
||||
solid_cell_ratio = gi->sdfgi_solid_cell_ratio;
|
||||
|
@ -667,6 +667,7 @@ public:
|
||||
|
||||
float y_mult = 1.0;
|
||||
|
||||
uint32_t version = 0;
|
||||
uint32_t render_pass = 0;
|
||||
|
||||
int32_t cascade_dynamic_light_count[SDFGI::MAX_CASCADES]; //used dynamically
|
||||
@ -701,11 +702,14 @@ public:
|
||||
Vector3 sdfgi_debug_probe_dir;
|
||||
bool sdfgi_debug_probe_enabled = false;
|
||||
Vector3i sdfgi_debug_probe_index;
|
||||
uint32_t sdfgi_current_version = 0;
|
||||
|
||||
/* SDFGI UPDATE */
|
||||
|
||||
int sdfgi_get_lightprobe_octahedron_size() const { return SDFGI::LIGHTPROBE_OCT_SIZE; }
|
||||
|
||||
virtual void sdfgi_reset() override;
|
||||
|
||||
struct SDFGIData {
|
||||
float grid_size[3];
|
||||
uint32_t max_cascades;
|
||||
|
@ -3323,14 +3323,18 @@ void RenderForwardClustered::sdfgi_update(const Ref<RenderSceneBuffers> &p_rende
|
||||
}
|
||||
|
||||
bool needs_sdfgi = p_environment.is_valid() && environment_get_sdfgi_enabled(p_environment);
|
||||
bool needs_reset = sdfgi.is_valid() ? sdfgi->version != gi.sdfgi_current_version : false;
|
||||
|
||||
if (!needs_sdfgi) {
|
||||
if (!needs_sdfgi || needs_reset) {
|
||||
if (sdfgi.is_valid()) {
|
||||
// delete it
|
||||
sdfgi.unref();
|
||||
rb->set_custom_data(RB_SCOPE_SDFGI, sdfgi);
|
||||
}
|
||||
return;
|
||||
|
||||
if (!needs_sdfgi) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure advanced shaders are available if SDFGI is used.
|
||||
|
@ -476,6 +476,8 @@ public:
|
||||
FUNC2(voxel_gi_set_interior, RID, bool)
|
||||
FUNC2(voxel_gi_set_use_two_bounces, RID, bool)
|
||||
|
||||
FUNC0(sdfgi_reset)
|
||||
|
||||
/* PARTICLES */
|
||||
|
||||
#undef ServerName
|
||||
|
@ -617,6 +617,8 @@ public:
|
||||
|
||||
virtual void voxel_gi_set_quality(VoxelGIQuality) = 0;
|
||||
|
||||
virtual void sdfgi_reset() = 0;
|
||||
|
||||
/* LIGHTMAP */
|
||||
|
||||
virtual RID lightmap_create() = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user