diff options
-rw-r--r-- | core/bind/core_bind.cpp | 2 | ||||
-rw-r--r-- | editor/editor_node.cpp | 1 | ||||
-rw-r--r-- | editor/icons/InterpolatedCamera.svg | 1 | ||||
-rw-r--r-- | editor/plugins/abstract_polygon_2d_editor.cpp | 2 | ||||
-rw-r--r-- | editor/quick_open.cpp | 82 | ||||
-rw-r--r-- | editor/quick_open.h | 4 | ||||
-rw-r--r-- | modules/gdnative/videodecoder/video_stream_gdnative.cpp | 5 | ||||
-rw-r--r-- | modules/gdscript/doc_classes/@GDScript.xml | 16 | ||||
-rw-r--r-- | platform/android/export/export.cpp | 6 | ||||
-rw-r--r-- | platform/android/java/app/AndroidManifest.xml | 4 | ||||
-rw-r--r-- | platform/linuxbsd/display_server_x11.cpp | 111 | ||||
-rw-r--r-- | platform/linuxbsd/display_server_x11.h | 2 | ||||
-rw-r--r-- | platform/linuxbsd/os_linuxbsd.cpp | 13 | ||||
-rw-r--r-- | scene/gui/video_player.cpp | 4 | ||||
-rw-r--r-- | servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl | 10 | ||||
-rw-r--r-- | servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl | 99 |
16 files changed, 89 insertions, 273 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 267391c4d6..cb82dc7f8f 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -454,7 +454,7 @@ Dictionary _OS::get_datetime_from_unix_time(int64_t unix_time_val) const { } else { dayno = (unix_time_val - SECS_DAY + 1) / SECS_DAY; dayclock = unix_time_val - dayno * SECS_DAY; - date.weekday = static_cast<OS::Weekday>((dayno - 3) % 7 + 7); + date.weekday = static_cast<OS::Weekday>(((dayno % 7) + 11) % 7); do { year--; dayno += YEARSIZE(year); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 30aa24695c..f2f8805aaf 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6488,6 +6488,7 @@ EditorNode::EditorNode() { } resource_preview->add_preview_generator(Ref<EditorTexturePreviewPlugin>(memnew(EditorTexturePreviewPlugin))); + resource_preview->add_preview_generator(Ref<EditorImagePreviewPlugin>(memnew(EditorImagePreviewPlugin))); resource_preview->add_preview_generator(Ref<EditorPackedScenePreviewPlugin>(memnew(EditorPackedScenePreviewPlugin))); resource_preview->add_preview_generator(Ref<EditorMaterialPreviewPlugin>(memnew(EditorMaterialPreviewPlugin))); resource_preview->add_preview_generator(Ref<EditorScriptPreviewPlugin>(memnew(EditorScriptPreviewPlugin))); diff --git a/editor/icons/InterpolatedCamera.svg b/editor/icons/InterpolatedCamera.svg deleted file mode 100644 index 4bc4ba1ee9..0000000000 --- a/editor/icons/InterpolatedCamera.svg +++ /dev/null @@ -1 +0,0 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m9.5.00004c-1.5691.0017903-2.8718 1.2125-2.9883 2.7773-.55103-.49952-1.268-.77655-2.0117-.77734-1.6569 0-3 1.3431-3 3 .00179 1.2698.80282 2.4009 2 2.8242v2.1758c0 .554.44599 1 1 1h6c.55401 0 .9853-.4462 1-1v-1l3 2v-6l-3 2v-1.7695c.63486-.56783.99842-1.3788 1-2.2305 0-1.6569-1.3431-3-3-3zm-6 12v4h1v-4zm3 0v4h1v-1h1c.55228 0 1-.44772 1-1v-1c0-.55228-.44824-1.024-1-1h-1zm5 0c-.55228 0-1 .44772-1 1v2c0 .55228.44772 1 1 1h1c.55228 0 1-.44772 1-1v-2c0-.55228-.44772-1-1-1zm-4 1h1v1h-1zm4 0h1v2h-1z" fill="#fc9c9c"/></svg>
\ No newline at end of file diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index e99ffe2b83..49e67f3605 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -369,7 +369,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) } else { const real_t grab_threshold = EDITOR_GET("editors/poly_editor/point_grab_radius"); - if (!_is_line() && wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_threshold) { + if (!_is_line() && wip.size() > 1 && xform.xform(wip[0]).distance_to(xform.xform(cpoint)) < grab_threshold) { //wip closed _wip_close(); diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp index bcef29dfa6..4719fcaae4 100644 --- a/editor/quick_open.cpp +++ b/editor/quick_open.cpp @@ -32,21 +32,18 @@ #include "core/os/keyboard.h" -void EditorQuickOpen::popup_dialog(const StringName &p_base, bool p_enable_multi, bool p_add_dirs, bool p_dontclear) { - add_directories = p_add_dirs; - popup_centered_ratio(0.6); +void EditorQuickOpen::popup_dialog(const StringName &p_base, bool p_enable_multi, bool p_dontclear) { + base_type = p_base; + search_options->set_select_mode(p_enable_multi ? Tree::SELECT_MULTI : Tree::SELECT_SINGLE); + popup_centered_ratio(0.4); + if (p_dontclear) { search_box->select_all(); } else { search_box->clear(); } - if (p_enable_multi) { - search_options->set_select_mode(Tree::SELECT_MULTI); - } else { - search_options->set_select_mode(Tree::SELECT_SINGLE); - } + search_box->grab_focus(); - base_type = p_base; _update_search(); } @@ -101,7 +98,6 @@ void EditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) { } current->select(0); - } break; } } @@ -124,61 +120,25 @@ float EditorQuickOpen::_path_cmp(String search, String path) const { } void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<String, Ref<Texture2D>>> &list) { - if (!add_directories) { - for (int i = 0; i < efsd->get_subdir_count(); i++) { - _parse_fs(efsd->get_subdir(i), list); - } + for (int i = 0; i < efsd->get_subdir_count(); i++) { + _parse_fs(efsd->get_subdir(i), list); } String search_text = search_box->get_text(); - if (add_directories) { - String path = efsd->get_path(); - if (!path.ends_with("/")) { - path += "/"; - } - if (path != "res://") { - path = path.substr(6, path.length()); - if (search_text.is_subsequence_ofi(path)) { - Pair<String, Ref<Texture2D>> pair; - pair.first = path; - pair.second = search_options->get_theme_icon("folder", "FileDialog"); - - if (search_text != String() && list.size() > 0) { - float this_sim = _path_cmp(search_text, path); - float other_sim = _path_cmp(list[0].first, path); - int pos = 1; - - while (pos < list.size() && this_sim <= other_sim) { - other_sim = _path_cmp(list[pos++].first, path); - } - - pos = this_sim >= other_sim ? pos - 1 : pos; - list.insert(pos, pair); - - } else { - list.push_back(pair); - } - } - } - } for (int i = 0; i < efsd->get_file_count(); i++) { String file = efsd->get_file_path(i); file = file.substr(6, file.length()); - if (ClassDB::is_parent_class(efsd->get_file_type(i), base_type) && (search_text.is_subsequence_ofi(file))) { + StringName file_type = efsd->get_file_type(i); + if (ClassDB::is_parent_class(file_type, base_type) && search_text.is_subsequence_ofi(file)) { Pair<String, Ref<Texture2D>> pair; pair.first = file; - pair.second = search_options->get_theme_icon((search_options->has_theme_icon(efsd->get_file_type(i), ei) ? efsd->get_file_type(i) : ot), ei); + StringName icon_name = search_options->has_theme_icon(file_type, ei) ? file_type : ot; + pair.second = search_options->get_theme_icon(icon_name, ei); list.push_back(pair); } } - - if (add_directories) { - for (int i = 0; i < efsd->get_subdir_count(); i++) { - _parse_fs(efsd->get_subdir(i), list); - } - } } Vector<Pair<String, Ref<Texture2D>>> EditorQuickOpen::_sort_fs(Vector<Pair<String, Ref<Texture2D>>> &list) { @@ -250,7 +210,7 @@ void EditorQuickOpen::_confirmed() { } void EditorQuickOpen::_theme_changed() { - search_box->set_right_icon(search_options->get_theme_icon("Search", "EditorIcons")); + search_box->set_right_icon(search_options->get_theme_icon("Search", ei)); } void EditorQuickOpen::_notification(int p_what) { @@ -277,23 +237,25 @@ void EditorQuickOpen::_bind_methods() { EditorQuickOpen::EditorQuickOpen() { VBoxContainer *vbc = memnew(VBoxContainer); vbc->connect("theme_changed", callable_mp(this, &EditorQuickOpen::_theme_changed)); - add_child(vbc); + search_box = memnew(LineEdit); - vbc->add_margin_child(TTR("Search:"), search_box); search_box->connect("text_changed", callable_mp(this, &EditorQuickOpen::_text_changed)); search_box->connect("gui_input", callable_mp(this, &EditorQuickOpen::_sbox_input)); + vbc->add_margin_child(TTR("Search:"), search_box); + search_options = memnew(Tree); + search_options->connect("item_activated", callable_mp(this, &EditorQuickOpen::_confirmed)); + search_options->set_hide_root(true); + search_options->set_hide_folding(true); + search_options->add_theme_constant_override("draw_guides", 1); vbc->add_margin_child(TTR("Matches:"), search_options, true); + get_ok()->set_text(TTR("Open")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); - search_options->connect("item_activated", callable_mp(this, &EditorQuickOpen::_confirmed)); - search_options->set_hide_root(true); - search_options->set_hide_folding(true); - search_options->add_theme_constant_override("draw_guides", 1); + ei = "EditorIcons"; ot = "Object"; - add_directories = false; } diff --git a/editor/quick_open.h b/editor/quick_open.h index e446ed6823..8670bb1ade 100644 --- a/editor/quick_open.h +++ b/editor/quick_open.h @@ -35,6 +35,7 @@ #include "editor_file_system.h" #include "scene/gui/dialogs.h" #include "scene/gui/tree.h" + class EditorQuickOpen : public ConfirmationDialog { GDCLASS(EditorQuickOpen, ConfirmationDialog); @@ -43,7 +44,6 @@ class EditorQuickOpen : public ConfirmationDialog { StringName base_type; StringName ei; StringName ot; - bool add_directories; void _update_search(); @@ -67,7 +67,7 @@ public: String get_selected() const; Vector<String> get_selected_files() const; - void popup_dialog(const StringName &p_base, bool p_enable_multi = false, bool p_add_dirs = false, bool p_dontclear = false); + void popup_dialog(const StringName &p_base, bool p_enable_multi = false, bool p_dontclear = false); EditorQuickOpen(); }; diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp index 9d9c5b6473..fe7c10cad9 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp +++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp @@ -214,6 +214,11 @@ void VideoStreamPlaybackGDNative::cleanup() { if (pcm) { memfree(pcm); } + if (file) { + file->close(); + memdelete(file); + file = nullptr; + } pcm = nullptr; time = 0; num_channels = -1; diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index be159b6407..f04cb4b4c3 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -619,11 +619,11 @@ <argument index="0" name="path" type="String"> </argument> <description> - Loads a resource from the filesystem located at [code]path[/code]. - [b]Note:[/b] Resource paths can be obtained by right-clicking on a resource in the FileSystem dock and choosing [b]Copy Path[/b]. + Loads a resource from the filesystem located at [code]path[/code]. The resource is loaded on the method call (unless it's referenced already elsewhere, e.g. in another script or in the scene), which might cause slight delay, especially when loading scenes. To avoid unnecessary delays when loading something multiple times, either store the resource in a variable or use [method preload]. + [b]Note:[/b] Resource paths can be obtained by right-clicking on a resource in the FileSystem dock and choosing "Copy Path" or by dragging the file from the FileSystem dock into the script. [codeblock] - # Load a scene called main located in the root of the project directory. - var main = load("res://main.tscn") + # Load a scene called main located in the root of the project directory and cache it in a variable. + var main = load("res://main.tscn") # main will contain a PackedScene resource. [/codeblock] [b]Important:[/b] The path must be absolute, a local path will just return [code]null[/code]. </description> @@ -797,11 +797,11 @@ <argument index="0" name="path" type="String"> </argument> <description> - Returns a resource from the filesystem that is loaded during script parsing. - [b]Note:[/b] Resource paths can be obtained by right clicking on a resource in the Assets Panel and choosing "Copy Path". + Returns a [Resource] from the filesystem located at [code]path[/code]. The resource is loaded during script parsing, i.e. is loaded with the script and [method preload] effectively acts as a reference to that resource. Note that the method requires a constant path. If you want to load a resource from a dynamic/variable path, use [method load]. + [b]Note:[/b] Resource paths can be obtained by right clicking on a resource in the Assets Panel and choosing "Copy Path" or by dragging the file from the FileSystem dock into the script. [codeblock] - # Load a scene called main located in the root of the project directory. - var main = preload("res://main.tscn") + # Instance a scene. + var diamond = preload("res://diamond.tscn").instance() [/codeblock] </description> </method> diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index a663a847c2..2f6f483edf 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -862,6 +862,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { String tname = string_table[name]; uint32_t attrcount = decode_uint32(&p_manifest[iofs + 20]); iofs += 28; + bool is_focus_aware_metadata = false; for (uint32_t i = 0; i < attrcount; i++) { uint32_t attr_nspace = decode_uint32(&p_manifest[iofs]); @@ -929,9 +930,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { } } - if (tname == "meta-data" && attrname == "value" && value == "oculus_focus_aware_value") { + if (tname == "meta-data" && attrname == "value" && is_focus_aware_metadata) { // Update the focus awareness meta-data value - string_table.write[attr_value] = xr_mode_index == /* XRMode.OVR */ 1 && focus_awareness ? "true" : "false"; + encode_uint32(xr_mode_index == /* XRMode.OVR */ 1 && focus_awareness ? 0xFFFFFFFF : 0, &p_manifest.write[iofs + 16]); } if (tname == "meta-data" && attrname == "value" && value == "plugins_value" && !plugins_names.empty()) { @@ -939,6 +940,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { string_table.write[attr_value] = plugins_names; } + is_focus_aware_metadata = tname == "meta-data" && attrname == "name" && value == "com.oculus.vr.focusaware"; iofs += 20; } diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml index dbf1dc0f3c..48c09552c1 100644 --- a/platform/android/java/app/AndroidManifest.xml +++ b/platform/android/java/app/AndroidManifest.xml @@ -45,8 +45,8 @@ android:resizeableActivity="false" tools:ignore="UnusedAttribute" > - <!-- Focus awareness metadata populated at export time if the user enables it in the 'Xr Features' section. --> - <meta-data android:name="com.oculus.vr.focusaware" android:value="oculus_focus_aware_value" /> + <!-- Focus awareness metadata is updated at export time if the user enables it in the 'Xr Features' section. --> + <meta-data android:name="com.oculus.vr.focusaware" android:value="false" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index a0954600a2..94c2e989f1 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -32,12 +32,12 @@ #ifdef X11_ENABLED -#include "detect_prime_x11.h" - -#include "core/os/dir_access.h" #include "core/print_string.h" -#include "errno.h" +#include "core/project_settings.h" +#include "detect_prime_x11.h" #include "key_mapping_x11.h" +#include "main/main.h" +#include "scene/resources/texture.h" #if defined(OPENGL_ENABLED) #include "drivers/gles2/rasterizer_gles2.h" @@ -47,20 +47,14 @@ #include "servers/rendering/rasterizer_rd/rasterizer_rd.h" #endif -#include "scene/resources/texture.h" - -#ifdef HAVE_MNTENT -#include <mntent.h> -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "X11/Xutil.h" +#include <X11/Xatom.h> +#include <X11/Xutil.h> +#include <X11/extensions/Xinerama.h> -#include "X11/Xatom.h" -#include "X11/extensions/Xinerama.h" // ICCCM #define WM_NormalState 1L // window normal state #define WM_IconicState 3L // window minimized @@ -69,8 +63,6 @@ #define _NET_WM_STATE_ADD 1L // add/set property #define _NET_WM_STATE_TOGGLE 2L // toggle property -#include "main/main.h" - #include <dlfcn.h> #include <fcntl.h> #include <sys/stat.h> @@ -82,14 +74,9 @@ #undef KEY_TAB #endif -#include <X11/Xatom.h> - #undef CursorShape - #include <X11/XKBlib.h> -#include "core/project_settings.h" - // 2.2 is the first release with multitouch #define XINPUT_CLIENT_VERSION_MAJOR 2 #define XINPUT_CLIENT_VERSION_MINOR 2 @@ -417,10 +404,6 @@ void DisplayServerX11::mouse_warp_to_position(const Point2i &p_to) { if (mouse_mode == MOUSE_MODE_CAPTURED) { last_mouse_pos = p_to; } else { - /*XWindowAttributes xwa; - XGetWindowAttributes(x11_display, x11_window, &xwa); - printf("%d %d\n", xwa.x, xwa.y); needed? */ - XWarpPointer(x11_display, None, windows[MAIN_WINDOW_ID].x11_window, 0, 0, 0, 0, (int)p_to.x, (int)p_to.y); } @@ -1098,18 +1081,19 @@ Size2i DisplayServerX11::window_get_real_size(WindowID p_window) const { return Size2i(w, h); } -bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const { - _THREAD_SAFE_METHOD_ - +// Just a helper to reduce code duplication in `window_is_maximize_allowed` +// and `_set_wm_maximized`. +bool DisplayServerX11::_window_maximize_check(WindowID p_window, const char *p_atom_name) const { ERR_FAIL_COND_V(!windows.has(p_window), false); const WindowData &wd = windows[p_window]; - Atom property = XInternAtom(x11_display, "_NET_WM_ALLOWED_ACTIONS", False); + Atom property = XInternAtom(x11_display, p_atom_name, False); Atom type; int format; unsigned long len; unsigned long remaining; unsigned char *data = nullptr; + bool retval = false; int result = XGetWindowProperty( x11_display, @@ -1141,13 +1125,20 @@ bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const { } if (found_wm_act_max_horz || found_wm_act_max_vert) { - return true; + retval = true; + break; } } - XFree(atoms); + + XFree(data); } - return false; + return retval; +} + +bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const { + _THREAD_SAFE_METHOD_ + return _window_maximize_check(p_window, "_NET_WM_ALLOWED_ACTIONS"); } void DisplayServerX11::_set_wm_maximized(WindowID p_window, bool p_enabled) { @@ -1385,60 +1376,14 @@ DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) c if (wd.fullscreen) { //if fullscreen, it's not in another mode return WINDOW_MODE_FULLSCREEN; } - { //test maximized - // Using EWMH -- Extended Window Manager Hints - Atom property = XInternAtom(x11_display, "_NET_WM_STATE", False); - Atom type; - int format; - unsigned long len; - unsigned long remaining; - unsigned char *data = nullptr; - bool retval = false; - int result = XGetWindowProperty( - x11_display, - wd.x11_window, - property, - 0, - 1024, - False, - XA_ATOM, - &type, - &format, - &len, - &remaining, - &data); - - if (result == Success && data) { - Atom *atoms = (Atom *)data; - Atom wm_max_horz = XInternAtom(x11_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); - Atom wm_max_vert = XInternAtom(x11_display, "_NET_WM_STATE_MAXIMIZED_VERT", False); - bool found_wm_max_horz = false; - bool found_wm_max_vert = false; - - for (uint64_t i = 0; i < len; i++) { - if (atoms[i] == wm_max_horz) { - found_wm_max_horz = true; - } - if (atoms[i] == wm_max_vert) { - found_wm_max_vert = true; - } - - if (found_wm_max_horz && found_wm_max_vert) { - retval = true; - break; - } - } - - XFree(data); - } - - if (retval) { - return WINDOW_MODE_MAXIMIZED; - } + // Test maximized. + // Using EWMH -- Extended Window Manager Hints + if (_window_maximize_check(p_window, "_NET_WM_STATE")) { + return WINDOW_MODE_MAXIMIZED; } - { // test minimzed + { // Test minimized. // Using ICCCM -- Inter-Client Communication Conventions Manual Atom property = XInternAtom(x11_display, "WM_STATE", True); Atom type; @@ -1471,7 +1416,7 @@ DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) c } } - // all other discarded, return windowed. + // All other discarded, return windowed. return WINDOW_MODE_WINDOWED; } diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h index f01b9a2323..3b2ff0e08d 100644 --- a/platform/linuxbsd/display_server_x11.h +++ b/platform/linuxbsd/display_server_x11.h @@ -36,7 +36,6 @@ #include "servers/display_server.h" #include "core/input/input.h" - #include "drivers/alsa/audio_driver_alsa.h" #include "drivers/alsamidi/midi_driver_alsamidi.h" #include "drivers/pulseaudio/audio_driver_pulseaudio.h" @@ -231,6 +230,7 @@ class DisplayServerX11 : public DisplayServer { static Property _read_property(Display *p_display, Window p_window, Atom p_property); void _update_real_mouse_position(const WindowData &wd); + bool _window_maximize_check(WindowID p_window, const char *p_atom_name) const; void _set_wm_fullscreen(WindowID p_window, bool p_enabled); void _set_wm_maximized(WindowID p_window, bool p_enabled); diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 09a5eca914..8c6f3b1167 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -31,8 +31,11 @@ #include "os_linuxbsd.h" #include "core/os/dir_access.h" -#include "core/print_string.h" -#include "errno.h" +#include "main/main.h" + +#ifdef X11_ENABLED +#include "display_server_x11.h" +#endif #ifdef HAVE_MNTENT #include <mntent.h> @@ -48,12 +51,6 @@ #include <sys/types.h> #include <unistd.h> -#include "main/main.h" - -#ifdef X11_ENABLED -#include "display_server_x11.h" -#endif - void OS_LinuxBSD::initialize() { crash_handler.initialize(); diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 881df06d8f..e118cb0d8d 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -201,10 +201,9 @@ bool VideoPlayer::has_expand() const { void VideoPlayer::set_stream(const Ref<VideoStream> &p_stream) { stop(); + AudioServer::get_singleton()->lock(); mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size()); - AudioServer::get_singleton()->unlock(); - stream = p_stream; if (stream.is_valid()) { stream->set_audio_track(audio_track); @@ -212,6 +211,7 @@ void VideoPlayer::set_stream(const Ref<VideoStream> &p_stream) { } else { playback = Ref<VideoStreamPlayback>(); } + AudioServer::get_singleton()->unlock(); if (!playback.is_null()) { playback->set_loop(loops); diff --git a/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl b/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl index 9a94a7914e..d6a56b2543 100644 --- a/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl +++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl @@ -2519,11 +2519,15 @@ FRAGMENT_SHADER_CODE vec3(0, -1, 0), vec3(0, 0, -1)); - vec3 cam_normal = mat3(scene_data.camera_matrix) * normal; + vec3 cam_normal = mat3(scene_data.camera_matrix) * normalize(normal_interp); + + float closest_dist = -1e20; for (uint i = 0; i < 6; i++) { - if (dot(cam_normal, aniso_dir[i]) > 0.001) { - facing_bits |= (1 << i); + float d = dot(cam_normal, aniso_dir[i]); + if (d > closest_dist) { + closest_dist = d; + facing_bits = (1 << i); } } diff --git a/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl b/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl index 7a523d3a3c..d7d19897e3 100644 --- a/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl +++ b/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl @@ -655,105 +655,6 @@ void main() { groupMemoryBarrier(); barrier(); } - /* - for(int s=0;s<8;s++) { - ivec3 local_pos = pos * 2 + ((ivec3(s) >> ivec3(2,1,0)) & ivec3(1,1,1)); - for(int i=0;i<8;i++) { - ivec3 offset = local_pos + ((ivec3(i) >> ivec3(2,1,0)) & ivec3(1,1,1)) * OCCLUSION_SIZE; - - ivec3 global_offset = region_offset + offset; - - if (any(lessThan(global_offset,ivec3(0))) || any(greaterThanEqual(global_offset,ivec3(params.grid_size)))) { - continue; // do not process - } - - ivec3 proc_pos = offset - ivec3(OCCLUSION_SIZE); - proc_pos += mix(ivec3(0),ivec3(1),greaterThanEqual(proc_pos,ivec3(0))); - - ivec3 proc_abs = abs(proc_pos); - ivec3 proc_pass = proc_abs - ivec3(1); - - if (proc_pass.x+proc_pass.y+proc_pass.z != step) { - continue; - } - - offset = global_offset; - - float occ; - - uint facing = imageLoad(src_facing,offset).r; //any bit present in facing means this is solid - - if (facing != 0) { //solid - occ = 0.0; - } else if (step==0) { - occ = 1.0; //first step - } else { - ivec3 read_dir = -sign(proc_pos); - - ivec3 major_axis; - if (proc_pass.x < proc_pass.y) { - if (proc_pass.z < proc_pass.y) { - major_axis = ivec3(0,1,0); - } else { - major_axis = ivec3(0,0,1); - } - } else { - if (proc_pass.z < proc_pass.x) { - major_axis = ivec3(1,0,0); - } else { - major_axis = ivec3(0,0,1); - } - } - - float avg = 0.0; - occ = 0.0; - - ivec3 read_x = offset + ivec3(read_dir.x,0,0) + (proc_pass.x == 0 ? major_axis * read_dir : ivec3(0)); - ivec3 read_y = offset + ivec3(0,read_dir.y,0) + (proc_pass.y == 0 ? major_axis * read_dir : ivec3(0)); - ivec3 read_z = offset + ivec3(0,0,read_dir.z) + (proc_pass.z == 0 ? major_axis * read_dir : ivec3(0)); - - if (all(greaterThanEqual(read_x,ivec3(0))) && all(lessThan(read_x,ivec3(params.grid_size)))) { - - uint f = imageLoad(src_facing,read_x).r; - if (f==0) { //non solid - occ += imageLoad(dst_occlusion[params.occlusion_index],read_x).r; - avg+=1.0; - } - } - - if (all(greaterThanEqual(read_y,ivec3(0))) && all(lessThan(read_y,ivec3(params.grid_size)))) { - - uint f = imageLoad(src_facing,read_y).r; - if (f==0) {//non solid - occ += imageLoad(dst_occlusion[params.occlusion_index],read_y).r; - avg+=1.0; - } - } - - if (all(greaterThanEqual(read_z,ivec3(0))) && all(lessThan(read_z,ivec3(params.grid_size)))) { - - uint f = imageLoad(src_facing,read_z).r; - if (f==0) {//non solid - occ += imageLoad(dst_occlusion[params.occlusion_index],read_z).r; - avg+=1.0; - } - } - - if (avg > 0.0) { - occ/=avg; - } - } - - imageStore(dst_occlusion[params.occlusion_index],offset,vec4(occ)); - - } - } - - groupMemoryBarrier(); - barrier(); - - } -*/ #if 1 //bias solid voxels away |