mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 11:19:51 +02:00
fix crash on last frame = first frame, make last frame inclusive
(cherry picked from commit f1253e3c6c
)
This commit is contained in:
parent
c3648fb04c
commit
9d721ba605
1 changed files with 3 additions and 3 deletions
|
@ -267,9 +267,9 @@ void ModelEntityItem::updateFrameCount() {
|
||||||
if (!getAnimationHold() && getAnimationIsPlaying()) {
|
if (!getAnimationHold() && getAnimationIsPlaying()) {
|
||||||
float deltaTime = (float)interval / (float)USECS_PER_SECOND;
|
float deltaTime = (float)interval / (float)USECS_PER_SECOND;
|
||||||
_currentFrame += (deltaTime * getAnimationFPS());
|
_currentFrame += (deltaTime * getAnimationFPS());
|
||||||
if (_currentFrame > getAnimationLastFrame()) {
|
if (_currentFrame > getAnimationLastFrame() + 1) {
|
||||||
if (getAnimationLoop()) {
|
if (getAnimationLoop() && getAnimationFirstFrame() != getAnimationLastFrame()) {
|
||||||
_currentFrame = getAnimationFirstFrame() + (int)(glm::floor(_currentFrame - getAnimationFirstFrame())) % (updatedFrameCount - 1);
|
_currentFrame = getAnimationFirstFrame() + (int)(_currentFrame - getAnimationFirstFrame()) % updatedFrameCount;
|
||||||
} else {
|
} else {
|
||||||
_currentFrame = getAnimationLastFrame();
|
_currentFrame = getAnimationLastFrame();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue