- sub1 = (sub1 % scene->framecount) + scene->firstframe;
- sub2 = (sub2 % scene->framecount) + scene->firstframe;
+ sublerp = scene->framerate * (cl.time - r->frame1time);
+ sub1 = (int) (sublerp);
+ sub2 = sub1 + 1;
+ sublerp -= sub1;
+ if (sublerp < (1.0f / 65536.0f))
+ sublerp = 0;
+ if (sublerp >= (65535.0f / 65536.0f))
+ sublerp = 1;
+ if (scene->loop)
+ {
+ sub1 = (sub1 % scene->framecount);
+ sub2 = (sub2 % scene->framecount);
+ }
+ else
+ {
+ sub1 = bound(0, sub1, (scene->framecount - 1));
+ sub2 = bound(0, sub2, (scene->framecount - 1));
+ }
+ sub1 += scene->firstframe;
+ sub2 += scene->firstframe;
+ f = sub1;
+ d = (1 - sublerp) * lerp;
+#define FRAMEBLENDINSERT\
+ if (d > 0)\
+ {\
+ for (i = 0;i < 4;i++)\
+ {\
+ if (blend[i].frame == f)\
+ {\
+ blend[i].lerp += d;\
+ break;\
+ }\
+ if (blend[i].lerp <= 0)\
+ {\
+ blend[i].frame = f;\
+ blend[i].lerp = d;\
+ break;\
+ }\
+ }\
+ }
+ FRAMEBLENDINSERT
+ f = sub2;
+ d = sublerp * lerp;