mirror of
https://github.com/DCFApixels/Unity-DebugX.git
synced 2025-11-12 09:35:55 +08:00
update
This commit is contained in:
parent
5b64866ca4
commit
ede7d5bb4d
@ -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;
|
||||
|
||||
@ -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<InstancingMeshGizmoLayout>(
|
||||
new InstancingMeshGizmoLayout(
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user