mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 22:30:42 +02:00
Merge pull request #12176 from SamGondelman/rendering
Fix animation crash, make last frame inclusive
This commit is contained in:
commit
3879626205
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