diff --git a/CSFML/build/VC2008/csfml-audio-d.def b/CSFML/build/VC2008/csfml-audio-d.def index 1e7c9ba6..253fa36d 100644 --- a/CSFML/build/VC2008/csfml-audio-d.def +++ b/CSFML/build/VC2008/csfml-audio-d.def @@ -4,8 +4,8 @@ EXPORTS sfListener_GetGlobalVolume sfListener_SetPosition sfListener_GetPosition - sfListener_SetTarget - sfListener_GetTarget + sfListener_SetDirection + sfListener_GetDirection sfMusic_CreateFromFile sfMusic_CreateFromMemory sfMusic_Destroy diff --git a/CSFML/build/VC2008/csfml-audio.def b/CSFML/build/VC2008/csfml-audio.def index b779a5ab..84032e68 100644 --- a/CSFML/build/VC2008/csfml-audio.def +++ b/CSFML/build/VC2008/csfml-audio.def @@ -4,8 +4,8 @@ EXPORTS sfListener_GetGlobalVolume sfListener_SetPosition sfListener_GetPosition - sfListener_SetTarget - sfListener_GetTarget + sfListener_SetDirection + sfListener_GetDirection sfMusic_CreateFromFile sfMusic_CreateFromMemory sfMusic_Destroy diff --git a/CSFML/include/SFML/Audio/Listener.h b/CSFML/include/SFML/Audio/Listener.h index ffc4cbd1..d6fa1a3e 100644 --- a/CSFML/include/SFML/Audio/Listener.h +++ b/CSFML/include/SFML/Audio/Listener.h @@ -68,26 +68,24 @@ CSFML_API void sfListener_SetPosition(float x, float y, float z); CSFML_API void sfListener_GetPosition(float* x, float* y, float* z); //////////////////////////////////////////////////////////// -/// Change the orientation of the listener (the point -/// he must look at) +/// Change the orientation of the listener /// -/// \param x : X position of the point the listener must look at -/// \param y : X position of the point the listener must look at -/// \param z : X position of the point the listener must look at +/// \param x : X component of the listener's direction +/// \param y : Y component of the listener's direction +/// \param z : Z component of the listener's direction /// //////////////////////////////////////////////////////////// -CSFML_API void sfListener_SetTarget(float x, float y, float z); +CSFML_API void sfListener_SetDirection(float x, float y, float z); //////////////////////////////////////////////////////////// -/// Get the current orientation of the listener (the point -/// he's looking at) +/// Get the current orientation of the listener /// -/// \param x : X position of the point the listener is looking at -/// \param y : X position of the point the listener is looking at -/// \param z : X position of the point the listener is looking at +/// \param x : X component of the listener's direction +/// \param y : Y component of the listener's direction +/// \param z : Z component of the listener's direction /// //////////////////////////////////////////////////////////// -CSFML_API void sfListener_GetTarget(float* x, float* y, float* z); +CSFML_API void sfListener_GetDirection(float* x, float* y, float* z); #endif // SFML_LISTENER_H diff --git a/CSFML/src/SFML/Audio/Listener.cpp b/CSFML/src/SFML/Audio/Listener.cpp index 0eb57ef6..44de4dc2 100644 --- a/CSFML/src/SFML/Audio/Listener.cpp +++ b/CSFML/src/SFML/Audio/Listener.cpp @@ -51,9 +51,9 @@ float sfListener_GetGlobalVolume() //////////////////////////////////////////////////////////// /// Change the position of the listener //////////////////////////////////////////////////////////// -void sfListener_SetPosition(float x, float y, float PosZ) +void sfListener_SetPosition(float x, float y, float z) { - sf::Listener::SetPosition(sf::Vector3f(x, y, PosZ)); + sf::Listener::SetPosition(x, y, z); } @@ -73,26 +73,24 @@ void sfListener_GetPosition(float* x, float* y, float* z) //////////////////////////////////////////////////////////// -/// Change the orientation of the listener (the point -/// he must look at) +/// Change the orientation of the listener //////////////////////////////////////////////////////////// -void sfListener_SetTarget(float x, float y, float z) +void sfListener_SetDirection(float x, float y, float z) { - sf::Listener::SetTarget(sf::Vector3f(x, y, z)); + sf::Listener::SetDirection(x, y, z); } //////////////////////////////////////////////////////////// -/// Get the current orientation of the listener (the point -/// he's looking at) +/// Get the current orientation of the listener //////////////////////////////////////////////////////////// -void sfListener_GetTarget(float* x, float* y, float* z) +void sfListener_GetDirection(float* x, float* y, float* z) { if (x && y && z) { - sf::Vector3f target = sf::Listener::GetTarget(); - *x = target.x; - *y = target.y; - *z = target.z; + sf::Vector3f direction = sf::Listener::GetDirection(); + *x = direction.x; + *y = direction.y; + *z = direction.z; } } diff --git a/dotnet/src/Audio/Listener.cs b/dotnet/src/Audio/Listener.cs index 03f97daa..7d79122b 100644 --- a/dotnet/src/Audio/Listener.cs +++ b/dotnet/src/Audio/Listener.cs @@ -39,14 +39,13 @@ namespace SFML //////////////////////////////////////////////////////////// /// - /// 3D position of the target, ie. the point the listener is looking at - /// (default is (0, 0, -1)) + /// 3D direction of the listener (default is (0, 0, -1)) /// //////////////////////////////////////////////////////////// - public static Vector3 Target + public static Vector3 Direction { - get {Vector3 v; sfListener_GetTarget(out v.X, out v.Y, out v.Z); return v;} - set {sfListener_SetTarget(value.X, value.Y, value.Z);} + get {Vector3 v; sfListener_GetDirection(out v.X, out v.Y, out v.Z); return v;} + set {sfListener_SetDirection(value.X, value.Y, value.Z);} } #region Imports @@ -57,16 +56,16 @@ namespace SFML static extern float sfListener_GetGlobalVolume(); [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] - static extern void sfListener_SetPosition(float PosX, float PosY, float PosZ); + static extern void sfListener_SetPosition(float X, float Y, float Z); [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] - static extern void sfListener_GetPosition(out float PosX, out float PosY, out float PosZ); + static extern void sfListener_GetPosition(out float X, out float Y, out float Z); [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] - static extern void sfListener_SetTarget(float TargetX, float TargetY, float TargetZ); + static extern void sfListener_GetDirection(float X, float Y, float Z); [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] - static extern void sfListener_GetTarget(out float TargetX, out float TargetY, out float TargetZ); + static extern void sfListener_SetDirection(out float X, out float Y, out float Z); #endregion } } diff --git a/include/SFML/Audio/Listener.hpp b/include/SFML/Audio/Listener.hpp index 34b39372..ceabcf22 100644 --- a/include/SFML/Audio/Listener.hpp +++ b/include/SFML/Audio/Listener.hpp @@ -87,33 +87,32 @@ public : static Vector3f GetPosition(); //////////////////////////////////////////////////////////// - /// Change the orientation of the listener (the point - /// he must look at) (take 3 values). - /// The default target is (0, 0, -1) + /// Change the orientation of the listener (take 3 values); + /// the direction does not need to be normalized. + /// The default direction is (0, 0, -1) /// - /// \param x, y, z : Position of the point the listener must look at + /// \param x, y, z : Orientation of the listener /// //////////////////////////////////////////////////////////// - static void SetTarget(float x, float y, float z); + static void SetDirection(float x, float y, float z); //////////////////////////////////////////////////////////// - /// Change the orientation of the listener (the point - /// he must look at) (take a 3D vector). - /// The default target is (0, 0, -1) + /// Change the orientation of the listener (take a 3D vector); + /// the direction does not need to be normalized. + /// The default direction is (0, 0, -1) /// - /// \param target : Position of the point the listener must look at + /// \param direction : Orientation of the listener /// //////////////////////////////////////////////////////////// - static void SetTarget(const Vector3f& target); + static void SetDirection(const Vector3f& direction); //////////////////////////////////////////////////////////// - /// Get the current orientation of the listener (the point - /// he's looking at) + /// Get the current orientation of the listener. /// - /// \return : Position of the point the listener is looking at + /// \return Current direction of the listener /// //////////////////////////////////////////////////////////// - static Vector3f GetTarget(); + static Vector3f GetDirection(); }; } // namespace sf diff --git a/src/SFML/Audio/AudioDevice.cpp b/src/SFML/Audio/AudioDevice.cpp index 40311aa8..ad8f4b18 100644 --- a/src/SFML/Audio/AudioDevice.cpp +++ b/src/SFML/Audio/AudioDevice.cpp @@ -65,7 +65,7 @@ AudioDevice::AudioDevice() // Initialize the listener, located at the origin and looking along the Z axis Listener::SetPosition(0.f, 0.f, 0.f); - Listener::SetTarget(0.f, 0.f, -1.f); + Listener::SetDirection(0.f, 0.f, -1.f); } else { diff --git a/src/SFML/Audio/Listener.cpp b/src/SFML/Audio/Listener.cpp index 19cacc2e..8f29411c 100644 --- a/src/SFML/Audio/Listener.cpp +++ b/src/SFML/Audio/Listener.cpp @@ -83,10 +83,9 @@ Vector3f Listener::GetPosition() //////////////////////////////////////////////////////////// -/// Change the orientation of the listener (the point -/// he must look at) (take 3 values) +/// Change the orientation of the listener (take 3 values) //////////////////////////////////////////////////////////// -void Listener::SetTarget(float x, float y, float z) +void Listener::SetDirection(float x, float y, float z) { float orientation[] = {x, y, z, 0.f, 1.f, 0.f}; ALCheck(alListenerfv(AL_ORIENTATION, orientation)); @@ -94,20 +93,18 @@ void Listener::SetTarget(float x, float y, float z) //////////////////////////////////////////////////////////// -/// Change the orientation of the listener (the point -/// he must look at) (take a 3D vector) +/// Change the orientation of the listener (take a 3D vector) //////////////////////////////////////////////////////////// -void Listener::SetTarget(const Vector3f& target) +void Listener::SetDirection(const Vector3f& direction) { - SetTarget(target.x, target.y, target.z); + SetDirection(direction.x, direction.y, direction.z); } //////////////////////////////////////////////////////////// -/// Get the current orientation of the listener (the point -/// he's looking at) + /// Get the current orientation of the listener. //////////////////////////////////////////////////////////// -Vector3f Listener::GetTarget() +Vector3f Listener::GetDirection() { float orientation[6]; ALCheck(alGetListenerfv(AL_ORIENTATION, orientation));