Added a flag that can disable looping of animations, used by some zyms.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1568 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
8882e0ec30
commit
6b8551e8b9
1 changed files with 37 additions and 7 deletions
|
@ -134,6 +134,7 @@ typedef struct {
|
||||||
qboolean isheirachical; //for models with transforms, states that bones need to be transformed from thier parent.
|
qboolean isheirachical; //for models with transforms, states that bones need to be transformed from thier parent.
|
||||||
//this is actually bad, and can result in bones shortening as they interpolate.
|
//this is actually bad, and can result in bones shortening as they interpolate.
|
||||||
#endif
|
#endif
|
||||||
|
qboolean loop;
|
||||||
int numposes;
|
int numposes;
|
||||||
float rate;
|
float rate;
|
||||||
int poseofs;
|
int poseofs;
|
||||||
|
@ -801,8 +802,16 @@ static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, i
|
||||||
frame1=mlerp;
|
frame1=mlerp;
|
||||||
frame2=frame1+1;
|
frame2=frame1+1;
|
||||||
mlerp-=frame1;
|
mlerp-=frame1;
|
||||||
frame1=frame1%g1->numposes;
|
if (g1->loop)
|
||||||
frame2=frame2%g1->numposes;
|
{
|
||||||
|
frame1=frame1%g1->numposes;
|
||||||
|
frame2=frame2%g1->numposes;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
frame1=(frame1>g1->numposes-1)?g1->numposes-1:frame1;
|
||||||
|
frame2=(frame2>g1->numposes-1)?g1->numposes-1:frame2;
|
||||||
|
}
|
||||||
|
|
||||||
plerp[l] = (1-mlerp)*(1-lerp);
|
plerp[l] = (1-mlerp)*(1-lerp);
|
||||||
if (plerp[l]>0)
|
if (plerp[l]>0)
|
||||||
|
@ -817,8 +826,16 @@ static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, i
|
||||||
frame1=mlerp;
|
frame1=mlerp;
|
||||||
frame2=frame1+1;
|
frame2=frame1+1;
|
||||||
mlerp-=frame1;
|
mlerp-=frame1;
|
||||||
frame1=frame1%g2->numposes;
|
if (g2->loop)
|
||||||
frame2=frame2%g2->numposes;
|
{
|
||||||
|
frame1=frame1%g2->numposes;
|
||||||
|
frame2=frame2%g2->numposes;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
frame1=(frame1>g2->numposes-1)?g2->numposes-1:frame1;
|
||||||
|
frame2=(frame2>g2->numposes-1)?g2->numposes-1:frame2;
|
||||||
|
}
|
||||||
|
|
||||||
plerp[l] = (1-mlerp)*(lerp);
|
plerp[l] = (1-mlerp)*(lerp);
|
||||||
if (plerp[l]>0)
|
if (plerp[l]>0)
|
||||||
|
@ -846,9 +863,16 @@ static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, i
|
||||||
frame1=lerp;
|
frame1=lerp;
|
||||||
frame2=frame1+1;
|
frame2=frame1+1;
|
||||||
lerp-=frame1;
|
lerp-=frame1;
|
||||||
frame1=frame1%g1->numposes;
|
if (g1->loop)
|
||||||
frame2=frame2%g1->numposes;
|
{
|
||||||
|
frame1=frame1%g1->numposes;
|
||||||
|
frame2=frame2%g1->numposes;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
frame1=(frame1>g1->numposes-1)?g1->numposes-1:frame1;
|
||||||
|
frame2=(frame2>g1->numposes-1)?g1->numposes-1:frame2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else //don't bother with a four way lerp. Yeah, this will produce jerkyness with models with just framegroups.
|
else //don't bother with a four way lerp. Yeah, this will produce jerkyness with models with just framegroups.
|
||||||
{
|
{
|
||||||
|
@ -2745,6 +2769,8 @@ void GL_LoadSkinFile(galiastexnum_t *texnum, char *surfacename, int skinnumber,
|
||||||
|
|
||||||
GL_ParseQ3SkinFile(shadername, surfacename, loadmodel->name, skinnumber, NULL);
|
GL_ParseQ3SkinFile(shadername, surfacename, loadmodel->name, skinnumber, NULL);
|
||||||
|
|
||||||
|
texnum->shader = R_RegisterSkin(shadername);
|
||||||
|
|
||||||
texnum->base = Mod_LoadHiResTexture(shadername, "models", true, true, true);
|
texnum->base = Mod_LoadHiResTexture(shadername, "models", true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2770,6 +2796,7 @@ static void *Q1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
|
||||||
vec3_t *verts;
|
vec3_t *verts;
|
||||||
|
|
||||||
frame = (galiasgroup_t*)((char *)galias + galias->groupofs);
|
frame = (galiasgroup_t*)((char *)galias + galias->groupofs);
|
||||||
|
frame->loop = true;
|
||||||
|
|
||||||
for (i = 0; i < pq1inmodel->numframes; i++)
|
for (i = 0; i < pq1inmodel->numframes; i++)
|
||||||
{
|
{
|
||||||
|
@ -4253,6 +4280,7 @@ typedef struct zymscene_s
|
||||||
int flags;
|
int flags;
|
||||||
int start, length; // range of poses
|
int start, length; // range of poses
|
||||||
} zymscene_t;
|
} zymscene_t;
|
||||||
|
#define ZYMSCENEFLAG_NOLOOP 1
|
||||||
|
|
||||||
typedef struct zymvertex_s
|
typedef struct zymvertex_s
|
||||||
{
|
{
|
||||||
|
@ -4446,6 +4474,7 @@ void GLMod_LoadZymoticModel(model_t *mod, void *buffer)
|
||||||
{
|
{
|
||||||
grp->isheirachical = 1;
|
grp->isheirachical = 1;
|
||||||
grp->rate = BigFloat(inscene->framerate);
|
grp->rate = BigFloat(inscene->framerate);
|
||||||
|
grp->loop = !(BigLong(inscene->flags) & ZYMSCENEFLAG_NOLOOP);
|
||||||
grp->numposes = BigLong(inscene->length);
|
grp->numposes = BigLong(inscene->length);
|
||||||
grp->poseofs = (char*)matrix - (char*)grp;
|
grp->poseofs = (char*)matrix - (char*)grp;
|
||||||
grp->poseofs += BigLong(inscene->start)*12*sizeof(float)*root->numbones;
|
grp->poseofs += BigLong(inscene->start)*12*sizeof(float)*root->numbones;
|
||||||
|
@ -5479,6 +5508,7 @@ galiasgroup_t GLMod_ParseMD5Anim(char *buffer, galiasinfo_t *prototype, void**po
|
||||||
grp.isheirachical = true;
|
grp.isheirachical = true;
|
||||||
grp.numposes = numframes;
|
grp.numposes = numframes;
|
||||||
grp.rate = framespersecond;
|
grp.rate = framespersecond;
|
||||||
|
grp.loop = true;
|
||||||
|
|
||||||
return grp;
|
return grp;
|
||||||
#undef EXPECT
|
#undef EXPECT
|
||||||
|
|
Loading…
Reference in a new issue