2024-07-21 21:13:31 +00:00
|
|
|
using System.Numerics;
|
|
|
|
|
2024-08-17 17:48:01 +00:00
|
|
|
namespace KeepersCompound.TMV;
|
2024-07-21 21:13:31 +00:00
|
|
|
|
|
|
|
public static class Utils
|
|
|
|
{
|
2024-08-01 17:29:10 +00:00
|
|
|
const float InverseScale = 4.0f;
|
2024-08-25 10:54:21 +00:00
|
|
|
public static Godot.Vector3 ToGodotVec3(this Vector3 vec, bool scale = true)
|
2024-07-21 21:13:31 +00:00
|
|
|
{
|
2024-08-25 10:54:21 +00:00
|
|
|
return new Godot.Vector3(vec.Y, vec.Z, vec.X) / (scale ? InverseScale : 1.0f);
|
2024-07-21 21:13:31 +00:00
|
|
|
}
|
2024-12-07 12:35:44 +00:00
|
|
|
|
|
|
|
public static Godot.Transform3D ToGodotTransform3D(this Matrix4x4 mat, bool scale = true)
|
|
|
|
{
|
|
|
|
var t = mat.Translation / (scale ? InverseScale : 1.0f);
|
2024-12-07 15:09:18 +00:00
|
|
|
return new Godot.Transform3D(mat.M22, mat.M32, mat.M12, mat.M23, mat.M33, mat.M13, mat.M21, mat.M31, mat.M11, t.Y, t.Z, t.X);
|
2024-12-07 12:35:44 +00:00
|
|
|
}
|
2024-07-21 21:13:31 +00:00
|
|
|
}
|