From 6abeaed4aaf44bc0c28501be37c2db0890039360 Mon Sep 17 00:00:00 2001 From: Zachariah Brown Date: Fri, 5 Sep 2014 14:26:10 -0400 Subject: [PATCH] Updated CSFML to match the changes related to the up vector changes --- include/SFML/Audio/Listener.h | 43 +++++++++++++++++++++++++++-------- src/SFML/Audio/Listener.cpp | 16 +++++++++++++ 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/include/SFML/Audio/Listener.h b/include/SFML/Audio/Listener.h index e47d529..95e39a0 100644 --- a/include/SFML/Audio/Listener.h +++ b/include/SFML/Audio/Listener.h @@ -71,25 +71,50 @@ CSFML_AUDIO_API void sfListener_setPosition(sfVector3f position); CSFML_AUDIO_API sfVector3f sfListener_getPosition(); //////////////////////////////////////////////////////////// -/// \brief Set the orientation of the listener in the scene +/// \brief Set the orientation of the forward vector in the scene /// -/// The orientation defines the 3D axes of the listener -/// (left, up, front) in the scene. The orientation vector -/// doesn't have to be normalized. -/// The default listener's orientation is (0, 0, -1). +/// The direction (also called "at vector") is the vector +/// pointing forward from the listener's perspective. Together +/// with the up vector, it defines the 3D orientation of the +/// listener in the scene. The direction vector doesn't +/// have to be normalized. +/// The default listener's direction is (0, 0, -1). /// -/// \param position New direction of the listener +/// \param direction New listener's direction /// //////////////////////////////////////////////////////////// -CSFML_AUDIO_API void sfListener_setDirection(sfVector3f orientation); +CSFML_AUDIO_API void sfListener_setDirection(sfVector3f direction); //////////////////////////////////////////////////////////// -/// \brief Get the current orientation of the listener in the scene +/// \brief Get the current forward vector of the listener in the scene /// -/// \return The listener's direction +/// \return Listener's forward vector (not normalized) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfVector3f sfListener_getDirection(); +//////////////////////////////////////////////////////////// +/// \brief Set the upward vector of the listener in the scene +/// +/// The up vector is the vector that points upward from the +/// listener's perspective. Together with the direction, it +/// defines the 3D orientation of the listener in the scene. +/// The up vector doesn't have to be normalized. +/// The default listener's up vector is (0, 1, 0). It is usually +/// not necessary to change it, especially in 2D scenarios. +/// +/// \param upVector New listener's up vector +/// +//////////////////////////////////////////////////////////// +CSFML_AUDIO_API void sfListener_setUpVector(sfVector3f upVector); + +//////////////////////////////////////////////////////////// +/// \brief Get the current upward vector of the listener in the scene +/// +/// \return Listener's upward vector (not normalized) +/// +//////////////////////////////////////////////////////////// +CSFML_AUDIO_API sfVector3f sfListener_getUpVector(); + #endif // SFML_LISTENER_H diff --git a/src/SFML/Audio/Listener.cpp b/src/SFML/Audio/Listener.cpp index fefffb1..ee069a7 100644 --- a/src/SFML/Audio/Listener.cpp +++ b/src/SFML/Audio/Listener.cpp @@ -74,3 +74,19 @@ sfVector3f sfListener_getDirection() sfVector3f direction = {sfmlDirection.x, sfmlDirection.y, sfmlDirection.z}; return direction; } + + +//////////////////////////////////////////////////////////// +void sfListener_setUpVector(sfVector3f upVector) +{ + sf::Listener::setUpVector(upVector.x, upVector.y, upVector.z); +} + + +//////////////////////////////////////////////////////////// +sfVector3f sfListener_getUpVector() +{ + sf::Vector3f sfmlUpVector = sf::Listener::getUpVector(); + sfVector3f upVector = {sfmlUpVector.x, sfmlUpVector.y, sfmlUpVector.z}; + return upVector; +}