summaryrefslogtreecommitdiffhomepage
path: root/src/rmodels.c
diff options
context:
space:
mode:
authorNikita Blizniuk <[email protected]>2024-02-19 18:51:04 +0100
committerGitHub <[email protected]>2024-02-19 18:51:04 +0100
commit54e0af40c1c534b3f3958264c67270434183639e (patch)
treedfcbd8f283535ee0ac604e591f34dab19da07e15 /src/rmodels.c
parent77eeb0010e957a2468deea3ac9f7c74fd3674202 (diff)
downloadraylib-54e0af40c1c534b3f3958264c67270434183639e.tar.gz
raylib-54e0af40c1c534b3f3958264c67270434183639e.zip
fixed loading GLTF animations with 1 frame (#3804)
Diffstat (limited to 'src/rmodels.c')
-rw-r--r--src/rmodels.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rmodels.c b/src/rmodels.c
index aef0e7c5..166f51a6 100644
--- a/src/rmodels.c
+++ b/src/rmodels.c
@@ -5368,7 +5368,7 @@ static bool GetPoseAtTimeGLTF(cgltf_accessor *input, cgltf_accessor *output, flo
}
}
- float t = (time - tstart)/(tend - tstart);
+ float t = (time - tstart)/fmax((tend - tstart), EPSILON);
t = (t < 0.0f)? 0.0f : t;
t = (t > 1.0f)? 1.0f : t;
@@ -5506,7 +5506,7 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCo
strncpy(animations[i].name, animData.name, sizeof(animations[i].name));
animations[i].name[sizeof(animations[i].name) - 1] = '\0';
- animations[i].frameCount = (int)(animDuration*1000.0f/GLTF_ANIMDELAY);
+ animations[i].frameCount = (int)(animDuration*1000.0f/GLTF_ANIMDELAY) + 1;
animations[i].framePoses = RL_MALLOC(animations[i].frameCount*sizeof(Transform *));
for (int j = 0; j < animations[i].frameCount; j++)