mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 20:23:54 +00:00
Merge branch 'animationfix'
This commit is contained in:
commit
f14dc90b34
10 changed files with 39 additions and 60 deletions
|
@ -158,6 +158,9 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
||||||
if (mEnvironment.mWindowManager->getMode()==MWGui::GM_Game)
|
if (mEnvironment.mWindowManager->getMode()==MWGui::GM_Game)
|
||||||
mEnvironment.mWorld->doPhysics (movement, mEnvironment.mFrameDuration);
|
mEnvironment.mWorld->doPhysics (movement, mEnvironment.mFrameDuration);
|
||||||
|
|
||||||
|
// update world
|
||||||
|
mEnvironment.mWorld->update (evt.timeSinceLastFrame);
|
||||||
|
|
||||||
// report focus object (for debugging)
|
// report focus object (for debugging)
|
||||||
if (mReportFocus)
|
if (mReportFocus)
|
||||||
updateFocusReport (mEnvironment.mFrameDuration);
|
updateFocusReport (mEnvironment.mFrameDuration);
|
||||||
|
|
|
@ -16,11 +16,7 @@ void Actors::insertNPC(const MWWorld::Ptr& ptr){
|
||||||
insertBegin(ptr, true, true);
|
insertBegin(ptr, true, true);
|
||||||
NpcAnimation* anim = new MWRender::NpcAnimation(ptr, mEnvironment, mRend);
|
NpcAnimation* anim = new MWRender::NpcAnimation(ptr, mEnvironment, mRend);
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
mAllActors[ptr] = anim;
|
mAllActors[ptr] = anim;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void Actors::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
|
void Actors::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
|
||||||
Ogre::SceneNode* cellnode;
|
Ogre::SceneNode* cellnode;
|
||||||
|
@ -121,10 +117,9 @@ void Actors::skipAnimation (const MWWorld::Ptr& ptr){
|
||||||
if(mAllActors.find(ptr) != mAllActors.end())
|
if(mAllActors.find(ptr) != mAllActors.end())
|
||||||
mAllActors[ptr]->stopScript();
|
mAllActors[ptr]->stopScript();
|
||||||
}
|
}
|
||||||
void Actors::addTime(){
|
void Actors::update (float duration){
|
||||||
//std::cout << "Adding time in actors\n";
|
|
||||||
for(std::map<MWWorld::Ptr, Animation*>::iterator iter = mAllActors.begin(); iter != mAllActors.end(); iter++)
|
for(std::map<MWWorld::Ptr, Animation*>::iterator iter = mAllActors.begin(); iter != mAllActors.end(); iter++)
|
||||||
{
|
{
|
||||||
(iter->second)->runAnimation(mEnvironment.mFrameDuration);
|
(iter->second)->runAnimation(duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace MWRender{
|
||||||
///< 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.
|
||||||
|
|
||||||
void addTime();
|
void update (float duration);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,22 +269,6 @@ void NpcAnimation::runAnimation(float timepassed){
|
||||||
handleAnimationTransforms();
|
handleAnimationTransforms();
|
||||||
Ogre::Vector3 current = insert->_getWorldAABB().getCenter();
|
Ogre::Vector3 current = insert->_getWorldAABB().getCenter();
|
||||||
|
|
||||||
//This is the attempt at npc physics
|
|
||||||
//mEnvironment.mWorld->setObjectPhysicsPosition(insert->getName(), current);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*if(base->hasSkeleton())
|
|
||||||
{
|
|
||||||
|
|
||||||
Ogre::Quaternion boneQuat = rotate;
|
|
||||||
Ogre::Vector3 boneTrans = trans;
|
|
||||||
mEnvironment.mWorld->setObjectPhysicsPosition(insert->getName(), boneTrans + insert->getPosition());
|
|
||||||
//mEnvironment.mWorld->setObjectPhysicsRotation(insert->getName(), boneQuat * insert->getOrientation());
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
std::vector<std::vector<Nif::NiTriShapeCopy>*>::iterator shapepartsiter = shapeparts.begin();
|
std::vector<std::vector<Nif::NiTriShapeCopy>*>::iterator shapepartsiter = shapeparts.begin();
|
||||||
std::vector<Ogre::Entity*>::iterator entitypartsiter = entityparts.begin();
|
std::vector<Ogre::Entity*>::iterator entitypartsiter = entityparts.begin();
|
||||||
while(shapepartsiter != shapeparts.end())
|
while(shapepartsiter != shapeparts.end())
|
||||||
|
|
|
@ -121,7 +121,7 @@ void RenderingManager::moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Ve
|
||||||
|
|
||||||
void RenderingManager::update (float duration){
|
void RenderingManager::update (float duration){
|
||||||
|
|
||||||
|
mActors.update (duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingManager::skyEnable ()
|
void RenderingManager::skyEnable ()
|
||||||
|
@ -240,9 +240,5 @@ void RenderingManager::skipAnimation (const MWWorld::Ptr& ptr)
|
||||||
{
|
{
|
||||||
mActors.skipAnimation(ptr);
|
mActors.skipAnimation(ptr);
|
||||||
}
|
}
|
||||||
void RenderingManager::addTime(){
|
|
||||||
mActors.addTime();
|
|
||||||
//Notify each animation that time has passed
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,8 +105,6 @@ class RenderingManager: private RenderingInterface {
|
||||||
///< 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.
|
||||||
|
|
||||||
void addTime();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void setAmbientMode();
|
void setAmbientMode();
|
||||||
|
|
|
@ -52,8 +52,8 @@ void insertCellRefList(MWRender::RenderingManager& rendering, MWWorld::Environme
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
void Scene::advanceTime(){
|
void Scene::update (float duration){
|
||||||
mRendering.addTime();
|
mRendering.update (duration);
|
||||||
}
|
}
|
||||||
void Scene::unloadCell (CellStoreCollection::iterator iter)
|
void Scene::unloadCell (CellStoreCollection::iterator iter)
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,7 +101,8 @@ namespace MWWorld
|
||||||
void markCellAsUnchanged();
|
void markCellAsUnchanged();
|
||||||
|
|
||||||
void insertCell(ESMS::CellStore<MWWorld::RefData> &cell, MWWorld::Environment& environment);
|
void insertCell(ESMS::CellStore<MWWorld::RefData> &cell, MWWorld::Environment& environment);
|
||||||
void advanceTime();
|
|
||||||
|
void update (float duration);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,6 @@ namespace MWWorld
|
||||||
|
|
||||||
if (days>0)
|
if (days>0)
|
||||||
mGlobalVariables->setInt ("dayspassed", days + mGlobalVariables->getInt ("dayspassed"));
|
mGlobalVariables->setInt ("dayspassed", days + mGlobalVariables->getInt ("dayspassed"));
|
||||||
mWorldScene->advanceTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::setHour (double hour)
|
void World::setHour (double hour)
|
||||||
|
@ -685,10 +684,9 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
mRendering.skipAnimation (ptr);
|
mRendering.skipAnimation (ptr);
|
||||||
}
|
}
|
||||||
void World::setObjectPhysicsRotation(const std::string& handle, Ogre::Quaternion quat){
|
|
||||||
mPhysics->rotateObject(handle, quat);
|
void World::update (float duration)
|
||||||
}
|
{
|
||||||
void World::setObjectPhysicsPosition(const std::string& handle, Ogre::Vector3 vec){
|
mWorldScene->update (duration);
|
||||||
mPhysics->moveObject(handle, vec);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,12 +140,16 @@ namespace MWWorld
|
||||||
void disable (Ptr reference);
|
void disable (Ptr reference);
|
||||||
|
|
||||||
void advanceTime (double hours);
|
void advanceTime (double hours);
|
||||||
|
///< Advance in-game time.
|
||||||
|
|
||||||
void setHour (double hour);
|
void setHour (double hour);
|
||||||
|
///< Set in-game time hour.
|
||||||
|
|
||||||
void setMonth (int month);
|
void setMonth (int month);
|
||||||
|
///< Set in-game time month.
|
||||||
|
|
||||||
void setDay (int day);
|
void setDay (int day);
|
||||||
|
///< Set in-game time day.
|
||||||
|
|
||||||
bool toggleSky();
|
bool toggleSky();
|
||||||
///< \return Resulting mode
|
///< \return Resulting mode
|
||||||
|
@ -218,8 +222,8 @@ namespace MWWorld
|
||||||
void skipAnimation (const MWWorld::Ptr& ptr);
|
void skipAnimation (const MWWorld::Ptr& ptr);
|
||||||
///< 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.
|
||||||
void setObjectPhysicsRotation(const std::string& handle,Ogre::Quaternion quat);
|
|
||||||
void setObjectPhysicsPosition(const std::string& handle,Ogre::Vector3 vector);
|
void update (float duration);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue