diff options
Diffstat (limited to 'servers')
80 files changed, 451 insertions, 0 deletions
diff --git a/servers/audio/audio_filter_sw.cpp b/servers/audio/audio_filter_sw.cpp index b4f3935f3a..b6759649cc 100644 --- a/servers/audio/audio_filter_sw.cpp +++ b/servers/audio/audio_filter_sw.cpp @@ -33,9 +33,11 @@ void AudioFilterSW::set_mode(Mode p_mode) { mode = p_mode; } + void AudioFilterSW::set_cutoff(float p_cutoff) { cutoff = p_cutoff; } + void AudioFilterSW::set_resonance(float p_resonance) { resonance = p_resonance; } diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index b7e3f8964b..11b96edb8d 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -312,6 +312,7 @@ void AudioStreamPlaybackRandomPitch::stop() { ; } } + bool AudioStreamPlaybackRandomPitch::is_playing() const { if (playing.is_valid()) { return playing->is_playing(); @@ -335,6 +336,7 @@ float AudioStreamPlaybackRandomPitch::get_playback_position() const { return 0; } + void AudioStreamPlaybackRandomPitch::seek(float p_time) { if (playing.is_valid()) { playing->seek(p_time); diff --git a/servers/audio/effects/audio_effect_chorus.cpp b/servers/audio/effects/audio_effect_chorus.cpp index 11d820f828..48f050c5ab 100644 --- a/servers/audio/effects/audio_effect_chorus.cpp +++ b/servers/audio/effects/audio_effect_chorus.cpp @@ -189,6 +189,7 @@ void AudioEffectChorus::set_voice_delay_ms(int p_voice, float p_delay_ms) { voice[p_voice].delay = p_delay_ms; } + float AudioEffectChorus::get_voice_delay_ms(int p_voice) const { ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0); return voice[p_voice].delay; @@ -199,6 +200,7 @@ void AudioEffectChorus::set_voice_rate_hz(int p_voice, float p_rate_hz) { voice[p_voice].rate = p_rate_hz; } + float AudioEffectChorus::get_voice_rate_hz(int p_voice) const { ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0); @@ -210,6 +212,7 @@ void AudioEffectChorus::set_voice_depth_ms(int p_voice, float p_depth_ms) { voice[p_voice].depth = p_depth_ms; } + float AudioEffectChorus::get_voice_depth_ms(int p_voice) const { ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0); @@ -221,6 +224,7 @@ void AudioEffectChorus::set_voice_level_db(int p_voice, float p_level_db) { voice[p_voice].level = p_level_db; } + float AudioEffectChorus::get_voice_level_db(int p_voice) const { ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0); @@ -232,6 +236,7 @@ void AudioEffectChorus::set_voice_cutoff_hz(int p_voice, float p_cutoff_hz) { voice[p_voice].cutoff = p_cutoff_hz; } + float AudioEffectChorus::get_voice_cutoff_hz(int p_voice) const { ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0); @@ -243,6 +248,7 @@ void AudioEffectChorus::set_voice_pan(int p_voice, float p_pan) { voice[p_voice].pan = p_pan; } + float AudioEffectChorus::get_voice_pan(int p_voice) const { ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0); @@ -252,6 +258,7 @@ float AudioEffectChorus::get_voice_pan(int p_voice) const { void AudioEffectChorus::set_wet(float amount) { wet = amount; } + float AudioEffectChorus::get_wet() const { return wet; } @@ -259,6 +266,7 @@ float AudioEffectChorus::get_wet() const { void AudioEffectChorus::set_dry(float amount) { dry = amount; } + float AudioEffectChorus::get_dry() const { return dry; } diff --git a/servers/audio/effects/audio_effect_compressor.cpp b/servers/audio/effects/audio_effect_compressor.cpp index b4728314b6..b0f829b679 100644 --- a/servers/audio/effects/audio_effect_compressor.cpp +++ b/servers/audio/effects/audio_effect_compressor.cpp @@ -134,6 +134,7 @@ float AudioEffectCompressor::get_threshold() const { void AudioEffectCompressor::set_ratio(float p_ratio) { ratio = p_ratio; } + float AudioEffectCompressor::get_ratio() const { return ratio; } @@ -141,6 +142,7 @@ float AudioEffectCompressor::get_ratio() const { void AudioEffectCompressor::set_gain(float p_gain) { gain = p_gain; } + float AudioEffectCompressor::get_gain() const { return gain; } @@ -148,6 +150,7 @@ float AudioEffectCompressor::get_gain() const { void AudioEffectCompressor::set_attack_us(float p_attack_us) { attack_us = p_attack_us; } + float AudioEffectCompressor::get_attack_us() const { return attack_us; } @@ -155,6 +158,7 @@ float AudioEffectCompressor::get_attack_us() const { void AudioEffectCompressor::set_release_ms(float p_release_ms) { release_ms = p_release_ms; } + float AudioEffectCompressor::get_release_ms() const { return release_ms; } @@ -162,6 +166,7 @@ float AudioEffectCompressor::get_release_ms() const { void AudioEffectCompressor::set_mix(float p_mix) { mix = p_mix; } + float AudioEffectCompressor::get_mix() const { return mix; } diff --git a/servers/audio/effects/audio_effect_delay.cpp b/servers/audio/effects/audio_effect_delay.cpp index 2a613ad4f1..00cf7a0e70 100644 --- a/servers/audio/effects/audio_effect_delay.cpp +++ b/servers/audio/effects/audio_effect_delay.cpp @@ -153,6 +153,7 @@ float AudioEffectDelay::get_dry() { void AudioEffectDelay::set_tap1_active(bool p_active) { tap_1_active = p_active; } + bool AudioEffectDelay::is_tap1_active() const { return tap_1_active; } @@ -160,6 +161,7 @@ bool AudioEffectDelay::is_tap1_active() const { void AudioEffectDelay::set_tap1_delay_ms(float p_delay_ms) { tap_1_delay_ms = p_delay_ms; } + float AudioEffectDelay::get_tap1_delay_ms() const { return tap_1_delay_ms; } @@ -167,6 +169,7 @@ float AudioEffectDelay::get_tap1_delay_ms() const { void AudioEffectDelay::set_tap1_level_db(float p_level_db) { tap_1_level = p_level_db; } + float AudioEffectDelay::get_tap1_level_db() const { return tap_1_level; } @@ -174,6 +177,7 @@ float AudioEffectDelay::get_tap1_level_db() const { void AudioEffectDelay::set_tap1_pan(float p_pan) { tap_1_pan = p_pan; } + float AudioEffectDelay::get_tap1_pan() const { return tap_1_pan; } @@ -181,6 +185,7 @@ float AudioEffectDelay::get_tap1_pan() const { void AudioEffectDelay::set_tap2_active(bool p_active) { tap_2_active = p_active; } + bool AudioEffectDelay::is_tap2_active() const { return tap_2_active; } @@ -188,6 +193,7 @@ bool AudioEffectDelay::is_tap2_active() const { void AudioEffectDelay::set_tap2_delay_ms(float p_delay_ms) { tap_2_delay_ms = p_delay_ms; } + float AudioEffectDelay::get_tap2_delay_ms() const { return tap_2_delay_ms; } @@ -195,6 +201,7 @@ float AudioEffectDelay::get_tap2_delay_ms() const { void AudioEffectDelay::set_tap2_level_db(float p_level_db) { tap_2_level = p_level_db; } + float AudioEffectDelay::get_tap2_level_db() const { return tap_2_level; } @@ -202,6 +209,7 @@ float AudioEffectDelay::get_tap2_level_db() const { void AudioEffectDelay::set_tap2_pan(float p_pan) { tap_2_pan = p_pan; } + float AudioEffectDelay::get_tap2_pan() const { return tap_2_pan; } @@ -209,6 +217,7 @@ float AudioEffectDelay::get_tap2_pan() const { void AudioEffectDelay::set_feedback_active(bool p_active) { feedback_active = p_active; } + bool AudioEffectDelay::is_feedback_active() const { return feedback_active; } @@ -216,6 +225,7 @@ bool AudioEffectDelay::is_feedback_active() const { void AudioEffectDelay::set_feedback_delay_ms(float p_delay_ms) { feedback_delay_ms = p_delay_ms; } + float AudioEffectDelay::get_feedback_delay_ms() const { return feedback_delay_ms; } @@ -223,6 +233,7 @@ float AudioEffectDelay::get_feedback_delay_ms() const { void AudioEffectDelay::set_feedback_level_db(float p_level_db) { feedback_level = p_level_db; } + float AudioEffectDelay::get_feedback_level_db() const { return feedback_level; } @@ -230,6 +241,7 @@ float AudioEffectDelay::get_feedback_level_db() const { void AudioEffectDelay::set_feedback_lowpass(float p_lowpass) { feedback_lowpass = p_lowpass; } + float AudioEffectDelay::get_feedback_lowpass() const { return feedback_lowpass; } diff --git a/servers/audio/effects/audio_effect_distortion.cpp b/servers/audio/effects/audio_effect_distortion.cpp index 7726b3da3e..da4c34ce82 100644 --- a/servers/audio/effects/audio_effect_distortion.cpp +++ b/servers/audio/effects/audio_effect_distortion.cpp @@ -112,6 +112,7 @@ AudioEffectDistortion::Mode AudioEffectDistortion::get_mode() const { void AudioEffectDistortion::set_pre_gain(float p_pre_gain) { pre_gain = p_pre_gain; } + float AudioEffectDistortion::get_pre_gain() const { return pre_gain; } @@ -119,6 +120,7 @@ float AudioEffectDistortion::get_pre_gain() const { void AudioEffectDistortion::set_keep_hf_hz(float p_keep_hf_hz) { keep_hf_hz = p_keep_hf_hz; } + float AudioEffectDistortion::get_keep_hf_hz() const { return keep_hf_hz; } @@ -126,6 +128,7 @@ float AudioEffectDistortion::get_keep_hf_hz() const { void AudioEffectDistortion::set_drive(float p_drive) { drive = p_drive; } + float AudioEffectDistortion::get_drive() const { return drive; } @@ -133,6 +136,7 @@ float AudioEffectDistortion::get_drive() const { void AudioEffectDistortion::set_post_gain(float p_post_gain) { post_gain = p_post_gain; } + float AudioEffectDistortion::get_post_gain() const { return post_gain; } diff --git a/servers/audio/effects/audio_effect_eq.cpp b/servers/audio/effects/audio_effect_eq.cpp index e8d38f87a3..ed4e7122b5 100644 --- a/servers/audio/effects/audio_effect_eq.cpp +++ b/servers/audio/effects/audio_effect_eq.cpp @@ -84,6 +84,7 @@ float AudioEffectEQ::get_band_gain_db(int p_band) const { return gain[p_band]; } + int AudioEffectEQ::get_band_count() const { return gain.size(); } diff --git a/servers/audio/effects/audio_effect_filter.cpp b/servers/audio/effects/audio_effect_filter.cpp index 664b1785d4..cf6d0fa896 100644 --- a/servers/audio/effects/audio_effect_filter.cpp +++ b/servers/audio/effects/audio_effect_filter.cpp @@ -113,6 +113,7 @@ float AudioEffectFilter::get_cutoff() const { void AudioEffectFilter::set_resonance(float p_amount) { resonance = p_amount; } + float AudioEffectFilter::get_resonance() const { return resonance; } @@ -120,6 +121,7 @@ float AudioEffectFilter::get_resonance() const { void AudioEffectFilter::set_gain(float p_amount) { gain = p_amount; } + float AudioEffectFilter::get_gain() const { return gain; } diff --git a/servers/audio/effects/audio_effect_limiter.cpp b/servers/audio/effects/audio_effect_limiter.cpp index aab217cde9..27f1aaf71f 100644 --- a/servers/audio/effects/audio_effect_limiter.cpp +++ b/servers/audio/effects/audio_effect_limiter.cpp @@ -86,6 +86,7 @@ float AudioEffectLimiter::get_threshold_db() const { void AudioEffectLimiter::set_ceiling_db(float p_ceiling) { ceiling = p_ceiling; } + float AudioEffectLimiter::get_ceiling_db() const { return ceiling; } @@ -93,6 +94,7 @@ float AudioEffectLimiter::get_ceiling_db() const { void AudioEffectLimiter::set_soft_clip_db(float p_soft_clip) { soft_clip = p_soft_clip; } + float AudioEffectLimiter::get_soft_clip_db() const { return soft_clip; } @@ -100,6 +102,7 @@ float AudioEffectLimiter::get_soft_clip_db() const { void AudioEffectLimiter::set_soft_clip_ratio(float p_soft_clip) { soft_clip_ratio = p_soft_clip; } + float AudioEffectLimiter::get_soft_clip_ratio() const { return soft_clip_ratio; } diff --git a/servers/audio/effects/audio_effect_phaser.cpp b/servers/audio/effects/audio_effect_phaser.cpp index 0d3d2f74a5..ffeaa7d25e 100644 --- a/servers/audio/effects/audio_effect_phaser.cpp +++ b/servers/audio/effects/audio_effect_phaser.cpp @@ -99,6 +99,7 @@ float AudioEffectPhaser::get_range_min_hz() const { void AudioEffectPhaser::set_range_max_hz(float p_hz) { range_max = p_hz; } + float AudioEffectPhaser::get_range_max_hz() const { return range_max; } @@ -106,6 +107,7 @@ float AudioEffectPhaser::get_range_max_hz() const { void AudioEffectPhaser::set_rate_hz(float p_hz) { rate = p_hz; } + float AudioEffectPhaser::get_rate_hz() const { return rate; } @@ -113,6 +115,7 @@ float AudioEffectPhaser::get_rate_hz() const { void AudioEffectPhaser::set_feedback(float p_fbk) { feedback = p_fbk; } + float AudioEffectPhaser::get_feedback() const { return feedback; } diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp index 24d5d72f37..a8f25ac325 100644 --- a/servers/audio/effects/audio_effect_pitch_shift.cpp +++ b/servers/audio/effects/audio_effect_pitch_shift.cpp @@ -225,6 +225,7 @@ void SMBPitchShift::PitchShift(float pitchShift, long numSampsToProcess, long ff } + void SMBPitchShift::smbFft(float *fftBuffer, long fftFrameSize, long sign) /* FFT routine, (C)1996 S.M.Bernsee. Sign = -1 is FFT, 1 is iFFT (inverse) @@ -280,6 +281,7 @@ void SMBPitchShift::smbFft(float *fftBuffer, long fftFrameSize, long sign) } } + /* Godot code again */ /* clang-format on */ diff --git a/servers/audio/effects/audio_effect_reverb.cpp b/servers/audio/effects/audio_effect_reverb.cpp index 3169e48d15..f6465abfaf 100644 --- a/servers/audio/effects/audio_effect_reverb.cpp +++ b/servers/audio/effects/audio_effect_reverb.cpp @@ -93,12 +93,15 @@ void AudioEffectReverb::set_predelay_msec(float p_msec) { void AudioEffectReverb::set_predelay_feedback(float p_feedback) { predelay_fb = CLAMP(p_feedback, 0, 0.98); } + void AudioEffectReverb::set_room_size(float p_size) { room_size = p_size; } + void AudioEffectReverb::set_damping(float p_damping) { damping = p_damping; } + void AudioEffectReverb::set_spread(float p_spread) { spread = p_spread; } @@ -106,9 +109,11 @@ void AudioEffectReverb::set_spread(float p_spread) { void AudioEffectReverb::set_dry(float p_dry) { dry = p_dry; } + void AudioEffectReverb::set_wet(float p_wet) { wet = p_wet; } + void AudioEffectReverb::set_hpf(float p_hpf) { hpf = p_hpf; } @@ -116,24 +121,31 @@ void AudioEffectReverb::set_hpf(float p_hpf) { float AudioEffectReverb::get_predelay_msec() const { return predelay; } + float AudioEffectReverb::get_predelay_feedback() const { return predelay_fb; } + float AudioEffectReverb::get_room_size() const { return room_size; } + float AudioEffectReverb::get_damping() const { return damping; } + float AudioEffectReverb::get_spread() const { return spread; } + float AudioEffectReverb::get_dry() const { return dry; } + float AudioEffectReverb::get_wet() const { return wet; } + float AudioEffectReverb::get_hpf() const { return hpf; } diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp index 69337a49c8..a3fd11c6c0 100644 --- a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp +++ b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp @@ -96,6 +96,7 @@ static void smbFft(float *fftBuffer, long fftFrameSize, long sign) } } } + void AudioEffectSpectrumAnalyzerInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { uint64_t time = OS::get_singleton()->get_ticks_usec(); diff --git a/servers/audio/effects/audio_effect_stereo_enhance.cpp b/servers/audio/effects/audio_effect_stereo_enhance.cpp index 6593e712a8..4f9bee83e4 100644 --- a/servers/audio/effects/audio_effect_stereo_enhance.cpp +++ b/servers/audio/effects/audio_effect_stereo_enhance.cpp @@ -113,6 +113,7 @@ float AudioEffectStereoEnhance::get_pan_pullout() const { void AudioEffectStereoEnhance::set_time_pullout(float p_amount) { time_pullout = p_amount; } + float AudioEffectStereoEnhance::get_time_pullout() const { return time_pullout; } @@ -120,6 +121,7 @@ float AudioEffectStereoEnhance::get_time_pullout() const { void AudioEffectStereoEnhance::set_surround(float p_amount) { surround = p_amount; } + float AudioEffectStereoEnhance::get_surround() const { return surround; } diff --git a/servers/audio/effects/audio_stream_generator.cpp b/servers/audio/effects/audio_stream_generator.cpp index e2f21ec6d2..aba04550db 100644 --- a/servers/audio/effects/audio_stream_generator.cpp +++ b/servers/audio/effects/audio_stream_generator.cpp @@ -41,6 +41,7 @@ float AudioStreamGenerator::get_mix_rate() const { void AudioStreamGenerator::set_buffer_length(float p_seconds) { buffer_len = p_seconds; } + float AudioStreamGenerator::get_buffer_length() const { return buffer_len; } @@ -54,6 +55,7 @@ Ref<AudioStreamPlayback> AudioStreamGenerator::instance_playback() { playback->buffer.clear(); return playback; } + String AudioStreamGenerator::get_stream_name() const { return "UserFeed"; } @@ -94,6 +96,7 @@ bool AudioStreamGeneratorPlayback::push_frame(const Vector2 &p_frame) { bool AudioStreamGeneratorPlayback::can_push_buffer(int p_frames) const { return buffer.space_left() >= p_frames; } + bool AudioStreamGeneratorPlayback::push_buffer(const PackedVector2Array &p_frames) { int to_write = p_frames.size(); if (buffer.space_left() < to_write) { @@ -154,6 +157,7 @@ void AudioStreamGeneratorPlayback::_mix_internal(AudioFrame *p_buffer, int p_fra mixed += p_frames / generator->get_mix_rate(); } + float AudioStreamGeneratorPlayback::get_stream_sampling_rate() { return generator->get_mix_rate(); } @@ -170,6 +174,7 @@ void AudioStreamGeneratorPlayback::start(float p_from_pos) { void AudioStreamGeneratorPlayback::stop() { active = false; } + bool AudioStreamGeneratorPlayback::is_playing() const { return active; //always playing, can't be stopped } @@ -181,6 +186,7 @@ int AudioStreamGeneratorPlayback::get_loop_count() const { float AudioStreamGeneratorPlayback::get_playback_position() const { return mixed; } + void AudioStreamGeneratorPlayback::seek(float p_time) { //no seek possible } diff --git a/servers/audio/effects/eq.cpp b/servers/audio/effects/eq.cpp index bbcf31d5a9..59b3ba2d0b 100644 --- a/servers/audio/effects/eq.cpp +++ b/servers/audio/effects/eq.cpp @@ -160,10 +160,12 @@ void EQ::set_preset_band_mode(Preset p_preset) { int EQ::get_band_count() const { return band.size(); } + float EQ::get_band_frequency(int p_band) { ERR_FAIL_INDEX_V(p_band, band.size(), 0); return band[p_band].freq; } + void EQ::set_bands(const Vector<float> &p_bands) { band.resize(p_bands.size()); for (int i = 0; i < p_bands.size(); i++) { diff --git a/servers/audio/effects/reverb.cpp b/servers/audio/effects/reverb.cpp index 6cfba28b05..99f60557e1 100644 --- a/servers/audio/effects/reverb.cpp +++ b/servers/audio/effects/reverb.cpp @@ -177,10 +177,12 @@ void Reverb::set_room_size(float p_size) { params.room_size = p_size; update_parameters(); } + void Reverb::set_damp(float p_damp) { params.damp = p_damp; update_parameters(); } + void Reverb::set_wet(float p_wet) { params.wet = p_wet; } @@ -192,6 +194,7 @@ void Reverb::set_dry(float p_dry) { void Reverb::set_predelay(float p_predelay) { params.predelay = p_predelay; } + void Reverb::set_predelay_feedback(float p_predelay_fb) { params.predelay_fb = p_predelay_fb; } diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index ff5439b596..edccd7507c 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -676,6 +676,7 @@ void AudioServer::set_bus_name(int p_bus, const String &p_name) { emit_signal("bus_layout_changed"); } + String AudioServer::get_bus_name(int p_bus) const { ERR_FAIL_INDEX_V(p_bus, buses.size(), String()); return buses[p_bus]->name; @@ -697,6 +698,7 @@ void AudioServer::set_bus_volume_db(int p_bus, float p_volume_db) { buses[p_bus]->volume_db = p_volume_db; } + float AudioServer::get_bus_volume_db(int p_bus) const { ERR_FAIL_INDEX_V(p_bus, buses.size(), 0); return buses[p_bus]->volume_db; @@ -741,6 +743,7 @@ void AudioServer::set_bus_mute(int p_bus, bool p_enable) { buses[p_bus]->mute = p_enable; } + bool AudioServer::is_bus_mute(int p_bus) const { ERR_FAIL_INDEX_V(p_bus, buses.size(), false); @@ -754,6 +757,7 @@ void AudioServer::set_bus_bypass_effects(int p_bus, bool p_enable) { buses[p_bus]->bypass = p_enable; } + bool AudioServer::is_bus_bypassing_effects(int p_bus) const { ERR_FAIL_INDEX_V(p_bus, buses.size(), false); @@ -855,6 +859,7 @@ void AudioServer::set_bus_effect_enabled(int p_bus, int p_effect, bool p_enabled buses.write[p_bus]->effects.write[p_effect].enabled = p_enabled; } + bool AudioServer::is_bus_effect_enabled(int p_bus, int p_effect) const { ERR_FAIL_INDEX_V(p_bus, buses.size(), false); ERR_FAIL_INDEX_V(p_effect, buses[p_bus]->effects.size(), false); @@ -867,6 +872,7 @@ float AudioServer::get_bus_peak_volume_left_db(int p_bus, int p_channel) const { return buses[p_bus]->channels[p_channel].peak_volume.l; } + float AudioServer::get_bus_peak_volume_right_db(int p_bus, int p_channel) const { ERR_FAIL_INDEX_V(p_bus, buses.size(), 0); ERR_FAIL_INDEX_V(p_channel, buses[p_bus]->channels.size(), 0); @@ -884,6 +890,7 @@ bool AudioServer::is_bus_channel_active(int p_bus, int p_channel) const { void AudioServer::set_global_rate_scale(float p_scale) { global_rate_scale = p_scale; } + float AudioServer::get_global_rate_scale() const { return global_rate_scale; } @@ -1020,6 +1027,7 @@ void AudioServer::finish() { void AudioServer::lock() { AudioDriver::get_singleton()->lock(); } + void AudioServer::unlock() { AudioDriver::get_singleton()->unlock(); } @@ -1027,6 +1035,7 @@ void AudioServer::unlock() { AudioServer::SpeakerMode AudioServer::get_speaker_mode() const { return (AudioServer::SpeakerMode)AudioDriver::get_singleton()->get_speaker_mode(); } + float AudioServer::get_mix_rate() const { return AudioDriver::get_singleton()->get_mix_rate(); } @@ -1385,6 +1394,7 @@ bool AudioBusLayout::_get(const StringName &p_name, Variant &r_ret) const { return false; } + void AudioBusLayout::_get_property_list(List<PropertyInfo> *p_list) const { for (int i = 0; i < buses.size(); i++) { p_list->push_back(PropertyInfo(Variant::STRING, "bus/" + itos(i) + "/name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); diff --git a/servers/display_server.cpp b/servers/display_server.cpp index 3561be2c35..ffb05588cc 100644 --- a/servers/display_server.cpp +++ b/servers/display_server.cpp @@ -127,6 +127,7 @@ void DisplayServer::global_menu_clear(const String &p_menu_root) { void DisplayServer::mouse_set_mode(MouseMode p_mode) { WARN_PRINT("Mouse is not supported by this display server."); } + DisplayServer::MouseMode DisplayServer::mouse_get_mode() const { return MOUSE_MODE_VISIBLE; } @@ -134,12 +135,15 @@ DisplayServer::MouseMode DisplayServer::mouse_get_mode() const { void DisplayServer::mouse_warp_to_position(const Point2i &p_to) { WARN_PRINT("Mouse warping is not supported by this display server."); } + Point2i DisplayServer::mouse_get_absolute_position() const { ERR_FAIL_V_MSG(Point2i(), "Mouse is not supported by this display server."); } + Point2i DisplayServer::mouse_get_position() const { ERR_FAIL_V_MSG(Point2i(), "Mouse is not supported by this display server."); } + int DisplayServer::mouse_get_button_state() const { ERR_FAIL_V_MSG(0, "Mouse is not supported by this display server."); } @@ -147,6 +151,7 @@ int DisplayServer::mouse_get_button_state() const { void DisplayServer::clipboard_set(const String &p_text) { WARN_PRINT("Clipboard is not supported by this display server."); } + String DisplayServer::clipboard_get() const { ERR_FAIL_V_MSG(String(), "Clipboard is not supported by this display server."); } @@ -154,6 +159,7 @@ String DisplayServer::clipboard_get() const { void DisplayServer::screen_set_orientation(ScreenOrientation p_orientation, int p_screen) { WARN_PRINT("Orientation not supported by this display server."); } + DisplayServer::ScreenOrientation DisplayServer::screen_get_orientation(int p_screen) const { return SCREEN_LANDSCAPE; } @@ -170,6 +176,7 @@ bool DisplayServer::screen_is_touchscreen(int p_screen) const { void DisplayServer::screen_set_keep_on(bool p_enable) { WARN_PRINT("Keeping screen on not supported by this display server."); } + bool DisplayServer::screen_is_kept_on() const { return false; } @@ -177,6 +184,7 @@ bool DisplayServer::screen_is_kept_on() const { DisplayServer::WindowID DisplayServer::create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &) { ERR_FAIL_V_MSG(INVALID_WINDOW_ID, "Sub-windows not supported by this display server."); } + void DisplayServer::delete_sub_window(WindowID p_id) { ERR_FAIL_MSG("Sub-windows not supported by this display server."); } @@ -184,6 +192,7 @@ void DisplayServer::delete_sub_window(WindowID p_id) { void DisplayServer::window_set_ime_active(const bool p_active, WindowID p_window) { WARN_PRINT("IME not supported by this display server."); } + void DisplayServer::window_set_ime_position(const Point2i &p_pos, WindowID p_window) { WARN_PRINT("IME not supported by this display server."); } @@ -191,6 +200,7 @@ void DisplayServer::window_set_ime_position(const Point2i &p_pos, WindowID p_win Point2i DisplayServer::ime_get_selection() const { ERR_FAIL_V_MSG(Point2i(), "IME or NOTIFICATION_WM_IME_UPDATE not supported by this display server."); } + String DisplayServer::ime_get_text() const { ERR_FAIL_V_MSG(String(), "IME or NOTIFICATION_WM_IME_UPDATEnot supported by this display server."); } @@ -198,6 +208,7 @@ String DisplayServer::ime_get_text() const { void DisplayServer::console_set_visible(bool p_enabled) { WARN_PRINT("Console window not supported by this display server."); } + bool DisplayServer::is_console_visible() const { return false; } @@ -205,6 +216,7 @@ bool DisplayServer::is_console_visible() const { void DisplayServer::virtual_keyboard_show(const String &p_existing_text, const Rect2 &p_screen_rect, int p_max_legth) { WARN_PRINT("Virtual keyboard not supported by this display server."); } + void DisplayServer::virtual_keyboard_hide() { WARN_PRINT("Virtual keyboard not supported by this display server."); } @@ -217,9 +229,11 @@ int DisplayServer::virtual_keyboard_get_height() const { void DisplayServer::cursor_set_shape(CursorShape p_shape) { WARN_PRINT("Cursor shape not supported by this display server."); } + DisplayServer::CursorShape DisplayServer::cursor_get_shape() const { return CURSOR_ARROW; } + void DisplayServer::cursor_set_custom_image(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) { WARN_PRINT("Custom cursor shape not supported by this display server."); } @@ -235,15 +249,19 @@ void DisplayServer::enable_for_stealing_focus(OS::ProcessID pid) { Error DisplayServer::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track, int p_screen) { ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Native video not supported by this display server."); } + bool DisplayServer::native_video_is_playing() const { return false; } + void DisplayServer::native_video_pause() { WARN_PRINT("Native video not supported by this display server."); } + void DisplayServer::native_video_unpause() { WARN_PRINT("Native video not supported by this display server."); } + void DisplayServer::native_video_stop() { WARN_PRINT("Native video not supported by this display server."); } @@ -252,6 +270,7 @@ Error DisplayServer::dialog_show(String p_title, String p_description, Vector<St WARN_PRINT("Native dialogs not supported by this display server."); return OK; } + Error DisplayServer::dialog_input_text(String p_title, String p_description, String p_partial, const Callable &p_callback) { WARN_PRINT("Native dialogs not supported by this display server."); return OK; @@ -267,9 +286,11 @@ void DisplayServer::force_process_and_drop_events() { void DisplayServer::release_rendering_thread() { WARN_PRINT("Rendering thread not supported by this display server."); } + void DisplayServer::make_rendering_thread() { WARN_PRINT("Rendering thread not supported by this display server."); } + void DisplayServer::swap_buffers() { WARN_PRINT("Swap buffers not supported by this display server."); } @@ -277,6 +298,7 @@ void DisplayServer::swap_buffers() { void DisplayServer::set_native_icon(const String &p_filename) { WARN_PRINT("Native icon not supported by this display server."); } + void DisplayServer::set_icon(const Ref<Image> &p_icon) { WARN_PRINT("Icon not supported by this display server."); } @@ -284,6 +306,7 @@ void DisplayServer::set_icon(const Ref<Image> &p_icon) { void DisplayServer::_set_use_vsync(bool p_enable) { WARN_PRINT("VSync not supported by this display server."); } + void DisplayServer::vsync_set_enabled(bool p_enable) { vsync_enabled = p_enable; if (switch_vsync_function) { //if a function was set, use function @@ -292,6 +315,7 @@ void DisplayServer::vsync_set_enabled(bool p_enable) { _set_use_vsync(p_enable); } } + bool DisplayServer::vsync_is_enabled() const { return vsync_enabled; } @@ -299,6 +323,7 @@ bool DisplayServer::vsync_is_enabled() const { void DisplayServer::vsync_set_use_via_compositor(bool p_enable) { WARN_PRINT("VSync via compositor not supported by this display server."); } + bool DisplayServer::vsync_is_using_via_compositor() const { return false; } @@ -565,6 +590,7 @@ DisplayServer *DisplayServer::create(int p_index, const String &p_rendering_driv void DisplayServer::_input_set_mouse_mode(Input::MouseMode p_mode) { singleton->mouse_set_mode(MouseMode(p_mode)); } + Input::MouseMode DisplayServer::_input_get_mouse_mode() { return Input::MouseMode(singleton->mouse_get_mode()); } @@ -576,6 +602,7 @@ void DisplayServer::_input_warp(const Vector2 &p_to_pos) { Input::CursorShape DisplayServer::_input_get_current_cursor_shape() { return (Input::CursorShape)singleton->cursor_get_shape(); } + void DisplayServer::_input_set_custom_mouse_cursor_func(const RES &p_image, Input::CursorShape p_shape, const Vector2 &p_hostspot) { singleton->cursor_set_custom_image(p_image, (CursorShape)p_shape, p_hostspot); } @@ -588,5 +615,6 @@ DisplayServer::DisplayServer() { Input::get_current_cursor_shape_func = _input_get_current_cursor_shape; Input::set_custom_mouse_cursor_func = _input_set_custom_mouse_cursor_func; } + DisplayServer::~DisplayServer() { } diff --git a/servers/navigation_server_2d.cpp b/servers/navigation_server_2d.cpp index 17f2232c72..b20f6865cd 100644 --- a/servers/navigation_server_2d.cpp +++ b/servers/navigation_server_2d.cpp @@ -83,21 +83,27 @@ NavigationServer2D *NavigationServer2D::singleton = nullptr; static RID rid_to_rid(const RID d) { return d; } + static bool bool_to_bool(const bool d) { return d; } + static int int_to_int(const int d) { return d; } + static real_t real_to_real(const real_t d) { return d; } + static Vector3 v2_to_v3(const Vector2 d) { return Vector3(d.x, 0.0, d.y); } + static Vector2 v3_to_v2(const Vector3 &d) { return Vector2(d.x, d.z); } + static Vector<Vector2> vector_v3_to_v2(const Vector<Vector3> &d) { Vector<Vector2> nd; nd.resize(d.size()); @@ -106,21 +112,26 @@ static Vector<Vector2> vector_v3_to_v2(const Vector<Vector3> &d) { } return nd; } + static Transform trf2_to_trf3(const Transform2D &d) { Vector3 o(v2_to_v3(d.get_origin())); Basis b; b.rotate(Vector3(0, 1, 0), d.get_rotation()); return Transform(b, o); } + static Object *obj_to_obj(Object *d) { return d; } + static StringName sn_to_sn(StringName &d) { return d; } + static Variant var_to_var(Variant &d) { return d; } + static Ref<NavigationMesh> poly_to_mesh(Ref<NavigationPolygon> d) { if (d.is_valid()) { return d->get_mesh(); diff --git a/servers/physics_2d/area_2d_sw.cpp b/servers/physics_2d/area_2d_sw.cpp index b566e75851..db2ae36067 100644 --- a/servers/physics_2d/area_2d_sw.cpp +++ b/servers/physics_2d/area_2d_sw.cpp @@ -38,6 +38,7 @@ Area2DSW::BodyKey::BodyKey(Body2DSW *p_body, uint32_t p_body_shape, uint32_t p_a body_shape = p_body_shape; area_shape = p_area_shape; } + Area2DSW::BodyKey::BodyKey(Area2DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape) { rid = p_body->get_self(); instance_id = p_body->get_instance_id(); diff --git a/servers/physics_2d/area_2d_sw.h b/servers/physics_2d/area_2d_sw.h index 4910167952..8deeb82174 100644 --- a/servers/physics_2d/area_2d_sw.h +++ b/servers/physics_2d/area_2d_sw.h @@ -169,6 +169,7 @@ void Area2DSW::add_body_to_query(Body2DSW *p_body, uint32_t p_body_shape, uint32 if (!monitor_query_list.in_list()) _queue_monitor_update(); } + void Area2DSW::remove_body_from_query(Body2DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape) { BodyKey bk(p_body, p_body_shape, p_area_shape); monitored_bodies[bk].dec(); @@ -182,6 +183,7 @@ void Area2DSW::add_area_to_query(Area2DSW *p_area, uint32_t p_area_shape, uint32 if (!monitor_query_list.in_list()) _queue_monitor_update(); } + void Area2DSW::remove_area_from_query(Area2DSW *p_area, uint32_t p_area_shape, uint32_t p_self_shape) { BodyKey bk(p_area, p_area_shape, p_self_shape); monitored_areas[bk].dec(); diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp index 12c7a49288..498972f538 100644 --- a/servers/physics_2d/body_2d_sw.cpp +++ b/servers/physics_2d/body_2d_sw.cpp @@ -235,6 +235,7 @@ void Body2DSW::set_mode(PhysicsServer2D::BodyMode p_mode) { _update_queries(); */ } + PhysicsServer2D::BodyMode Body2DSW::get_mode() const { return mode; } @@ -314,6 +315,7 @@ void Body2DSW::set_state(PhysicsServer2D::BodyState p_state, const Variant &p_va } break; } } + Variant Body2DSW::get_state(PhysicsServer2D::BodyState p_state) const { switch (p_state) { case PhysicsServer2D::BODY_STATE_TRANSFORM: { diff --git a/servers/physics_2d/broad_phase_2d_basic.cpp b/servers/physics_2d/broad_phase_2d_basic.cpp index 9f4960c4f6..a6bcae11e9 100644 --- a/servers/physics_2d/broad_phase_2d_basic.cpp +++ b/servers/physics_2d/broad_phase_2d_basic.cpp @@ -47,11 +47,13 @@ void BroadPhase2DBasic::move(ID p_id, const Rect2 &p_aabb) { ERR_FAIL_COND(!E); E->get().aabb = p_aabb; } + void BroadPhase2DBasic::set_static(ID p_id, bool p_static) { Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND(!E); E->get()._static = p_static; } + void BroadPhase2DBasic::remove(ID p_id) { Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND(!E); @@ -63,11 +65,13 @@ CollisionObject2DSW *BroadPhase2DBasic::get_object(ID p_id) const { ERR_FAIL_COND_V(!E, nullptr); return E->get().owner; } + bool BroadPhase2DBasic::is_static(ID p_id) const { const Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND_V(!E, false); return E->get()._static; } + int BroadPhase2DBasic::get_subindex(ID p_id) const { const Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND_V(!E, -1); @@ -90,6 +94,7 @@ int BroadPhase2DBasic::cull_segment(const Vector2 &p_from, const Vector2 &p_to, return rc; } + int BroadPhase2DBasic::cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices) { int rc = 0; @@ -111,6 +116,7 @@ void BroadPhase2DBasic::set_pair_callback(PairCallback p_pair_callback, void *p_ pair_userdata = p_userdata; pair_callback = p_pair_callback; } + void BroadPhase2DBasic::set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) { unpair_userdata = p_userdata; unpair_callback = p_unpair_callback; diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp index b78dcf2866..e3a841366e 100644 --- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp +++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp @@ -321,6 +321,7 @@ void BroadPhase2DHashGrid::move(ID p_id, const Rect2 &p_aabb) { e.aabb = p_aabb; } + void BroadPhase2DHashGrid::set_static(ID p_id, bool p_static) { Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND(!E); @@ -340,6 +341,7 @@ void BroadPhase2DHashGrid::set_static(ID p_id, bool p_static) { _check_motion(&e); } } + void BroadPhase2DHashGrid::remove(ID p_id) { Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND(!E); @@ -357,11 +359,13 @@ CollisionObject2DSW *BroadPhase2DHashGrid::get_object(ID p_id) const { ERR_FAIL_COND_V(!E, nullptr); return E->get().owner; } + bool BroadPhase2DHashGrid::is_static(ID p_id) const { const Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND_V(!E, false); return E->get()._static; } + int BroadPhase2DHashGrid::get_subindex(ID p_id) const { const Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND_V(!E, -1); @@ -560,6 +564,7 @@ void BroadPhase2DHashGrid::set_pair_callback(PairCallback p_pair_callback, void pair_callback = p_pair_callback; pair_userdata = p_userdata; } + void BroadPhase2DHashGrid::set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) { unpair_callback = p_unpair_callback; unpair_userdata = p_userdata; diff --git a/servers/physics_2d/physics_server_2d_sw.cpp b/servers/physics_2d/physics_server_2d_sw.cpp index 645ee5ff45..a35283d76d 100644 --- a/servers/physics_2d/physics_server_2d_sw.cpp +++ b/servers/physics_2d/physics_server_2d_sw.cpp @@ -86,15 +86,19 @@ RID PhysicsServer2DSW::line_shape_create() { RID PhysicsServer2DSW::ray_shape_create() { return _shape_create(SHAPE_RAY); } + RID PhysicsServer2DSW::segment_shape_create() { return _shape_create(SHAPE_SEGMENT); } + RID PhysicsServer2DSW::circle_shape_create() { return _shape_create(SHAPE_CIRCLE); } + RID PhysicsServer2DSW::rectangle_shape_create() { return _shape_create(SHAPE_RECTANGLE); } + RID PhysicsServer2DSW::capsule_shape_create() { return _shape_create(SHAPE_CAPSULE); } @@ -102,6 +106,7 @@ RID PhysicsServer2DSW::capsule_shape_create() { RID PhysicsServer2DSW::convex_polygon_shape_create() { return _shape_create(SHAPE_CONVEX_POLYGON); } + RID PhysicsServer2DSW::concave_polygon_shape_create() { return _shape_create(SHAPE_CONCAVE_POLYGON); } @@ -349,6 +354,7 @@ void PhysicsServer2DSW::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) area->set_shape(p_shape_idx, shape); } + void PhysicsServer2DSW::area_set_shape_transform(RID p_area, int p_shape_idx, const Transform2D &p_transform) { Area2DSW *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); @@ -371,6 +377,7 @@ int PhysicsServer2DSW::area_get_shape_count(RID p_area) const { return area->get_shape_count(); } + RID PhysicsServer2DSW::area_get_shape(RID p_area, int p_shape_idx) const { Area2DSW *area = area_owner.getornull(p_area); ERR_FAIL_COND_V(!area, RID()); @@ -380,6 +387,7 @@ RID PhysicsServer2DSW::area_get_shape(RID p_area, int p_shape_idx) const { return shape->get_self(); } + Transform2D PhysicsServer2DSW::area_get_shape_transform(RID p_area, int p_shape_idx) const { Area2DSW *area = area_owner.getornull(p_area); ERR_FAIL_COND_V(!area, Transform2D()); @@ -411,6 +419,7 @@ void PhysicsServer2DSW::area_attach_object_instance_id(RID p_area, ObjectID p_id ERR_FAIL_COND(!area); area->set_instance_id(p_id); } + ObjectID PhysicsServer2DSW::area_get_object_instance_id(RID p_area) const { if (space_owner.owns(p_area)) { Space2DSW *space = space_owner.getornull(p_area); @@ -430,6 +439,7 @@ void PhysicsServer2DSW::area_attach_canvas_instance_id(RID p_area, ObjectID p_id ERR_FAIL_COND(!area); area->set_canvas_instance_id(p_id); } + ObjectID PhysicsServer2DSW::area_get_canvas_instance_id(RID p_area) const { if (space_owner.owns(p_area)) { Space2DSW *space = space_owner.getornull(p_area); @@ -586,6 +596,7 @@ void PhysicsServer2DSW::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) body->set_shape(p_shape_idx, shape); } + void PhysicsServer2DSW::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform2D &p_transform) { Body2DSW *body = body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -611,6 +622,7 @@ int PhysicsServer2DSW::body_get_shape_count(RID p_body) const { return body->get_shape_count(); } + RID PhysicsServer2DSW::body_get_shape(RID p_body, int p_shape_idx) const { Body2DSW *body = body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, RID()); @@ -620,6 +632,7 @@ RID PhysicsServer2DSW::body_get_shape(RID p_body, int p_shape_idx) const { return shape->get_self(); } + Transform2D PhysicsServer2DSW::body_get_shape_transform(RID p_body, int p_shape_idx) const { Body2DSW *body = body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, Transform2D()); @@ -650,6 +663,7 @@ void PhysicsServer2DSW::body_set_shape_disabled(RID p_body, int p_shape_idx, boo body->set_shape_as_disabled(p_shape_idx, p_disabled); } + void PhysicsServer2DSW::body_set_shape_as_one_way_collision(RID p_body, int p_shape_idx, bool p_enable, float p_margin) { Body2DSW *body = body_owner.getornull(p_body); ERR_FAIL_COND(!body); diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 4976e3ede4..1fb53cf065 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -882,6 +882,7 @@ void ConcavePolygonShape2DSW::set_data(const Variant &p_data) { configure(aabb); } + Variant ConcavePolygonShape2DSW::get_data() const { Vector<Vector2> rsegments; int len = segments.size(); diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index 5fcb31221f..97bbc0f8f2 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -1107,9 +1107,11 @@ void Space2DSW::_broadphase_unpair(CollisionObject2DSW *A, int p_subindex_A, Col const SelfList<Body2DSW>::List &Space2DSW::get_active_body_list() const { return active_list; } + void Space2DSW::body_add_to_active_list(SelfList<Body2DSW> *p_body) { active_list.add(p_body); } + void Space2DSW::body_remove_from_active_list(SelfList<Body2DSW> *p_body) { active_list.remove(p_body); } @@ -1143,6 +1145,7 @@ const Set<CollisionObject2DSW *> &Space2DSW::get_objects() const { void Space2DSW::body_add_to_state_query_list(SelfList<Body2DSW> *p_body) { state_query_list.add(p_body); } + void Space2DSW::body_remove_from_state_query_list(SelfList<Body2DSW> *p_body) { state_query_list.remove(p_body); } @@ -1150,6 +1153,7 @@ void Space2DSW::body_remove_from_state_query_list(SelfList<Body2DSW> *p_body) { void Space2DSW::area_add_to_monitor_query_list(SelfList<Area2DSW> *p_area) { monitor_query_list.add(p_area); } + void Space2DSW::area_remove_from_monitor_query_list(SelfList<Area2DSW> *p_area) { monitor_query_list.remove(p_area); } diff --git a/servers/physics_3d/area_3d_sw.cpp b/servers/physics_3d/area_3d_sw.cpp index 59041cb5e0..de4399330d 100644 --- a/servers/physics_3d/area_3d_sw.cpp +++ b/servers/physics_3d/area_3d_sw.cpp @@ -38,6 +38,7 @@ Area3DSW::BodyKey::BodyKey(Body3DSW *p_body, uint32_t p_body_shape, uint32_t p_a body_shape = p_body_shape; area_shape = p_area_shape; } + Area3DSW::BodyKey::BodyKey(Area3DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape) { rid = p_body->get_self(); instance_id = p_body->get_instance_id(); diff --git a/servers/physics_3d/area_3d_sw.h b/servers/physics_3d/area_3d_sw.h index f64c84b5ab..d85a7fc509 100644 --- a/servers/physics_3d/area_3d_sw.h +++ b/servers/physics_3d/area_3d_sw.h @@ -170,6 +170,7 @@ void Area3DSW::add_body_to_query(Body3DSW *p_body, uint32_t p_body_shape, uint32 if (!monitor_query_list.in_list()) _queue_monitor_update(); } + void Area3DSW::remove_body_from_query(Body3DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape) { BodyKey bk(p_body, p_body_shape, p_area_shape); monitored_bodies[bk].dec(); @@ -183,6 +184,7 @@ void Area3DSW::add_area_to_query(Area3DSW *p_area, uint32_t p_area_shape, uint32 if (!monitor_query_list.in_list()) _queue_monitor_update(); } + void Area3DSW::remove_area_from_query(Area3DSW *p_area, uint32_t p_area_shape, uint32_t p_self_shape) { BodyKey bk(p_area, p_area_shape, p_self_shape); monitored_areas[bk].dec(); diff --git a/servers/physics_3d/body_3d_sw.cpp b/servers/physics_3d/body_3d_sw.cpp index c8a6a2303e..c01e55c4dd 100644 --- a/servers/physics_3d/body_3d_sw.cpp +++ b/servers/physics_3d/body_3d_sw.cpp @@ -254,6 +254,7 @@ void Body3DSW::set_mode(PhysicsServer3D::BodyMode p_mode) { _update_queries(); */ } + PhysicsServer3D::BodyMode Body3DSW::get_mode() const { return mode; } @@ -331,6 +332,7 @@ void Body3DSW::set_state(PhysicsServer3D::BodyState p_state, const Variant &p_va } break; } } + Variant Body3DSW::get_state(PhysicsServer3D::BodyState p_state) const { switch (p_state) { case PhysicsServer3D::BODY_STATE_TRANSFORM: { @@ -635,6 +637,7 @@ void BodySW::simulate_motion(const Transform& p_xform,real_t p_step) { } + */ void Body3DSW::wakeup_neighbours() { diff --git a/servers/physics_3d/broad_phase_3d_basic.cpp b/servers/physics_3d/broad_phase_3d_basic.cpp index 6a679a1040..68bf0da53e 100644 --- a/servers/physics_3d/broad_phase_3d_basic.cpp +++ b/servers/physics_3d/broad_phase_3d_basic.cpp @@ -51,11 +51,13 @@ void BroadPhase3DBasic::move(ID p_id, const AABB &p_aabb) { ERR_FAIL_COND(!E); E->get().aabb = p_aabb; } + void BroadPhase3DBasic::set_static(ID p_id, bool p_static) { Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND(!E); E->get()._static = p_static; } + void BroadPhase3DBasic::remove(ID p_id) { Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND(!E); @@ -83,11 +85,13 @@ CollisionObject3DSW *BroadPhase3DBasic::get_object(ID p_id) const { ERR_FAIL_COND_V(!E, nullptr); return E->get().owner; } + bool BroadPhase3DBasic::is_static(ID p_id) const { const Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND_V(!E, false); return E->get()._static; } + int BroadPhase3DBasic::get_subindex(ID p_id) const { const Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND_V(!E, -1); @@ -127,6 +131,7 @@ int BroadPhase3DBasic::cull_segment(const Vector3 &p_from, const Vector3 &p_to, return rc; } + int BroadPhase3DBasic::cull_aabb(const AABB &p_aabb, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices) { int rc = 0; @@ -148,6 +153,7 @@ void BroadPhase3DBasic::set_pair_callback(PairCallback p_pair_callback, void *p_ pair_userdata = p_userdata; pair_callback = p_pair_callback; } + void BroadPhase3DBasic::set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) { unpair_userdata = p_userdata; unpair_callback = p_unpair_callback; diff --git a/servers/physics_3d/broad_phase_octree.cpp b/servers/physics_3d/broad_phase_octree.cpp index b81ce31ef3..ffa1802bc8 100644 --- a/servers/physics_3d/broad_phase_octree.cpp +++ b/servers/physics_3d/broad_phase_octree.cpp @@ -44,6 +44,7 @@ void BroadPhaseOctree::set_static(ID p_id, bool p_static) { CollisionObject3DSW *it = octree.get(p_id); octree.set_pairable(p_id, !p_static, 1 << it->get_type(), p_static ? 0 : 0xFFFFF); //pair everything, don't care 1? } + void BroadPhaseOctree::remove(ID p_id) { octree.erase(p_id); } @@ -53,9 +54,11 @@ CollisionObject3DSW *BroadPhaseOctree::get_object(ID p_id) const { ERR_FAIL_COND_V(!it, nullptr); return it; } + bool BroadPhaseOctree::is_static(ID p_id) const { return !octree.is_pairable(p_id); } + int BroadPhaseOctree::get_subindex(ID p_id) const { return octree.get_subindex(p_id); } @@ -92,6 +95,7 @@ void BroadPhaseOctree::set_pair_callback(PairCallback p_pair_callback, void *p_u pair_callback = p_pair_callback; pair_userdata = p_userdata; } + void BroadPhaseOctree::set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) { unpair_callback = p_unpair_callback; unpair_userdata = p_userdata; diff --git a/servers/physics_3d/collision_object_3d_sw.cpp b/servers/physics_3d/collision_object_3d_sw.cpp index f7e3b507ca..22a8235744 100644 --- a/servers/physics_3d/collision_object_3d_sw.cpp +++ b/servers/physics_3d/collision_object_3d_sw.cpp @@ -61,6 +61,7 @@ void CollisionObject3DSW::set_shape(int p_index, Shape3DSW *p_shape) { //_update_shapes(); //_shapes_changed(); } + void CollisionObject3DSW::set_shape_transform(int p_index, const Transform &p_transform) { ERR_FAIL_INDEX(p_index, shapes.size()); diff --git a/servers/physics_3d/gjk_epa.cpp b/servers/physics_3d/gjk_epa.cpp index a937ebc426..7f7fc0f55b 100644 --- a/servers/physics_3d/gjk_epa.cpp +++ b/servers/physics_3d/gjk_epa.cpp @@ -847,6 +847,7 @@ bool Distance( const Shape3DSW* shape0, } } + // bool Penetration( const Shape3DSW* shape0, const Transform& wtrs0, @@ -891,6 +892,7 @@ bool Penetration( const Shape3DSW* shape0, } + /* Symbols cleanup */ #undef GJK_MAX_ITERATIONS diff --git a/servers/physics_3d/joints/generic_6dof_joint_3d_sw.cpp b/servers/physics_3d/joints/generic_6dof_joint_3d_sw.cpp index 77e6eacb69..97310a5924 100644 --- a/servers/physics_3d/joints/generic_6dof_joint_3d_sw.cpp +++ b/servers/physics_3d/joints/generic_6dof_joint_3d_sw.cpp @@ -623,6 +623,7 @@ void Generic6DOFJoint3DSW::set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOF break; // Can't happen, but silences warning } } + bool Generic6DOFJoint3DSW::get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const { ERR_FAIL_INDEX_V(p_axis, 3, 0); switch (p_flag) { diff --git a/servers/physics_3d/joints/hinge_joint_3d_sw.cpp b/servers/physics_3d/joints/hinge_joint_3d_sw.cpp index a77d78ccaa..a879b4ca7f 100644 --- a/servers/physics_3d/joints/hinge_joint_3d_sw.cpp +++ b/servers/physics_3d/joints/hinge_joint_3d_sw.cpp @@ -360,12 +360,14 @@ void HingeJoint3DSW::solve(real_t p_step) { } } } + /* void HingeJointSW::updateRHS(real_t timeStep) { (void)timeStep; } + */ static _FORCE_INLINE_ real_t atan2fast(real_t y, real_t x) { @@ -459,6 +461,7 @@ void HingeJoint3DSW::set_flag(PhysicsServer3D::HingeJointFlag p_flag, bool p_val break; // Can't happen, but silences warning } } + bool HingeJoint3DSW::get_flag(PhysicsServer3D::HingeJointFlag p_flag) const { switch (p_flag) { case PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT: diff --git a/servers/physics_3d/physics_server_3d_sw.cpp b/servers/physics_3d/physics_server_3d_sw.cpp index d2856829ed..d05001e636 100644 --- a/servers/physics_3d/physics_server_3d_sw.cpp +++ b/servers/physics_3d/physics_server_3d_sw.cpp @@ -278,6 +278,7 @@ int PhysicsServer3DSW::area_get_shape_count(RID p_area) const { return area->get_shape_count(); } + RID PhysicsServer3DSW::area_get_shape(RID p_area, int p_shape_idx) const { Area3DSW *area = area_owner.getornull(p_area); ERR_FAIL_COND_V(!area, RID()); @@ -287,6 +288,7 @@ RID PhysicsServer3DSW::area_get_shape(RID p_area, int p_shape_idx) const { return shape->get_self(); } + Transform PhysicsServer3DSW::area_get_shape_transform(RID p_area, int p_shape_idx) const { Area3DSW *area = area_owner.getornull(p_area); ERR_FAIL_COND_V(!area, Transform()); @@ -326,6 +328,7 @@ void PhysicsServer3DSW::area_attach_object_instance_id(RID p_area, ObjectID p_id ERR_FAIL_COND(!area); area->set_instance_id(p_id); } + ObjectID PhysicsServer3DSW::area_get_object_instance_id(RID p_area) const { if (space_owner.owns(p_area)) { Space3DSW *space = space_owner.getornull(p_area); @@ -494,6 +497,7 @@ void PhysicsServer3DSW::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) body->set_shape(p_shape_idx, shape); } + void PhysicsServer3DSW::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform &p_transform) { Body3DSW *body = body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -507,6 +511,7 @@ int PhysicsServer3DSW::body_get_shape_count(RID p_body) const { return body->get_shape_count(); } + RID PhysicsServer3DSW::body_get_shape(RID p_body, int p_shape_idx) const { Body3DSW *body = body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, RID()); @@ -909,6 +914,7 @@ void PhysicsServer3DSW::pin_joint_set_param(RID p_joint, PinJointParam p_param, PinJoint3DSW *pin_joint = static_cast<PinJoint3DSW *>(joint); pin_joint->set_param(p_param, p_value); } + real_t PhysicsServer3DSW::pin_joint_get_param(RID p_joint, PinJointParam p_param) const { Joint3DSW *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, 0); @@ -924,6 +930,7 @@ void PhysicsServer3DSW::pin_joint_set_local_a(RID p_joint, const Vector3 &p_A) { PinJoint3DSW *pin_joint = static_cast<PinJoint3DSW *>(joint); pin_joint->set_pos_a(p_A); } + Vector3 PhysicsServer3DSW::pin_joint_get_local_a(RID p_joint) const { Joint3DSW *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, Vector3()); @@ -939,6 +946,7 @@ void PhysicsServer3DSW::pin_joint_set_local_b(RID p_joint, const Vector3 &p_B) { PinJoint3DSW *pin_joint = static_cast<PinJoint3DSW *>(joint); pin_joint->set_pos_b(p_B); } + Vector3 PhysicsServer3DSW::pin_joint_get_local_b(RID p_joint) const { Joint3DSW *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, Vector3()); @@ -994,6 +1002,7 @@ void PhysicsServer3DSW::hinge_joint_set_param(RID p_joint, HingeJointParam p_par HingeJoint3DSW *hinge_joint = static_cast<HingeJoint3DSW *>(joint); hinge_joint->set_param(p_param, p_value); } + real_t PhysicsServer3DSW::hinge_joint_get_param(RID p_joint, HingeJointParam p_param) const { Joint3DSW *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, 0); @@ -1009,6 +1018,7 @@ void PhysicsServer3DSW::hinge_joint_set_flag(RID p_joint, HingeJointFlag p_flag, HingeJoint3DSW *hinge_joint = static_cast<HingeJoint3DSW *>(joint); hinge_joint->set_flag(p_flag, p_value); } + bool PhysicsServer3DSW::hinge_joint_get_flag(RID p_joint, HingeJointFlag p_flag) const { Joint3DSW *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, false); @@ -1089,6 +1099,7 @@ void PhysicsServer3DSW::slider_joint_set_param(RID p_joint, SliderJointParam p_p SliderJoint3DSW *slider_joint = static_cast<SliderJoint3DSW *>(joint); slider_joint->set_param(p_param, p_value); } + real_t PhysicsServer3DSW::slider_joint_get_param(RID p_joint, SliderJointParam p_param) const { Joint3DSW *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, 0); @@ -1124,6 +1135,7 @@ void PhysicsServer3DSW::cone_twist_joint_set_param(RID p_joint, ConeTwistJointPa ConeTwistJoint3DSW *cone_twist_joint = static_cast<ConeTwistJoint3DSW *>(joint); cone_twist_joint->set_param(p_param, p_value); } + real_t PhysicsServer3DSW::cone_twist_joint_get_param(RID p_joint, ConeTwistJointParam p_param) const { Joint3DSW *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, 0); @@ -1159,6 +1171,7 @@ void PhysicsServer3DSW::generic_6dof_joint_set_param(RID p_joint, Vector3::Axis Generic6DOFJoint3DSW *generic_6dof_joint = static_cast<Generic6DOFJoint3DSW *>(joint); generic_6dof_joint->set_param(p_axis, p_param, p_value); } + real_t PhysicsServer3DSW::generic_6dof_joint_get_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param) { Joint3DSW *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, 0); @@ -1174,6 +1187,7 @@ void PhysicsServer3DSW::generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis p Generic6DOFJoint3DSW *generic_6dof_joint = static_cast<Generic6DOFJoint3DSW *>(joint); generic_6dof_joint->set_flag(p_axis, p_flag, p_enable); } + bool PhysicsServer3DSW::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag) { Joint3DSW *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, false); diff --git a/servers/physics_3d/shape_3d_sw.cpp b/servers/physics_3d/shape_3d_sw.cpp index 2c248a4d38..a44244f7d5 100644 --- a/servers/physics_3d/shape_3d_sw.cpp +++ b/servers/physics_3d/shape_3d_sw.cpp @@ -1380,12 +1380,15 @@ ConcavePolygonShape3DSW::ConcavePolygonShape3DSW() { Vector<real_t> HeightMapShape3DSW::get_heights() const { return heights; } + int HeightMapShape3DSW::get_width() const { return width; } + int HeightMapShape3DSW::get_depth() const { return depth; } + real_t HeightMapShape3DSW::get_cell_size() const { return cell_size; } diff --git a/servers/physics_3d/space_3d_sw.cpp b/servers/physics_3d/space_3d_sw.cpp index 9193e6cbdd..066945d808 100644 --- a/servers/physics_3d/space_3d_sw.cpp +++ b/servers/physics_3d/space_3d_sw.cpp @@ -386,6 +386,7 @@ static void _rest_cbk_result(const Vector3 &p_point_A, const Vector3 &p_point_B, rd->best_object = rd->object; rd->best_shape = rd->shape; } + bool PhysicsDirectSpaceState3DSW::rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { Shape3DSW *shape = static_cast<PhysicsServer3DSW *>(PhysicsServer3D::get_singleton())->shape_owner.getornull(p_shape); ERR_FAIL_COND_V(!shape, 0); @@ -990,9 +991,11 @@ void Space3DSW::_broadphase_unpair(CollisionObject3DSW *A, int p_subindex_A, Col const SelfList<Body3DSW>::List &Space3DSW::get_active_body_list() const { return active_list; } + void Space3DSW::body_add_to_active_list(SelfList<Body3DSW> *p_body) { active_list.add(p_body); } + void Space3DSW::body_remove_from_active_list(SelfList<Body3DSW> *p_body) { active_list.remove(p_body); } @@ -1026,6 +1029,7 @@ const Set<CollisionObject3DSW *> &Space3DSW::get_objects() const { void Space3DSW::body_add_to_state_query_list(SelfList<Body3DSW> *p_body) { state_query_list.add(p_body); } + void Space3DSW::body_remove_from_state_query_list(SelfList<Body3DSW> *p_body) { state_query_list.remove(p_body); } @@ -1033,6 +1037,7 @@ void Space3DSW::body_remove_from_state_query_list(SelfList<Body3DSW> *p_body) { void Space3DSW::area_add_to_monitor_query_list(SelfList<Area3DSW> *p_area) { monitor_query_list.add(p_area); } + void Space3DSW::area_remove_from_monitor_query_list(SelfList<Area3DSW> *p_area) { monitor_query_list.remove(p_area); } diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp index df38788b29..e3051c8fba 100644 --- a/servers/physics_server_2d.cpp +++ b/servers/physics_server_2d.cpp @@ -146,6 +146,7 @@ RID PhysicsShapeQueryParameters2D::get_shape_rid() const { void PhysicsShapeQueryParameters2D::set_transform(const Transform2D &p_transform) { transform = p_transform; } + Transform2D PhysicsShapeQueryParameters2D::get_transform() const { return transform; } @@ -153,6 +154,7 @@ Transform2D PhysicsShapeQueryParameters2D::get_transform() const { void PhysicsShapeQueryParameters2D::set_motion(const Vector2 &p_motion) { motion = p_motion; } + Vector2 PhysicsShapeQueryParameters2D::get_motion() const { return motion; } @@ -160,6 +162,7 @@ Vector2 PhysicsShapeQueryParameters2D::get_motion() const { void PhysicsShapeQueryParameters2D::set_margin(float p_margin) { margin = p_margin; } + float PhysicsShapeQueryParameters2D::get_margin() const { return margin; } @@ -167,6 +170,7 @@ float PhysicsShapeQueryParameters2D::get_margin() const { void PhysicsShapeQueryParameters2D::set_collision_mask(int p_collision_mask) { collision_mask = p_collision_mask; } + int PhysicsShapeQueryParameters2D::get_collision_mask() const { return collision_mask; } @@ -359,6 +363,7 @@ Array PhysicsDirectSpaceState2D::_collide_shape(const Ref<PhysicsShapeQueryParam r[i] = ret[i]; return r; } + Dictionary PhysicsDirectSpaceState2D::_get_rest_info(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query) { ERR_FAIL_COND_V(!p_shape_query.is_valid(), Dictionary()); @@ -396,15 +401,19 @@ void PhysicsDirectSpaceState2D::_bind_methods() { int PhysicsShapeQueryResult2D::get_result_count() const { return result.size(); } + RID PhysicsShapeQueryResult2D::get_result_rid(int p_idx) const { return result[p_idx].rid; } + ObjectID PhysicsShapeQueryResult2D::get_result_object_id(int p_idx) const { return result[p_idx].collider_id; } + Object *PhysicsShapeQueryResult2D::get_result_object(int p_idx) const { return result[p_idx].collider; } + int PhysicsShapeQueryResult2D::get_result_object_shape(int p_idx) const { return result[p_idx].shape; } @@ -425,6 +434,7 @@ void PhysicsShapeQueryResult2D::_bind_methods() { Vector2 PhysicsTestMotionResult2D::get_motion() const { return result.motion; } + Vector2 PhysicsTestMotionResult2D::get_motion_remainder() const { return result.remainder; } @@ -432,15 +442,19 @@ Vector2 PhysicsTestMotionResult2D::get_motion_remainder() const { Vector2 PhysicsTestMotionResult2D::get_collision_point() const { return result.collision_point; } + Vector2 PhysicsTestMotionResult2D::get_collision_normal() const { return result.collision_normal; } + Vector2 PhysicsTestMotionResult2D::get_collider_velocity() const { return result.collider_velocity; } + ObjectID PhysicsTestMotionResult2D::get_collider_id() const { return result.collider_id; } + RID PhysicsTestMotionResult2D::get_collider_rid() const { return result.collider; } diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp index 2625141142..c8f5ae985e 100644 --- a/servers/physics_server_3d.cpp +++ b/servers/physics_server_3d.cpp @@ -150,6 +150,7 @@ RID PhysicsShapeQueryParameters3D::get_shape_rid() const { void PhysicsShapeQueryParameters3D::set_transform(const Transform &p_transform) { transform = p_transform; } + Transform PhysicsShapeQueryParameters3D::get_transform() const { return transform; } @@ -165,6 +166,7 @@ float PhysicsShapeQueryParameters3D::get_margin() const { void PhysicsShapeQueryParameters3D::set_collision_mask(int p_collision_mask) { collision_mask = p_collision_mask; } + int PhysicsShapeQueryParameters3D::get_collision_mask() const { return collision_mask; } @@ -298,6 +300,7 @@ Array PhysicsDirectSpaceState3D::_cast_motion(const Ref<PhysicsShapeQueryParamet ret[1] = closest_unsafe; return ret; } + Array PhysicsDirectSpaceState3D::_collide_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results) { ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array()); @@ -313,6 +316,7 @@ Array PhysicsDirectSpaceState3D::_collide_shape(const Ref<PhysicsShapeQueryParam r[i] = ret[i]; return r; } + Dictionary PhysicsDirectSpaceState3D::_get_rest_info(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query) { ERR_FAIL_COND_V(!p_shape_query.is_valid(), Dictionary()); @@ -347,15 +351,19 @@ void PhysicsDirectSpaceState3D::_bind_methods() { int PhysicsShapeQueryResult3D::get_result_count() const { return result.size(); } + RID PhysicsShapeQueryResult3D::get_result_rid(int p_idx) const { return result[p_idx].rid; } + ObjectID PhysicsShapeQueryResult3D::get_result_object_id(int p_idx) const { return result[p_idx].collider_id; } + Object *PhysicsShapeQueryResult3D::get_result_object(int p_idx) const { return result[p_idx].collider; } + int PhysicsShapeQueryResult3D::get_result_object_shape(int p_idx) const { return result[p_idx].shape; } diff --git a/servers/rendering/rasterizer.cpp b/servers/rendering/rasterizer.cpp index e7b5d81bf1..566a14b655 100644 --- a/servers/rendering/rasterizer.cpp +++ b/servers/rendering/rasterizer.cpp @@ -40,6 +40,7 @@ void RasterizerScene::InstanceDependency::instance_notify_changed(bool p_aabb, b E->key()->dependency_changed(p_aabb, p_dependencies); } } + void RasterizerScene::InstanceDependency::instance_notify_deleted(RID p_deleted) { for (Map<InstanceBase *, uint32_t>::Element *E = instances.front(); E; E = E->next()) { E->key()->dependency_deleted(p_deleted); diff --git a/servers/rendering/rasterizer_rd/light_cluster_builder.cpp b/servers/rendering/rasterizer_rd/light_cluster_builder.cpp index 260c0f3760..efb48e6df7 100644 --- a/servers/rendering/rasterizer_rd/light_cluster_builder.cpp +++ b/servers/rendering/rasterizer_rd/light_cluster_builder.cpp @@ -203,6 +203,7 @@ void LightClusterBuilder::setup(uint32_t p_width, uint32_t p_height, uint32_t p_ RID LightClusterBuilder::get_cluster_texture() const { return cluster_texture; } + RID LightClusterBuilder::get_cluster_indices_buffer() const { return items_buffer; } @@ -226,6 +227,7 @@ LightClusterBuilder::LightClusterBuilder() { items_buffer = RD::get_singleton()->storage_buffer_create(sizeof(uint32_t) * 1024); item_max = 1024; } + LightClusterBuilder::~LightClusterBuilder() { if (cluster_data.size()) { RD::get_singleton()->free(cluster_texture); diff --git a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp index f328bab7d1..4c477ca5f4 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp @@ -1545,6 +1545,7 @@ void RasterizerCanvasRD::light_set_texture(RID p_rid, RID p_texture) { cl->texture = p_texture; } + void RasterizerCanvasRD::light_set_use_shadow(RID p_rid, bool p_enable, int p_resolution) { CanvasLight *cl = canvas_light_owner.getornull(p_rid); ERR_FAIL_COND(!cl); @@ -1758,6 +1759,7 @@ void RasterizerCanvasRD::occluder_polygon_set_shape_as_lines(RID p_occluder, con } } } + void RasterizerCanvasRD::occluder_polygon_set_cull_mode(RID p_occluder, RS::CanvasOccluderPolygonCullMode p_mode) { OccluderPolygon *oc = occluder_polygon_owner.getornull(p_occluder); ERR_FAIL_COND(!oc); @@ -1955,6 +1957,7 @@ void RasterizerCanvasRD::ShaderData::set_default_texture_param(const StringName default_texture_params[p_name] = p_texture; } } + void RasterizerCanvasRD::ShaderData::get_param_list(List<PropertyInfo> *p_param_list) const { Map<int, StringName> order; @@ -2002,9 +2005,11 @@ bool RasterizerCanvasRD::ShaderData::is_param_texture(const StringName &p_param) bool RasterizerCanvasRD::ShaderData::is_animated() const { return false; } + bool RasterizerCanvasRD::ShaderData::casts_shadows() const { return false; } + Variant RasterizerCanvasRD::ShaderData::get_default_parameter(const StringName &p_parameter) const { if (uniforms.has(p_parameter)) { ShaderLanguage::ShaderNode::Uniform uniform = uniforms[p_parameter]; @@ -2033,6 +2038,7 @@ RasterizerStorageRD::ShaderData *RasterizerCanvasRD::_create_shader_func() { ShaderData *shader_data = memnew(ShaderData); return shader_data; } + void RasterizerCanvasRD::MaterialData::update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) { RasterizerCanvasRD *canvas_singleton = (RasterizerCanvasRD *)RasterizerCanvas::singleton; @@ -2134,6 +2140,7 @@ void RasterizerCanvasRD::MaterialData::update_parameters(const Map<StringName, V uniform_set = RD::get_singleton()->uniform_set_create(uniforms, canvas_singleton->shader.canvas_shader.version_get_shader(shader_data->version, 0), 1); } + RasterizerCanvasRD::MaterialData::~MaterialData() { if (uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(uniform_set)) { RD::get_singleton()->free(uniform_set); diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp index 26d7090fbc..2b747cd04a 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp @@ -414,6 +414,7 @@ bool RasterizerSceneHighEndRD::ShaderData::is_animated() const { bool RasterizerSceneHighEndRD::ShaderData::casts_shadows() const { return false; } + Variant RasterizerSceneHighEndRD::ShaderData::get_default_parameter(const StringName &p_parameter) const { if (uniforms.has(p_parameter)) { ShaderLanguage::ShaderNode::Uniform uniform = uniforms[p_parameter]; diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp index 3ea89d643f..ac986fab58 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp @@ -1130,36 +1130,43 @@ void RasterizerSceneRD::environment_set_background(RID p_env, RS::EnvironmentBG ERR_FAIL_COND(!env); env->background = p_bg; } + void RasterizerSceneRD::environment_set_sky(RID p_env, RID p_sky) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->sky = p_sky; } + void RasterizerSceneRD::environment_set_sky_custom_fov(RID p_env, float p_scale) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->sky_custom_fov = p_scale; } + void RasterizerSceneRD::environment_set_sky_orientation(RID p_env, const Basis &p_orientation) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->sky_orientation = p_orientation; } + void RasterizerSceneRD::environment_set_bg_color(RID p_env, const Color &p_color) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->bg_color = p_color; } + void RasterizerSceneRD::environment_set_bg_energy(RID p_env, float p_energy) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->bg_energy = p_energy; } + void RasterizerSceneRD::environment_set_canvas_max_layer(RID p_env, int p_max_layer) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->canvas_max_layer = p_max_layer; } + void RasterizerSceneRD::environment_set_ambient_light(RID p_env, const Color &p_color, RS::EnvironmentAmbientSource p_ambient, float p_energy, float p_sky_contribution, RS::EnvironmentReflectionSource p_reflection_source, const Color &p_ao_color) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); @@ -1176,56 +1183,67 @@ RS::EnvironmentBG RasterizerSceneRD::environment_get_background(RID p_env) const ERR_FAIL_COND_V(!env, RS::ENV_BG_MAX); return env->background; } + RID RasterizerSceneRD::environment_get_sky(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, RID()); return env->sky; } + float RasterizerSceneRD::environment_get_sky_custom_fov(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->sky_custom_fov; } + Basis RasterizerSceneRD::environment_get_sky_orientation(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, Basis()); return env->sky_orientation; } + Color RasterizerSceneRD::environment_get_bg_color(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, Color()); return env->bg_color; } + float RasterizerSceneRD::environment_get_bg_energy(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->bg_energy; } + int RasterizerSceneRD::environment_get_canvas_max_layer(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->canvas_max_layer; } + Color RasterizerSceneRD::environment_get_ambient_light_color(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, Color()); return env->ambient_light; } + RS::EnvironmentAmbientSource RasterizerSceneRD::environment_get_ambient_source(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, RS::ENV_AMBIENT_SOURCE_BG); return env->ambient_source; } + float RasterizerSceneRD::environment_get_ambient_light_energy(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->ambient_light_energy; } + float RasterizerSceneRD::environment_get_ambient_sky_contribution(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->ambient_sky_contribution; } + RS::EnvironmentReflectionSource RasterizerSceneRD::environment_get_reflection_source(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, RS::ENV_REFLECTION_SOURCE_DISABLED); @@ -1321,6 +1339,7 @@ float RasterizerSceneRD::environment_get_ssao_ao_affect(RID p_env) const { ERR_FAIL_COND_V(!env, false); return env->ssao_ao_channel_affect; } + float RasterizerSceneRD::environment_get_ssao_light_affect(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, false); diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp index 63abe6b215..c04bbc6c06 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp @@ -713,6 +713,7 @@ RID RasterizerStorageRD::texture_2d_layered_create(const Vector<Ref<Image>> &p_l return texture_owner.make_rid(texture); } + RID RasterizerStorageRD::texture_3d_create(const Vector<Ref<Image>> &p_slices) { return RID(); } @@ -765,9 +766,11 @@ void RasterizerStorageRD::_texture_2d_update(RID p_texture, const Ref<Image> &p_ void RasterizerStorageRD::texture_2d_update_immediate(RID p_texture, const Ref<Image> &p_image, int p_layer) { _texture_2d_update(p_texture, p_image, p_layer, true); } + void RasterizerStorageRD::texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer) { _texture_2d_update(p_texture, p_image, p_layer, false); } + void RasterizerStorageRD::texture_3d_update(RID p_texture, const Ref<Image> &p_image, int p_depth, int p_mipmap) { } @@ -826,6 +829,7 @@ RID RasterizerStorageRD::texture_2d_placeholder_create() { return texture_2d_create(image); } + RID RasterizerStorageRD::texture_2d_layered_placeholder_create(RS::TextureLayeredType p_layered_type) { //this could be better optimized to reuse an existing image , done this way //for now to get it working @@ -851,6 +855,7 @@ RID RasterizerStorageRD::texture_2d_layered_placeholder_create(RS::TextureLayere return texture_2d_layered_create(images, p_layered_type); } + RID RasterizerStorageRD::texture_3d_placeholder_create() { return RID(); } @@ -882,9 +887,11 @@ Ref<Image> RasterizerStorageRD::texture_2d_get(RID p_texture) const { return image; } + Ref<Image> RasterizerStorageRD::texture_2d_layer_get(RID p_texture, int p_layer) const { return Ref<Image>(); } + Ref<Image> RasterizerStorageRD::texture_3d_slice_get(RID p_texture, int p_depth, int p_mipmap) const { return Ref<Image>(); } @@ -928,6 +935,7 @@ void RasterizerStorageRD::texture_replace(RID p_texture, RID p_by_texture) { decal_atlas.dirty = true; //mark it dirty since it was most likely modified } } + void RasterizerStorageRD::texture_set_size_override(RID p_texture, int p_width, int p_height) { Texture *tex = texture_owner.getornull(p_texture); ERR_FAIL_COND(!tex); @@ -941,6 +949,7 @@ void RasterizerStorageRD::texture_set_path(RID p_texture, const String &p_path) ERR_FAIL_COND(!tex); tex->path = p_path; } + String RasterizerStorageRD::texture_get_path(RID p_texture) const { return String(); } @@ -951,23 +960,27 @@ void RasterizerStorageRD::texture_set_detect_3d_callback(RID p_texture, RS::Text tex->detect_3d_callback_ud = p_userdata; tex->detect_3d_callback = p_callback; } + void RasterizerStorageRD::texture_set_detect_normal_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) { Texture *tex = texture_owner.getornull(p_texture); ERR_FAIL_COND(!tex); tex->detect_normal_callback_ud = p_userdata; tex->detect_normal_callback = p_callback; } + void RasterizerStorageRD::texture_set_detect_roughness_callback(RID p_texture, RS::TextureDetectRoughnessCallback p_callback, void *p_userdata) { Texture *tex = texture_owner.getornull(p_texture); ERR_FAIL_COND(!tex); tex->detect_roughness_callback_ud = p_userdata; tex->detect_roughness_callback = p_callback; } + void RasterizerStorageRD::texture_debug_usage(List<RS::TextureInfo> *r_info) { } void RasterizerStorageRD::texture_set_proxy(RID p_proxy, RID p_base) { } + void RasterizerStorageRD::texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) { } @@ -1055,6 +1068,7 @@ String RasterizerStorageRD::shader_get_code(RID p_shader) const { ERR_FAIL_COND_V(!shader, String()); return shader->code; } + void RasterizerStorageRD::shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const { Shader *shader = shader_owner.getornull(p_shader); ERR_FAIL_COND(!shader); @@ -1088,6 +1102,7 @@ RID RasterizerStorageRD::shader_get_default_texture_param(RID p_shader, const St return RID(); } + Variant RasterizerStorageRD::shader_get_param_default(RID p_shader, const StringName &p_param) const { Shader *shader = shader_owner.getornull(p_shader); ERR_FAIL_COND_V(!shader, Variant()); @@ -1096,6 +1111,7 @@ Variant RasterizerStorageRD::shader_get_param_default(RID p_shader, const String } return Variant(); } + void RasterizerStorageRD::shader_set_data_request_function(ShaderType p_shader_type, ShaderDataRequestFunction p_function) { ERR_FAIL_INDEX(p_shader_type, SHADER_TYPE_MAX); shader_data_request_func[p_shader_type] = p_function; @@ -1217,6 +1233,7 @@ void RasterizerStorageRD::material_set_next_pass(RID p_material, RID p_next_mate material->instance_dependency.instance_notify_changed(false, true); } + void RasterizerStorageRD::material_set_render_priority(RID p_material, int priority) { Material *material = material_owner.getornull(p_material); ERR_FAIL_COND(!material); @@ -1238,6 +1255,7 @@ bool RasterizerStorageRD::material_is_animated(RID p_material) { } return false; //by default nothing is animated } + bool RasterizerStorageRD::material_casts_shadows(RID p_material) { Material *material = material_owner.getornull(p_material); ERR_FAIL_COND_V(!material, true); @@ -1978,6 +1996,7 @@ void RasterizerStorageRD::_update_queued_materials() { } material_update_list = nullptr; } + /* MESH API */ RID RasterizerStorageRD::mesh_create() { @@ -2142,6 +2161,7 @@ void RasterizerStorageRD::mesh_set_blend_shape_mode(RID p_mesh, RS::BlendShapeMo mesh->blend_shape_mode = p_mode; } + RS::BlendShapeMode RasterizerStorageRD::mesh_get_blend_shape_mode(RID p_mesh) const { Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND_V(!mesh, RS::BLEND_SHAPE_MODE_NORMALIZED); @@ -2168,6 +2188,7 @@ void RasterizerStorageRD::mesh_surface_set_material(RID p_mesh, int p_surface, R mesh->instance_dependency.instance_notify_changed(false, true); mesh->material_cache.clear(); } + RID RasterizerStorageRD::mesh_surface_get_material(RID p_mesh, int p_surface) const { Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND_V(!mesh, RID()); @@ -2222,6 +2243,7 @@ void RasterizerStorageRD::mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) { ERR_FAIL_COND(!mesh); mesh->custom_aabb = p_aabb; } + AABB RasterizerStorageRD::mesh_get_custom_aabb(RID p_mesh) const { Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND_V(!mesh, AABB()); @@ -2772,6 +2794,7 @@ void RasterizerStorageRD::multimesh_instance_set_transform_2d(RID p_multimesh, i _multimesh_mark_dirty(multimesh, p_index, true); } + void RasterizerStorageRD::multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color) { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND(!multimesh); @@ -2793,6 +2816,7 @@ void RasterizerStorageRD::multimesh_instance_set_color(RID p_multimesh, int p_in _multimesh_mark_dirty(multimesh, p_index, false); } + void RasterizerStorageRD::multimesh_instance_set_custom_data(RID p_multimesh, int p_index, const Color &p_color) { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND(!multimesh); @@ -2852,6 +2876,7 @@ Transform RasterizerStorageRD::multimesh_instance_get_transform(RID p_multimesh, return t; } + Transform2D RasterizerStorageRD::multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND_V(!multimesh, Transform2D()); @@ -2876,6 +2901,7 @@ Transform2D RasterizerStorageRD::multimesh_instance_get_transform_2d(RID p_multi return t; } + Color RasterizerStorageRD::multimesh_instance_get_color(RID p_multimesh, int p_index) const { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND_V(!multimesh, Color()); @@ -2898,6 +2924,7 @@ Color RasterizerStorageRD::multimesh_instance_get_color(RID p_multimesh, int p_i return c; } + Color RasterizerStorageRD::multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND_V(!multimesh, Color()); @@ -2992,6 +3019,7 @@ void RasterizerStorageRD::multimesh_set_visible_instances(RID p_multimesh, int p multimesh->visible_instances = p_visible; } + int RasterizerStorageRD::multimesh_get_visible_instances(RID p_multimesh) const { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND_V(!multimesh, 0); @@ -3102,6 +3130,7 @@ void RasterizerStorageRD::skeleton_allocate(RID p_skeleton, int p_bones, bool p_ _skeleton_make_dirty(skeleton); } } + int RasterizerStorageRD::skeleton_get_bone_count(RID p_skeleton) const { Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); ERR_FAIL_COND_V(!skeleton, 0); @@ -3160,6 +3189,7 @@ Transform RasterizerStorageRD::skeleton_bone_get_transform(RID p_skeleton, int p return t; } + void RasterizerStorageRD::skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) { Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); @@ -3180,6 +3210,7 @@ void RasterizerStorageRD::skeleton_bone_set_transform_2d(RID p_skeleton, int p_b _skeleton_make_dirty(skeleton); } + Transform2D RasterizerStorageRD::skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const { Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); @@ -3258,6 +3289,7 @@ void RasterizerStorageRD::light_set_color(RID p_light, const Color &p_color) { light->color = p_color; } + void RasterizerStorageRD::light_set_param(RID p_light, RS::LightParam p_param, float p_value) { Light *light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); @@ -3282,6 +3314,7 @@ void RasterizerStorageRD::light_set_param(RID p_light, RS::LightParam p_param, f light->param[p_param] = p_value; } + void RasterizerStorageRD::light_set_shadow(RID p_light, bool p_enabled) { Light *light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); @@ -3322,6 +3355,7 @@ void RasterizerStorageRD::light_set_negative(RID p_light, bool p_enable) { light->negative = p_enable; } + void RasterizerStorageRD::light_set_cull_mask(RID p_light, uint32_t p_mask) { Light *light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); @@ -3351,6 +3385,7 @@ void RasterizerStorageRD::light_set_use_gi(RID p_light, bool p_enabled) { light->version++; light->instance_dependency.instance_notify_changed(true, false); } + void RasterizerStorageRD::light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode) { Light *light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); @@ -3500,6 +3535,7 @@ void RasterizerStorageRD::reflection_probe_set_max_distance(RID p_probe, float p reflection_probe->instance_dependency.instance_notify_changed(true, false); } + void RasterizerStorageRD::reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) { ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND(!reflection_probe); @@ -3507,6 +3543,7 @@ void RasterizerStorageRD::reflection_probe_set_extents(RID p_probe, const Vector reflection_probe->extents = p_extents; reflection_probe->instance_dependency.instance_notify_changed(true, false); } + void RasterizerStorageRD::reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) { ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND(!reflection_probe); @@ -3522,6 +3559,7 @@ void RasterizerStorageRD::reflection_probe_set_as_interior(RID p_probe, bool p_e reflection_probe->interior = p_enable; reflection_probe->instance_dependency.instance_notify_changed(true, false); } + void RasterizerStorageRD::reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) { ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND(!reflection_probe); @@ -3536,6 +3574,7 @@ void RasterizerStorageRD::reflection_probe_set_enable_shadows(RID p_probe, bool reflection_probe->enable_shadows = p_enable; reflection_probe->instance_dependency.instance_notify_changed(true, false); } + void RasterizerStorageRD::reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) { ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND(!reflection_probe); @@ -3562,6 +3601,7 @@ AABB RasterizerStorageRD::reflection_probe_get_aabb(RID p_probe) const { return aabb; } + RS::ReflectionProbeUpdateMode RasterizerStorageRD::reflection_probe_get_update_mode(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!reflection_probe, RS::REFLECTION_PROBE_UPDATE_ALWAYS); @@ -3582,6 +3622,7 @@ Vector3 RasterizerStorageRD::reflection_probe_get_extents(RID p_probe) const { return reflection_probe->extents; } + Vector3 RasterizerStorageRD::reflection_probe_get_origin_offset(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!reflection_probe, Vector3()); @@ -3616,12 +3657,14 @@ float RasterizerStorageRD::reflection_probe_get_intensity(RID p_probe) const { return reflection_probe->intensity; } + bool RasterizerStorageRD::reflection_probe_is_interior(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!reflection_probe, false); return reflection_probe->interior; } + bool RasterizerStorageRD::reflection_probe_is_box_projection(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!reflection_probe, false); @@ -3635,12 +3678,14 @@ Color RasterizerStorageRD::reflection_probe_get_interior_ambient(RID p_probe) co return reflection_probe->interior_ambient; } + float RasterizerStorageRD::reflection_probe_get_interior_ambient_energy(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!reflection_probe, 0); return reflection_probe->interior_ambient_energy; } + float RasterizerStorageRD::reflection_probe_get_interior_ambient_probe_contribution(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!reflection_probe, 0); @@ -3658,6 +3703,7 @@ void RasterizerStorageRD::decal_set_extents(RID p_decal, const Vector3 &p_extent decal->extents = p_extents; decal->instance_dependency.instance_notify_changed(true, false); } + void RasterizerStorageRD::decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) { Decal *decal = decal_owner.getornull(p_decal); ERR_FAIL_COND(!decal); @@ -3681,6 +3727,7 @@ void RasterizerStorageRD::decal_set_texture(RID p_decal, RS::DecalTexture p_type decal->instance_dependency.instance_notify_changed(false, true); } + void RasterizerStorageRD::decal_set_emission_energy(RID p_decal, float p_energy) { Decal *decal = decal_owner.getornull(p_decal); ERR_FAIL_COND(!decal); @@ -3698,6 +3745,7 @@ void RasterizerStorageRD::decal_set_modulate(RID p_decal, const Color &p_modulat ERR_FAIL_COND(!decal); decal->modulate = p_modulate; } + void RasterizerStorageRD::decal_set_cull_mask(RID p_decal, uint32_t p_layers) { Decal *decal = decal_owner.getornull(p_decal); ERR_FAIL_COND(!decal); @@ -3875,6 +3923,7 @@ Vector3i RasterizerStorageRD::gi_probe_get_octree_size(RID p_gi_probe) const { ERR_FAIL_COND_V(!gi_probe, Vector3i()); return gi_probe->octree_size; } + Vector<uint8_t> RasterizerStorageRD::gi_probe_get_octree_cells(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, Vector<uint8_t>()); @@ -3884,6 +3933,7 @@ Vector<uint8_t> RasterizerStorageRD::gi_probe_get_octree_cells(RID p_gi_probe) c } return Vector<uint8_t>(); } + Vector<uint8_t> RasterizerStorageRD::gi_probe_get_data_cells(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, Vector<uint8_t>()); @@ -3893,6 +3943,7 @@ Vector<uint8_t> RasterizerStorageRD::gi_probe_get_data_cells(RID p_gi_probe) con } return Vector<uint8_t>(); } + Vector<uint8_t> RasterizerStorageRD::gi_probe_get_distance_field(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, Vector<uint8_t>()); @@ -3902,12 +3953,14 @@ Vector<uint8_t> RasterizerStorageRD::gi_probe_get_distance_field(RID p_gi_probe) } return Vector<uint8_t>(); } + Vector<int> RasterizerStorageRD::gi_probe_get_level_counts(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, Vector<int>()); return gi_probe->level_counts; } + Transform RasterizerStorageRD::gi_probe_get_to_cell_xform(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, Transform()); @@ -3922,6 +3975,7 @@ void RasterizerStorageRD::gi_probe_set_dynamic_range(RID p_gi_probe, float p_ran gi_probe->dynamic_range = p_range; gi_probe->version++; } + float RasterizerStorageRD::gi_probe_get_dynamic_range(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, 0); @@ -3936,6 +3990,7 @@ void RasterizerStorageRD::gi_probe_set_propagation(RID p_gi_probe, float p_range gi_probe->propagation = p_range; gi_probe->version++; } + float RasterizerStorageRD::gi_probe_get_propagation(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, 0); @@ -3948,6 +4003,7 @@ void RasterizerStorageRD::gi_probe_set_energy(RID p_gi_probe, float p_energy) { gi_probe->energy = p_energy; } + float RasterizerStorageRD::gi_probe_get_energy(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, 0); @@ -3960,6 +4016,7 @@ void RasterizerStorageRD::gi_probe_set_ao(RID p_gi_probe, float p_ao) { gi_probe->ao = p_ao; } + float RasterizerStorageRD::gi_probe_get_ao(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, 0); @@ -3985,6 +4042,7 @@ void RasterizerStorageRD::gi_probe_set_bias(RID p_gi_probe, float p_bias) { gi_probe->bias = p_bias; } + float RasterizerStorageRD::gi_probe_get_bias(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, 0); @@ -3997,6 +4055,7 @@ void RasterizerStorageRD::gi_probe_set_normal_bias(RID p_gi_probe, float p_norma gi_probe->normal_bias = p_normal_bias; } + float RasterizerStorageRD::gi_probe_get_normal_bias(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, 0); @@ -4060,6 +4119,7 @@ RID RasterizerStorageRD::gi_probe_get_octree_buffer(RID p_gi_probe) const { ERR_FAIL_COND_V(!gi_probe, RID()); return gi_probe->octree_buffer; } + RID RasterizerStorageRD::gi_probe_get_data_buffer(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, RID()); @@ -4072,6 +4132,7 @@ RID RasterizerStorageRD::gi_probe_get_sdf_texture(RID p_gi_probe) { return gi_probe->sdf_texture; } + /* LIGHTMAP API */ RID RasterizerStorageRD::lightmap_create() { @@ -4160,16 +4221,19 @@ PackedVector3Array RasterizerStorageRD::lightmap_get_probe_capture_points(RID p_ return lm->points; } + PackedColorArray RasterizerStorageRD::lightmap_get_probe_capture_sh(RID p_lightmap) const { Lightmap *lm = lightmap_owner.getornull(p_lightmap); ERR_FAIL_COND_V(!lm, PackedColorArray()); return lm->point_sh; } + PackedInt32Array RasterizerStorageRD::lightmap_get_probe_capture_tetrahedra(RID p_lightmap) const { Lightmap *lm = lightmap_owner.getornull(p_lightmap); ERR_FAIL_COND_V(!lm, PackedInt32Array()); return lm->tetrahedra; } + PackedInt32Array RasterizerStorageRD::lightmap_get_probe_capture_bsp_tree(RID p_lightmap) const { Lightmap *lm = lightmap_owner.getornull(p_lightmap); ERR_FAIL_COND_V(!lm, PackedInt32Array()); @@ -4235,6 +4299,7 @@ bool RasterizerStorageRD::lightmap_is_interior(RID p_lightmap) const { ERR_FAIL_COND_V(!lm, false); return lm->interior; } + AABB RasterizerStorageRD::lightmap_get_aabb(RID p_lightmap) const { const Lightmap *lm = lightmap_owner.getornull(p_lightmap); ERR_FAIL_COND_V(!lm, AABB()); @@ -4463,12 +4528,14 @@ RID RasterizerStorageRD::render_target_get_rd_framebuffer(RID p_render_target) { return rt->framebuffer; } + RID RasterizerStorageRD::render_target_get_rd_texture(RID p_render_target) { RenderTarget *rt = render_target_owner.getornull(p_render_target); ERR_FAIL_COND_V(!rt, RID()); return rt->color; } + void RasterizerStorageRD::render_target_request_clear(RID p_render_target, const Color &p_clear_color) { RenderTarget *rt = render_target_owner.getornull(p_render_target); ERR_FAIL_COND(!rt); @@ -5227,6 +5294,7 @@ void RasterizerStorageRD::global_variable_remove(const StringName &p_name) { global_variables.variables.erase(p_name); } + Vector<StringName> RasterizerStorageRD::global_variable_get_list() const { if (!Engine::get_singleton()->is_editor_hint()) { ERR_FAIL_V_MSG(Vector<StringName>(), "This function should never be used outside the editor, it can severely damage performance."); @@ -5260,6 +5328,7 @@ void RasterizerStorageRD::global_variable_set(const StringName &p_name, const Va } } } + void RasterizerStorageRD::global_variable_set_override(const StringName &p_name, const Variant &p_value) { if (!global_variables.variables.has(p_name)) { return; //variable may not exist @@ -5422,6 +5491,7 @@ void RasterizerStorageRD::global_variables_instance_free(RID p_instance) { } global_variables.instance_buffer_pos.erase(p_instance); } + void RasterizerStorageRD::global_variables_instance_update(RID p_instance, int p_index, const Variant &p_value) { if (!global_variables.instance_buffer_pos.has(p_instance)) { return; //just not allocated, ignore @@ -5546,6 +5616,7 @@ bool RasterizerStorageRD::has_os_feature(const String &p_feature) const { return false; } + bool RasterizerStorageRD::free(RID p_rid) { if (texture_owner.owns(p_rid)) { Texture *t = texture_owner.getornull(p_rid); @@ -5683,6 +5754,7 @@ void RasterizerStorageRD::capture_timestamp(const String &p_name) { uint32_t RasterizerStorageRD::get_captured_timestamps_count() const { return RD::get_singleton()->get_captured_timestamps_count(); } + uint64_t RasterizerStorageRD::get_captured_timestamps_frame() const { return RD::get_singleton()->get_captured_timestamps_frame(); } @@ -5690,9 +5762,11 @@ uint64_t RasterizerStorageRD::get_captured_timestamps_frame() const { uint64_t RasterizerStorageRD::get_captured_timestamp_gpu_time(uint32_t p_index) const { return RD::get_singleton()->get_captured_timestamp_gpu_time(p_index); } + uint64_t RasterizerStorageRD::get_captured_timestamp_cpu_time(uint32_t p_index) const { return RD::get_singleton()->get_captured_timestamp_cpu_time(p_index); } + String RasterizerStorageRD::get_captured_timestamp_name(uint32_t p_index) const { return RD::get_singleton()->get_captured_timestamp_name(p_index); } diff --git a/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp b/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp index 310fa1bed4..b24874345e 100644 --- a/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp +++ b/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp @@ -202,6 +202,7 @@ static int _get_datatype_alignment(SL::DataType p_type) { ERR_FAIL_V(0); } + static String _interpstr(SL::DataInterpolation p_interp) { switch (p_interp) { case SL::INTERPOLATION_FLAT: diff --git a/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl b/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl index dbeccbfff4..18555d9672 100644 --- a/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl +++ b/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl @@ -51,6 +51,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float jitter_seed; uint pad[2]; } + params; //used to work around downsampling filter diff --git a/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl index 8c2b0c925d..3e0d5c4ffc 100644 --- a/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl +++ b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl @@ -12,6 +12,7 @@ layout(push_constant, binding = 0, std430) uniform Constants { vec2 direction; vec2 pad; } + constants; layout(location = 0) out highp float depth; diff --git a/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl index a39866004b..ba05b8b2fb 100644 --- a/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl +++ b/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl @@ -51,6 +51,7 @@ layout(push_constant, binding = 0, std430) uniform DrawData { vec2 color_texture_pixel_size; uint lights[4]; } + draw_data; // The values passed per draw primitives are cached within it @@ -82,6 +83,7 @@ layout(set = 2, binding = 0, std140) uniform CanvasData { float time_pad; //uint light_count; } + canvas_data; layout(set = 2, binding = 1) uniform textureBuffer skeleton_buffer; @@ -90,6 +92,7 @@ layout(set = 2, binding = 2, std140) uniform SkeletonData { mat4 skeleton_transform; //in world coordinates mat4 skeleton_transform_inverse; } + skeleton_data; #ifdef USE_LIGHTING @@ -123,6 +126,7 @@ struct Light { layout(set = 2, binding = 3, std140) uniform LightData { Light data[MAX_LIGHTS]; } + light_array; layout(set = 2, binding = 4) uniform texture2D light_textures[MAX_LIGHT_TEXTURES]; @@ -135,6 +139,7 @@ layout(set = 2, binding = 6) uniform sampler shadow_sampler; layout(set = 2, binding = 7, std430) restrict readonly buffer GlobalVariableData { vec4 data[]; } + global_variables; /* SET3: Render Target Data */ diff --git a/servers/rendering/rasterizer_rd/shaders/copy.glsl b/servers/rendering/rasterizer_rd/shaders/copy.glsl index c8a8b027c8..249e7963d0 100644 --- a/servers/rendering/rasterizer_rd/shaders/copy.glsl +++ b/servers/rendering/rasterizer_rd/shaders/copy.glsl @@ -37,6 +37,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float camera_z_near; uint pad2[2]; } + params; #ifdef MODE_CUBEMAP_ARRAY_TO_PANORAMA diff --git a/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl b/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl index 2308f58e00..5f53045afd 100644 --- a/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl +++ b/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl @@ -17,6 +17,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool force_luminance; uint pad[3]; } + params; void main() { diff --git a/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl b/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl index 2fd2e05ae1..133d97ffcb 100644 --- a/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl @@ -18,6 +18,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float z_near; bool z_flip; } + params; layout(r32f, set = 1, binding = 0) uniform restrict writeonly image2D depth_buffer; diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl index 9f3ecf6053..8d88e46727 100644 --- a/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl @@ -37,6 +37,7 @@ layout(rgba16f, set = 1, binding = 0) uniform restrict writeonly imageCube dest_ layout(push_constant, binding = 1, std430) uniform Params { uint face_size; } + params; #define M_PI 3.14159265359 @@ -46,26 +47,31 @@ void get_dir_0(out vec3 dir, in float u, in float v) { dir[1] = v; dir[2] = -u; } + void get_dir_1(out vec3 dir, in float u, in float v) { dir[0] = -1.0; dir[1] = v; dir[2] = u; } + void get_dir_2(out vec3 dir, in float u, in float v) { dir[0] = u; dir[1] = 1.0; dir[2] = -v; } + void get_dir_3(out vec3 dir, in float u, in float v) { dir[0] = u; dir[1] = -1.0; dir[2] = v; } + void get_dir_4(out vec3 dir, in float u, in float v) { dir[0] = u; dir[1] = v; dir[2] = 1.0; } + void get_dir_5(out vec3 dir, in float u, in float v) { dir[0] = -u; dir[1] = v; diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl index 193d0a8a3c..20bc0e2d0d 100644 --- a/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl @@ -51,11 +51,13 @@ layout(rgba16f, set = 2, binding = 6) uniform restrict writeonly imageCube dest_ layout(set = 1, binding = 0, std430) buffer restrict readonly Data { vec4[7][5][3][24] coeffs; } + data; #else layout(set = 1, binding = 0, std430) buffer restrict readonly Data { vec4[7][5][6] coeffs; } + data; #endif diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl index 36dba6df3d..0e6e51f0de 100644 --- a/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl @@ -21,6 +21,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool use_direct_write; float face_size; } + params; #define M_PI 3.14159265359 diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe.glsl index e4449afbd0..60c4032d80 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe.glsl @@ -24,6 +24,7 @@ struct CellChildren { layout(set = 0, binding = 1, std430) buffer CellChildrenBuffer { CellChildren data[]; } + cell_children; struct CellData { @@ -36,6 +37,7 @@ struct CellData { layout(set = 0, binding = 2, std430) buffer CellDataBuffer { CellData data[]; } + cell_data; #endif // MODE DYNAMIC @@ -65,6 +67,7 @@ struct Light { layout(set = 0, binding = 3, std140) uniform Lights { Light data[MAX_LIGHTS]; } + lights; #endif // MODE COMPUTE LIGHT @@ -96,11 +99,13 @@ layout(push_constant, binding = 0, std430) uniform Params { float aniso_strength; uint pad; } + params; layout(set = 0, binding = 4, std430) buffer Outputs { vec4 data[]; } + outputs; #endif // MODE DYNAMIC @@ -143,6 +148,7 @@ layout(push_constant, binding = 0, std430) uniform Params { float propagation; float pad[3]; } + params; #ifdef MODE_DYNAMIC_LIGHTING diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl index dd347c86a7..db3043fb28 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl @@ -16,6 +16,7 @@ struct CellData { layout(set = 0, binding = 1, std140) buffer CellDataBuffer { CellData data[]; } + cell_data; layout(set = 0, binding = 2) uniform texture3D color_tex; @@ -36,6 +37,7 @@ layout(push_constant, binding = 0, std430) uniform Params { ivec3 bounds; uint pad; } + params; layout(location = 0) out vec4 color_interp; diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl index 5e54c8b4de..37ea673fbe 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl @@ -20,6 +20,7 @@ struct CellChildren { layout(set = 0, binding = 1, std430) buffer CellChildrenBuffer { CellChildren data[]; } + cell_children; struct CellData { @@ -32,6 +33,7 @@ struct CellData { layout(set = 0, binding = 2, std430) buffer CellDataBuffer { CellData data[]; } + cell_data; layout(r8ui, set = 0, binding = 3) uniform restrict writeonly uimage3D sdf_tex; @@ -42,6 +44,7 @@ layout(push_constant, binding = 0, std430) uniform Params { uint pad0; uint pad1; } + params; void main() { @@ -81,6 +84,7 @@ float distance_to_aabb(ivec3 pos, ivec3 aabb_pos, ivec3 aabb_size) { return length(delta); } + void main() { ivec3 pos = ivec3(gl_GlobalInvocationID); diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl index d0f2703214..7a79f6a3ac 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl @@ -18,6 +18,7 @@ struct CellChildren { layout(set = 0, binding = 1, std430) buffer CellChildrenBuffer { CellChildren data[]; } + cell_children; struct CellData { @@ -30,6 +31,7 @@ struct CellData { layout(set = 0, binding = 2, std430) buffer CellDataBuffer { CellData data[]; } + cell_data; #define LIGHT_TYPE_DIRECTIONAL 0 @@ -57,6 +59,7 @@ struct Light { layout(set = 0, binding = 3, std140) uniform Lights { Light data[MAX_LIGHTS]; } + lights; #endif @@ -74,11 +77,13 @@ layout(push_constant, binding = 0, std430) uniform Params { uint cell_count; uint pad[2]; } + params; layout(set = 0, binding = 4, std140) uniform Outputs { vec4 data[]; } + output; #ifdef MODE_COMPUTE_LIGHT diff --git a/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl b/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl index 979fdb2dc1..060b1a3101 100644 --- a/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl +++ b/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl @@ -37,6 +37,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float exposure_adjust; float pad[3]; } + params; void main() { diff --git a/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl b/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl index 6969a967b9..e59424e3d6 100644 --- a/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl +++ b/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl @@ -16,6 +16,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float curve; uint pad; } + params; #define HALF_PI 1.5707963267948966 diff --git a/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl index 4c2fb296e6..93ddcc9dbc 100644 --- a/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl +++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl @@ -6,6 +6,7 @@ layout(push_constant, binding = 0, std430) uniform DrawCall { uint pad; //16 bits minimum size vec2 bake_uv2_offset; //used for bake to uv2, ignored otherwise } + draw_call; /* Set 0 Scene data that never changes, ever */ @@ -117,6 +118,7 @@ layout(set = 0, binding = 3, std140) uniform SceneData { float fog_height_curve; #endif } + scene_data; #define INSTANCE_FLAGS_USE_LIGHTMAP_CAPTURE (1 << 8) @@ -146,6 +148,7 @@ struct InstanceData { layout(set = 0, binding = 4, std430) restrict readonly buffer Instances { InstanceData data[]; } + instances; struct LightData { //this structure needs to be as packed as possible @@ -172,6 +175,7 @@ struct LightData { //this structure needs to be as packed as possible layout(set = 0, binding = 5, std430) restrict readonly buffer Lights { LightData data[]; } + lights; struct ReflectionData { @@ -188,6 +192,7 @@ struct ReflectionData { layout(set = 0, binding = 6, std140) uniform ReflectionProbeData { ReflectionData data[MAX_REFLECTION_DATA_STRUCTS]; } + reflections; struct DirectionalLightData { @@ -226,6 +231,7 @@ struct DirectionalLightData { layout(set = 0, binding = 7, std140) uniform DirectionalLights { DirectionalLightData data[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS]; } + directional_lights; struct GIProbeData { @@ -247,6 +253,7 @@ struct GIProbeData { layout(set = 0, binding = 8, std140) uniform GIProbes { GIProbeData data[MAX_GI_PROBES]; } + gi_probes; layout(set = 0, binding = 9) uniform texture3D gi_probe_textures[MAX_GI_PROBE_TEXTURES]; @@ -261,6 +268,7 @@ struct Lightmap { layout(set = 0, binding = 10, std140) restrict readonly buffer Lightmaps { Lightmap data[]; } + lightmaps; layout(set = 0, binding = 11) uniform texture2DArray lightmap_textures[MAX_LIGHTMAP_TEXTURES]; @@ -272,6 +280,7 @@ struct LightmapCapture { layout(set = 0, binding = 12, std140) restrict readonly buffer LightmapCaptures { LightmapCapture data[]; } + lightmap_captures; #define CLUSTER_COUNTER_SHIFT 20 @@ -302,6 +311,7 @@ struct DecalData { layout(set = 0, binding = 15, std430) restrict readonly buffer Decals { DecalData data[]; } + decals; layout(set = 0, binding = 16) uniform utexture3D cluster_texture; @@ -309,6 +319,7 @@ layout(set = 0, binding = 16) uniform utexture3D cluster_texture; layout(set = 0, binding = 17, std430) restrict readonly buffer ClusterData { uint indices[]; } + cluster_data; layout(set = 0, binding = 18) uniform texture2D directional_shadow_atlas; @@ -316,6 +327,7 @@ layout(set = 0, binding = 18) uniform texture2D directional_shadow_atlas; layout(set = 0, binding = 19, std430) restrict readonly buffer GlobalVariableData { vec4 data[]; } + global_variables; // decal atlas @@ -351,6 +363,7 @@ layout(set = 3, binding = 4) uniform texture2D ao_buffer; layout(set = 4, binding = 0, std430) restrict readonly buffer Transforms { vec4 data[]; } + transforms; /* Set 5 User Material */ diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl index fcde6b9d7a..39b10871ac 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl @@ -42,6 +42,7 @@ layout(push_constant, binding = 2, std430) uniform Params { mat4 projection; } + params; vec2 view_to_screen(vec3 view_pos, out float w) { diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl index a4ff2ba815..c36143039c 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl @@ -33,6 +33,7 @@ layout(push_constant, binding = 2, std430) uniform Params { bool vertical; uint steps; } + params; #define GAUSS_TABLE_SIZE 15 diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl index 3c6b3748d8..072f57eb40 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl @@ -26,6 +26,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool filtered; uint pad[2]; } + params; void main() { diff --git a/servers/rendering/rasterizer_rd/shaders/sky.glsl b/servers/rendering/rasterizer_rd/shaders/sky.glsl index f8e2257480..b0be03fe44 100644 --- a/servers/rendering/rasterizer_rd/shaders/sky.glsl +++ b/servers/rendering/rasterizer_rd/shaders/sky.glsl @@ -14,6 +14,7 @@ layout(push_constant, binding = 1, std430) uniform Params { vec4 position_multiplier; float time; } + params; void main() { @@ -40,6 +41,7 @@ layout(push_constant, binding = 1, std430) uniform Params { vec4 position_multiplier; float time; //TODO consider adding vec2 screen res, and float radiance size } + params; #define SAMPLER_NEAREST_CLAMP 0 @@ -60,6 +62,7 @@ layout(set = 0, binding = 0) uniform sampler material_samplers[12]; layout(set = 0, binding = 1, std430) restrict readonly buffer GlobalVariableData { vec4 data[]; } + global_variables; #ifdef USE_MATERIAL_UNIFORMS @@ -108,6 +111,7 @@ struct DirectionalLightData { layout(set = 3, binding = 0, std140) uniform DirectionalLights { DirectionalLightData data[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS]; } + directional_lights; /* clang-format off */ diff --git a/servers/rendering/rasterizer_rd/shaders/ssao.glsl b/servers/rendering/rasterizer_rd/shaders/ssao.glsl index 0175e26b85..764d7eeeac 100644 --- a/servers/rendering/rasterizer_rd/shaders/ssao.glsl +++ b/servers/rendering/rasterizer_rd/shaders/ssao.glsl @@ -78,6 +78,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float proj_scale; uint pad; } + params; vec3 reconstructCSPosition(vec2 S, float z) { diff --git a/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl b/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl index 642a051ba0..ca7cc7d71b 100644 --- a/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl +++ b/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl @@ -31,6 +31,7 @@ layout(push_constant, binding = 1, std430) uniform Params { ivec2 axis; /** (1, 0) or (0, 1) */ ivec2 screen_size; } + params; /** Filter radius in pixels. This will be multiplied by SCALE. */ diff --git a/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl b/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl index db50ce1893..c590e406f3 100644 --- a/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl +++ b/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl @@ -16,6 +16,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool orthogonal; uint pad; } + params; #ifdef MINIFY_START diff --git a/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl b/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl index c91ef49c78..9d660c5865 100644 --- a/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl +++ b/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl @@ -105,6 +105,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float depth_scale; uint pad[3]; } + params; layout(set = 0, binding = 0) uniform sampler2D source_image; diff --git a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl index 780d961197..f4754bfea7 100644 --- a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl +++ b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl @@ -52,6 +52,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool use_fxaa; uint pad; } + params; layout(location = 0) out vec4 frag_color; diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp index fa9f095585..55b65d2747 100644 --- a/servers/rendering/rendering_device.cpp +++ b/servers/rendering/rendering_device.cpp @@ -44,6 +44,7 @@ RenderingDevice::ShaderCacheFunction RenderingDevice::cache_function = nullptr; void RenderingDevice::shader_set_compile_function(ShaderCompileFunction p_function) { compile_function = p_function; } + void RenderingDevice::shader_set_cache_function(ShaderCacheFunction p_function) { cache_function = p_function; } diff --git a/servers/rendering/rendering_server_canvas.cpp b/servers/rendering/rendering_server_canvas.cpp index 809e9700c4..324765a217 100644 --- a/servers/rendering/rendering_server_canvas.cpp +++ b/servers/rendering/rendering_server_canvas.cpp @@ -297,6 +297,7 @@ void RenderingServerCanvas::canvas_set_item_mirroring(RID p_canvas, RID p_item, ERR_FAIL_COND(idx == -1); canvas->child_items.write[idx].mirror = p_mirroring; } + void RenderingServerCanvas::canvas_set_modulate(RID p_canvas, const Color &p_color) { Canvas *canvas = canvas_owner.getornull(p_canvas); ERR_FAIL_COND(!canvas); @@ -365,6 +366,7 @@ void RenderingServerCanvas::canvas_item_set_parent(RID p_item, RID p_parent) { canvas_item->parent = p_parent; } + void RenderingServerCanvas::canvas_item_set_visible(RID p_item, bool p_visible) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -373,6 +375,7 @@ void RenderingServerCanvas::canvas_item_set_visible(RID p_item, bool p_visible) _mark_ysort_dirty(canvas_item, canvas_item_owner); } + void RenderingServerCanvas::canvas_item_set_light_mask(RID p_item, int p_mask) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -386,18 +389,21 @@ void RenderingServerCanvas::canvas_item_set_transform(RID p_item, const Transfor canvas_item->xform = p_transform; } + void RenderingServerCanvas::canvas_item_set_clip(RID p_item, bool p_clip) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); canvas_item->clip = p_clip; } + void RenderingServerCanvas::canvas_item_set_distance_field_mode(RID p_item, bool p_enable) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); canvas_item->distance_field = p_enable; } + void RenderingServerCanvas::canvas_item_set_custom_rect(RID p_item, bool p_custom_rect, const Rect2 &p_rect) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -405,12 +411,14 @@ void RenderingServerCanvas::canvas_item_set_custom_rect(RID p_item, bool p_custo canvas_item->custom_rect = p_custom_rect; canvas_item->rect = p_rect; } + void RenderingServerCanvas::canvas_item_set_modulate(RID p_item, const Color &p_color) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); canvas_item->modulate = p_color; } + void RenderingServerCanvas::canvas_item_set_self_modulate(RID p_item, const Color &p_color) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -716,6 +724,7 @@ void RenderingServerCanvas::canvas_item_add_nine_patch(RID p_item, const Rect2 & style->axis_x = p_x_axis_mode; style->axis_y = p_y_axis_mode; } + void RenderingServerCanvas::canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) { uint32_t pc = p_points.size(); ERR_FAIL_COND(pc == 0 || pc > 4); @@ -811,6 +820,7 @@ void RenderingServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh, m->transform = p_transform; m->modulate = p_modulate; } + void RenderingServerCanvas::canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -844,6 +854,7 @@ void RenderingServerCanvas::canvas_item_add_clip_ignore(RID p_item, bool p_ignor ERR_FAIL_COND(!ci); ci->ignore = p_ignore; } + void RenderingServerCanvas::canvas_item_set_sort_children_by_y(RID p_item, bool p_enable) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -852,6 +863,7 @@ void RenderingServerCanvas::canvas_item_set_sort_children_by_y(RID p_item, bool _mark_ysort_dirty(canvas_item, canvas_item_owner); } + void RenderingServerCanvas::canvas_item_set_z_index(RID p_item, int p_z) { ERR_FAIL_COND(p_z < RS::CANVAS_ITEM_Z_MIN || p_z > RS::CANVAS_ITEM_Z_MAX); @@ -860,6 +872,7 @@ void RenderingServerCanvas::canvas_item_set_z_index(RID p_item, int p_z) { canvas_item->z_index = p_z; } + void RenderingServerCanvas::canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -898,6 +911,7 @@ void RenderingServerCanvas::canvas_item_clear(RID p_item) { canvas_item->clear(); } + void RenderingServerCanvas::canvas_item_set_draw_index(RID p_item, int p_index) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -936,6 +950,7 @@ RID RenderingServerCanvas::canvas_light_create() { clight->light_internal = RSG::canvas_render->light_create(); return canvas_light_owner.make_rid(clight); } + void RenderingServerCanvas::canvas_light_attach_to_canvas(RID p_light, RID p_canvas) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); @@ -962,18 +977,21 @@ void RenderingServerCanvas::canvas_light_set_enabled(RID p_light, bool p_enabled clight->enabled = p_enabled; } + void RenderingServerCanvas::canvas_light_set_scale(RID p_light, float p_scale) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->scale = p_scale; } + void RenderingServerCanvas::canvas_light_set_transform(RID p_light, const Transform2D &p_transform) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->xform = p_transform; } + void RenderingServerCanvas::canvas_light_set_texture(RID p_light, RID p_texture) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); @@ -982,30 +1000,35 @@ void RenderingServerCanvas::canvas_light_set_texture(RID p_light, RID p_texture) clight->version++; RSG::canvas_render->light_set_texture(clight->light_internal, p_texture); } + void RenderingServerCanvas::canvas_light_set_texture_offset(RID p_light, const Vector2 &p_offset) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->texture_offset = p_offset; } + void RenderingServerCanvas::canvas_light_set_color(RID p_light, const Color &p_color) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->color = p_color; } + void RenderingServerCanvas::canvas_light_set_height(RID p_light, float p_height) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->height = p_height; } + void RenderingServerCanvas::canvas_light_set_energy(RID p_light, float p_energy) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->energy = p_energy; } + void RenderingServerCanvas::canvas_light_set_z_range(RID p_light, int p_min_z, int p_max_z) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); @@ -1013,6 +1036,7 @@ void RenderingServerCanvas::canvas_light_set_z_range(RID p_light, int p_min_z, i clight->z_min = p_min_z; clight->z_max = p_max_z; } + void RenderingServerCanvas::canvas_light_set_layer_range(RID p_light, int p_min_layer, int p_max_layer) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); @@ -1020,18 +1044,21 @@ void RenderingServerCanvas::canvas_light_set_layer_range(RID p_light, int p_min_ clight->layer_max = p_max_layer; clight->layer_min = p_min_layer; } + void RenderingServerCanvas::canvas_light_set_item_cull_mask(RID p_light, int p_mask) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->item_mask = p_mask; } + void RenderingServerCanvas::canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->item_shadow_mask = p_mask; } + void RenderingServerCanvas::canvas_light_set_mode(RID p_light, RS::CanvasLightMode p_mode) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); @@ -1073,6 +1100,7 @@ void RenderingServerCanvas::canvas_light_set_shadow_filter(RID p_light, RS::Canv clight->shadow_filter = p_filter; } + void RenderingServerCanvas::canvas_light_set_shadow_color(RID p_light, const Color &p_color) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); @@ -1091,6 +1119,7 @@ RID RenderingServerCanvas::canvas_light_occluder_create() { return canvas_light_occluder_owner.make_rid(occluder); } + void RenderingServerCanvas::canvas_light_occluder_attach_to_canvas(RID p_occluder, RID p_canvas) { RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder); ERR_FAIL_COND(!occluder); @@ -1110,12 +1139,14 @@ void RenderingServerCanvas::canvas_light_occluder_attach_to_canvas(RID p_occlude canvas->occluders.insert(occluder); } } + void RenderingServerCanvas::canvas_light_occluder_set_enabled(RID p_occluder, bool p_enabled) { RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder); ERR_FAIL_COND(!occluder); occluder->enabled = p_enabled; } + void RenderingServerCanvas::canvas_light_occluder_set_polygon(RID p_occluder, RID p_polygon) { RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder); ERR_FAIL_COND(!occluder); @@ -1143,12 +1174,14 @@ void RenderingServerCanvas::canvas_light_occluder_set_polygon(RID p_occluder, RI } } } + void RenderingServerCanvas::canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) { RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder); ERR_FAIL_COND(!occluder); occluder->xform = p_xform; } + void RenderingServerCanvas::canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask) { RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder); ERR_FAIL_COND(!occluder); @@ -1161,6 +1194,7 @@ RID RenderingServerCanvas::canvas_occluder_polygon_create() { occluder_poly->occluder = RSG::canvas_render->occluder_polygon_create(); return canvas_light_occluder_polygon_owner.make_rid(occluder_poly); } + void RenderingServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed) { if (p_shape.size() < 3) { canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon, p_shape); @@ -1189,6 +1223,7 @@ void RenderingServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_pol canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon, lines); } + void RenderingServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const Vector<Vector2> &p_shape) { LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_occluder_polygon); ERR_FAIL_COND(!occluder_poly); diff --git a/servers/rendering/rendering_server_raster.cpp b/servers/rendering/rendering_server_raster.cpp index 6aaf197062..a301d81691 100644 --- a/servers/rendering/rendering_server_raster.cpp +++ b/servers/rendering/rendering_server_raster.cpp @@ -156,14 +156,18 @@ void RenderingServerRaster::draw(bool p_swap_buffers, double frame_step) { frame_profile_frame = RSG::storage->get_captured_timestamps_frame(); } + void RenderingServerRaster::sync() { } + bool RenderingServerRaster::has_changed() const { return changes > 0; } + void RenderingServerRaster::init() { RSG::rasterizer->initialize(); } + void RenderingServerRaster::finish() { if (test_cube.is_valid()) { free(test_cube); @@ -204,6 +208,7 @@ void RenderingServerRaster::set_boot_image(const Ref<Image> &p_image, const Colo redraw_request(); RSG::rasterizer->set_boot_image(p_image, p_color, p_scale, p_use_filter); } + void RenderingServerRaster::set_default_clear_color(const Color &p_color) { RSG::viewport->set_default_clear_color(p_color); } @@ -238,6 +243,7 @@ bool RenderingServerRaster::is_low_end() const { //return RSG::rasterizer->is_low_end(); return false; } + RenderingServerRaster::RenderingServerRaster() { RSG::canvas = memnew(RenderingServerCanvas); RSG::viewport = memnew(RenderingServerViewport); diff --git a/servers/rendering/rendering_server_scene.cpp b/servers/rendering/rendering_server_scene.cpp index 0f8c4b6935..06217b3f0e 100644 --- a/servers/rendering/rendering_server_scene.cpp +++ b/servers/rendering/rendering_server_scene.cpp @@ -197,6 +197,7 @@ void *RenderingServerScene::_instance_pair(void *p_self, OctreeElementID, Instan return nullptr; } + void RenderingServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance *p_A, int, OctreeElementID, Instance *p_B, int, void *udata) { //RenderingServerScene *self = (RenderingServerScene*)p_self; Instance *A = p_A; @@ -499,6 +500,7 @@ void RenderingServerScene::instance_set_base(RID p_instance, RID p_base) { _instance_queue_update(instance, true, true); } + void RenderingServerScene::instance_set_scenario(RID p_instance, RID p_scenario) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); @@ -583,12 +585,14 @@ void RenderingServerScene::instance_set_scenario(RID p_instance, RID p_scenario) _instance_queue_update(instance, true, true); } } + void RenderingServerScene::instance_set_layer_mask(RID p_instance, uint32_t p_mask) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); instance->layer_mask = p_mask; } + void RenderingServerScene::instance_set_transform(RID p_instance, const Transform &p_transform) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); @@ -612,12 +616,14 @@ void RenderingServerScene::instance_set_transform(RID p_instance, const Transfor instance->transform = p_transform; _instance_queue_update(instance, true); } + void RenderingServerScene::instance_attach_object_instance_id(RID p_instance, ObjectID p_id) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); instance->object_id = p_id; } + void RenderingServerScene::instance_set_blend_shape_weight(RID p_instance, int p_shape, float p_weight) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); @@ -690,6 +696,7 @@ void RenderingServerScene::instance_set_visible(RID p_instance, bool p_visible) } } } + inline bool is_geometry_instance(RenderingServer::InstanceType p_type) { return p_type == RS::INSTANCE_MESH || p_type == RS::INSTANCE_MULTIMESH || p_type == RS::INSTANCE_PARTICLES || p_type == RS::INSTANCE_IMMEDIATE; } @@ -766,6 +773,7 @@ Vector<ObjectID> RenderingServerScene::instances_cull_aabb(const AABB &p_aabb, R return instances; } + Vector<ObjectID> RenderingServerScene::instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario) const { Vector<ObjectID> instances; Scenario *scenario = scenario_owner.getornull(p_scenario); @@ -787,6 +795,7 @@ Vector<ObjectID> RenderingServerScene::instances_cull_ray(const Vector3 &p_from, return instances; } + Vector<ObjectID> RenderingServerScene::instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario) const { Vector<ObjectID> instances; Scenario *scenario = scenario_owner.getornull(p_scenario); @@ -846,6 +855,7 @@ void RenderingServerScene::instance_geometry_set_flag(RID p_instance, RS::Instan } } } + void RenderingServerScene::instance_geometry_set_cast_shadows_setting(RID p_instance, RS::ShadowCastingSetting p_shadow_casting_setting) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); @@ -853,6 +863,7 @@ void RenderingServerScene::instance_geometry_set_cast_shadows_setting(RID p_inst instance->cast_shadows = p_shadow_casting_setting; _instance_queue_update(instance, false, true); } + void RenderingServerScene::instance_geometry_set_material_override(RID p_instance, RID p_material) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); @@ -863,6 +874,7 @@ void RenderingServerScene::instance_geometry_set_material_override(RID p_instanc void RenderingServerScene::instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) { } + void RenderingServerScene::instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance) { } diff --git a/servers/rendering/rendering_server_viewport.cpp b/servers/rendering/rendering_server_viewport.cpp index 660c96e441..4491f699dc 100644 --- a/servers/rendering/rendering_server_viewport.cpp +++ b/servers/rendering/rendering_server_viewport.cpp @@ -589,12 +589,14 @@ void RenderingServerViewport::viewport_set_hide_scenario(RID p_viewport, bool p_ viewport->hide_scenario = p_hide; } + void RenderingServerViewport::viewport_set_hide_canvas(RID p_viewport, bool p_hide) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); viewport->hide_canvas = p_hide; } + void RenderingServerViewport::viewport_set_disable_environment(RID p_viewport, bool p_disable) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); @@ -608,12 +610,14 @@ void RenderingServerViewport::viewport_attach_camera(RID p_viewport, RID p_camer viewport->camera = p_camera; } + void RenderingServerViewport::viewport_set_scenario(RID p_viewport, RID p_scenario) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); viewport->scenario = p_scenario; } + void RenderingServerViewport::viewport_attach_canvas(RID p_viewport, RID p_canvas) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); @@ -639,6 +643,7 @@ void RenderingServerViewport::viewport_remove_canvas(RID p_viewport, RID p_canva viewport->canvas_map.erase(p_canvas); canvas->viewports.erase(p_viewport); } + void RenderingServerViewport::viewport_set_canvas_transform(RID p_viewport, RID p_canvas, const Transform2D &p_offset) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); @@ -646,6 +651,7 @@ void RenderingServerViewport::viewport_set_canvas_transform(RID p_viewport, RID ERR_FAIL_COND(!viewport->canvas_map.has(p_canvas)); viewport->canvas_map[p_canvas].transform = p_offset; } + void RenderingServerViewport::viewport_set_transparent_background(RID p_viewport, bool p_enabled) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); @@ -660,6 +666,7 @@ void RenderingServerViewport::viewport_set_global_canvas_transform(RID p_viewpor viewport->global_transform = p_transform; } + void RenderingServerViewport::viewport_set_canvas_stacking(RID p_viewport, RID p_canvas, int p_layer, int p_sublayer) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index e71c084aab..5db9e44084 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -3093,6 +3093,7 @@ bool ShaderLanguage::_propagate_function_call_sampler_uniform_settings(StringNam } ERR_FAIL_V(false); //bug? function not found } + bool ShaderLanguage::_propagate_function_call_sampler_builtin_reference(StringName p_name, int p_argument, const StringName &p_builtin) { for (int i = 0; shader->functions.size(); i++) { if (shader->functions[i].name == p_name) { |