X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=r_lerpanim.c;h=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391;hp=f384d81af0eb39c67af64157fb3c565e70e413ed;hb=d694563ab3206f9ef3c89d275cc75f7de45034b8;hpb=9e10334c3d85c0ff3630fe015f40b5c5a227668a diff --git a/r_lerpanim.c b/r_lerpanim.c index f384d81a..e69de29b 100644 --- a/r_lerpanim.c +++ b/r_lerpanim.c @@ -1,101 +0,0 @@ -#include "quakedef.h" - -// LordHavoc: quite tempting to break apart this function to reuse the -// duplicated code, but I suspect it is better for performance -// this way -// LordHavoc: later note: made FRAMEBLENDINSERT macro -void R_LerpAnimation(entity_render_t *r) -{ - int sub2, numframes, f, i, k; - int isfirstframegroup = true; - int nolerp; - double sublerp, lerp, d; - animscene_t *scene; - framegroupblend_t *g; - frameblend_t *blend; - dp_model_t *model = r->model; - - memset(r->frameblend, 0, sizeof(r->frameblend)); - - if (!model || !model->surfmesh.isanimated) - { - r->frameblend[0].lerp = 1; - return; - } - - blend = r->frameblend; - nolerp = (model->type == mod_sprite) ? !r_lerpsprites.integer : !r_lerpmodels.integer; - numframes = model->numframes; - for (k = 0, g = r->framegroupblend;k < MAX_FRAMEGROUPBLENDS;k++, g++) - { - if ((unsigned int)g->frame >= (unsigned int)numframes) - { - Con_DPrintf("CL_LerpAnimation: no such frame %d\n", g->frame); - g->frame = 0; - } - f = g->frame; - d = lerp = g->lerp; - if (lerp <= 0) - continue; - if (nolerp) - { - if (isfirstframegroup) - { - d = lerp = 1; - isfirstframegroup = false; - } - else - continue; - } - if (model->animscenes) - { - scene = model->animscenes + f; - f = scene->firstframe; - if (scene->framecount > 1) - { - // this code path is only used on .zym models and torches - sublerp = scene->framerate * (cl.time - g->start); - f = (int) floor(sublerp); - sublerp -= f; - sub2 = f + 1; - if (nolerp) - sublerp = 0; - if (scene->loop) - { - f = (f % scene->framecount); - sub2 = (sub2 % scene->framecount); - } - f = bound(0, f, (scene->framecount - 1)) + scene->firstframe; - sub2 = bound(0, sub2, (scene->framecount - 1)) + scene->firstframe; - d = sublerp * lerp; - // two framelerps produced from one animation - if (f != sub2 && d > 0) - { - for (i = 0;i < MAX_FRAMEBLENDS;i++) - { - if (blend[i].lerp <= 0 || blend[i].subframe == sub2) - { - blend[i].subframe = sub2; - blend[i].lerp += d; - break; - } - } - } - d = (1 - sublerp) * lerp; - } - } - if (d > 0) - { - for (i = 0;i < MAX_FRAMEBLENDS;i++) - { - if (blend[i].lerp <= 0 || blend[i].subframe == f) - { - blend[i].subframe = f; - blend[i].lerp += d; - break; - } - } - } - } -} -