Skip to content

Commit

Permalink
idSIMD ToJointQuat detour.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cowcat5150 committed Mar 2, 2023
1 parent fdeb9ae commit a577044
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions neo/idlib/math/Simd_Generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2372,8 +2372,7 @@ inline float FastScalarInvSqrt( float f ) {

void VPCALL idSIMD_Generic::ConvertJointMatsToJointQuats( idJointQuat *jointQuats, const idJointMat *jointMats, const int numJoints ) {

//#if !defined(__MORPHOS__)
#if 1
#if 0

int i;

Expand All @@ -2397,9 +2396,9 @@ void VPCALL idSIMD_Generic::ConvertJointMatsToJointQuats( idJointQuat *jointQuat
float trace;
float s;
float t;
int i;
int j;
int k;
int i;
int j;
int k;

static int next[3] = { 1, 2, 0 };

Expand All @@ -2409,7 +2408,8 @@ void VPCALL idSIMD_Generic::ConvertJointMatsToJointQuats( idJointQuat *jointQuat
if ( trace > 0.0f ) {

t = trace + 1.0f;
s = FastScalarInvSqrt( t ) * 0.5f;
s = idMath::InvSqrt( t ) * 0.5f;
//s = FastScalarInvSqrt( t ) * 0.5f; // try this on G5

jq.q[3] = s * t;
jq.q[0] = ( mat[1 * 4 + 2] - mat[2 * 4 + 1] ) * s;
Expand All @@ -2429,7 +2429,8 @@ void VPCALL idSIMD_Generic::ConvertJointMatsToJointQuats( idJointQuat *jointQuat
k = next[j];

t = ( mat[i * 4 + i] - ( mat[j * 4 + j] + mat[k * 4 + k] ) ) + 1.0f;
s = FastScalarInvSqrt( t ) * 0.5f;
s = idMath::InvSqrt( t ) * 0.5f;
//s = FastScalarInvSqrt( t ) * 0.5f; // try this on G5

jq.q[i] = s * t;
jq.q[3] = ( mat[j * 4 + k] - mat[k * 4 + j] ) * s;
Expand Down

0 comments on commit a577044

Please sign in to comment.