1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 23:53:56 +00:00

Fixed: engine: Bug #437 Stop animations when paused better fix; scene: Bug #430 Teleporting and using loading doors linking within the same cell reloads the cell

Bug #437 fix only pauses the RenderingManager, and still updates the mOcclusionQuery
Bug #430 fix is only tested in interiors (ToddTest)
This commit is contained in:
emoose 2012-11-03 19:29:55 +00:00
parent c8cc6b6e65
commit cadc753216
8 changed files with 60 additions and 44 deletions

View file

@ -101,8 +101,7 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
MWBase::Environment::get().getWorld()->doPhysics (movement, mEnvironment.getFrameDuration()); MWBase::Environment::get().getWorld()->doPhysics (movement, mEnvironment.getFrameDuration());
// update world // update world
if (!MWBase::Environment::get().getWindowManager()->isGuiMode()) MWBase::Environment::get().getWorld()->update (evt.timeSinceLastFrame, MWBase::Environment::get().getWindowManager()->isGuiMode());
MWBase::Environment::get().getWorld()->update (evt.timeSinceLastFrame);
// update GUI // update GUI
Ogre::RenderWindow* window = mOgre->getWindow(); Ogre::RenderWindow* window = mOgre->getWindow();

View file

@ -265,7 +265,7 @@ namespace MWBase
///< Skip the animation for the given MW-reference for one frame. Calls to this function for ///< Skip the animation for the given MW-reference for one frame. Calls to this function for
/// references that are currently not in the rendered scene should be ignored. /// references that are currently not in the rendered scene should be ignored.
virtual void update (float duration) = 0; virtual void update (float duration, bool paused) = 0;
virtual bool placeObject(const MWWorld::Ptr& object, float cursorX, float cursorY) = 0; virtual bool placeObject(const MWWorld::Ptr& object, float cursorX, float cursorY) = 0;
///< place an object into the gameworld at the specified cursor position ///< place an object into the gameworld at the specified cursor position

View file

@ -313,7 +313,7 @@ RenderingManager::moveObjectToCell(
child->setPosition(pos); child->setPosition(pos);
} }
void RenderingManager::update (float duration) void RenderingManager::update (float duration, bool paused)
{ {
Ogre::Vector3 orig, dest; Ogre::Vector3 orig, dest;
mPlayer->setCameraDistance(); mPlayer->setCameraDistance();
@ -328,12 +328,16 @@ void RenderingManager::update (float duration)
mPlayer->setCameraDistance(test.second * orig.distance(dest), false, false); mPlayer->setCameraDistance(test.second * orig.distance(dest), false, false);
} }
} }
mOcclusionQuery->update(duration);
if(paused)
return;
mPlayer->update(duration); mPlayer->update(duration);
mActors.update (duration); mActors.update (duration);
mObjects.update (duration); mObjects.update (duration);
mOcclusionQuery->update(duration);
mSkyManager->update(duration); mSkyManager->update(duration);

View file

@ -125,7 +125,7 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
/// \param store Cell the object was in previously (\a ptr has already been updated to the new cell). /// \param store Cell the object was in previously (\a ptr has already been updated to the new cell).
void moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Vector3& position, MWWorld::CellStore *store); void moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Vector3& position, MWWorld::CellStore *store);
void update (float duration); void update (float duration, bool paused);
void setAmbientColour(const Ogre::ColourValue& colour); void setAmbientColour(const Ogre::ColourValue& colour);
void setSunColour(const Ogre::ColourValue& colour); void setSunColour(const Ogre::ColourValue& colour);

View file

@ -62,8 +62,8 @@ namespace
namespace MWWorld namespace MWWorld
{ {
void Scene::update (float duration){ void Scene::update (float duration, bool paused){
mRendering.update (duration); mRendering.update (duration, paused);
} }
void Scene::unloadCell (CellStoreCollection::iterator iter) void Scene::unloadCell (CellStoreCollection::iterator iter)
@ -306,44 +306,57 @@ namespace MWWorld
{ {
std::cout << "Changing to interior\n"; std::cout << "Changing to interior\n";
CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName);
// remove active bool loadcell = (mCurrentCell == NULL);
CellStoreCollection::iterator active = mActiveCells.begin(); if(!loadcell)
// count number of cells to unload
int numUnload = 0;
while (active!=mActiveCells.end())
{ {
++active; std::string nam = std::string(cellName);
++numUnload; std::string curnam = std::string(mCurrentCell->cell->mName);
std::transform(nam.begin(), nam.end(), nam.begin(), ::tolower);
std::transform(curnam.begin(), curnam.end(), curnam.begin(), ::tolower);
loadcell = nam != curnam;
} }
if(loadcell)
// unload
int current = 0;
active = mActiveCells.begin();
while (active!=mActiveCells.end())
{ {
MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Unloading cells", 0, current, numUnload); CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName);
unloadCell (active++); // remove active
++current; CellStoreCollection::iterator active = mActiveCells.begin();
// count number of cells to unload
int numUnload = 0;
while (active!=mActiveCells.end())
{
++active;
++numUnload;
}
// unload
int current = 0;
active = mActiveCells.begin();
while (active!=mActiveCells.end())
{
MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Unloading cells", 0, current, numUnload);
unloadCell (active++);
++current;
}
// Load cell.
std::cout << "cellName:" << cellName << std::endl;
MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading cells", 0, 0, 1);
loadCell (cell);
mCurrentCell = cell;
// adjust fog
mRendering.switchToInterior();
mRendering.configureFog(*cell);
} }
// Load cell.
std::cout << "cellName:" << cellName << std::endl;
MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading cells", 0, 0, 1);
loadCell (cell);
// adjust player // adjust player
mCurrentCell = cell; playerCellChange (mCurrentCell, position);
playerCellChange (cell, position);
// adjust fog
mRendering.switchToInterior();
mRendering.configureFog(*cell);
// Sky system // Sky system
MWBase::Environment::get().getWorld()->adjustSky(); MWBase::Environment::get().getWorld()->adjustSky();

View file

@ -88,7 +88,7 @@ namespace MWWorld
void insertCell (Ptr::CellStore &cell); void insertCell (Ptr::CellStore &cell);
void update (float duration); void update (float duration, bool paused);
void addObjectToScene (const Ptr& ptr); void addObjectToScene (const Ptr& ptr);
///< Add an object that already exists in the world model to the scene. ///< Add an object that already exists in the world model to the scene.

View file

@ -858,11 +858,11 @@ namespace MWWorld
mRendering->skipAnimation (ptr); mRendering->skipAnimation (ptr);
} }
void World::update (float duration) void World::update (float duration, bool paused)
{ {
/// \todo split this function up into subfunctions /// \todo split this function up into subfunctions
mWorldScene->update (duration); mWorldScene->update (duration, paused);
float pitch, yaw; float pitch, yaw;
Ogre::Vector3 eyepos; Ogre::Vector3 eyepos;

View file

@ -280,7 +280,7 @@ namespace MWWorld
///< Skip the animation for the given MW-reference for one frame. Calls to this function for ///< Skip the animation for the given MW-reference for one frame. Calls to this function for
/// references that are currently not in the rendered scene should be ignored. /// references that are currently not in the rendered scene should be ignored.
virtual void update (float duration); virtual void update (float duration, bool paused);
virtual bool placeObject (const Ptr& object, float cursorX, float cursorY); virtual bool placeObject (const Ptr& object, float cursorX, float cursorY);
///< place an object into the gameworld at the specified cursor position ///< place an object into the gameworld at the specified cursor position