public TPoseBoneAccessor(studiohdr_t *studioHeader) { var bones = (mstudiobone_t *)((byte *)studioHeader + studioHeader->boneindex); BoneTransform = new Matrix34f[studioHeader->numbones]; BoneCount = studioHeader->numbones; Matrix34f matrix = new Matrix34f(); Quaternion q = new Quaternion(); Matrix34f.AngleQuaternion(&bones[0].value[3], out q); Matrix34f.QuaternionMatrix(q, out matrix); matrix.Origin = new Vector3(bones[0].value[0], bones[0].value[1], bones[0].value[2]); Matrix34f rebaseTransform = Matrix34f.Zero; rebaseTransform.M[1] = -1; rebaseTransform.M[4] = 1; rebaseTransform.M[10] = 1; Matrix34f.ConcatTransforms(rebaseTransform, matrix, out BoneTransform[0]); for (int i = 1; i < studioHeader->numbones; i++) { Matrix34f.AngleQuaternion(&bones[i].value[3], out q); Matrix34f.QuaternionMatrix(q, out matrix); matrix.Origin = new Vector3(bones[i].value[0], bones[i].value[1], bones[i].value[2]); Matrix34f.ConcatTransforms(BoneTransform[bones[i].parent], matrix, out BoneTransform[i]); } Scale = GBConstant.G2BScale; }
public static Matrix ToBullet(this Matrix34f self) { return(self); }