mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-25 19:11:34 +00:00
Specify a proper up vector for the listener
This commit is contained in:
parent
991f942fba
commit
6942fa97da
4 changed files with 9 additions and 5 deletions
|
@ -114,7 +114,7 @@ namespace MWBase
|
||||||
|
|
||||||
virtual void update(float duration) = 0;
|
virtual void update(float duration) = 0;
|
||||||
|
|
||||||
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir) = 0;
|
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir, const Ogre::Vector3 &up) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int operator|(SoundManager::PlayMode a, SoundManager::PlayMode b)
|
inline int operator|(SoundManager::PlayMode a, SoundManager::PlayMode b)
|
||||||
|
|
|
@ -111,12 +111,14 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
Ogre::Vector3 pos = mCamera->getRealPosition();
|
Ogre::Vector3 pos = mCamera->getRealPosition();
|
||||||
Ogre::Vector3 dir = mCamera->getRealDirection();
|
Ogre::Vector3 dir = mCamera->getRealDirection();
|
||||||
|
Ogre::Vector3 up = mCamera->getRealUp();
|
||||||
|
|
||||||
Ogre::Real xch;
|
Ogre::Real xch;
|
||||||
xch = pos.y, pos.y = -pos.z, pos.z = xch;
|
xch = pos.y, pos.y = -pos.z, pos.z = xch;
|
||||||
xch = dir.y, dir.y = -dir.z, dir.z = xch;
|
xch = dir.y, dir.y = -dir.z, dir.z = xch;
|
||||||
|
xch = up.y, up.y = -up.z, up.z = xch;
|
||||||
|
|
||||||
MWBase::Environment::get().getSoundManager()->setListenerPosDir(pos, dir);
|
MWBase::Environment::get().getSoundManager()->setListenerPosDir(pos, dir, up);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::update(float duration)
|
void Player::update(float duration)
|
||||||
|
|
|
@ -486,7 +486,7 @@ namespace MWSound
|
||||||
mOutput->updateListener(
|
mOutput->updateListener(
|
||||||
mListenerPos,
|
mListenerPos,
|
||||||
mListenerDir,
|
mListenerDir,
|
||||||
Ogre::Vector3::UNIT_Z,
|
mListenerUp,
|
||||||
env
|
env
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -546,10 +546,11 @@ namespace MWSound
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundManager::setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir)
|
void SoundManager::setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir, const Ogre::Vector3 &up)
|
||||||
{
|
{
|
||||||
mListenerPos = pos;
|
mListenerPos = pos;
|
||||||
mListenerDir = dir;
|
mListenerDir = dir;
|
||||||
|
mListenerUp = up;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default readAll implementation, for decoders that can't do anything
|
// Default readAll implementation, for decoders that can't do anything
|
||||||
|
|
|
@ -52,6 +52,7 @@ namespace MWSound
|
||||||
|
|
||||||
Ogre::Vector3 mListenerPos;
|
Ogre::Vector3 mListenerPos;
|
||||||
Ogre::Vector3 mListenerDir;
|
Ogre::Vector3 mListenerDir;
|
||||||
|
Ogre::Vector3 mListenerUp;
|
||||||
|
|
||||||
std::string lookup(const std::string &soundId,
|
std::string lookup(const std::string &soundId,
|
||||||
float &volume, float &min, float &max);
|
float &volume, float &min, float &max);
|
||||||
|
@ -128,7 +129,7 @@ namespace MWSound
|
||||||
|
|
||||||
virtual void update(float duration);
|
virtual void update(float duration);
|
||||||
|
|
||||||
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir);
|
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir, const Ogre::Vector3 &up);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue