diff options
Diffstat (limited to 'servers')
41 files changed, 107 insertions, 116 deletions
diff --git a/servers/audio/audio_effect.h b/servers/audio/audio_effect.h index 1274e06740..8ae716db20 100644 --- a/servers/audio/audio_effect.h +++ b/servers/audio/audio_effect.h @@ -35,7 +35,7 @@ #include "core/resource.h" class AudioEffectInstance : public Reference { - GDCLASS(AudioEffectInstance, Reference) + GDCLASS(AudioEffectInstance, Reference); public: virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) = 0; @@ -43,7 +43,8 @@ public: }; class AudioEffect : public Resource { - GDCLASS(AudioEffect, Resource) + GDCLASS(AudioEffect, Resource); + public: virtual Ref<AudioEffectInstance> instance() = 0; AudioEffect(); diff --git a/servers/audio/audio_filter_sw.cpp b/servers/audio/audio_filter_sw.cpp index 392938a2be..ca033f6079 100644 --- a/servers/audio/audio_filter_sw.cpp +++ b/servers/audio/audio_filter_sw.cpp @@ -154,7 +154,6 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) { double tmpq = Math::sqrt(Q); if (tmpq <= 0) tmpq = 0.001; - alpha = sin_v / (2 * tmpq); double beta = Math::sqrt(tmpgain) / tmpq; a0 = (tmpgain + 1.0) + (tmpgain - 1.0) * cos_v + beta * sin_v; @@ -169,7 +168,6 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) { double tmpq = Math::sqrt(Q); if (tmpq <= 0) tmpq = 0.001; - alpha = sin_v / (2 * tmpq); double beta = Math::sqrt(tmpgain) / tmpq; a0 = (tmpgain + 1.0) - (tmpgain - 1.0) * cos_v + beta * sin_v; diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index 98a137fd82..17f5e158a7 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -224,7 +224,7 @@ float AudioStreamPlaybackMicrophone::get_playback_position() const { } void AudioStreamPlaybackMicrophone::seek(float p_time) { - return; // Can't seek a microphone input + // Can't seek a microphone input } AudioStreamPlaybackMicrophone::~AudioStreamPlaybackMicrophone() { diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h index ab4ef5f91b..ef9f8ea92a 100644 --- a/servers/audio/audio_stream.h +++ b/servers/audio/audio_stream.h @@ -38,7 +38,7 @@ class AudioStreamPlayback : public Reference { - GDCLASS(AudioStreamPlayback, Reference) + GDCLASS(AudioStreamPlayback, Reference); public: virtual void start(float p_from_pos = 0.0) = 0; @@ -55,7 +55,7 @@ public: class AudioStreamPlaybackResampled : public AudioStreamPlayback { - GDCLASS(AudioStreamPlaybackResampled, AudioStreamPlayback) + GDCLASS(AudioStreamPlaybackResampled, AudioStreamPlayback); enum { FP_BITS = 16, //fixed point used for resampling @@ -81,7 +81,7 @@ public: class AudioStream : public Resource { - GDCLASS(AudioStream, Resource) + GDCLASS(AudioStream, Resource); OBJ_SAVE_TYPE(AudioStream) //children are all saved as AudioStream, so they can be exchanged protected: @@ -100,7 +100,7 @@ class AudioStreamPlaybackMicrophone; class AudioStreamMicrophone : public AudioStream { - GDCLASS(AudioStreamMicrophone, AudioStream) + GDCLASS(AudioStreamMicrophone, AudioStream); friend class AudioStreamPlaybackMicrophone; Set<AudioStreamPlaybackMicrophone *> playbacks; @@ -119,7 +119,7 @@ public: class AudioStreamPlaybackMicrophone : public AudioStreamPlaybackResampled { - GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlayback) + GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlaybackResampled); friend class AudioStreamMicrophone; bool active; @@ -153,7 +153,7 @@ class AudioStreamPlaybackRandomPitch; class AudioStreamRandomPitch : public AudioStream { - GDCLASS(AudioStreamRandomPitch, AudioStream) + GDCLASS(AudioStreamRandomPitch, AudioStream); friend class AudioStreamPlaybackRandomPitch; Set<AudioStreamPlaybackRandomPitch *> playbacks; @@ -180,7 +180,7 @@ public: class AudioStreamPlaybackRandomPitch : public AudioStreamPlayback { - GDCLASS(AudioStreamPlaybackRandomPitch, AudioStreamPlayback) + GDCLASS(AudioStreamPlaybackRandomPitch, AudioStreamPlayback); friend class AudioStreamRandomPitch; Ref<AudioStreamRandomPitch> random_pitch; diff --git a/servers/audio/effects/audio_effect_amplify.h b/servers/audio/effects/audio_effect_amplify.h index b6e2a1d4d8..4a98196d94 100644 --- a/servers/audio/effects/audio_effect_amplify.h +++ b/servers/audio/effects/audio_effect_amplify.h @@ -36,7 +36,7 @@ class AudioEffectAmplify; class AudioEffectAmplifyInstance : public AudioEffectInstance { - GDCLASS(AudioEffectAmplifyInstance, AudioEffectInstance) + GDCLASS(AudioEffectAmplifyInstance, AudioEffectInstance); friend class AudioEffectAmplify; Ref<AudioEffectAmplify> base; @@ -47,7 +47,7 @@ public: }; class AudioEffectAmplify : public AudioEffect { - GDCLASS(AudioEffectAmplify, AudioEffect) + GDCLASS(AudioEffectAmplify, AudioEffect); friend class AudioEffectAmplifyInstance; float volume_db; diff --git a/servers/audio/effects/audio_effect_chorus.h b/servers/audio/effects/audio_effect_chorus.h index 9cad2906ff..417cc0c035 100644 --- a/servers/audio/effects/audio_effect_chorus.h +++ b/servers/audio/effects/audio_effect_chorus.h @@ -36,7 +36,7 @@ class AudioEffectChorus; class AudioEffectChorusInstance : public AudioEffectInstance { - GDCLASS(AudioEffectChorusInstance, AudioEffectInstance) + GDCLASS(AudioEffectChorusInstance, AudioEffectInstance); friend class AudioEffectChorus; Ref<AudioEffectChorus> base; @@ -54,7 +54,7 @@ public: }; class AudioEffectChorus : public AudioEffect { - GDCLASS(AudioEffectChorus, AudioEffect) + GDCLASS(AudioEffectChorus, AudioEffect); friend class AudioEffectChorusInstance; diff --git a/servers/audio/effects/audio_effect_compressor.h b/servers/audio/effects/audio_effect_compressor.h index 3ea3a58cb2..0fe956f60b 100644 --- a/servers/audio/effects/audio_effect_compressor.h +++ b/servers/audio/effects/audio_effect_compressor.h @@ -36,7 +36,7 @@ class AudioEffectCompressor; class AudioEffectCompressorInstance : public AudioEffectInstance { - GDCLASS(AudioEffectCompressorInstance, AudioEffectInstance) + GDCLASS(AudioEffectCompressorInstance, AudioEffectInstance); friend class AudioEffectCompressor; Ref<AudioEffectCompressor> base; @@ -49,7 +49,7 @@ public: }; class AudioEffectCompressor : public AudioEffect { - GDCLASS(AudioEffectCompressor, AudioEffect) + GDCLASS(AudioEffectCompressor, AudioEffect); friend class AudioEffectCompressorInstance; float threshold; diff --git a/servers/audio/effects/audio_effect_delay.h b/servers/audio/effects/audio_effect_delay.h index 131b8714a0..ee778c70dc 100644 --- a/servers/audio/effects/audio_effect_delay.h +++ b/servers/audio/effects/audio_effect_delay.h @@ -36,7 +36,7 @@ class AudioEffectDelay; class AudioEffectDelayInstance : public AudioEffectInstance { - GDCLASS(AudioEffectDelayInstance, AudioEffectInstance) + GDCLASS(AudioEffectDelayInstance, AudioEffectInstance); friend class AudioEffectDelay; Ref<AudioEffectDelay> base; @@ -58,7 +58,7 @@ public: }; class AudioEffectDelay : public AudioEffect { - GDCLASS(AudioEffectDelay, AudioEffect) + GDCLASS(AudioEffectDelay, AudioEffect); friend class AudioEffectDelayInstance; enum { diff --git a/servers/audio/effects/audio_effect_distortion.h b/servers/audio/effects/audio_effect_distortion.h index 2cbffc81a1..0b5ad0ec9e 100644 --- a/servers/audio/effects/audio_effect_distortion.h +++ b/servers/audio/effects/audio_effect_distortion.h @@ -36,7 +36,7 @@ class AudioEffectDistortion; class AudioEffectDistortionInstance : public AudioEffectInstance { - GDCLASS(AudioEffectDistortionInstance, AudioEffectInstance) + GDCLASS(AudioEffectDistortionInstance, AudioEffectInstance); friend class AudioEffectDistortion; Ref<AudioEffectDistortion> base; float h[2]; @@ -46,7 +46,8 @@ public: }; class AudioEffectDistortion : public AudioEffect { - GDCLASS(AudioEffectDistortion, AudioEffect) + GDCLASS(AudioEffectDistortion, AudioEffect); + public: enum Mode { MODE_CLIP, diff --git a/servers/audio/effects/audio_effect_eq.h b/servers/audio/effects/audio_effect_eq.h index c9735b9073..dc75e566e7 100644 --- a/servers/audio/effects/audio_effect_eq.h +++ b/servers/audio/effects/audio_effect_eq.h @@ -37,7 +37,7 @@ class AudioEffectEQ; class AudioEffectEQInstance : public AudioEffectInstance { - GDCLASS(AudioEffectEQInstance, AudioEffectInstance) + GDCLASS(AudioEffectEQInstance, AudioEffectInstance); friend class AudioEffectEQ; Ref<AudioEffectEQ> base; @@ -49,7 +49,7 @@ public: }; class AudioEffectEQ : public AudioEffect { - GDCLASS(AudioEffectEQ, AudioEffect) + GDCLASS(AudioEffectEQ, AudioEffect); friend class AudioEffectEQInstance; @@ -75,21 +75,24 @@ public: }; class AudioEffectEQ6 : public AudioEffectEQ { - GDCLASS(AudioEffectEQ6, AudioEffectEQ) + GDCLASS(AudioEffectEQ6, AudioEffectEQ); + public: AudioEffectEQ6() : AudioEffectEQ(EQ::PRESET_6_BANDS) {} }; class AudioEffectEQ10 : public AudioEffectEQ { - GDCLASS(AudioEffectEQ10, AudioEffectEQ) + GDCLASS(AudioEffectEQ10, AudioEffectEQ); + public: AudioEffectEQ10() : AudioEffectEQ(EQ::PRESET_10_BANDS) {} }; class AudioEffectEQ21 : public AudioEffectEQ { - GDCLASS(AudioEffectEQ21, AudioEffectEQ) + GDCLASS(AudioEffectEQ21, AudioEffectEQ); + public: AudioEffectEQ21() : AudioEffectEQ(EQ::PRESET_21_BANDS) {} diff --git a/servers/audio/effects/audio_effect_filter.h b/servers/audio/effects/audio_effect_filter.h index fd9a4bcf07..bb0d451522 100644 --- a/servers/audio/effects/audio_effect_filter.h +++ b/servers/audio/effects/audio_effect_filter.h @@ -37,7 +37,7 @@ class AudioEffectFilter; class AudioEffectFilterInstance : public AudioEffectInstance { - GDCLASS(AudioEffectFilterInstance, AudioEffectInstance) + GDCLASS(AudioEffectFilterInstance, AudioEffectInstance); friend class AudioEffectFilter; Ref<AudioEffectFilter> base; @@ -55,7 +55,8 @@ public: }; class AudioEffectFilter : public AudioEffect { - GDCLASS(AudioEffectFilter, AudioEffect) + GDCLASS(AudioEffectFilter, AudioEffect); + public: enum FilterDB { FILTER_6DB, @@ -95,7 +96,7 @@ public: VARIANT_ENUM_CAST(AudioEffectFilter::FilterDB) class AudioEffectLowPassFilter : public AudioEffectFilter { - GDCLASS(AudioEffectLowPassFilter, AudioEffectFilter) + GDCLASS(AudioEffectLowPassFilter, AudioEffectFilter); void _validate_property(PropertyInfo &property) const { if (property.name == "gain") property.usage = 0; @@ -107,7 +108,7 @@ public: }; class AudioEffectHighPassFilter : public AudioEffectFilter { - GDCLASS(AudioEffectHighPassFilter, AudioEffectFilter) + GDCLASS(AudioEffectHighPassFilter, AudioEffectFilter); void _validate_property(PropertyInfo &property) const { if (property.name == "gain") property.usage = 0; } @@ -118,7 +119,7 @@ public: }; class AudioEffectBandPassFilter : public AudioEffectFilter { - GDCLASS(AudioEffectBandPassFilter, AudioEffectFilter) + GDCLASS(AudioEffectBandPassFilter, AudioEffectFilter); void _validate_property(PropertyInfo &property) const { if (property.name == "gain") property.usage = 0; } @@ -129,28 +130,32 @@ public: }; class AudioEffectNotchFilter : public AudioEffectFilter { - GDCLASS(AudioEffectNotchFilter, AudioEffectFilter) + GDCLASS(AudioEffectNotchFilter, AudioEffectFilter); + public: AudioEffectNotchFilter() : AudioEffectFilter(AudioFilterSW::NOTCH) {} }; class AudioEffectBandLimitFilter : public AudioEffectFilter { - GDCLASS(AudioEffectBandLimitFilter, AudioEffectFilter) + GDCLASS(AudioEffectBandLimitFilter, AudioEffectFilter); + public: AudioEffectBandLimitFilter() : AudioEffectFilter(AudioFilterSW::BANDLIMIT) {} }; class AudioEffectLowShelfFilter : public AudioEffectFilter { - GDCLASS(AudioEffectLowShelfFilter, AudioEffectFilter) + GDCLASS(AudioEffectLowShelfFilter, AudioEffectFilter); + public: AudioEffectLowShelfFilter() : AudioEffectFilter(AudioFilterSW::LOWSHELF) {} }; class AudioEffectHighShelfFilter : public AudioEffectFilter { - GDCLASS(AudioEffectHighShelfFilter, AudioEffectFilter) + GDCLASS(AudioEffectHighShelfFilter, AudioEffectFilter); + public: AudioEffectHighShelfFilter() : AudioEffectFilter(AudioFilterSW::HIGHSHELF) {} diff --git a/servers/audio/effects/audio_effect_limiter.h b/servers/audio/effects/audio_effect_limiter.h index d629166f42..bf7167e3f4 100644 --- a/servers/audio/effects/audio_effect_limiter.h +++ b/servers/audio/effects/audio_effect_limiter.h @@ -36,7 +36,7 @@ class AudioEffectLimiter; class AudioEffectLimiterInstance : public AudioEffectInstance { - GDCLASS(AudioEffectLimiterInstance, AudioEffectInstance) + GDCLASS(AudioEffectLimiterInstance, AudioEffectInstance); friend class AudioEffectLimiter; Ref<AudioEffectLimiter> base; @@ -47,7 +47,7 @@ public: }; class AudioEffectLimiter : public AudioEffect { - GDCLASS(AudioEffectLimiter, AudioEffect) + GDCLASS(AudioEffectLimiter, AudioEffect); friend class AudioEffectLimiterInstance; float threshold; diff --git a/servers/audio/effects/audio_effect_panner.h b/servers/audio/effects/audio_effect_panner.h index 4256d05a2f..7bd5a09fc6 100644 --- a/servers/audio/effects/audio_effect_panner.h +++ b/servers/audio/effects/audio_effect_panner.h @@ -36,7 +36,7 @@ class AudioEffectPanner; class AudioEffectPannerInstance : public AudioEffectInstance { - GDCLASS(AudioEffectPannerInstance, AudioEffectInstance) + GDCLASS(AudioEffectPannerInstance, AudioEffectInstance); friend class AudioEffectPanner; Ref<AudioEffectPanner> base; @@ -45,7 +45,7 @@ public: }; class AudioEffectPanner : public AudioEffect { - GDCLASS(AudioEffectPanner, AudioEffect) + GDCLASS(AudioEffectPanner, AudioEffect); friend class AudioEffectPannerInstance; float pan; diff --git a/servers/audio/effects/audio_effect_phaser.h b/servers/audio/effects/audio_effect_phaser.h index 264e792be5..b76d6bb29c 100644 --- a/servers/audio/effects/audio_effect_phaser.h +++ b/servers/audio/effects/audio_effect_phaser.h @@ -36,7 +36,7 @@ class AudioEffectPhaser; class AudioEffectPhaserInstance : public AudioEffectInstance { - GDCLASS(AudioEffectPhaserInstance, AudioEffectInstance) + GDCLASS(AudioEffectPhaserInstance, AudioEffectInstance); friend class AudioEffectPhaser; Ref<AudioEffectPhaser> base; @@ -70,7 +70,7 @@ public: }; class AudioEffectPhaser : public AudioEffect { - GDCLASS(AudioEffectPhaser, AudioEffect) + GDCLASS(AudioEffectPhaser, AudioEffect); friend class AudioEffectPhaserInstance; float range_min; diff --git a/servers/audio/effects/audio_effect_pitch_shift.h b/servers/audio/effects/audio_effect_pitch_shift.h index 0c80cb6344..2028496ebf 100644 --- a/servers/audio/effects/audio_effect_pitch_shift.h +++ b/servers/audio/effects/audio_effect_pitch_shift.h @@ -72,7 +72,7 @@ public: class AudioEffectPitchShift; class AudioEffectPitchShiftInstance : public AudioEffectInstance { - GDCLASS(AudioEffectPitchShiftInstance, AudioEffectInstance) + GDCLASS(AudioEffectPitchShiftInstance, AudioEffectInstance); friend class AudioEffectPitchShift; Ref<AudioEffectPitchShift> base; @@ -85,8 +85,11 @@ public: }; class AudioEffectPitchShift : public AudioEffect { - GDCLASS(AudioEffectPitchShift, AudioEffect) + GDCLASS(AudioEffectPitchShift, AudioEffect); + public: + friend class AudioEffectPitchShiftInstance; + enum FFT_Size { FFT_SIZE_256, FFT_SIZE_512, @@ -96,9 +99,6 @@ public: FFT_SIZE_MAX }; -public: - friend class AudioEffectPitchShiftInstance; - float pitch_scale; int oversampling; FFT_Size fft_size; diff --git a/servers/audio/effects/audio_effect_record.h b/servers/audio/effects/audio_effect_record.h index 528c7dbd7c..d9bf39eb5f 100644 --- a/servers/audio/effects/audio_effect_record.h +++ b/servers/audio/effects/audio_effect_record.h @@ -43,7 +43,7 @@ class AudioEffectRecord; class AudioEffectRecordInstance : public AudioEffectInstance { - GDCLASS(AudioEffectRecordInstance, AudioEffectInstance) + GDCLASS(AudioEffectRecordInstance, AudioEffectInstance); friend class AudioEffectRecord; Ref<AudioEffectRecord> base; @@ -77,7 +77,7 @@ public: }; class AudioEffectRecord : public AudioEffect { - GDCLASS(AudioEffectRecord, AudioEffect) + GDCLASS(AudioEffectRecord, AudioEffect); friend class AudioEffectRecordInstance; diff --git a/servers/audio/effects/audio_effect_reverb.h b/servers/audio/effects/audio_effect_reverb.h index ed76050f24..31a796bf98 100644 --- a/servers/audio/effects/audio_effect_reverb.h +++ b/servers/audio/effects/audio_effect_reverb.h @@ -37,7 +37,7 @@ class AudioEffectReverb; class AudioEffectReverbInstance : public AudioEffectInstance { - GDCLASS(AudioEffectReverbInstance, AudioEffectInstance) + GDCLASS(AudioEffectReverbInstance, AudioEffectInstance); Ref<AudioEffectReverb> base; @@ -54,7 +54,7 @@ public: }; class AudioEffectReverb : public AudioEffect { - GDCLASS(AudioEffectReverb, AudioEffect) + GDCLASS(AudioEffectReverb, AudioEffect); friend class AudioEffectReverbInstance; diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp index 305f9046c3..bb1daf04a4 100644 --- a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp +++ b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp @@ -231,8 +231,8 @@ Ref<AudioEffectInstance> AudioEffectSpectrumAnalyzer::instance() { return ins; } -void AudioEffectSpectrumAnalyzer::set_buffer_length(float p_volume) { - buffer_length = p_volume; +void AudioEffectSpectrumAnalyzer::set_buffer_length(float p_seconds) { + buffer_length = p_seconds; } float AudioEffectSpectrumAnalyzer::get_buffer_length() const { diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.h b/servers/audio/effects/audio_effect_spectrum_analyzer.h index 4f4c3c8a58..27eb88d29f 100644 --- a/servers/audio/effects/audio_effect_spectrum_analyzer.h +++ b/servers/audio/effects/audio_effect_spectrum_analyzer.h @@ -36,7 +36,7 @@ class AudioEffectSpectrumAnalyzer; class AudioEffectSpectrumAnalyzerInstance : public AudioEffectInstance { - GDCLASS(AudioEffectSpectrumAnalyzerInstance, AudioEffectInstance) + GDCLASS(AudioEffectSpectrumAnalyzerInstance, AudioEffectInstance); public: enum MagnitudeMode { @@ -68,7 +68,8 @@ public: VARIANT_ENUM_CAST(AudioEffectSpectrumAnalyzerInstance::MagnitudeMode) class AudioEffectSpectrumAnalyzer : public AudioEffect { - GDCLASS(AudioEffectSpectrumAnalyzer, AudioEffect) + GDCLASS(AudioEffectSpectrumAnalyzer, AudioEffect); + public: enum FFT_Size { FFT_SIZE_256, diff --git a/servers/audio/effects/audio_effect_stereo_enhance.h b/servers/audio/effects/audio_effect_stereo_enhance.h index 787c351a03..44b7d3eb5c 100644 --- a/servers/audio/effects/audio_effect_stereo_enhance.h +++ b/servers/audio/effects/audio_effect_stereo_enhance.h @@ -36,7 +36,7 @@ class AudioEffectStereoEnhance; class AudioEffectStereoEnhanceInstance : public AudioEffectInstance { - GDCLASS(AudioEffectStereoEnhanceInstance, AudioEffectInstance) + GDCLASS(AudioEffectStereoEnhanceInstance, AudioEffectInstance); friend class AudioEffectStereoEnhance; Ref<AudioEffectStereoEnhance> base; @@ -56,7 +56,7 @@ public: }; class AudioEffectStereoEnhance : public AudioEffect { - GDCLASS(AudioEffectStereoEnhance, AudioEffect) + GDCLASS(AudioEffectStereoEnhance, AudioEffect); friend class AudioEffectStereoEnhanceInstance; float volume_db; diff --git a/servers/audio/effects/audio_stream_generator.h b/servers/audio/effects/audio_stream_generator.h index c3490ddaa5..33839d3db8 100644 --- a/servers/audio/effects/audio_stream_generator.h +++ b/servers/audio/effects/audio_stream_generator.h @@ -35,7 +35,7 @@ #include "servers/audio/audio_stream.h" class AudioStreamGenerator : public AudioStream { - GDCLASS(AudioStreamGenerator, AudioStream) + GDCLASS(AudioStreamGenerator, AudioStream); float mix_rate; float buffer_len; @@ -59,7 +59,7 @@ public: class AudioStreamGeneratorPlayback : public AudioStreamPlaybackResampled { - GDCLASS(AudioStreamGeneratorPlayback, AudioStreamPlaybackResampled) + GDCLASS(AudioStreamGeneratorPlayback, AudioStreamPlaybackResampled); friend class AudioStreamGenerator; RingBuffer<AudioFrame> buffer; int skips; diff --git a/servers/audio_server.h b/servers/audio_server.h index f62c35d4ab..b0fff9d4b7 100644 --- a/servers/audio_server.h +++ b/servers/audio_server.h @@ -147,7 +147,8 @@ class AudioBusLayout; class AudioServer : public Object { - GDCLASS(AudioServer, Object) + GDCLASS(AudioServer, Object); + public: //re-expose this here, as AudioDriver is not exposed to script enum SpeakerMode { @@ -395,7 +396,7 @@ VARIANT_ENUM_CAST(AudioServer::SpeakerMode) class AudioBusLayout : public Resource { - GDCLASS(AudioBusLayout, Resource) + GDCLASS(AudioBusLayout, Resource); friend class AudioServer; diff --git a/servers/camera/camera_feed.cpp b/servers/camera/camera_feed.cpp index 31b8b2874f..094c83cd7c 100644 --- a/servers/camera/camera_feed.cpp +++ b/servers/camera/camera_feed.cpp @@ -60,8 +60,8 @@ void CameraFeed::_bind_methods() { BIND_ENUM_CONSTANT(FEED_NOIMAGE); BIND_ENUM_CONSTANT(FEED_RGB); - BIND_ENUM_CONSTANT(FEED_YCbCr); - BIND_ENUM_CONSTANT(FEED_YCbCr_Sep); + BIND_ENUM_CONSTANT(FEED_YCBCR); + BIND_ENUM_CONSTANT(FEED_YCBCR_SEP); BIND_ENUM_CONSTANT(FEED_UNSPECIFIED); BIND_ENUM_CONSTANT(FEED_FRONT); @@ -145,7 +145,7 @@ CameraFeed::CameraFeed() { // create a texture object VisualServer *vs = VisualServer::get_singleton(); texture[CameraServer::FEED_Y_IMAGE] = vs->texture_create(); // also used for RGBA - texture[CameraServer::FEED_CbCr_IMAGE] = vs->texture_create(); + texture[CameraServer::FEED_CBCR_IMAGE] = vs->texture_create(); } CameraFeed::CameraFeed(String p_name, FeedPosition p_position) { @@ -162,14 +162,14 @@ CameraFeed::CameraFeed(String p_name, FeedPosition p_position) { // create a texture object VisualServer *vs = VisualServer::get_singleton(); texture[CameraServer::FEED_Y_IMAGE] = vs->texture_create(); // also used for RGBA - texture[CameraServer::FEED_CbCr_IMAGE] = vs->texture_create(); + texture[CameraServer::FEED_CBCR_IMAGE] = vs->texture_create(); } CameraFeed::~CameraFeed() { // Free our textures VisualServer *vs = VisualServer::get_singleton(); vs->free(texture[CameraServer::FEED_Y_IMAGE]); - vs->free(texture[CameraServer::FEED_CbCr_IMAGE]); + vs->free(texture[CameraServer::FEED_CBCR_IMAGE]); } void CameraFeed::set_RGB_img(Ref<Image> p_rgb_img) { @@ -208,7 +208,7 @@ void CameraFeed::set_YCbCr_img(Ref<Image> p_ycbcr_img) { } vs->texture_set_data(texture[CameraServer::FEED_RGBA_IMAGE], p_ycbcr_img); - datatype = CameraFeed::FEED_YCbCr; + datatype = CameraFeed::FEED_YCBCR; } } @@ -233,12 +233,12 @@ void CameraFeed::set_YCbCr_imgs(Ref<Image> p_y_img, Ref<Image> p_cbcr_img) { vs->texture_allocate(texture[CameraServer::FEED_Y_IMAGE], new_y_width, new_y_height, 0, Image::FORMAT_R8, VS::TEXTURE_TYPE_2D, VS::TEXTURE_FLAG_USED_FOR_STREAMING); ///@TODO GLES2 doesn't support FORMAT_RG8, need to do some form of conversion - vs->texture_allocate(texture[CameraServer::FEED_CbCr_IMAGE], new_cbcr_width, new_cbcr_height, 0, Image::FORMAT_RG8, VS::TEXTURE_TYPE_2D, VS::TEXTURE_FLAG_USED_FOR_STREAMING); + vs->texture_allocate(texture[CameraServer::FEED_CBCR_IMAGE], new_cbcr_width, new_cbcr_height, 0, Image::FORMAT_RG8, VS::TEXTURE_TYPE_2D, VS::TEXTURE_FLAG_USED_FOR_STREAMING); } vs->texture_set_data(texture[CameraServer::FEED_Y_IMAGE], p_y_img); - vs->texture_set_data(texture[CameraServer::FEED_CbCr_IMAGE], p_cbcr_img); - datatype = CameraFeed::FEED_YCbCr_Sep; + vs->texture_set_data(texture[CameraServer::FEED_CBCR_IMAGE], p_cbcr_img); + datatype = CameraFeed::FEED_YCBCR_SEP; } } diff --git a/servers/camera/camera_feed.h b/servers/camera/camera_feed.h index 90c076071c..0c53ff9309 100644 --- a/servers/camera/camera_feed.h +++ b/servers/camera/camera_feed.h @@ -50,8 +50,8 @@ public: enum FeedDataType { FEED_NOIMAGE, // we don't have an image yet FEED_RGB, // our texture will contain a normal RGB texture that can be used directly - FEED_YCbCr, // our texture will contain a YCbCr texture that needs to be converted to RGB before output - FEED_YCbCr_Sep // our camera is split into two textures, first plane contains Y data, second plane contains CbCr data + FEED_YCBCR, // our texture will contain a YCbCr texture that needs to be converted to RGB before output + FEED_YCBCR_SEP // our camera is split into two textures, first plane contains Y data, second plane contains CbCr data }; enum FeedPosition { diff --git a/servers/camera_server.cpp b/servers/camera_server.cpp index 8d2ae37001..0f93221072 100644 --- a/servers/camera_server.cpp +++ b/servers/camera_server.cpp @@ -47,9 +47,9 @@ void CameraServer::_bind_methods() { ADD_SIGNAL(MethodInfo("camera_feed_removed", PropertyInfo(Variant::INT, "id"))); BIND_ENUM_CONSTANT(FEED_RGBA_IMAGE); - BIND_ENUM_CONSTANT(FEED_YCbCr_IMAGE); + BIND_ENUM_CONSTANT(FEED_YCBCR_IMAGE); BIND_ENUM_CONSTANT(FEED_Y_IMAGE); - BIND_ENUM_CONSTANT(FEED_CbCr_IMAGE); + BIND_ENUM_CONSTANT(FEED_CBCR_IMAGE); }; CameraServer *CameraServer::singleton = NULL; diff --git a/servers/camera_server.h b/servers/camera_server.h index d204142c7d..5a62af3d60 100644 --- a/servers/camera_server.h +++ b/servers/camera_server.h @@ -53,9 +53,9 @@ class CameraServer : public Object { public: enum FeedImage { FEED_RGBA_IMAGE = 0, - FEED_YCbCr_IMAGE = 0, + FEED_YCBCR_IMAGE = 0, FEED_Y_IMAGE = 0, - FEED_CbCr_IMAGE = 1, + FEED_CBCR_IMAGE = 1, FEED_IMAGES = 2 }; diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp index b4c3670a7b..172a2a3429 100644 --- a/servers/physics/body_sw.cpp +++ b/servers/physics/body_sw.cpp @@ -346,8 +346,7 @@ void BodySW::set_state(PhysicsServer::BodyState p_state, const Variant &p_varian //biased_angular_velocity=Vector3(); set_active(false); } else { - if (mode != PhysicsServer::BODY_MODE_STATIC) - set_active(true); + set_active(true); } } break; case PhysicsServer::BODY_STATE_CAN_SLEEP: { diff --git a/servers/physics/broad_phase_octree.cpp b/servers/physics/broad_phase_octree.cpp index 94bf274f9c..1b59779bd6 100644 --- a/servers/physics/broad_phase_octree.cpp +++ b/servers/physics/broad_phase_octree.cpp @@ -45,7 +45,7 @@ void BroadPhaseOctree::move(ID p_id, const AABB &p_aabb) { void BroadPhaseOctree::set_static(ID p_id, bool p_static) { CollisionObjectSW *it = octree.get(p_id); - octree.set_pairable(p_id, p_static ? false : true, 1 << it->get_type(), p_static ? 0 : 0xFFFFF); //pair everything, don't care 1? + 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) { diff --git a/servers/physics/collision_solver_sat.cpp b/servers/physics/collision_solver_sat.cpp index 3073cc8b11..a13fa65009 100644 --- a/servers/physics/collision_solver_sat.cpp +++ b/servers/physics/collision_solver_sat.cpp @@ -538,8 +538,6 @@ static void _collision_sphere_capsule(const ShapeSW *p_a, const Transform &p_tra template <bool withMargin> static void _collision_sphere_cylinder(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) { - - return; } template <bool withMargin> @@ -835,8 +833,6 @@ static void _collision_box_capsule(const ShapeSW *p_a, const Transform &p_transf template <bool withMargin> static void _collision_box_cylinder(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) { - - return; } template <bool withMargin> @@ -1117,8 +1113,6 @@ static void _collision_capsule_capsule(const ShapeSW *p_a, const Transform &p_tr template <bool withMargin> static void _collision_capsule_cylinder(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) { - - return; } template <bool withMargin> @@ -1243,20 +1237,14 @@ static void _collision_capsule_face(const ShapeSW *p_a, const Transform &p_trans template <bool withMargin> static void _collision_cylinder_cylinder(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) { - - return; } template <bool withMargin> static void _collision_cylinder_convex_polygon(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) { - - return; } template <bool withMargin> static void _collision_cylinder_face(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) { - - return; } template <bool withMargin> diff --git a/servers/physics/gjk_epa.cpp b/servers/physics/gjk_epa.cpp index ae512183fd..1d5ca42838 100644 --- a/servers/physics/gjk_epa.cpp +++ b/servers/physics/gjk_epa.cpp @@ -722,7 +722,10 @@ struct GJK append(m_stock,face); return(0); } - m_status=m_stock.root?eStatus::OutOfVertices:eStatus::OutOfFaces; + // -- GODOT start -- + //m_status=m_stock.root?eStatus::OutOfVertices:eStatus::OutOfFaces; + m_status=eStatus::OutOfFaces; + // -- GODOT end -- return(0); } sFace* findbest() diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp index 813d9b7704..a9fe045856 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.cpp +++ b/servers/physics/joints/generic_6dof_joint_sw.cpp @@ -421,7 +421,6 @@ void Generic6DOFJointSW::calcAnchorPos(void) { const Vector3 &pA = m_calculatedTransformA.origin; const Vector3 &pB = m_calculatedTransformB.origin; m_AnchorPos = pA * weight + pB * (real_t(1.0) - weight); - return; } // Generic6DOFJointSW::calcAnchorPos() void Generic6DOFJointSW::set_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param, real_t p_value) { diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index 8b9f210850..f3a4cbed24 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -118,7 +118,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto if (!_can_collide_with(space->intersection_query_results[i], p_collision_mask, p_collide_with_bodies, p_collide_with_areas)) continue; - if (p_pick_ray && !(static_cast<CollisionObjectSW *>(space->intersection_query_results[i])->is_ray_pickable())) + if (p_pick_ray && !(space->intersection_query_results[i]->is_ray_pickable())) continue; if (p_exclude.has(space->intersection_query_results[i]->get_self())) @@ -439,7 +439,7 @@ bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_ continue; } - if (rcd.best_len == 0) + if (rcd.best_len == 0 || !rcd.best_object) return false; r_info->collider_id = rcd.best_object->get_instance_id(); diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index e2b1bb9da4..7c89c43f36 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -442,7 +442,7 @@ bool Physics2DDirectSpaceStateSW::rest_info(RID p_shape, const Transform2D &p_sh continue; } - if (rcd.best_len == 0) + if (rcd.best_len == 0 || !rcd.best_object) return false; r_info->collider_id = rcd.best_object->get_instance_id(); diff --git a/servers/server_wrap_mt_common.h b/servers/server_wrap_mt_common.h index f0ab256374..a6f595d776 100644 --- a/servers/server_wrap_mt_common.h +++ b/servers/server_wrap_mt_common.h @@ -50,7 +50,7 @@ } \ void m_type##_free_cached_ids() { \ while (m_type##_id_pool.size()) { \ - free(m_type##_id_pool.front()->get()); \ + server_name->free(m_type##_id_pool.front()->get()); \ m_type##_id_pool.pop_front(); \ } \ } \ diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index bc6010117c..75910ff1c0 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -137,6 +137,8 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4); shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["NORMAL"] = constt(ShaderLanguage::TYPE_VEC3); + shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2); + shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["UV2"] = constt(ShaderLanguage::TYPE_VEC2); shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["VIEW"] = constt(ShaderLanguage::TYPE_VEC3); shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT"] = constt(ShaderLanguage::TYPE_VEC3); shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT_COLOR"] = constt(ShaderLanguage::TYPE_VEC3); diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index d5e154a7fc..66e2429bd0 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -783,7 +783,7 @@ void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector ERR_FAIL_COND(!p_bones.empty() && p_bones.size() != vertex_count * 4); ERR_FAIL_COND(!p_weights.empty() && p_weights.size() != vertex_count * 4); - Vector<int> indices = p_indices; + const Vector<int> &indices = p_indices; int count = p_count * 3; diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h index 26424f927e..28a8770c90 100644 --- a/servers/visual/visual_server_canvas.h +++ b/servers/visual/visual_server_canvas.h @@ -84,8 +84,8 @@ public: if (Math::is_equal_approx(p_left->ysort_pos.y, p_right->ysort_pos.y)) return p_left->ysort_pos.x < p_right->ysort_pos.x; - else - return p_left->ysort_pos.y < p_right->ysort_pos.y; + + return p_left->ysort_pos.y < p_right->ysort_pos.y; } }; diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 3ee23e9290..faf5a1f8fa 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -3387,11 +3387,7 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) { RID mat = VSG::storage->immediate_get_material(p_instance->base); - if (!mat.is_valid() || VSG::storage->material_casts_shadows(mat)) { - can_cast_shadows = true; - } else { - can_cast_shadows = false; - } + can_cast_shadows = !mat.is_valid() || VSG::storage->material_casts_shadows(mat); if (mat.is_valid() && VSG::storage->material_is_animated(mat)) { is_animated = true; diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index b7c54caffd..f8ed035766 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -253,8 +253,6 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E } else { _draw_3d(p_viewport, p_eye); } - - scenario_draw_canvas_bg = false; } //VSG::canvas_render->canvas_debug_viewport_shadows(lights_with_shadow); diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h index 43bbcb66c3..bdd4c1d4f2 100644 --- a/servers/visual/visual_server_viewport.h +++ b/servers/visual/visual_server_viewport.h @@ -138,9 +138,8 @@ public: if (left_to_screen == right_to_screen) { return p_left->parent == p_right->self; - } else { - return right_to_screen; } + return right_to_screen; } }; diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 60be63fd24..c6468694fd 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -917,7 +917,7 @@ uint32_t VisualServer::mesh_surface_make_offsets_from_format(uint32_t p_format, } r_offsets[i] = elem_size; continue; - } break; + } default: { ERR_FAIL_V(0); } @@ -953,15 +953,12 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim switch (var.get_type()) { case Variant::POOL_VECTOR2_ARRAY: { PoolVector<Vector2> v2 = var; - array_len = v2.size(); } break; case Variant::POOL_VECTOR3_ARRAY: { PoolVector<Vector3> v3 = var; - array_len = v3.size(); } break; default: { Array v = var; - array_len = v.size(); } break; } @@ -1151,7 +1148,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim if (err) { ERR_EXPLAIN("Invalid array format for surface"); - ERR_FAIL_COND(err != OK); + ERR_FAIL(); } Vector<PoolVector<uint8_t> > blend_shape_data; @@ -1165,9 +1162,9 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim AABB laabb; Error err2 = _surface_set_data(p_blend_shapes[i], format & ~ARRAY_FORMAT_INDEX, offsets, total_elem_size, vertex_array_shape, array_len, noindex, 0, laabb, bone_aabb); aabb.merge_with(laabb); - if (err2) { + if (err2 != OK) { ERR_EXPLAIN("Invalid blend shape array format for surface"); - ERR_FAIL_COND(err2 != OK); + ERR_FAIL(); } blend_shape_data.push_back(vertex_array_shape); |