diff options
8 files changed, 52 insertions, 59 deletions
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index fdbde8dc5c..97edf84488 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -40,38 +40,35 @@ #include "editor/editor_scale.h" #include "editor_file_system.h" -void ScriptCreateDialog::_theme_changed() { - for (int i = 0; i < ScriptServer::get_language_count(); i++) { - String lang = ScriptServer::get_language(i)->get_type(); - Ref<Texture2D> lang_icon = gc->get_theme_icon(lang, "EditorIcons"); - if (lang_icon.is_valid()) { - language_menu->set_item_icon(i, lang_icon); - } - } - - String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", ""); - if (!last_lang.is_empty()) { - for (int i = 0; i < language_menu->get_item_count(); i++) { - if (language_menu->get_item_text(i) == last_lang) { - language_menu->select(i); - current_language = i; - break; +void ScriptCreateDialog::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: { + for (int i = 0; i < ScriptServer::get_language_count(); i++) { + String lang = ScriptServer::get_language(i)->get_type(); + Ref<Texture2D> lang_icon = get_theme_icon(lang, "EditorIcons"); + if (lang_icon.is_valid()) { + language_menu->set_item_icon(i, lang_icon); + } } - } - } else { - language_menu->select(default_language); - } - path_button->set_icon(gc->get_theme_icon("Folder", "EditorIcons")); - parent_browse_button->set_icon(gc->get_theme_icon("Folder", "EditorIcons")); - parent_search_button->set_icon(gc->get_theme_icon("ClassList", "EditorIcons")); - status_panel->add_theme_style_override("panel", gc->get_theme_stylebox("bg", "Tree")); -} + String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", ""); + if (!last_lang.is_empty()) { + for (int i = 0; i < language_menu->get_item_count(); i++) { + if (language_menu->get_item_text(i) == last_lang) { + language_menu->select(i); + current_language = i; + break; + } + } + } else { + language_menu->select(default_language); + } -void ScriptCreateDialog::_notification(int p_what) { - switch (p_what) { - case NOTIFICATION_ENTER_TREE: { - _theme_changed(); + path_button->set_icon(get_theme_icon("Folder", "EditorIcons")); + parent_browse_button->set_icon(get_theme_icon("Folder", "EditorIcons")); + parent_search_button->set_icon(get_theme_icon("ClassList", "EditorIcons")); + status_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); } break; } } @@ -451,7 +448,7 @@ void ScriptCreateDialog::_lang_changed(int l) { override_info += ", "; } } - template_menu->set_item_icon(extended.id, gc->get_theme_icon("Override", "EditorIcons")); + template_menu->set_item_icon(extended.id, get_theme_icon("Override", "EditorIcons")); template_menu->get_popup()->set_item_tooltip(extended.id, override_info.as_string()); } // Reselect last selected template @@ -609,18 +606,18 @@ void ScriptCreateDialog::_path_submitted(const String &p_path) { void ScriptCreateDialog::_msg_script_valid(bool valid, const String &p_msg) { error_label->set_text("- " + p_msg); if (valid) { - error_label->add_theme_color_override("font_color", gc->get_theme_color("success_color", "Editor")); + error_label->add_theme_color_override("font_color", get_theme_color("success_color", "Editor")); } else { - error_label->add_theme_color_override("font_color", gc->get_theme_color("error_color", "Editor")); + error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); } } void ScriptCreateDialog::_msg_path_valid(bool valid, const String &p_msg) { path_error_label->set_text("- " + p_msg); if (valid) { - path_error_label->add_theme_color_override("font_color", gc->get_theme_color("success_color", "Editor")); + path_error_label->add_theme_color_override("font_color", get_theme_color("success_color", "Editor")); } else { - path_error_label->add_theme_color_override("font_color", gc->get_theme_color("error_color", "Editor")); + path_error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); } } @@ -748,15 +745,11 @@ void ScriptCreateDialog::_bind_methods() { } ScriptCreateDialog::ScriptCreateDialog() { - /* DIALOG */ - /* Main Controls */ - gc = memnew(GridContainer); + GridContainer *gc = memnew(GridContainer); gc->set_columns(2); - gc->connect("theme_changed", callable_mp(this, &ScriptCreateDialog::_theme_changed)); - /* Error Messages Field */ VBoxContainer *vb = memnew(VBoxContainer); @@ -832,7 +825,6 @@ ScriptCreateDialog::ScriptCreateDialog() { parent_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb->add_child(parent_name); parent_search_button = memnew(Button); - parent_search_button->set_flat(true); parent_search_button->connect("pressed", callable_mp(this, &ScriptCreateDialog::_browse_class_in_tree)); hb->add_child(parent_search_button); parent_browse_button = memnew(Button); diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h index a020be0478..7c2ef1e150 100644 --- a/editor/script_create_dialog.h +++ b/editor/script_create_dialog.h @@ -45,7 +45,6 @@ class CreateDialog; class ScriptCreateDialog : public ConfirmationDialog { GDCLASS(ScriptCreateDialog, ConfirmationDialog); - GridContainer *gc; LineEdit *class_name; Label *error_label; Label *path_error_label; @@ -127,7 +126,6 @@ class ScriptCreateDialog : public ConfirmationDialog { void _update_dialog(); protected: - void _theme_changed(); void _notification(int p_what); static void _bind_methods(); diff --git a/servers/rendering/renderer_rd/effects_rd.cpp b/servers/rendering/renderer_rd/effects_rd.cpp index 4290e0d574..b0a1a2c939 100644 --- a/servers/rendering/renderer_rd/effects_rd.cpp +++ b/servers/rendering/renderer_rd/effects_rd.cpp @@ -503,11 +503,10 @@ void EffectsRD::screen_space_reflection(RID p_diffuse, RID p_normal_roughness, R if (p_roughness_quality != RS::ENV_SSR_ROUGNESS_QUALITY_DISABLED) { RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_compute_uniform_set_from_image_pair(p_output, p_blur_radius), 1); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_compute_uniform_set_from_texture_pair(p_metallic, p_normal_roughness), 3); } else { RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_uniform_set_from_image(p_output), 1); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_compute_uniform_set_from_texture(p_metallic), 3); } + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_compute_uniform_set_from_texture(p_metallic), 3); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_uniform_set_from_image(p_scale_normal), 2); RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_screen_size.width, p_screen_size.height, 1); diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp index 3270e30ded..2be906d1b1 100644 --- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp @@ -781,7 +781,8 @@ void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const Strin { overdraw_material_shader = storage->shader_allocate(); storage->shader_initialize(overdraw_material_shader); - storage->shader_set_code(overdraw_material_shader, "shader_type spatial;\nrender_mode blend_add,unshaded;\n void fragment() { ALBEDO=vec3(0.4,0.8,0.8); ALPHA=0.2; }"); + // Use relatively low opacity so that more "layers" of overlapping objects can be distinguished. + storage->shader_set_code(overdraw_material_shader, "shader_type spatial;\nrender_mode blend_add,unshaded;\n void fragment() { ALBEDO=vec3(0.4,0.8,0.8); ALPHA=0.1; }"); overdraw_material = storage->material_allocate(); storage->material_initialize(overdraw_material); storage->material_set_shader(overdraw_material, overdraw_material_shader); diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp index 187bdf14e3..a7308e54ef 100644 --- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp @@ -767,7 +767,8 @@ void SceneShaderForwardMobile::init(RendererStorageRD *p_storage, const String p { overdraw_material_shader = storage->shader_allocate(); storage->shader_initialize(overdraw_material_shader); - storage->shader_set_code(overdraw_material_shader, "shader_type spatial;\nrender_mode blend_add,unshaded;\n void fragment() { ALBEDO=vec3(0.4,0.8,0.8); ALPHA=0.2; }"); + // Use relatively low opacity so that more "layers" of overlapping objects can be distinguished. + storage->shader_set_code(overdraw_material_shader, "shader_type spatial;\nrender_mode blend_add,unshaded;\n void fragment() { ALBEDO=vec3(0.4,0.8,0.8); ALPHA=0.1; }"); overdraw_material = storage->material_allocate(); storage->material_initialize(overdraw_material); storage->material_set_shader(overdraw_material, overdraw_material_shader); diff --git a/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp index 9228e06d7e..98d08f68e8 100644 --- a/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp @@ -3029,8 +3029,6 @@ void RendererSceneGIRD::setup_voxel_gi_instances(RID p_render_buffers, const Tra RID voxel_gi_buffer = p_scene_render->render_buffers_get_voxel_gi_buffer(p_render_buffers); - RD::get_singleton()->draw_command_begin_label("VoxelGIs Setup"); - VoxelGIData voxel_gi_data[MAX_VOXEL_GI_INSTANCES]; bool voxel_gi_instances_changed = false; @@ -3110,10 +3108,12 @@ void RendererSceneGIRD::setup_voxel_gi_instances(RID p_render_buffers, const Tra } if (p_voxel_gi_instances.size() > 0) { + RD::get_singleton()->draw_command_begin_label("VoxelGIs Setup"); + RD::get_singleton()->buffer_update(voxel_gi_buffer, 0, sizeof(VoxelGIData) * MIN((uint64_t)MAX_VOXEL_GI_INSTANCES, p_voxel_gi_instances.size()), voxel_gi_data, RD::BARRIER_MASK_COMPUTE); - } - RD::get_singleton()->draw_command_end_label(); + RD::get_singleton()->draw_command_end_label(); + } } void RendererSceneGIRD::process_gi(RID p_render_buffers, RID p_normal_roughness_buffer, RID p_voxel_gi_buffer, RID p_environment, const CameraMatrix &p_projection, const Transform3D &p_transform, const PagedArray<RID> &p_voxel_gi_instances, RendererSceneRenderRD *p_scene_render) { @@ -3346,6 +3346,7 @@ void RendererSceneGIRD::process_gi(RID p_render_buffers, RID p_normal_roughness_ } else { mode = (use_sdfgi && use_voxel_gi_instances) ? MODE_COMBINED : (use_sdfgi ? MODE_SDFGI : MODE_VOXEL_GI); } + RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin(true); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, pipelines[mode]); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, rb->gi.uniform_set, 0); diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 44ca17e273..46057bddab 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -3759,9 +3759,7 @@ void RendererSceneRenderRD::render_scene(RID p_render_buffers, const CameraData rb->sdfgi->update_light(); } - if (p_voxel_gi_instances.size()) { - gi.setup_voxel_gi_instances(render_data.render_buffers, render_data.cam_transform, *render_data.voxel_gi_instances, render_state.voxel_gi_count, this); - } + gi.setup_voxel_gi_instances(render_data.render_buffers, render_data.cam_transform, *render_data.voxel_gi_instances, render_state.voxel_gi_count, this); } render_state.depth_prepass_used = false; diff --git a/servers/rendering/renderer_rd/shaders/screen_space_reflection_scale.glsl b/servers/rendering/renderer_rd/shaders/screen_space_reflection_scale.glsl index 7e06516d90..2328effe7b 100644 --- a/servers/rendering/renderer_rd/shaders/screen_space_reflection_scale.glsl +++ b/servers/rendering/renderer_rd/shaders/screen_space_reflection_scale.glsl @@ -36,12 +36,12 @@ void main() { float divisor = 0.0; vec4 color; float depth; - vec3 normal; + vec4 normal; if (params.filtered) { color = vec4(0.0); depth = 0.0; - normal = vec3(0.0); + normal = vec4(0.0); for (int i = 0; i < 4; i++) { ivec2 ofs = ssC << 1; @@ -53,7 +53,9 @@ void main() { } color += texelFetch(source_ssr, ofs, 0); float d = texelFetch(source_depth, ofs, 0).r; - normal += texelFetch(source_normal, ofs, 0).xyz * 2.0 - 1.0; + vec4 nr = texelFetch(source_normal, ofs, 0); + normal.xyz += nr.xyz * 2.0 - 1.0; + normal.w += nr.w; d = d * 2.0 - 1.0; if (params.orthogonal) { @@ -66,11 +68,12 @@ void main() { color /= 4.0; depth /= 4.0; - normal = normalize(normal / 4.0) * 0.5 + 0.5; + normal.xyz = normalize(normal.xyz / 4.0) * 0.5 + 0.5; + normal.w /= 4.0; } else { color = texelFetch(source_ssr, ssC << 1, 0); depth = texelFetch(source_depth, ssC << 1, 0).r; - normal = texelFetch(source_normal, ssC << 1, 0).xyz; + normal = texelFetch(source_normal, ssC << 1, 0); depth = depth * 2.0 - 1.0; if (params.orthogonal) { @@ -83,5 +86,5 @@ void main() { imageStore(dest_ssr, ssC, color); imageStore(dest_depth, ssC, vec4(depth)); - imageStore(dest_normal, ssC, vec4(normal, 0.0)); + imageStore(dest_normal, ssC, normal); } |