diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/audio_listener_3d.cpp (renamed from scene/3d/listener_3d.cpp) | 54 | ||||
-rw-r--r-- | scene/3d/audio_listener_3d.h (renamed from scene/3d/listener_3d.h) | 10 | ||||
-rw-r--r-- | scene/3d/audio_stream_player_3d.cpp | 4 |
3 files changed, 34 insertions, 34 deletions
diff --git a/scene/3d/listener_3d.cpp b/scene/3d/audio_listener_3d.cpp index 8ae1f1940f..b2319e40d7 100644 --- a/scene/3d/listener_3d.cpp +++ b/scene/3d/audio_listener_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* listener_3d.cpp */ +/* audio_listener_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,18 +28,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "listener_3d.h" +#include "audio_listener_3d.h" #include "scene/main/viewport.h" -void Listener3D::_update_audio_listener_state() { +void AudioListener3D::_update_audio_listener_state() { } -void Listener3D::_request_listener_update() { +void AudioListener3D::_request_listener_update() { _update_listener(); } -bool Listener3D::_set(const StringName &p_name, const Variant &p_value) { +bool AudioListener3D::_set(const StringName &p_name, const Variant &p_value) { if (p_name == "current") { if (p_value.operator bool()) { make_current(); @@ -53,7 +53,7 @@ bool Listener3D::_set(const StringName &p_name, const Variant &p_value) { return true; } -bool Listener3D::_get(const StringName &p_name, Variant &r_ret) const { +bool AudioListener3D::_get(const StringName &p_name, Variant &r_ret) const { if (p_name == "current") { if (is_inside_tree() && get_tree()->is_node_being_edited(this)) { r_ret = current; @@ -67,20 +67,20 @@ bool Listener3D::_get(const StringName &p_name, Variant &r_ret) const { return true; } -void Listener3D::_get_property_list(List<PropertyInfo> *p_list) const { +void AudioListener3D::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::BOOL, "current")); } -void Listener3D::_update_listener() { +void AudioListener3D::_update_listener() { if (is_inside_tree() && is_current()) { get_viewport()->_listener_transform_3d_changed_notify(); } } -void Listener3D::_notification(int p_what) { +void AudioListener3D::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_WORLD: { - bool first_listener = get_viewport()->_listener_3d_add(this); + bool first_listener = get_viewport()->_audio_listener_3d_add(this); if (!get_tree()->is_node_being_edited(this) && (current || first_listener)) { make_current(); } @@ -99,41 +99,41 @@ void Listener3D::_notification(int p_what) { } } - get_viewport()->_listener_3d_remove(this); + get_viewport()->_audio_listener_3d_remove(this); } break; } } -Transform3D Listener3D::get_listener_transform() const { +Transform3D AudioListener3D::get_listener_transform() const { return get_global_transform().orthonormalized(); } -void Listener3D::make_current() { +void AudioListener3D::make_current() { current = true; if (!is_inside_tree()) { return; } - get_viewport()->_listener_3d_set(this); + get_viewport()->_audio_listener_3d_set(this); } -void Listener3D::clear_current() { +void AudioListener3D::clear_current() { current = false; if (!is_inside_tree()) { return; } - if (get_viewport()->get_listener_3d() == this) { - get_viewport()->_listener_3d_set(nullptr); - get_viewport()->_listener_3d_make_next_current(this); + if (get_viewport()->get_audio_listener_3d() == this) { + get_viewport()->_audio_listener_3d_set(nullptr); + get_viewport()->_audio_listener_3d_make_next_current(this); } } -bool Listener3D::is_current() const { +bool AudioListener3D::is_current() const { if (is_inside_tree() && !get_tree()->is_node_being_edited(this)) { - return get_viewport()->get_listener_3d() == this; + return get_viewport()->get_audio_listener_3d() == this; } else { return current; } @@ -141,16 +141,16 @@ bool Listener3D::is_current() const { return false; } -void Listener3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("make_current"), &Listener3D::make_current); - ClassDB::bind_method(D_METHOD("clear_current"), &Listener3D::clear_current); - ClassDB::bind_method(D_METHOD("is_current"), &Listener3D::is_current); - ClassDB::bind_method(D_METHOD("get_listener_transform"), &Listener3D::get_listener_transform); +void AudioListener3D::_bind_methods() { + ClassDB::bind_method(D_METHOD("make_current"), &AudioListener3D::make_current); + ClassDB::bind_method(D_METHOD("clear_current"), &AudioListener3D::clear_current); + ClassDB::bind_method(D_METHOD("is_current"), &AudioListener3D::is_current); + ClassDB::bind_method(D_METHOD("get_listener_transform"), &AudioListener3D::get_listener_transform); } -Listener3D::Listener3D() { +AudioListener3D::AudioListener3D() { set_notify_transform(true); } -Listener3D::~Listener3D() { +AudioListener3D::~AudioListener3D() { } diff --git a/scene/3d/listener_3d.h b/scene/3d/audio_listener_3d.h index 08c08aa0cb..492cacb0e9 100644 --- a/scene/3d/listener_3d.h +++ b/scene/3d/audio_listener_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* listener_3d.h */ +/* audio_listener_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -33,8 +33,8 @@ #include "scene/3d/node_3d.h" -class Listener3D : public Node3D { - GDCLASS(Listener3D, Node3D); +class AudioListener3D : public Node3D { + GDCLASS(AudioListener3D, Node3D); private: bool force_change = false; @@ -66,8 +66,8 @@ public: void set_visible_layers(uint32_t p_layers); uint32_t get_visible_layers() const; - Listener3D(); - ~Listener3D(); + AudioListener3D(); + ~AudioListener3D(); }; #endif diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 907c6cd03a..6c7cb6e61a 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -31,8 +31,8 @@ #include "audio_stream_player_3d.h" #include "scene/3d/area_3d.h" +#include "scene/3d/audio_listener_3d.h" #include "scene/3d/camera_3d.h" -#include "scene/3d/listener_3d.h" #include "scene/main/viewport.h" // Based on "A Novel Multichannel Panning Method for Standard and Arbitrary Loudspeaker Configurations" by Ramy Sadek and Chris Kyriakakis (2004) @@ -391,7 +391,7 @@ Vector<AudioFrame> AudioStreamPlayer3D::_update_panning() { bool listener_is_camera = true; Node3D *listener_node = camera; - Listener3D *listener = vp->get_listener_3d(); + AudioListener3D *listener = vp->get_audio_listener_3d(); if (listener) { listener_node = listener; listener_is_camera = false; |