diff options
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 8 | ||||
-rw-r--r-- | scene/audio/audio_player.cpp | 9 |
2 files changed, 9 insertions, 8 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 25115bc18a..7692a0932a 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -941,12 +941,12 @@ LIGHT_SHADER_CODE vec3 H = normalize(V + L); float NoL = max(0.0,dot(N, L)); - float VoH = max(0.0,dot(L, H)); + float LoH = max(0.0,dot(L, H)); float NoV = max(0.0,dot(N, V)); - float FD90 = 0.5 + 2.0 * VoH * VoH * roughness; - float FdV = 1.0 + (FD90 - 1.0) * pow( 1.0 - NoV, 5.0 ); - float FdL = 1.0 + (FD90 - 1.0) * pow( 1.0 - NoL, 5.0 ); + float FD90 = 0.5 + 2.0 * LoH * LoH * roughness; + float FdV = 1.0 + (FD90 - 1.0) * SchlickFresnel(NoV); + float FdL = 1.0 + (FD90 - 1.0) * SchlickFresnel(NoL); light_amount = ( (1.0 / M_PI) * FdV * FdL ); /* float energyBias = mix(roughness, 0.0, 0.5); diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp index 14dd39a491..058b162e83 100644 --- a/scene/audio/audio_player.cpp +++ b/scene/audio/audio_player.cpp @@ -122,7 +122,6 @@ void AudioStreamPlayer::_notification(int p_what) { void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) { - ERR_FAIL_COND(!p_stream.is_valid()); AudioServer::get_singleton()->lock(); mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size()); @@ -134,12 +133,14 @@ void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) { setseek = -1; } - stream = p_stream; - stream_playback = p_stream->instance_playback(); + if (p_stream.is_valid()) { + stream = p_stream; + stream_playback = p_stream->instance_playback(); + } AudioServer::get_singleton()->unlock(); - if (stream_playback.is_null()) { + if (p_stream.is_valid() && stream_playback.is_null()) { stream.unref(); ERR_FAIL_COND(stream_playback.is_null()); } |