On 22/11/2022 20:07, Martin Storsjö wrote:
+ inline bool decompose(const float4x4 &mat, float3 *out_scale, quaternion *out_rot, float3 *out_translate) { + float4x4 val = mat; + if (out_translate) + *out_translate = translation(val); + val.m41 = val.m42 = val.m43 = 0.0f; + float3 scale = float3( + length(float3(val.m11, val.m12, val.m13)), + length(float3(val.m21, val.m22, val.m23)), + length(float3(val.m31, val.m32, val.m33)) + ); + if (out_scale) + *out_scale = scale; + val = make_float4x4_scale(float3(1.0f/scale.x, 1.0f/scale.y, 1.0f/scale.z)) * val; + if (out_rot) + *out_rot = make_quaternion_from_rotation_matrix(val); + return true; + }
I feel that there should be some conditions that cause this function to return false, if the input is not a scale/rotate/translate matrix...
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public