Skip to content

Commit

Permalink
kram - simd - faster decompose_scale
Browse files Browse the repository at this point in the history
  • Loading branch information
alecazam committed Nov 4, 2024
1 parent dc52d03 commit 1bacbd6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libkram/vectormath/float234.h
Original file line number Diff line number Diff line change
Expand Up @@ -994,13 +994,15 @@ SIMD_CALL float4x4 float4x4m(float3 axis, float radians)
// These sizes are positive and do not include inversion
SIMD_CALL float decompose_size(const float4x4& m)
{
// assumes m[0].w is 0
return length(m[0]);
}
SIMD_CALL float3 decompose_scale(const float4x4& m)
{
return float3m(length(m[0]),
length(m[1]),
length(m[2]));
// assumes m[i].w is 0
return sqrt(float3m(length_squared(m[0]),
length_squared(m[1]),
length_squared(m[2])));
}
SIMD_CALL float decompose_scale_max(const float4x4& m)
{
Expand Down

0 comments on commit 1bacbd6

Please sign in to comment.