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)
actorid
emoose 12 years ago
parent c8cc6b6e65
commit cadc753216

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

@ -265,7 +265,7 @@ namespace MWBase
///< 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.
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;
///< place an object into the gameworld at the specified cursor position

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

@ -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).
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 setSunColour(const Ogre::ColourValue& colour);

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

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

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

@ -280,7 +280,7 @@ namespace MWWorld
///< 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.
virtual void update (float duration);
virtual void update (float duration, bool paused);
virtual bool placeObject (const Ptr& object, float cursorX, float cursorY);
///< place an object into the gameworld at the specified cursor position

Loading…
Cancel
Save