1
0
Fork 0
forked from fte/fteqw

fix pointer lock.

r_nolerp should affect skeletal framegroups too.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4853 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2015-04-21 14:58:29 +00:00
parent 906b705bf0
commit afe18bec95
2 changed files with 26 additions and 2 deletions

View file

@ -1151,6 +1151,7 @@ static qboolean Alias_BuildSkelLerps(skellerps_t *lerps, struct framestateregion
galiasanimation_t *g; galiasanimation_t *g;
unsigned int b; unsigned int b;
float totalweight = 0; float totalweight = 0;
extern cvar_t r_nolerp;
lerps->skeltype = SKEL_IDENTITY; //sometimes nothing else is valid. lerps->skeltype = SKEL_IDENTITY; //sometimes nothing else is valid.
@ -1187,8 +1188,10 @@ static qboolean Alias_BuildSkelLerps(skellerps_t *lerps, struct framestateregion
else if (lerps->skeltype != g->skeltype) else if (lerps->skeltype != g->skeltype)
continue; //oops, can't cope with mixed blend types continue; //oops, can't cope with mixed blend types
if (frame1 == frame2 || r_noframegrouplerp.ival) if (frame1 == frame2)
mlerp = 0; mlerp = 0;
else if (r_noframegrouplerp.ival)
mlerp = (mlerp>0.5)?1:0;
lerps->frac[l] = (1-mlerp)*fs->lerpweight[b]; lerps->frac[l] = (1-mlerp)*fs->lerpweight[b];
if (lerps->frac[l]>0) if (lerps->frac[l]>0)
{ {
@ -1204,7 +1207,23 @@ static qboolean Alias_BuildSkelLerps(skellerps_t *lerps, struct framestateregion
} }
} }
if (l && totalweight != 1) if (r_nolerp.ival && l > 1)
{ //when lerping is completely disabled, find the strongest influence
frame1 = 0;
mlerp = lerps->frac[0];
for (b = 1; b < l; b++)
{
if (lerps->frac[b] > mlerp)
{
frame1 = b;
mlerp = lerps->frac[b];
}
}
lerps->frac[0] = 1;
lerps->pose[0] = lerps->pose[frame1];
l = 1;
}
else if (l && totalweight != 1)
{ //don't rescale if some animation got dropped. { //don't rescale if some animation got dropped.
totalweight = 1 / totalweight; totalweight = 1 / totalweight;
for (b = 0; b < l; b++) for (b = 0; b < l; b++)

View file

@ -305,6 +305,11 @@ mergeInto(LibraryManager.library,
events.forEach(function(event) events.forEach(function(event)
{ {
Module['canvas'].addEventListener(event, FTEC.handleevent, true); Module['canvas'].addEventListener(event, FTEC.handleevent, true);
});
var docevents = ['keypress', 'keydown', 'keyup'];
docevents.forEach(function(event)
{
document.addEventListener(event, FTEC.handleevent, true); document.addEventListener(event, FTEC.handleevent, true);
}); });