stub for soundmanager, adjust rotation mode

This commit is contained in:
greye 2012-08-09 13:27:32 +04:00
parent 378fcc2460
commit df60f4bf92
2 changed files with 18 additions and 5 deletions

View file

@ -263,6 +263,11 @@ RenderingManager::rotateObject(
} }
MWWorld::Class::get(ptr).adjustRotation(ptr, rot.x, rot.y, rot.z); MWWorld::Class::get(ptr).adjustRotation(ptr, rot.x, rot.y, rot.z);
if (adjust) {
float *f = ptr.getRefData().getPosition().rot;
rot.x += f[0], rot.y += f[1], rot.z += f[2];
}
Ogre::Quaternion xr(Ogre::Degree(rot.x), Ogre::Vector3::UNIT_X); Ogre::Quaternion xr(Ogre::Degree(rot.x), Ogre::Vector3::UNIT_X);
Ogre::Quaternion yr(Ogre::Degree(-rot.z), Ogre::Vector3::UNIT_Y); Ogre::Quaternion yr(Ogre::Degree(-rot.z), Ogre::Vector3::UNIT_Y);
Ogre::Quaternion zr(Ogre::Degree(rot.y), Ogre::Vector3::UNIT_Z); Ogre::Quaternion zr(Ogre::Degree(rot.y), Ogre::Vector3::UNIT_Z);

View file

@ -13,8 +13,6 @@
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwrender/player.hpp"
#include "sound_output.hpp" #include "sound_output.hpp"
#include "sound_decoder.hpp" #include "sound_decoder.hpp"
#include "sound.hpp" #include "sound.hpp"
@ -491,9 +489,17 @@ namespace MWSound
if(!isMusicPlaying()) if(!isMusicPlaying())
startRandomTitle(); startRandomTitle();
const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell; 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::Camera *cam = MWBase::Environment::get().getWorld()->getPlayer().getRenderer()->getCamera();
Ogre::Vector3 nPos, nDir, nUp; 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(); nPos = cam->getRealPosition();
nDir = cam->getRealDirection(); nDir = cam->getRealDirection();
@ -501,15 +507,17 @@ namespace MWSound
*/ */
Environment env = Env_Normal; Environment env = Env_Normal;
if((cell->data.flags&cell->HasWater) && nPos.y < cell->water) if((cell->data.flags&cell->HasWater) && pos.z < cell->water)
env = Env_Underwater; env = Env_Underwater;
// The output handler is expecting vectors oriented like the game // The output handler is expecting vectors oriented like the game
// (that is, -Z goes down, +Y goes forward), but that's not what we // (that is, -Z goes down, +Y goes forward), but that's not what we
// get from Ogre's camera, so we have to convert. // get from Ogre's camera, so we have to convert.
/*
const Ogre::Vector3 pos(nPos[0], -nPos[2], nPos[1]); const Ogre::Vector3 pos(nPos[0], -nPos[2], nPos[1]);
const Ogre::Vector3 at(nDir[0], -nDir[2], nDir[1]); const Ogre::Vector3 at(nDir[0], -nDir[2], nDir[1]);
const Ogre::Vector3 up(nUp[0], -nUp[2], nUp[1]); const Ogre::Vector3 up(nUp[0], -nUp[2], nUp[1]);
*/
mOutput->updateListener(pos, at, up, env); mOutput->updateListener(pos, at, up, env);