diff options
-rw-r--r-- | .github/workflows/main.yml | 126 | ||||
-rw-r--r-- | SConstruct | 1 | ||||
-rw-r--r-- | core/project_settings.cpp | 22 | ||||
-rw-r--r-- | doc/classes/RenderingServer.xml | 4 | ||||
-rw-r--r-- | doc/classes/Sky.xml | 12 | ||||
-rw-r--r-- | editor/editor_audio_buses.cpp | 4 | ||||
-rw-r--r-- | editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | editor/icons/GuiTabMenu.svg | 2 | ||||
-rw-r--r-- | editor/icons/GuiTabMenuHl.svg | 2 | ||||
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | modules/bullet/rigid_body_bullet.cpp | 1 | ||||
-rw-r--r-- | modules/enet/doc_classes/NetworkedMultiplayerENet.xml | 4 | ||||
-rw-r--r-- | scene/2d/camera_2d.cpp | 19 | ||||
-rw-r--r-- | scene/2d/camera_2d.h | 1 | ||||
-rw-r--r-- | scene/resources/sky.cpp | 6 | ||||
-rw-r--r-- | scene/resources/sky.h | 2 | ||||
-rw-r--r-- | servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp | 83 | ||||
-rw-r--r-- | servers/rendering/rasterizer_rd/rasterizer_scene_rd.h | 5 | ||||
-rw-r--r-- | servers/rendering_server.h | 2 |
21 files changed, 243 insertions, 63 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..2ef335fe02 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,126 @@ +# Engine build CI +name: Godot CI + +on: + # will build EVERY pull request + pull_request: + + # will only build explicit branches + push: + branches: [ master, 3.2, 3.1, 3.0 ] + +# Global Cache Settings +# SCONS_CACHE for windows must be set in the build environment +env: + SCONS_CACHE_MSVC_CONFIG: true + SCONS_CACHE_LIMIT: 8192 +jobs: + windows-editor: + # Windows 10 with latest image + runs-on: "windows-latest" + + # Windows Editor - checkout with the plugin + name: Windows Editor (target=release_debug, tools=yes) + + steps: + - uses: actions/checkout@v2 + + # Upload cache on completion and check it out now + # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache. + # Linux with this will work reliably, so not as bad to edit for Linux. + - name: Load .scons_cache directory + id: windows-editor-cache + uses: RevoluPowered/cache@v2.1 + with: + path: /.scons_cache/ + key: ${{runner.os}}-editor-${{github.sha}} + restore-keys: | + ${{runner.os}}-editor-${{github.sha}} + ${{runner.os}}-editor + ${{runner.os}} + + # Use python 3.x release (works cross platform; best to keep self contained in it's own step) + - name: Set up Python 3.x + uses: actions/setup-python@v2 + with: + # Semantic version range syntax or exact version of a Python version + python-version: '3.x' + # Optional - x64 or x86 architecture, defaults to x64 + architecture: 'x64' + + # Setup scons, print python version and scons version info, so if anything is broken it won't run the build. + - name: Configuring Python packages + run: | + python -c "import sys; print(sys.version)" + python -m pip install scons pywin32 + python --version + scons --version + + # We should always be explicit with our flags usage here since it's gonna be sure to always set those flags + - name: Compilation + env: + SCONS_CACHE: /.scons_cache/ + run: | + scons -j2 verbose=yes warnings=all werror=yes platform=windows tools=yes target=release_debug + +# Build Product Upload (tested and working) +# sorry this is disabled until github can give us some more space as we would hit our limit very quickly +# tested this code and it works fine so just enable it to get them back +# - name: publishing godot windows-editor +# uses: actions/upload-artifact@v1 +# with: +# name: windows-editor (x64) +# path: bin/godot.windows.opt.tools.64.exe + + + windows-template: + runs-on: "windows-latest" + name: Windows Template (target=release, tools=no) + + steps: + - uses: actions/checkout@v2 + + # Upload cache on completion and check it out now + # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache. + # Linux with this will work reliably, so not as bad to edit for Linux. + - name: Load .scons_cache directory + id: windows-template-cache + uses: RevoluPowered/cache@v2.1 + with: + path: /.scons_cache/ + key: ${{runner.os}}-template-${{github.sha}} + restore-keys: | + ${{runner.os}}-template-${{github.sha}} + ${{runner.os}}-template + ${{runner.os}} + + # Use python 3.x release (works cross platform) + - name: Set up Python 3.x + uses: actions/setup-python@v2 + with: + # Semantic version range syntax or exact version of a Python version + python-version: '3.x' + # Optional - x64 or x86 architecture, defaults to x64 + architecture: 'x64' + + # You can test your matrix by printing the current Python version + - name: Configuring Python packages + run: | + python -c "import sys; print(sys.version)" + python -m pip install scons pywin32 + python --version + scons --version + - name: Compilation + env: + SCONS_CACHE: /.scons_cache/ + run: | + scons -j2 verbose=yes warnings=all werror=yes platform=windows target=release tools=no + +# Build Product Upload (tested and working) +# sorry this is disabled until github can give us some more space as we would hit our limit very quickly +# tested this code and it works fine so just enable it to get them back +# - name: publishing godot windows-template +# uses: actions/upload-artifact@v1 +# with: +# name: windows-template (x64) +# path: bin/godot.windows.opt.64.exe diff --git a/SConstruct b/SConstruct index 9496595a26..ef74ce7736 100644 --- a/SConstruct +++ b/SConstruct @@ -455,6 +455,7 @@ if selected_platform in platform_list: all_plus_warnings = ["-Wwrite-strings"] if methods.using_gcc(env): + env.Append(CCFLAGS=["-Wno-misleading-indentation"]) if cc_version_major >= 7: shadow_local_warning = ["-Wshadow-local"] diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 3f9585c03c..638987bb2f 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -488,6 +488,14 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bo _load_settings_text(custom_settings); } } + // Using GLOBAL_GET on every block for compressing can be slow, so assigning here. + Compression::zstd_long_distance_matching = GLOBAL_GET("compression/formats/zstd/long_distance_matching"); + Compression::zstd_level = GLOBAL_GET("compression/formats/zstd/compression_level"); + Compression::zstd_window_log_size = GLOBAL_GET("compression/formats/zstd/window_log_size"); + + Compression::zlib_level = GLOBAL_GET("compression/formats/zlib/compression_level"); + + Compression::gzip_level = GLOBAL_GET("compression/formats/gzip/compression_level"); return err; } @@ -1007,6 +1015,9 @@ void ProjectSettings::_bind_methods() { } ProjectSettings::ProjectSettings() { + // Initialization of engine variables should be done in the setup() method, + // so that the values can be overridden from project.godot or project.binary. + singleton = this; Array events; @@ -1206,18 +1217,17 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF("debug/settings/profiler/max_functions", 16384); custom_prop_info["debug/settings/profiler/max_functions"] = PropertyInfo(Variant::INT, "debug/settings/profiler/max_functions", PROPERTY_HINT_RANGE, "128,65535,1"); - //assigning here, because using GLOBAL_GET on every block for compressing can be slow - Compression::zstd_long_distance_matching = GLOBAL_DEF("compression/formats/zstd/long_distance_matching", false); + GLOBAL_DEF("compression/formats/zstd/long_distance_matching", Compression::zstd_long_distance_matching); custom_prop_info["compression/formats/zstd/long_distance_matching"] = PropertyInfo(Variant::BOOL, "compression/formats/zstd/long_distance_matching"); - Compression::zstd_level = GLOBAL_DEF("compression/formats/zstd/compression_level", 3); + GLOBAL_DEF("compression/formats/zstd/compression_level", Compression::zstd_level); custom_prop_info["compression/formats/zstd/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/zstd/compression_level", PROPERTY_HINT_RANGE, "1,22,1"); - Compression::zstd_window_log_size = GLOBAL_DEF("compression/formats/zstd/window_log_size", 27); + GLOBAL_DEF("compression/formats/zstd/window_log_size", Compression::zstd_window_log_size); custom_prop_info["compression/formats/zstd/window_log_size"] = PropertyInfo(Variant::INT, "compression/formats/zstd/window_log_size", PROPERTY_HINT_RANGE, "10,30,1"); - Compression::zlib_level = GLOBAL_DEF("compression/formats/zlib/compression_level", Z_DEFAULT_COMPRESSION); + GLOBAL_DEF("compression/formats/zlib/compression_level", Compression::zlib_level); custom_prop_info["compression/formats/zlib/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/zlib/compression_level", PROPERTY_HINT_RANGE, "-1,9,1"); - Compression::gzip_level = GLOBAL_DEF("compression/formats/gzip/compression_level", Z_DEFAULT_COMPRESSION); + GLOBAL_DEF("compression/formats/gzip/compression_level", Compression::gzip_level); custom_prop_info["compression/formats/gzip/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/gzip/compression_level", PROPERTY_HINT_RANGE, "-1,9,1"); } diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 7539f8ff43..85eaac454f 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -3431,10 +3431,10 @@ </constant> <constant name="VIEWPORT_DEBUG_DRAW_GI_BUFFER" value="17" enum="ViewportDebugDraw"> </constant> - <constant name="SKY_MODE_QUALITY" value="0" enum="SkyMode"> + <constant name="SKY_MODE_QUALITY" value="1" enum="SkyMode"> Uses high quality importance sampling to process the radiance map. In general, this results in much higher quality than [constant Sky.PROCESS_MODE_REALTIME] but takes much longer to generate. This should not be used if you plan on changing the sky at runtime. If you are finding that the reflection is not blurry enough and is showing sparkles or fireflies, try increasing [member ProjectSettings.rendering/quality/reflections/ggx_samples]. </constant> - <constant name="SKY_MODE_REALTIME" value="1" enum="SkyMode"> + <constant name="SKY_MODE_REALTIME" value="3" enum="SkyMode"> Uses the fast filtering algorithm to process the radiance map. In general this results in lower quality, but substantially faster run times. [b]Note:[/b] The fast filtering algorithm is limited to 256x256 cubemaps, so [member Sky.radiance_size] must be set to [constant Sky.RADIANCE_SIZE_256]. </constant> diff --git a/doc/classes/Sky.xml b/doc/classes/Sky.xml index 78c75d9c2b..a77515b3e6 100644 --- a/doc/classes/Sky.xml +++ b/doc/classes/Sky.xml @@ -48,11 +48,17 @@ <constant name="RADIANCE_SIZE_MAX" value="7" enum="RadianceSize"> Represents the size of the [enum RadianceSize] enum. </constant> - <constant name="PROCESS_MODE_QUALITY" value="0" enum="ProcessMode"> + <constant name="PROCESS_MODE_AUTOMATIC" value="0" enum="ProcessMode"> + Automatically selects the appropriate process mode based on your sky shader. If your shader uses [code]TIME[/code] or [code]POSITION[/code], this will use [constant PROCESS_MODE_REALTIME]. If your shader uses any of the [code]LIGHT_*[/code] variables or any custom uniforms, this uses [constant PROCESS_MODE_INCREMENTAL]. Otherwise, this defaults to [constant PROCESS_MODE_QUALITY]. + </constant> + <constant name="PROCESS_MODE_QUALITY" value="1" enum="ProcessMode"> Uses high quality importance sampling to process the radiance map. In general, this results in much higher quality than [constant PROCESS_MODE_REALTIME] but takes much longer to generate. This should not be used if you plan on changing the sky at runtime. If you are finding that the reflection is not blurry enough and is showing sparkles or fireflies, try increasing [member ProjectSettings.rendering/quality/reflections/ggx_samples]. </constant> - <constant name="PROCESS_MODE_REALTIME" value="1" enum="ProcessMode"> - Uses the fast filtering algorithm to process the radiance map. In general this results in lower quality, but substantially faster run times. + <constant name="PROCESS_MODE_INCREMENTAL" value="2" enum="ProcessMode"> + Uses the same high quality importance sampling to process the radiance map as [constant PROCESS_MODE_QUALITY], but updates over several frames. The number of frames is determined by [member ProjectSettings.rendering/quality/reflections/roughness_layers]. Use this when you need highest quality radiance maps, but have a sky that updates slowly. + </constant> + <constant name="PROCESS_MODE_REALTIME" value="3" enum="ProcessMode"> + Uses the fast filtering algorithm to process the radiance map. In general this results in lower quality, but substantially faster run times. If you need better quality, but still need to update the sky every frame, consider turning on [member ProjectSettings.rendering/quality/reflections/fast_filter_high_quality]. [b]Note:[/b] The fast filtering algorithm is limited to 256x256 cubemaps, so [member radiance_size] must be set to [constant RADIANCE_SIZE_256]. </constant> </constants> diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 10825973ae..669868c632 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -84,7 +84,7 @@ void EditorAudioBus::_notification(int p_what) { bypass->set_icon(get_theme_icon("AudioBusBypass", "EditorIcons")); bypass->add_theme_color_override("icon_color_pressed", bypass_color); - bus_options->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); + bus_options->set_icon(get_theme_icon("GuiTabMenuHl", "EditorIcons")); update_bus(); set_process(true); @@ -172,7 +172,7 @@ void EditorAudioBus::_notification(int p_what) { mute->set_icon(get_theme_icon("AudioBusMute", "EditorIcons")); bypass->set_icon(get_theme_icon("AudioBusBypass", "EditorIcons")); - bus_options->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); + bus_options->set_icon(get_theme_icon("GuiTabMenuHl", "EditorIcons")); } break; case NOTIFICATION_MOUSE_EXIT: case NOTIFICATION_DRAG_END: { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index f768a2cacf..fe68797483 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -456,6 +456,8 @@ void EditorNode::_notification(int p_what) { editor_selection->update(); + //scene_root->set_size_override(true, Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height"))); + { //TODO should only happen on settings changed int current_filter = GLOBAL_GET("rendering/canvas_textures/default_texture_filter"); if (current_filter != scene_root->get_default_canvas_item_texture_filter()) { diff --git a/editor/icons/GuiTabMenu.svg b/editor/icons/GuiTabMenu.svg index 8bf5ef2f7d..55e98143a6 100644 --- a/editor/icons/GuiTabMenu.svg +++ b/editor/icons/GuiTabMenu.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 6 16" width="6" xmlns="http://www.w3.org/2000/svg"><path d="m3 0a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2zm0 6a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2zm0 6a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2z" fill="#fff" fill-opacity=".39216"/></svg>
\ No newline at end of file +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 0a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2zm0 6a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2zm0 6a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2z" fill="#fff" fill-opacity=".39216"/></svg>
\ No newline at end of file diff --git a/editor/icons/GuiTabMenuHl.svg b/editor/icons/GuiTabMenuHl.svg index 42d58a5abf..e4c5b7bf1e 100644 --- a/editor/icons/GuiTabMenuHl.svg +++ b/editor/icons/GuiTabMenuHl.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 6 16" width="6" xmlns="http://www.w3.org/2000/svg"><path d="m3 0a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2zm0 6a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2zm0 6a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2z" fill="#e0e0e0"/></svg>
\ No newline at end of file +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 0a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2zm0 6a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2zm0 6a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2z" fill="#e0e0e0"/></svg>
\ No newline at end of file diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index de04a299fb..be220fb30c 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -117,7 +117,7 @@ void AnimationPlayerEditor::_notification(int p_what) { stop->set_icon(get_theme_icon("Stop", "EditorIcons")); onion_toggle->set_icon(get_theme_icon("Onion", "EditorIcons")); - onion_skinning->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); + onion_skinning->set_icon(get_theme_icon("GuiTabMenuHl", "EditorIcons")); pin->set_icon(get_theme_icon("Pin", "EditorIcons")); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index a278a27324..44913abe8b 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3982,7 +3982,7 @@ void CanvasItemEditor::_notification(int p_what) { rotate_button->set_icon(get_theme_icon("ToolRotate", "EditorIcons")); smart_snap_button->set_icon(get_theme_icon("Snap", "EditorIcons")); grid_snap_button->set_icon(get_theme_icon("SnapGrid", "EditorIcons")); - snap_config_menu->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); + snap_config_menu->set_icon(get_theme_icon("GuiTabMenuHl", "EditorIcons")); skeleton_menu->set_icon(get_theme_icon("Bone", "EditorIcons")); override_camera_button->set_icon(get_theme_icon("Camera2D", "EditorIcons")); pan_button->set_icon(get_theme_icon("ToolPan", "EditorIcons")); @@ -3999,7 +3999,7 @@ void CanvasItemEditor::_notification(int p_what) { key_scale_button->set_icon(get_theme_icon("KeyScale", "EditorIcons")); key_insert_button->set_icon(get_theme_icon("Key", "EditorIcons")); key_auto_insert_button->set_icon(get_theme_icon("AutoKey", "EditorIcons")); - animation_menu->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); + animation_menu->set_icon(get_theme_icon("GuiTabMenuHl", "EditorIcons")); zoom_minus->set_icon(get_theme_icon("ZoomLess", "EditorIcons")); zoom_plus->set_icon(get_theme_icon("ZoomMore", "EditorIcons")); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index b51ea9e1c6..6165f39561 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2551,7 +2551,7 @@ void Node3DEditorViewport::_notification(int p_what) { } if (p_what == NOTIFICATION_THEME_CHANGED) { - view_menu->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); + view_menu->set_icon(get_theme_icon("GuiTabMenuHl", "EditorIcons")); preview_camera->set_icon(get_theme_icon("Camera3D", "EditorIcons")); view_menu->add_theme_style_override("normal", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index 8ff27cda30..717c99c738 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -320,6 +320,7 @@ void RigidBodyBullet::set_space(SpaceBullet *p_space) { // Clear the old space if there is one if (space) { can_integrate_forces = false; + isScratchedSpaceOverrideModificator = false; // Remove all eventual constraints assert_no_constraints(); diff --git a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml index 860da32a22..c908af7479 100644 --- a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml +++ b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml @@ -128,7 +128,7 @@ Enforce ordered packets when using [constant NetworkedMultiplayerPeer.TRANSFER_MODE_UNRELIABLE] (thus behaving similarly to [constant NetworkedMultiplayerPeer.TRANSFER_MODE_UNRELIABLE_ORDERED]). This is the only way to use ordering with the RPC system. </member> <member name="channel_count" type="int" setter="set_channel_count" getter="get_channel_count" default="3"> - The number of channels to be used by ENet. Channels are used to separate different kinds of data. In reliable or ordered mode, for example, the packet delivery order is ensured on a per channel basis. + The number of channels to be used by ENet. Channels are used to separate different kinds of data. In reliable or ordered mode, for example, the packet delivery order is ensured on a per-channel basis. This is done to combat latency and reduces ordering restrictions on packets. The delivery status of a packet in one channel won't stall the delivery of other packets in another channel. </member> <member name="compression_mode" type="int" setter="set_compression_mode" getter="get_compression_mode" enum="NetworkedMultiplayerENet.CompressionMode" default="0"> The compression method used for network packets. These have different tradeoffs of compression speed versus bandwidth, you may need to test which one works best for your use case if you use compression at all. @@ -141,7 +141,7 @@ Enable or disable the server feature that notifies clients of other peers' connection/disconnection, and relays messages between them. When this option is [code]false[/code], clients won't be automatically notified of other peers and won't be able to send them packets through the server. </member> <member name="transfer_channel" type="int" setter="set_transfer_channel" getter="get_transfer_channel" default="-1"> - Set the default channel to be used to transfer data. By default, this value is [code]-1[/code] which means that ENet will only use 2 channels, one for reliable and one for unreliable packets. Channel [code]0[/code] is reserved, and cannot be used. Setting this member to any value between [code]0[/code] and [member channel_count] (excluded) will force ENet to use that channel for sending data. + Set the default channel to be used to transfer data. By default, this value is [code]-1[/code] which means that ENet will only use 2 channels: one for reliable packets, and one for unreliable packets. The channel [code]0[/code] is reserved and cannot be used. Setting this member to any value between [code]0[/code] and [member channel_count] (excluded) will force ENet to use that channel for sending data. See [member channel_count] for more information about ENet channels. </member> <member name="transfer_mode" type="int" setter="set_transfer_mode" getter="get_transfer_mode" override="true" enum="NetworkedMultiplayerPeer.TransferMode" default="2" /> <member name="use_dtls" type="bool" setter="set_dtls_enabled" getter="is_dtls_enabled" default="false"> diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 992c86d632..68e99445d8 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -32,7 +32,6 @@ #include "core/engine.h" #include "core/math/math_funcs.h" -#include "editor/editor_node.h" #include "scene/scene_string_names.h" #include "servers/rendering_server.h" @@ -57,7 +56,7 @@ void Camera2D::_update_scroll() { viewport->set_canvas_transform(xform); - Size2 screen_size = get_camera_screen_size(); + Size2 screen_size = viewport->get_visible_rect().size; Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5) : Point2()); get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, group_name, "_camera_moved", xform, screen_offset); @@ -95,7 +94,7 @@ Transform2D Camera2D::get_camera_transform() { ERR_FAIL_COND_V(custom_viewport && !ObjectDB::get_instance(custom_viewport_id), Transform2D()); - Size2 screen_size = get_camera_screen_size(); + Size2 screen_size = viewport->get_visible_rect().size; Point2 new_camera_pos = get_global_transform().get_origin(); Point2 ret_camera_pos; @@ -275,7 +274,7 @@ void Camera2D::_notification(int p_what) { } Transform2D inv_camera_transform = get_camera_transform().affine_inverse(); - Size2 screen_size = get_camera_screen_size(); + Size2 screen_size = get_viewport_rect().size; Vector2 screen_endpoints[4] = { inv_camera_transform.xform(Vector2(0, 0)), @@ -322,7 +321,7 @@ void Camera2D::_notification(int p_what) { } Transform2D inv_camera_transform = get_camera_transform().affine_inverse(); - Size2 screen_size = get_camera_screen_size(); + Size2 screen_size = get_viewport_rect().size; Vector2 margin_endpoints[4] = { inv_camera_transform.xform(Vector2((screen_size.width / 2) - ((screen_size.width / 2) * drag_margin[MARGIN_LEFT]), (screen_size.height / 2) - ((screen_size.height / 2) * drag_margin[MARGIN_TOP]))), @@ -470,7 +469,7 @@ void Camera2D::reset_smoothing() { void Camera2D::align() { ERR_FAIL_COND(custom_viewport && !ObjectDB::get_instance(custom_viewport_id)); - Size2 screen_size = get_camera_screen_size(); + Size2 screen_size = viewport->get_visible_rect().size; Point2 current_camera_pos = get_global_transform().get_origin(); if (anchor_mode == ANCHOR_MODE_DRAG_CENTER) { @@ -508,14 +507,6 @@ Point2 Camera2D::get_camera_screen_center() const { return camera_screen_center; } -Size2 Camera2D::get_camera_screen_size() const { - // special case if the camera2D is in the root viewport - if (Engine::get_singleton()->is_editor_hint() && get_viewport() == EditorNode::get_singleton()->get_scene_root()) { - return Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height")); - } - return get_viewport_rect().size; -} - void Camera2D::set_h_drag_enabled(bool p_enabled) { h_drag_enabled = p_enabled; } diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h index 4d34b51e97..0a4e269c40 100644 --- a/scene/2d/camera_2d.h +++ b/scene/2d/camera_2d.h @@ -147,7 +147,6 @@ public: Vector2 get_zoom() const; Point2 get_camera_screen_center() const; - Size2 get_camera_screen_size() const; void set_custom_viewport(Node *p_viewport); Node *get_custom_viewport() const; diff --git a/scene/resources/sky.cpp b/scene/resources/sky.cpp index 38d1346541..7e32516f94 100644 --- a/scene/resources/sky.cpp +++ b/scene/resources/sky.cpp @@ -83,8 +83,8 @@ void Sky::_bind_methods() { ClassDB::bind_method(D_METHOD("get_material"), &Sky::get_material); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "sky_material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,PanoramaSkyMaterial,ProceduralSkyMaterial,PhysicalSkyMaterial"), "set_material", "get_material"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Automatic,HighQuality,HighQualityIncremental,RealTime"), "set_process_mode", "get_process_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "radiance_size", PROPERTY_HINT_ENUM, "32,64,128,256,512,1024,2048"), "set_radiance_size", "get_radiance_size"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "HighQuality,RealTime"), "set_process_mode", "get_process_mode"); BIND_ENUM_CONSTANT(RADIANCE_SIZE_32); BIND_ENUM_CONSTANT(RADIANCE_SIZE_64); @@ -95,12 +95,14 @@ void Sky::_bind_methods() { BIND_ENUM_CONSTANT(RADIANCE_SIZE_2048); BIND_ENUM_CONSTANT(RADIANCE_SIZE_MAX); + BIND_ENUM_CONSTANT(PROCESS_MODE_AUTOMATIC); BIND_ENUM_CONSTANT(PROCESS_MODE_QUALITY); + BIND_ENUM_CONSTANT(PROCESS_MODE_INCREMENTAL); BIND_ENUM_CONSTANT(PROCESS_MODE_REALTIME); } Sky::Sky() { - mode = PROCESS_MODE_QUALITY; + mode = PROCESS_MODE_AUTOMATIC; radiance_size = RADIANCE_SIZE_256; sky = RS::get_singleton()->sky_create(); } diff --git a/scene/resources/sky.h b/scene/resources/sky.h index 21a1484fe2..526ca94317 100644 --- a/scene/resources/sky.h +++ b/scene/resources/sky.h @@ -51,7 +51,9 @@ public: }; enum ProcessMode { + PROCESS_MODE_AUTOMATIC, PROCESS_MODE_QUALITY, + PROCESS_MODE_INCREMENTAL, PROCESS_MODE_REALTIME }; diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp index dd68011111..4ebed78996 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp @@ -181,16 +181,14 @@ void RasterizerSceneRD::_create_reflection_importance_sample(ReflectionData &rd, } } -void RasterizerSceneRD::_update_reflection_mipmaps(ReflectionData &rd) { - if (sky_use_cubemap_array) { - for (int i = 0; i < rd.layers.size(); i++) { - for (int j = 0; j < rd.layers[i].mipmaps.size() - 1; j++) { - for (int k = 0; k < 6; k++) { - RID view = rd.layers[i].mipmaps[j].views[k]; - RID texture = rd.layers[i].mipmaps[j + 1].views[k]; - Size2i size = rd.layers[i].mipmaps[j + 1].size; - storage->get_effects()->make_mipmap(view, texture, size); - } +void RasterizerSceneRD::_update_reflection_mipmaps(ReflectionData &rd, int p_start, int p_end) { + for (int i = p_start; i < p_end; i++) { + for (int j = 0; j < rd.layers[i].mipmaps.size() - 1; j++) { + for (int k = 0; k < 6; k++) { + RID view = rd.layers[i].mipmaps[j].views[k]; + RID texture = rd.layers[i].mipmaps[j + 1].views[k]; + Size2i size = rd.layers[i].mipmaps[j + 1].size; + storage->get_effects()->make_mipmap(view, texture, size); } } } @@ -1924,6 +1922,7 @@ void RasterizerSceneRD::_update_dirty_skys() { } sky->reflection.dirty = true; + sky->processing_layer = 0; Sky *next = sky->dirty_list; sky->dirty_list = nullptr; @@ -2276,8 +2275,32 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro float multiplier = environment_get_bg_energy(p_environment); + bool update_single_frame = sky->mode == RS::SKY_MODE_REALTIME || sky->mode == RS::SKY_MODE_QUALITY; + RS::SkyMode sky_mode = sky->mode; + + if (sky_mode == RS::SKY_MODE_AUTOMATIC) { + if (shader_data->uses_time || shader_data->uses_position) { + update_single_frame = true; + sky_mode = RS::SKY_MODE_REALTIME; + } else if (shader_data->uses_light || shader_data->ubo_size > 0) { + update_single_frame = false; + sky_mode = RS::SKY_MODE_INCREMENTAL; + } else { + update_single_frame = true; + sky_mode = RS::SKY_MODE_QUALITY; + } + } + + if (sky->processing_layer == 0 && sky_mode == RS::SKY_MODE_INCREMENTAL) { + // On the first frame after creating sky, rebuild in single frame + update_single_frame = true; + sky_mode = RS::SKY_MODE_QUALITY; + } + + int max_processing_layer = sky_use_cubemap_array ? sky->reflection.layers.size() : sky->reflection.layers[0].mipmaps.size(); + // Update radiance cubemap - if (sky->reflection.dirty) { + if (sky->reflection.dirty && (sky->processing_layer >= max_processing_layer || update_single_frame)) { static const Vector3 view_normals[6] = { Vector3(+1, 0, 0), Vector3(-1, 0, 0), @@ -2349,27 +2372,41 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro storage->get_effects()->render_sky(cubemap_draw_list, time, sky->reflection.layers[0].mipmaps[0].framebuffers[i], sky_scene_state.sampler_uniform_set, sky_scene_state.light_uniform_set, pipeline, material->uniform_set, texture_uniform_set, cm, local_view.basis, multiplier, p_transform.origin); RD::get_singleton()->draw_list_end(); } - if (sky_use_cubemap_array) { - if (sky->mode == RS::SKY_MODE_QUALITY) { - for (int i = 1; i < sky->reflection.layers.size(); i++) { - _create_reflection_importance_sample(sky->reflection, sky_use_cubemap_array, 10, i); - } - } else { - _create_reflection_fast_filter(sky->reflection, sky_use_cubemap_array); - } - _update_reflection_mipmaps(sky->reflection); + if (sky_mode == RS::SKY_MODE_REALTIME) { + _create_reflection_fast_filter(sky->reflection, sky_use_cubemap_array); + if (sky_use_cubemap_array) { + _update_reflection_mipmaps(sky->reflection, 0, sky->reflection.layers.size()); + } } else { - if (sky->mode == RS::SKY_MODE_QUALITY) { - for (int i = 1; i < sky->reflection.layers[0].mipmaps.size(); i++) { + if (update_single_frame) { + for (int i = 1; i < max_processing_layer; i++) { _create_reflection_importance_sample(sky->reflection, sky_use_cubemap_array, 10, i); } + if (sky_use_cubemap_array) { + _update_reflection_mipmaps(sky->reflection, 0, sky->reflection.layers.size()); + } } else { - _create_reflection_fast_filter(sky->reflection, sky_use_cubemap_array); + if (sky_use_cubemap_array) { + // Multi-Frame so just update the first array level + _update_reflection_mipmaps(sky->reflection, 0, 1); + } } + sky->processing_layer = 1; } sky->reflection.dirty = false; + + } else { + if (sky_mode == RS::SKY_MODE_INCREMENTAL && sky->processing_layer < max_processing_layer) { + _create_reflection_importance_sample(sky->reflection, sky_use_cubemap_array, 10, sky->processing_layer); + + if (sky_use_cubemap_array) { + _update_reflection_mipmaps(sky->reflection, sky->processing_layer, sky->processing_layer + 1); + } + + sky->processing_layer++; + } } } diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h index 83c03399ab..f09f9dde65 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h +++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h @@ -145,7 +145,7 @@ private: void _update_reflection_data(ReflectionData &rd, int p_size, int p_mipmaps, bool p_use_array, RID p_base_cube, int p_base_layer, bool p_low_quality); void _create_reflection_fast_filter(ReflectionData &rd, bool p_use_arrays); void _create_reflection_importance_sample(ReflectionData &rd, bool p_use_arrays, int p_cube_side, int p_base_layer); - void _update_reflection_mipmaps(ReflectionData &rd); + void _update_reflection_mipmaps(ReflectionData &rd, int p_start, int p_end); /* Sky shader */ @@ -261,10 +261,11 @@ private: int radiance_size = 256; - RS::SkyMode mode = RS::SKY_MODE_QUALITY; + RS::SkyMode mode = RS::SKY_MODE_AUTOMATIC; ReflectionData reflection; bool dirty = false; + int processing_layer = 0; Sky *dirty_list = nullptr; //State to track when radiance cubemap needs updating diff --git a/servers/rendering_server.h b/servers/rendering_server.h index 2e5ceec02f..109e9e53c5 100644 --- a/servers/rendering_server.h +++ b/servers/rendering_server.h @@ -720,7 +720,9 @@ public: /* SKY API */ enum SkyMode { + SKY_MODE_AUTOMATIC, SKY_MODE_QUALITY, + SKY_MODE_INCREMENTAL, SKY_MODE_REALTIME }; |