Bugfix [#33467] Fluid Simulations Speed factor animated wrong result

Thanks to Brecht for providing a patch and example blend.
I changed and extended it a bit since there was another bug in that loop.
This commit is contained in:
Daniel Genrich
2012-12-11 13:02:42 +00:00
parent d321ee3fda
commit e089c5a976
2 changed files with 8 additions and 1 deletions

View File

@@ -420,7 +420,12 @@ int ntlWorld::advanceSims(int framenum)
// Was: double targetTime = mSimulationTime + (*mpSims)[mFirstSim]->getFrameTime(framenum); - DG
double totalTime = 0.0, targetTime = 0.0;
for(size_t i = 0; i < mSimFrameCnt; i++)
totalTime += (*mpSims)[mFirstSim]->getFrameTime(framenum);
{
/* We need an intermediate array "mSimFrameValue" because
otherwise if we don't start with starttime = 0,
the sim gets out of sync - DG */
totalTime += (*mpSims)[mFirstSim]->getFrameTime(mSimFrameValue[i]);
}
targetTime = totalTime + (*mpSims)[mFirstSim]->getFrameTime(framenum);
int gstate = 0;
@@ -468,6 +473,7 @@ int ntlWorld::advanceSims(int framenum)
sim->prepareVisualization();
}
mSimFrameValue.push_back(framenum);
mSimFrameCnt++;
return 0;

View File

@@ -118,6 +118,7 @@ class ntlWorld
/*! count no. of frame for correct sim time */
int mSimFrameCnt;
vector<int> mSimFrameValue;
};