mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 14:42:13 +00:00
don't bug out so much on skeletal models when frametimes are negative (can happen via csqc)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5226 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
cfa28262b4
commit
93624e9d62
3 changed files with 11 additions and 8 deletions
|
@ -1004,8 +1004,8 @@ typedef struct
|
||||||
} skellerps_t;
|
} skellerps_t;
|
||||||
static qboolean Alias_BuildSkelLerps(skellerps_t *lerps, struct framestateregion_s *fs, int numbones, galiasinfo_t *inf)
|
static qboolean Alias_BuildSkelLerps(skellerps_t *lerps, struct framestateregion_s *fs, int numbones, galiasinfo_t *inf)
|
||||||
{
|
{
|
||||||
unsigned int frame1;
|
int frame1; //signed, because frametime might be negative...
|
||||||
unsigned int frame2;
|
int frame2;
|
||||||
float mlerp; //minor lerp, poses within a group.
|
float mlerp; //minor lerp, poses within a group.
|
||||||
int l = 0;
|
int l = 0;
|
||||||
galiasanimation_t *g;
|
galiasanimation_t *g;
|
||||||
|
@ -1042,18 +1042,22 @@ static qboolean Alias_BuildSkelLerps(skellerps_t *lerps, struct framestateregion
|
||||||
}
|
}
|
||||||
|
|
||||||
mlerp = time*g->rate;
|
mlerp = time*g->rate;
|
||||||
frame1=mlerp;
|
frame1=floor(mlerp);
|
||||||
frame2=frame1+1;
|
frame2=frame1+1;
|
||||||
mlerp-=frame1;
|
mlerp-=frame1;
|
||||||
if (g->loop)
|
if (g->loop)
|
||||||
{ //loop normally.
|
{ //loop normally.
|
||||||
frame1=frame1%g->numposes;
|
frame1=frame1%g->numposes;
|
||||||
frame2=frame2%g->numposes;
|
frame2=frame2%g->numposes;
|
||||||
|
if (frame1 < 0)
|
||||||
|
frame1 += g->numposes;
|
||||||
|
if (frame2 < 0)
|
||||||
|
frame2 += g->numposes;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
frame1=(frame1>g->numposes-1)?g->numposes-1:frame1;
|
frame1=bound(0, frame1, g->numposes-1);
|
||||||
frame2=(frame2>g->numposes-1)?g->numposes-1:frame2;
|
frame2=bound(0, frame2, g->numposes-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lerps->skeltype == SKEL_IDENTITY)
|
if (lerps->skeltype == SKEL_IDENTITY)
|
||||||
|
|
|
@ -1895,10 +1895,9 @@ vec_t QDECL VectorNormalize2 (const vec3_t v, vec3_t out)
|
||||||
float length, ilength;
|
float length, ilength;
|
||||||
|
|
||||||
length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
|
length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
|
||||||
|
length = sqrt (length);
|
||||||
if (length)
|
if (length)
|
||||||
{
|
{
|
||||||
length = sqrt (length); // FIXME
|
|
||||||
ilength = 1/length;
|
ilength = 1/length;
|
||||||
out[0] = v[0]*ilength;
|
out[0] = v[0]*ilength;
|
||||||
out[1] = v[1]*ilength;
|
out[1] = v[1]*ilength;
|
||||||
|
|
|
@ -1726,7 +1726,7 @@ void R_GAlias_GenerateBatches(entity_t *e, batch_t **batches)
|
||||||
continue;
|
continue;
|
||||||
skin = skin?skin:NULL;
|
skin = skin?skin:NULL;
|
||||||
shader = e->forcedshader?e->forcedshader:regshader;
|
shader = e->forcedshader?e->forcedshader:regshader;
|
||||||
if (shader)
|
if (shader && !(shader->flags & SHADER_NODRAW))
|
||||||
{
|
{
|
||||||
b = BE_GetTempBatch();
|
b = BE_GetTempBatch();
|
||||||
if (!b)
|
if (!b)
|
||||||
|
|
Loading…
Reference in a new issue