mirror of
https://github.com/raysan5/raylib.git
synced 2026-08-24 21:28:27 -04:00
Compare commits
2 Commits
1225932449
...
d46a59367f
| Author | SHA1 | Date | |
|---|---|---|---|
| d46a59367f | |||
| 868413839a |
@ -357,7 +357,7 @@
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\src\external\glfw\include</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<DebugInformationFormat />
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
||||
@ -6390,6 +6390,7 @@ static bool GetPoseAtTimeGLTF(cgltf_interpolation_type interpolationType, cgltf_
|
||||
float tstart = 0.0f;
|
||||
float tend = 0.0f;
|
||||
int keyframe = 0; // Defaults to first pose
|
||||
bool found = false;
|
||||
|
||||
for (int i = 0; i < (int)input->count - 1; i++)
|
||||
{
|
||||
@ -6402,10 +6403,26 @@ static bool GetPoseAtTimeGLTF(cgltf_interpolation_type interpolationType, cgltf_
|
||||
if ((tstart <= time) && (time < tend))
|
||||
{
|
||||
keyframe = i;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// No interval contains a time at (or past) the last keyframe, because the
|
||||
// search above requires time < tend: clamp to the edge interval instead of
|
||||
// falling back to keyframe 0, which returns a pose from the start
|
||||
if (!found && ((int)input->count >= 2))
|
||||
{
|
||||
keyframe = (int)input->count - 2;
|
||||
|
||||
float tfirst = 0.0f;
|
||||
if (!cgltf_accessor_read_float(input, 0, &tfirst, 1)) return false;
|
||||
if (time < tfirst) keyframe = 0;
|
||||
|
||||
if (!cgltf_accessor_read_float(input, keyframe, &tstart, 1)) return false;
|
||||
if (!cgltf_accessor_read_float(input, keyframe + 1, &tend, 1)) return false;
|
||||
}
|
||||
|
||||
// Constant animation, no need to interpolate
|
||||
if (FloatEquals(tend, tstart))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user