Fix rendering IQM models between model frames
For lerped frames (refEntity_t frame not equal oldframe) IQM joint matrices may have incorrect axis scale. This can cause significant model distortion. The matrix lerp is linear causing each vector to move in a straight line between frames instead of arcing like a circle. Each joint frame can have a different scale so can't just normalize the joint matrix. Store joints as quaternions and spherical lerp between them and then convert to a matrix. For my test model, setting up the skeleton is four times slower now but it still seems to be fast enough to be usable.
This commit is contained in:
parent
d13d06424e
commit
d404519cce
5 changed files with 294 additions and 164 deletions
|
@ -368,6 +368,8 @@ typedef vec_t vec3_t[3];
|
|||
typedef vec_t vec4_t[4];
|
||||
typedef vec_t vec5_t[5];
|
||||
|
||||
typedef vec_t quat_t[4];
|
||||
|
||||
typedef int fixed4_t;
|
||||
typedef int fixed8_t;
|
||||
typedef int fixed16_t;
|
||||
|
@ -578,6 +580,8 @@ typedef struct {
|
|||
|
||||
#define Byte4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
|
||||
|
||||
#define QuatCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
|
||||
|
||||
#define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));}
|
||||
// just in case you don't want to use the macros
|
||||
vec_t _DotProduct( const vec3_t v1, const vec3_t v2 );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue