|
|
|
@ -4,8 +4,6 @@
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
|
|
#include <OgreRoot.h>
|
|
|
|
|
|
|
|
|
|
#include <components/esm_store/store.hpp>
|
|
|
|
|
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
@ -492,34 +490,17 @@ namespace MWSound
|
|
|
|
|
MWWorld::Ptr player =
|
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
|
|
|
|
const ESM::Cell *cell = player.getCell()->cell;
|
|
|
|
|
// Ogre::Camera *cam = MWBase::Environment::get().getWorld()->getPlayer().getRenderer()->getCamera();
|
|
|
|
|
Ogre::Vector3 pos, at, up = Ogre::Vector3::UNIT_Z;
|
|
|
|
|
|
|
|
|
|
float *fval = player.getRefData().getPosition().pos;
|
|
|
|
|
pos.x = fval[0], pos.y = fval[1], pos.z = fval[2];
|
|
|
|
|
|
|
|
|
|
fval = player.getRefData().getPosition().rot;
|
|
|
|
|
at.x = fval[0], at.y = fval[1], at.z = fval[2];
|
|
|
|
|
/*
|
|
|
|
|
nPos = cam->getRealPosition();
|
|
|
|
|
nDir = cam->getRealDirection();
|
|
|
|
|
nUp = cam->getRealUp();
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
Environment env = Env_Normal;
|
|
|
|
|
if((cell->data.flags&cell->HasWater) && pos.z < cell->water)
|
|
|
|
|
if((cell->data.flags&cell->HasWater) && mListenerPos.z < cell->water)
|
|
|
|
|
env = Env_Underwater;
|
|
|
|
|
|
|
|
|
|
// The output handler is expecting vectors oriented like the game
|
|
|
|
|
// (that is, -Z goes down, +Y goes forward), but that's not what we
|
|
|
|
|
// get from Ogre's camera, so we have to convert.
|
|
|
|
|
/*
|
|
|
|
|
const Ogre::Vector3 pos(nPos[0], -nPos[2], nPos[1]);
|
|
|
|
|
const Ogre::Vector3 at(nDir[0], -nDir[2], nDir[1]);
|
|
|
|
|
const Ogre::Vector3 up(nUp[0], -nUp[2], nUp[1]);
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
mOutput->updateListener(pos, at, up, env);
|
|
|
|
|
mOutput->updateListener(
|
|
|
|
|
mListenerPos,
|
|
|
|
|
mListenerDir,
|
|
|
|
|
Ogre::Vector3::UNIT_Z,
|
|
|
|
|
env
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Check if any sounds are finished playing, and trash them
|
|
|
|
|
SoundMap::iterator snditer = mActiveSounds.begin();
|
|
|
|
@ -577,6 +558,12 @@ namespace MWSound
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SoundManager::setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir)
|
|
|
|
|
{
|
|
|
|
|
mListenerPos = pos;
|
|
|
|
|
mListenerDir = dir;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Default readAll implementation, for decoders that can't do anything
|
|
|
|
|
// better
|
|
|
|
|
void Sound_Decoder::readAll(std::vector<char> &output)
|
|
|
|
|