diff options
38 files changed, 108 insertions, 74 deletions
diff --git a/doc/classes/AudioEffectAmplify.xml b/doc/classes/AudioEffectAmplify.xml index 7ae0b06dad..43fa9d6ad3 100644 --- a/doc/classes/AudioEffectAmplify.xml +++ b/doc/classes/AudioEffectAmplify.xml @@ -2,12 +2,12 @@ <class name="AudioEffectAmplify" inherits="AudioEffect" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> Adds an amplifying audio effect to an audio bus. - Increases or decreases the volume of the selected audio bus. </brief_description> <description> Increases or decreases the volume being routed through the audio bus. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> <members> <member name="volume_db" type="float" setter="set_volume_db" getter="get_volume_db" default="0.0"> diff --git a/doc/classes/AudioEffectBandLimitFilter.xml b/doc/classes/AudioEffectBandLimitFilter.xml index 3635f122f2..4efa431714 100644 --- a/doc/classes/AudioEffectBandLimitFilter.xml +++ b/doc/classes/AudioEffectBandLimitFilter.xml @@ -7,5 +7,6 @@ Limits the frequencies in a range around the [member AudioEffectFilter.cutoff_hz] and allows frequencies outside of this range to pass. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> </class> diff --git a/doc/classes/AudioEffectBandPassFilter.xml b/doc/classes/AudioEffectBandPassFilter.xml index 5e7713f3d4..6820b2c9f8 100644 --- a/doc/classes/AudioEffectBandPassFilter.xml +++ b/doc/classes/AudioEffectBandPassFilter.xml @@ -7,5 +7,6 @@ Attenuates the frequencies inside of a range around the [member AudioEffectFilter.cutoff_hz] and cuts frequencies outside of this band. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> </class> diff --git a/doc/classes/AudioEffectCapture.xml b/doc/classes/AudioEffectCapture.xml index 7a7f1f8e8a..8e02056456 100644 --- a/doc/classes/AudioEffectCapture.xml +++ b/doc/classes/AudioEffectCapture.xml @@ -8,6 +8,7 @@ Application code should consume these audio frames from this ring buffer using [method get_buffer] and process it as needed, for example to capture data from a microphone, implement application defined effects, or to transmit audio over the network. When capturing audio data from a microphone, the format of the samples will be stereo 32-bit floating point PCM. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> <methods> <method name="can_get_buffer" qualifiers="const"> diff --git a/doc/classes/AudioEffectChorus.xml b/doc/classes/AudioEffectChorus.xml index ca04126da4..5efba17e6a 100644 --- a/doc/classes/AudioEffectChorus.xml +++ b/doc/classes/AudioEffectChorus.xml @@ -7,6 +7,7 @@ Adds a chorus audio effect. The effect applies a filter with voices to duplicate the audio source and manipulate it through the filter. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> <methods> <method name="get_voice_cutoff_hz" qualifiers="const"> diff --git a/doc/classes/AudioEffectCompressor.xml b/doc/classes/AudioEffectCompressor.xml index 5ad948feba..8793ec0a02 100644 --- a/doc/classes/AudioEffectCompressor.xml +++ b/doc/classes/AudioEffectCompressor.xml @@ -13,6 +13,7 @@ - Accentuates transients by using a wider attack, making effects sound more punchy. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> <members> <member name="attack_us" type="float" setter="set_attack_us" getter="get_attack_us" default="20.0"> diff --git a/doc/classes/AudioEffectDelay.xml b/doc/classes/AudioEffectDelay.xml index 8a95e315cd..8223ccd6bd 100644 --- a/doc/classes/AudioEffectDelay.xml +++ b/doc/classes/AudioEffectDelay.xml @@ -8,6 +8,7 @@ Plays input signal back after a period of time. The delayed signal may be played back multiple times to create the sound of a repeating, decaying echo. Delay effects range from a subtle echo effect to a pronounced blending of previous sounds with new sounds. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> <members> <member name="dry" type="float" setter="set_dry" getter="get_dry" default="1.0"> diff --git a/doc/classes/AudioEffectEQ.xml b/doc/classes/AudioEffectEQ.xml index 908ae956ed..ce5b6de3be 100644 --- a/doc/classes/AudioEffectEQ.xml +++ b/doc/classes/AudioEffectEQ.xml @@ -8,6 +8,7 @@ AudioEffectEQ gives you control over frequencies. Use it to compensate for existing deficiencies in audio. AudioEffectEQs are useful on the Master bus to completely master a mix and give it more character. They are also useful when a game is run on a mobile device, to adjust the mix to that kind of speakers (it can be added but disabled when headphones are plugged). </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> <methods> <method name="get_band_count" qualifiers="const"> diff --git a/doc/classes/AudioEffectEQ10.xml b/doc/classes/AudioEffectEQ10.xml index 0b03ea99dd..8cf53b9df2 100644 --- a/doc/classes/AudioEffectEQ10.xml +++ b/doc/classes/AudioEffectEQ10.xml @@ -19,5 +19,6 @@ See also [AudioEffectEQ], [AudioEffectEQ6], [AudioEffectEQ21]. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> </class> diff --git a/doc/classes/AudioEffectEQ21.xml b/doc/classes/AudioEffectEQ21.xml index 6861a74596..2eed3b4836 100644 --- a/doc/classes/AudioEffectEQ21.xml +++ b/doc/classes/AudioEffectEQ21.xml @@ -30,5 +30,6 @@ See also [AudioEffectEQ], [AudioEffectEQ6], [AudioEffectEQ10]. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> </class> diff --git a/doc/classes/AudioEffectEQ6.xml b/doc/classes/AudioEffectEQ6.xml index 5aea8efaa9..816d4b9b38 100644 --- a/doc/classes/AudioEffectEQ6.xml +++ b/doc/classes/AudioEffectEQ6.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectEQ6" inherits="AudioEffectEQ" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Adds a 6-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 32 Hz to 10000 Hz. + Adds a 6-band equalizer audio effect to an audio bus. Gives you control over frequencies from 32 Hz to 10000 Hz. Each frequency can be modulated between -60/+24 dB. </brief_description> <description> @@ -15,5 +15,6 @@ See also [AudioEffectEQ], [AudioEffectEQ10], [AudioEffectEQ21]. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> </class> diff --git a/doc/classes/AudioEffectHighPassFilter.xml b/doc/classes/AudioEffectHighPassFilter.xml index 02d8dbfffc..53e6f3ca63 100644 --- a/doc/classes/AudioEffectHighPassFilter.xml +++ b/doc/classes/AudioEffectHighPassFilter.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectHighPassFilter" inherits="AudioEffectFilter" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Adds a high-pass filter to the Audio Bus. + Adds a high-pass filter to the audio bus. </brief_description> <description> Cuts frequencies lower than the [member AudioEffectFilter.cutoff_hz] and allows higher frequencies to pass. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> </class> diff --git a/doc/classes/AudioEffectHighShelfFilter.xml b/doc/classes/AudioEffectHighShelfFilter.xml index bb5cf5c4a0..f2c20862fb 100644 --- a/doc/classes/AudioEffectHighShelfFilter.xml +++ b/doc/classes/AudioEffectHighShelfFilter.xml @@ -1,9 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectHighShelfFilter" inherits="AudioEffectFilter" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Reduces all frequencies above the [member AudioEffectFilter.cutoff_hz]. + Adds a high-shelf filter to the audio bus. </brief_description> <description> + Reduces all frequencies above the [member AudioEffectFilter.cutoff_hz]. </description> <tutorials> <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> diff --git a/doc/classes/AudioEffectLimiter.xml b/doc/classes/AudioEffectLimiter.xml index 3fd099b55e..e841889b2a 100644 --- a/doc/classes/AudioEffectLimiter.xml +++ b/doc/classes/AudioEffectLimiter.xml @@ -8,6 +8,7 @@ Soft clipping starts to reduce the peaks a little below the threshold level and progressively increases its effect as the input level increases such that the threshold is never exceeded. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> <members> <member name="ceiling_db" type="float" setter="set_ceiling_db" getter="get_ceiling_db" default="-0.1"> diff --git a/doc/classes/AudioEffectLowPassFilter.xml b/doc/classes/AudioEffectLowPassFilter.xml index 8a9ca04354..b0577f19c3 100644 --- a/doc/classes/AudioEffectLowPassFilter.xml +++ b/doc/classes/AudioEffectLowPassFilter.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectLowPassFilter" inherits="AudioEffectFilter" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Adds a low-pass filter to the Audio bus. + Adds a low-pass filter to the audio bus. </brief_description> <description> Cuts frequencies higher than the [member AudioEffectFilter.cutoff_hz] and allows lower frequencies to pass. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> </class> diff --git a/doc/classes/AudioEffectLowShelfFilter.xml b/doc/classes/AudioEffectLowShelfFilter.xml index 04cc1ab1d8..f654ba3612 100644 --- a/doc/classes/AudioEffectLowShelfFilter.xml +++ b/doc/classes/AudioEffectLowShelfFilter.xml @@ -1,9 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectLowShelfFilter" inherits="AudioEffectFilter" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Reduces all frequencies below the [member AudioEffectFilter.cutoff_hz]. + Adds a low-shelf filter to the audio bus. </brief_description> <description> + Reduces all frequencies below the [member AudioEffectFilter.cutoff_hz]. </description> <tutorials> <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> diff --git a/doc/classes/AudioEffectNotchFilter.xml b/doc/classes/AudioEffectNotchFilter.xml index a2cc764003..ad4577cfbc 100644 --- a/doc/classes/AudioEffectNotchFilter.xml +++ b/doc/classes/AudioEffectNotchFilter.xml @@ -7,5 +7,6 @@ Attenuates frequencies in a narrow band around the [member AudioEffectFilter.cutoff_hz] and cuts frequencies outside of this range. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> </class> diff --git a/doc/classes/AudioEffectPanner.xml b/doc/classes/AudioEffectPanner.xml index 1dd2d9fa27..291e86214e 100644 --- a/doc/classes/AudioEffectPanner.xml +++ b/doc/classes/AudioEffectPanner.xml @@ -1,12 +1,13 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectPanner" inherits="AudioEffect" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Adds a panner audio effect to an Audio bus. Pans sound left or right. + Adds a panner audio effect to an audio bus. Pans sound left or right. </brief_description> <description> Determines how much of an audio signal is sent to the left and right buses. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> <members> <member name="pan" type="float" setter="set_pan" getter="get_pan" default="0.0"> diff --git a/doc/classes/AudioEffectPhaser.xml b/doc/classes/AudioEffectPhaser.xml index 9c10052b6a..7aaf404352 100644 --- a/doc/classes/AudioEffectPhaser.xml +++ b/doc/classes/AudioEffectPhaser.xml @@ -1,13 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectPhaser" inherits="AudioEffect" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Adds a phaser audio effect to an Audio bus. + Adds a phaser audio effect to an audio bus. Combines the original signal with a copy that is slightly out of phase with the original. </brief_description> <description> Combines phase-shifted signals with the original signal. The movement of the phase-shifted signals is controlled using a low-frequency oscillator. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> <members> <member name="depth" type="float" setter="set_depth" getter="get_depth" default="1.0"> diff --git a/doc/classes/AudioEffectPitchShift.xml b/doc/classes/AudioEffectPitchShift.xml index aab380aa72..952d432879 100644 --- a/doc/classes/AudioEffectPitchShift.xml +++ b/doc/classes/AudioEffectPitchShift.xml @@ -1,13 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectPitchShift" inherits="AudioEffect" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Adds a pitch-shifting audio effect to an Audio bus. + Adds a pitch-shifting audio effect to an audio bus. Raises or lowers the pitch of original sound. </brief_description> <description> Allows modulation of pitch independently of tempo. All frequencies can be increased/decreased with minimal effect on transients. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> <members> <member name="fft_size" type="int" setter="set_fft_size" getter="get_fft_size" enum="AudioEffectPitchShift.FFTSize" default="3"> diff --git a/doc/classes/AudioEffectReverb.xml b/doc/classes/AudioEffectReverb.xml index 5525102806..b024f06849 100644 --- a/doc/classes/AudioEffectReverb.xml +++ b/doc/classes/AudioEffectReverb.xml @@ -2,12 +2,12 @@ <class name="AudioEffectReverb" inherits="AudioEffect" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> Adds a reverberation audio effect to an Audio bus. - Simulates the sound of acoustic environments such as rooms, concert halls, caverns, or an open spaces. </brief_description> <description> - Simulates rooms of different sizes. Its parameters can be adjusted to simulate the sound of a specific room. + Simulates the sound of acoustic environments such as rooms, concert halls, caverns, or an open spaces. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> </tutorials> <members> diff --git a/doc/classes/AudioEffectStereoEnhance.xml b/doc/classes/AudioEffectStereoEnhance.xml index 5c62ba982f..088d61189f 100644 --- a/doc/classes/AudioEffectStereoEnhance.xml +++ b/doc/classes/AudioEffectStereoEnhance.xml @@ -7,6 +7,7 @@ An audio effect that can be used to adjust the intensity of stereo panning. </description> <tutorials> + <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link> </tutorials> <members> <member name="pan_pullout" type="float" setter="set_pan_pullout" getter="get_pan_pullout" default="1.0"> diff --git a/doc/classes/ORMMaterial3D.xml b/doc/classes/ORMMaterial3D.xml index 69d238ceff..656594a3c3 100644 --- a/doc/classes/ORMMaterial3D.xml +++ b/doc/classes/ORMMaterial3D.xml @@ -1,9 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ORMMaterial3D" inherits="BaseMaterial3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Physically based rendering (PBR) material that can be applied to 3D objects, can use an ORM texture. </brief_description> <description> + ORMMaterial3D's properties are inherited from [BaseMaterial3D]. Unlike [StandardMaterial3D], ORMMaterial3D uses a single texture for ambient occlusion, roughness and metallic maps, known as an ORM texture. </description> <tutorials> + <link title="Standard Material 3D and ORM Material 3D">$DOCS_URL/tutorials/3d/standard_material_3d.html</link> </tutorials> </class> diff --git a/doc/classes/StandardMaterial3D.xml b/doc/classes/StandardMaterial3D.xml index 2305a9d325..bd6e5cdfa2 100644 --- a/doc/classes/StandardMaterial3D.xml +++ b/doc/classes/StandardMaterial3D.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="StandardMaterial3D" inherits="BaseMaterial3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Physically based rendering (PBR) material that can be applied to 3D objects. </brief_description> <description> + StandardMaterial3D's properties are inherited from [BaseMaterial3D]. </description> <tutorials> - <link title="Standard Material 3D">$DOCS_URL/tutorials/3d/standard_material_3d.html</link> + <link title="Standard Material 3D and ORM Material 3D">$DOCS_URL/tutorials/3d/standard_material_3d.html</link> </tutorials> </class> diff --git a/doc/classes/TileData.xml b/doc/classes/TileData.xml index 0c2961fd5e..66cf602e5d 100644 --- a/doc/classes/TileData.xml +++ b/doc/classes/TileData.xml @@ -199,7 +199,8 @@ </member> <member name="flip_v" type="bool" setter="set_flip_v" getter="get_flip_v" default="false"> </member> - <member name="material" type="ShaderMaterial" setter="set_material" getter="get_material"> + <member name="material" type="Material" setter="set_material" getter="get_material"> + The [Material] to use for this [TileData]. This can be a [CanvasItemMaterial] to use the default shader, or a [ShaderMaterial] to use a custom shader. </member> <member name="modulate" type="Color" setter="set_modulate" getter="get_modulate" default="Color(1, 1, 1, 1)"> </member> diff --git a/doc/tools/make_rst.py b/doc/tools/make_rst.py index f59f2ff872..ce09361dfa 100755 --- a/doc/tools/make_rst.py +++ b/doc/tools/make_rst.py @@ -913,9 +913,9 @@ def format_codeblock(code_type, post_text, indent_level, state): # types: str, if to_skip > indent_level: print_error( - "{}.xml: Four spaces should be used for indentation within [" - + code_type - + "].".format(state.current_class), + "{}.xml: Four spaces should be used for indentation within [{}].".format( + state.current_class, code_type + ), state, ) diff --git a/modules/minimp3/audio_stream_mp3.cpp b/modules/minimp3/audio_stream_mp3.cpp index b5b51403f7..c37bea519f 100644 --- a/modules/minimp3/audio_stream_mp3.cpp +++ b/modules/minimp3/audio_stream_mp3.cpp @@ -38,7 +38,9 @@ #include "core/io/file_access.h" int AudioStreamPlaybackMP3::_mix_internal(AudioFrame *p_buffer, int p_frames) { - ERR_FAIL_COND_V(!active, 0); + if (!active) { + return 0; + } int todo = p_frames; diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp index b645a48c88..89a6b03ff8 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp @@ -36,23 +36,22 @@ int AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_frames) { ERR_FAIL_COND_V(!ready, 0); - ERR_FAIL_COND_V(!active, 0); + + if (!active) { + return 0; + } int todo = p_frames; int start_buffer = 0; - int frames_mixed_this_step = p_frames; - - while (todo && active) { + while (todo > 0 && active) { AudioFrame *buffer = p_buffer; if (start_buffer > 0) { buffer = buffer + start_buffer; } int mixed = _mix_frames_vorbis(buffer, todo); - if (mixed < 0) { - return 0; - } + ERR_FAIL_COND_V(mixed < 0, 0); todo -= mixed; frames_mixed += mixed; start_buffer += mixed; @@ -67,16 +66,14 @@ int AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_fram // we still have buffer to fill, start from this element in the next iteration. start_buffer = p_frames - todo; } else { - frames_mixed_this_step = p_frames - todo; for (int i = p_frames - todo; i < p_frames; i++) { p_buffer[i] = AudioFrame(0, 0); } active = false; - todo = 0; } } } - return frames_mixed_this_step; + return p_frames - todo; } int AudioStreamPlaybackOGGVorbis::_mix_frames_vorbis(AudioFrame *p_buffer, int p_frames) { diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 6d04dcdc71..9c4b0feea2 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1090,7 +1090,7 @@ void TileMap::_rendering_update_dirty_quadrants(SelfList<TileMapQuadrant>::List q.occluders.clear(); // Those allow to group cell per material or z-index. - Ref<ShaderMaterial> prev_material; + Ref<Material> prev_material; int prev_z_index = 0; RID prev_canvas_item; @@ -1129,7 +1129,7 @@ void TileMap::_rendering_update_dirty_quadrants(SelfList<TileMapQuadrant>::List tile_data = atlas_source->get_tile_data(c.get_atlas_coords(), c.alternative_tile); } - Ref<ShaderMaterial> mat = tile_data->get_material(); + Ref<Material> mat = tile_data->get_material(); int z_index = tile_data->get_z_index(); // Quandrant pos. diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 0320585b5a..dba53338eb 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -40,6 +40,8 @@ // Version 3: new string ID for ext/subresources, breaks forward compat. #define FORMAT_VERSION 3 +#define BINARY_FORMAT_VERSION 4 + #include "core/io/dir_access.h" #include "core/version.h" @@ -66,12 +68,8 @@ Error ResourceLoaderText::_parse_sub_resource_dummy(DummyReadData *p_data, Varia String unique_id = token.value; if (!p_data->resource_map.has(unique_id)) { - Ref<DummyResource> dr; - dr.instantiate(); - dr->set_scene_unique_id(unique_id); - p_data->resource_map[unique_id] = dr; - uint32_t im_size = p_data->resource_index_map.size(); - p_data->resource_index_map.insert(dr, im_size); + r_err_str = "Found unique_id reference before mapping, sub-resources stored out of order in resource file"; + return ERR_PARSE_ERROR; } r_res = p_data->resource_map[unique_id]; @@ -1078,7 +1076,7 @@ Error ResourceLoaderText::save_as_binary(Ref<FileAccess> p_f, const String &p_pa wf->store_32(0); //64 bits file, false for now wf->store_32(VERSION_MAJOR); wf->store_32(VERSION_MINOR); - static const int save_format_version = 3; //use format version 3 for saving + static const int save_format_version = BINARY_FORMAT_VERSION; wf->store_32(save_format_version); bs_save_unicode_string(wf, is_scene ? "PackedScene" : resource_type); @@ -1176,7 +1174,7 @@ Error ResourceLoaderText::save_as_binary(Ref<FileAccess> p_f, const String &p_pa while (next_tag.name == "sub_resource" || next_tag.name == "resource") { String type; - int id = -1; + String id; bool main_res; if (next_tag.name == "sub_resource") { @@ -1197,15 +1195,26 @@ Error ResourceLoaderText::save_as_binary(Ref<FileAccess> p_f, const String &p_pa type = next_tag.fields["type"]; id = next_tag.fields["id"]; main_res = false; + + if (!dummy_read.resource_map.has(id)) { + Ref<DummyResource> dr; + dr.instantiate(); + dr->set_scene_unique_id(id); + dummy_read.resource_map[id] = dr; + uint32_t im_size = dummy_read.resource_index_map.size(); + dummy_read.resource_index_map.insert(dr, im_size); + } + } else { type = res_type; - id = 0; //used for last anyway + String uid_text = ResourceUID::get_singleton()->id_to_text(res_uid); + id = type + "_" + uid_text.replace("uid://", "").replace("<invalid>", "0"); main_res = true; } local_offsets.push_back(wf2->get_position()); - bs_save_unicode_string(wf, "local://" + itos(id)); + bs_save_unicode_string(wf, "local://" + id); local_pointers_pos.push_back(wf->get_position()); wf->store_64(0); //temp local offset @@ -1274,7 +1283,8 @@ Error ResourceLoaderText::save_as_binary(Ref<FileAccess> p_f, const String &p_pa List<PropertyInfo> props; packed_scene->get_property_list(&props); - bs_save_unicode_string(wf, "local://0"); + String id = "PackedScene_" + ResourceUID::get_singleton()->id_to_text(res_uid).replace("uid://", "").replace("<invalid>", "0"); + bs_save_unicode_string(wf, "local://" + id); local_pointers_pos.push_back(wf->get_position()); wf->store_64(0); //temp local offset diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 8976aa17d2..13b671e562 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -5058,11 +5058,11 @@ Vector2i TileData::get_texture_offset() const { return tex_offset; } -void TileData::set_material(Ref<ShaderMaterial> p_material) { +void TileData::set_material(Ref<Material> p_material) { material = p_material; emit_signal(SNAME("changed")); } -Ref<ShaderMaterial> TileData::get_material() const { +Ref<Material> TileData::get_material() const { return material; } @@ -5700,7 +5700,7 @@ void TileData::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transpose"), "set_transpose", "get_transpose"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "texture_offset", PROPERTY_HINT_NONE, "suffix:px"), "set_texture_offset", "get_texture_offset"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "modulate"), "set_modulate", "get_modulate"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial"), "set_material", "get_material"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemMaterial,ShaderMaterial"), "set_material", "get_material"); ADD_PROPERTY(PropertyInfo(Variant::INT, "z_index"), "set_z_index", "get_z_index"); ADD_PROPERTY(PropertyInfo(Variant::INT, "y_sort_origin"), "set_y_sort_origin", "get_y_sort_origin"); diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index 181782e5af..7368d2bd87 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -164,7 +164,7 @@ private: String name; Ref<Texture2D> texture; Vector2 tex_offset; - Ref<ShaderMaterial> material; + Ref<Material> material; Rect2 region; int tile_mode = 0; Color modulate = Color(1, 1, 1); @@ -783,7 +783,7 @@ private: bool flip_v = false; bool transpose = false; Vector2i tex_offset = Vector2i(); - Ref<ShaderMaterial> material = Ref<ShaderMaterial>(); + Ref<Material> material = Ref<Material>(); Color modulate = Color(1.0, 1.0, 1.0, 1.0); int z_index = 0; int y_sort_origin = 0; @@ -864,8 +864,8 @@ public: void set_texture_offset(Vector2i p_texture_offset); Vector2i get_texture_offset() const; - void set_material(Ref<ShaderMaterial> p_material); - Ref<ShaderMaterial> get_material() const; + void set_material(Ref<Material> p_material); + Ref<Material> get_material() const; void set_modulate(Color p_modulate); Color get_modulate() const; void set_z_index(int p_z_index); diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index 3983bc5cb1..5d9a9e61dc 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -135,9 +135,10 @@ int AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale, uint64_t mix_increment = uint64_t(((get_stream_sampling_rate() * p_rate_scale * playback_speed_scale) / double(target_rate)) * double(FP_LEN)); - int mixed_frames_total = p_frames; + int mixed_frames_total = -1; - for (int i = 0; i < p_frames; i++) { + int i; + for (i = 0; i < p_frames; i++) { uint32_t idx = CUBIC_INTERP_HISTORY + uint32_t(mix_offset >> FP_BITS); //standard cubic interpolation (great quality/performance ratio) //this used to be moved to a LUT for greater performance, but nowadays CPU speed is generally faster than memory. @@ -147,7 +148,7 @@ int AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale, AudioFrame y2 = internal_buffer[idx - 1]; AudioFrame y3 = internal_buffer[idx - 0]; - if (idx <= internal_buffer_end && idx >= internal_buffer_end && mixed_frames_total == p_frames) { + if (idx >= internal_buffer_end && mixed_frames_total == -1) { // The internal buffer ends somewhere in this range, and we haven't yet recorded the number of good frames we have. mixed_frames_total = i; } @@ -167,24 +168,20 @@ int AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale, internal_buffer[1] = internal_buffer[INTERNAL_BUFFER_LEN + 1]; internal_buffer[2] = internal_buffer[INTERNAL_BUFFER_LEN + 2]; internal_buffer[3] = internal_buffer[INTERNAL_BUFFER_LEN + 3]; - if (is_playing()) { - int mixed_frames = _mix_internal(internal_buffer + 4, INTERNAL_BUFFER_LEN); - if (mixed_frames != INTERNAL_BUFFER_LEN) { - // internal_buffer[mixed_frames] is the first frame of silence. - internal_buffer_end = mixed_frames; - } else { - // The internal buffer does not contain the first frame of silence. - internal_buffer_end = -1; - } + int mixed_frames = _mix_internal(internal_buffer + 4, INTERNAL_BUFFER_LEN); + if (mixed_frames != INTERNAL_BUFFER_LEN) { + // internal_buffer[mixed_frames] is the first frame of silence. + internal_buffer_end = mixed_frames; } else { - //fill with silence, not playing - for (int j = 0; j < INTERNAL_BUFFER_LEN; ++j) { - internal_buffer[j + 4] = AudioFrame(0, 0); - } + // The internal buffer does not contain the first frame of silence. + internal_buffer_end = -1; } mix_offset -= (INTERNAL_BUFFER_LEN << FP_BITS); } } + if (mixed_frames_total == -1 && i == p_frames) { + mixed_frames_total = p_frames; + } return mixed_frames_total; } 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 cfb30ef2f3..182aecd3be 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 @@ -621,7 +621,7 @@ void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const Strin //builtins - actions.renames["TIME"] = "scene_data_block.data.time"; + actions.renames["TIME"] = "global_time"; actions.renames["PI"] = _MKSTR(Math_PI); actions.renames["TAU"] = _MKSTR(Math_TAU); actions.renames["E"] = _MKSTR(Math_E); diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl index b992e948c3..268e1dd7d0 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl @@ -96,6 +96,8 @@ layout(set = MATERIAL_UNIFORM_SET, binding = 0, std140) uniform MaterialUniforms } material; #endif +float global_time; + #ifdef MODE_DUAL_PARABOLOID layout(location = 9) out float dp_clip; @@ -386,9 +388,12 @@ void main() { mat4 model_matrix = instances.data[instance_index].transform; #if defined(MOTION_VECTORS) + global_time = scene_data_block.prev_data.time; vertex_shader(instance_index, is_multimesh, scene_data_block.prev_data, instances.data[instance_index].prev_transform, prev_screen_position); + global_time = scene_data_block.data.time; vertex_shader(instance_index, is_multimesh, scene_data_block.data, model_matrix, screen_position); #else + global_time = scene_data_block.data.time; vec4 screen_position; vertex_shader(instance_index, is_multimesh, scene_data_block.data, model_matrix, screen_position); #endif @@ -486,6 +491,8 @@ layout(location = 10) in flat uint instance_index_interp; #define inv_projection_matrix scene_data.inv_projection_matrix #endif +#define global_time scene_data_block.data.time + #if defined(ENABLE_SSS) && defined(ENABLE_TRANSMITTANCE) //both required for transmittance to be enabled #define LIGHT_TRANSMITTANCE_USED diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl index cd94908c31..26d0de46c2 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl @@ -114,9 +114,9 @@ invariant gl_Position; #GLOBALS -void main() { - SceneData scene_data = scene_data_block.data; +#define scene_data scene_data_block.data +void main() { vec4 instance_custom = vec4(0.0); #if defined(COLOR_USED) color_interp = color_attrib; @@ -576,13 +576,14 @@ vec4 fog_process(vec3 vertex) { #endif //!MODE_RENDER DEPTH +#define scene_data scene_data_block.data + void main() { #ifdef MODE_DUAL_PARABOLOID if (dp_clip > 0.0) discard; #endif - SceneData scene_data = scene_data_block.data; //lay out everything, whatever is unused is optimized away anyway vec3 vertex = vertex_interp; diff --git a/servers/rendering/rendering_server_default.cpp b/servers/rendering/rendering_server_default.cpp index 718f20f80a..3813db4b72 100644 --- a/servers/rendering/rendering_server_default.cpp +++ b/servers/rendering/rendering_server_default.cpp @@ -333,13 +333,10 @@ void RenderingServerDefault::_thread_exit() { } void RenderingServerDefault::_thread_draw(bool p_swap_buffers, double frame_step) { - if (!draw_pending.decrement()) { - _draw(p_swap_buffers, frame_step); - } + _draw(p_swap_buffers, frame_step); } void RenderingServerDefault::_thread_flush() { - draw_pending.decrement(); } void RenderingServerDefault::_thread_callback(void *_instance) { @@ -370,7 +367,6 @@ void RenderingServerDefault::_thread_loop() { void RenderingServerDefault::sync() { if (create_thread) { - draw_pending.increment(); command_queue.push_and_sync(this, &RenderingServerDefault::_thread_flush); } else { command_queue.flush_all(); //flush all pending from other threads @@ -379,7 +375,6 @@ void RenderingServerDefault::sync() { void RenderingServerDefault::draw(bool p_swap_buffers, double frame_step) { if (create_thread) { - draw_pending.increment(); command_queue.push(this, &RenderingServerDefault::_thread_draw, p_swap_buffers, frame_step); } else { _draw(p_swap_buffers, frame_step); diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h index 56ab5891ed..2829dae837 100644 --- a/servers/rendering/rendering_server_default.h +++ b/servers/rendering/rendering_server_default.h @@ -84,7 +84,6 @@ class RenderingServerDefault : public RenderingServer { SafeFlag draw_thread_up; bool create_thread; - SafeNumeric<uint64_t> draw_pending; void _thread_draw(bool p_swap_buffers, double frame_step); void _thread_flush(); |