hanim fix

This commit is contained in:
aap 2020-06-01 20:28:04 +02:00
parent 7c7727e7da
commit 8bbb6a2a4a
2 changed files with 10 additions and 4 deletions

View file

@ -319,14 +319,20 @@ HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier)
RpHAnimAnimation *anim = RpHAnimAnimationCreate(rpHANIMSTDKEYFRAMETYPEID, numNodes, 0, 0.0f);
if(anim == nil)
return nil;
RpHAnimStdKeyFrame *frame = (RpHAnimStdKeyFrame*)HANIMFRAMES(anim);
RpHAnimStdKeyFrame *frame;
for(i = 0; i < numNodes; i++){
frame = (RpHAnimStdKeyFrame*)HANIMFRAME(anim, i); // games uses struct size here, not safe
frame->q.real = 1.0f;
frame->q.imag.x = frame->q.imag.y = frame->q.imag.z = 0.0f;
frame->t.x = frame->t.y = frame->t.z = 0.0f;
#ifdef FIX_BUGS
// times are subtracted and divided giving NaNs
// so they can't both be 0
frame->time = i/hier->numNodes;
#else
frame->time = 0.0f;
#endif
frame->prevFrame = nil;
frame++;
}
return anim;
}