Skip to content

Commit

Permalink
Merge branch 'master' into InstrusiveAllocator_MemoryPools
Browse files Browse the repository at this point in the history
  • Loading branch information
robertosfield committed Jul 2, 2024
2 parents a34563e + d05479e commit cc10773
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/vsg/animation/Animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,18 @@ bool Animation::update(double simulationTime)
return x < 0.0 ? y + std::fmod(x, y) : std::fmod(x, y);
};

time = time + (simulationTime - _previousSimulationTime) * speed;
auto samplerTime = time = time + (simulationTime - _previousSimulationTime) * speed;

_previousSimulationTime = simulationTime;

if (mode == REPEAT)
{
time = time_within_period(time, _maxTime);
samplerTime = time = time_within_period(time, _maxTime);
}
else if (mode == FORWARD_AND_BACK)
{
time = time_within_period(time, 2.0 * _maxTime);
if (time > _maxTime) time = 2.0 * _maxTime - time;
samplerTime = time = time_within_period(time, 2.0 * _maxTime);
if (time > _maxTime) samplerTime = 2.0 * _maxTime - time;
}
else
{
Expand All @@ -159,7 +160,7 @@ bool Animation::update(double simulationTime)

for (auto sampler : samplers)
{
sampler->update(time);
sampler->update(samplerTime);
}

return true;
Expand Down

0 comments on commit cc10773

Please sign in to comment.