Fusee
Fusee copied to clipboard
Transform shouldn't implicitly convert zero-scale-matrices to `NaN`
Current behavior
var tr = new Transform();
tr.RotationMatrix = new float4x4(float4.Zero, float4.Zero, float4.Zero, new float4(0, 0, 0, 1));
Console.WriteLine(tr.RotationMatrix.ToString());
Output
(NaN; NaN; NaN; 0)
(NaN; NaN; NaN; 0)
(NaN; NaN; NaN; 0)
(0; 0; 0; 1)
Rendering output crashes without any warnings or error messages.
Expected behavior
Output
(0; 0; 0; 0)
(0; 0; 0; 0)
(0; 0; 0; 0)
(0; 0; 0; 1)
How to fix
Check before dividing by 0 within all float4x4 methods.
https://github.com/FUSEEProjectTeam/Fusee/blob/38ddf80c4df7a49607973cbefbc1957d564637f0/src/Math/Core/float4x4.cs#L2143
These methods are called implicitly via the setters inside Transform.cs
https://github.com/FUSEEProjectTeam/Fusee/blob/38ddf80c4df7a49607973cbefbc1957d564637f0/src/Engine/Core/Scene/Transform.cs#L107