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