Matrix4x4_Scale doesn't affect the 4th row, but Matrix4x4_Accumulate
does, leading to wrong result. This broke weapon to player attachment
when the player has a skeletonobject.
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11886
d7cf8633-e32d-0410-b094-
e92efae38249
int firstbone = PRVM_G_FLOAT(OFS_PARM4) - 1;
int lastbone = PRVM_G_FLOAT(OFS_PARM5) - 1;
dp_model_t *model = CL_GetModelByIndex(modelindex);
- float blendfrac;
int numblends;
int bonenum;
int blendindex;
lastbone = min(lastbone, skeleton->model->num_bones - 1);
VM_GenerateFrameGroupBlend(prog, framegroupblend, ed);
VM_FrameBlendFromFrameGroupBlend(frameblend, framegroupblend, model, cl.time);
- blendfrac = 1.0f - retainfrac;
for (numblends = 0;numblends < MAX_FRAMEBLENDS && frameblend[numblends].lerp;numblends++)
;
for (bonenum = firstbone;bonenum <= lastbone;bonenum++)
Matrix4x4_Accumulate(&bonematrix, &matrix, frameblend[blendindex].lerp);
}
Matrix4x4_Normalize3(&bonematrix, &bonematrix);
- Matrix4x4_Scale(&skeleton->relativetransforms[bonenum], retainfrac, retainfrac);
- Matrix4x4_Accumulate(&skeleton->relativetransforms[bonenum], &bonematrix, blendfrac);
+ Matrix4x4_Interpolate(&skeleton->relativetransforms[bonenum], &bonematrix, &skeleton->relativetransforms[bonenum], retainfrac);
}
PRVM_G_FLOAT(OFS_RETURN) = skeletonindex + 1;
}
int firstbone = PRVM_G_FLOAT(OFS_PARM4) - 1;
int lastbone = PRVM_G_FLOAT(OFS_PARM5) - 1;
dp_model_t *model = SV_GetModelByIndex(modelindex);
- float blendfrac;
int numblends;
int bonenum;
int blendindex;
lastbone = min(lastbone, skeleton->model->num_bones - 1);
VM_GenerateFrameGroupBlend(prog, framegroupblend, ed);
VM_FrameBlendFromFrameGroupBlend(frameblend, framegroupblend, model, sv.time);
- blendfrac = 1.0f - retainfrac;
for (numblends = 0;numblends < MAX_FRAMEBLENDS && frameblend[numblends].lerp;numblends++)
;
for (bonenum = firstbone;bonenum <= lastbone;bonenum++)
Matrix4x4_Accumulate(&bonematrix, &matrix, frameblend[blendindex].lerp);
}
Matrix4x4_Normalize3(&bonematrix, &bonematrix);
- Matrix4x4_Scale(&skeleton->relativetransforms[bonenum], retainfrac, retainfrac);
- Matrix4x4_Accumulate(&skeleton->relativetransforms[bonenum], &bonematrix, blendfrac);
+ Matrix4x4_Interpolate(&skeleton->relativetransforms[bonenum], &bonematrix, &skeleton->relativetransforms[bonenum], retainfrac);
}
PRVM_G_FLOAT(OFS_RETURN) = skeletonindex + 1;
}