From ede7d5bb4d92433f0d43314d5df4a319e47181da Mon Sep 17 00:00:00 2001 From: DCFApixels <99481254+DCFApixels@users.noreply.github.com> Date: Sun, 12 Oct 2025 22:13:01 +0800 Subject: [PATCH] update --- Runtime/Gizmos/DebugX.lines.cs | 2 +- Runtime/Gizmos/DebugX.primitives.cs | 2 +- Runtime/Utils/DebugXUtility.cs | 23 ----------------------- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/Runtime/Gizmos/DebugX.lines.cs b/Runtime/Gizmos/DebugX.lines.cs index 9016e2b..44c701a 100644 --- a/Runtime/Gizmos/DebugX.lines.cs +++ b/Runtime/Gizmos/DebugX.lines.cs @@ -201,7 +201,7 @@ namespace DCFApixels const float MinDistance = 2.5f; Vector3 direction = end - start; - float distance = DebugXUtility.FastSqrt(direction.sqrMagnitude); + float distance = direction.magnitude; Quaternion rotation = direction == default ? Quaternion.identity : Quaternion.LookRotation(direction); var arrowSize = 0.5f; diff --git a/Runtime/Gizmos/DebugX.primitives.cs b/Runtime/Gizmos/DebugX.primitives.cs index 7a08311..2006674 100644 --- a/Runtime/Gizmos/DebugX.primitives.cs +++ b/Runtime/Gizmos/DebugX.primitives.cs @@ -111,7 +111,7 @@ namespace DCFApixels float x = sqrRadius * sqrRadius / sqrMagnitude; if (x / sqrRadius < 1f) { - float resultSize = DebugXUtility.FastSqrt(sqrRadius - x); + float resultSize = Mathf.Sqrt(sqrRadius - x); _buffer[i] = new Gizmo( new InstancingMeshGizmoLayout( diff --git a/Runtime/Utils/DebugXUtility.cs b/Runtime/Utils/DebugXUtility.cs index 3c7128d..86bf84b 100644 --- a/Runtime/Utils/DebugXUtility.cs +++ b/Runtime/Utils/DebugXUtility.cs @@ -92,29 +92,6 @@ namespace DCFApixels.DebugXCore return isFull ? type.FullName : type.Name; #endif } - - [IN(LINE)] - public static float FastMagnitude(Vector3 v) - { - return FastSqrt(v.x * v.x + v.y * v.y + v.z * v.z); - } - [IN(LINE)] - public static unsafe float FastSqrt(float number) - { - long i; - float x2, y; - const float threehalfs = 1.5F; - - x2 = number * 0.5F; - y = number; - i = *(long*)&y; // evil floating point bit level hacking - i = 0x5f3759df - (i >> 1); // what the fuck? - y = *(float*)&i; - y = y * (threehalfs - (x2 * y * y)); // 1st iteration - //y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed - - return 1 / y; - } [IN(LINE)] public static int NextPow2(int v) {