summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-07 16:30:22 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-07 16:30:22 +0100
commit743e26d4f93ba277e6af33c75de6b65b8c592084 (patch)
treeae12cc998c1390ed010fe98e42c63267f98aa0fa /scene
parent7ebd8b502d1f0838c7278b29102bbb98377c152b (diff)
parent826e54fa7356a16f67730f08e4a6fcc8c33c6622 (diff)
Merge pull request #72829 from Sauermann/fix-code-simplifications
Some code simplifications
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/audio_stream_player_3d.cpp11
-rw-r--r--scene/animation/animation_player.cpp2
-rw-r--r--scene/main/viewport.cpp2
3 files changed, 6 insertions, 9 deletions
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 436b936586..77bf15125e 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -162,12 +162,10 @@ void AudioStreamPlayer3D::_calc_reverb_vol(Area3D *area, Vector3 listener_area_p
rev_pos.y = 0;
rev_pos.normalize();
- if (channel_count >= 1) {
- // Stereo pair
- float c = rev_pos.x * 0.5 + 0.5;
- reverb_vol.write[0].l = 1.0 - c;
- reverb_vol.write[0].r = c;
- }
+ // Stereo pair.
+ float c = rev_pos.x * 0.5 + 0.5;
+ reverb_vol.write[0].l = 1.0 - c;
+ reverb_vol.write[0].r = c;
if (channel_count >= 3) {
// Center pair + Side pair
@@ -183,7 +181,6 @@ void AudioStreamPlayer3D::_calc_reverb_vol(Area3D *area, Vector3 listener_area_p
if (channel_count >= 4) {
// Rear pair
// FIXME: Not sure what math should be done here
- float c = rev_pos.x * 0.5 + 0.5;
reverb_vol.write[3].l = 1.0 - c;
reverb_vol.write[3].r = c;
}
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 8087ac6250..ad0c19b1e6 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -1233,7 +1233,7 @@ void AnimationPlayer::_animation_update_transforms() {
if (aa->time < pasi.start) {
stop = true;
}
- } else if (aa->backward) {
+ } else {
if (aa->time > pasi.start) {
stop = true;
}
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index c064d97eea..89f0fd2039 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -380,7 +380,7 @@ void Viewport::_notification(int p_what) {
if (get_tree()->is_debugging_collisions_hint()) {
PhysicsServer2D::get_singleton()->space_set_debug_contacts(find_world_2d()->get_space(), get_tree()->get_collision_debug_contact_count());
contact_2d_debug = RenderingServer::get_singleton()->canvas_item_create();
- RenderingServer::get_singleton()->canvas_item_set_parent(contact_2d_debug, find_world_2d()->get_canvas());
+ RenderingServer::get_singleton()->canvas_item_set_parent(contact_2d_debug, current_canvas);
#ifndef _3D_DISABLED
PhysicsServer3D::get_singleton()->space_set_debug_contacts(find_world_3d()->get_space(), get_tree()->get_collision_debug_contact_count());
contact_3d_debug_multimesh = RenderingServer::get_singleton()->multimesh_create();