broken
This commit is contained in:
@@ -1,11 +1,36 @@
|
||||
using UnityEngine;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine.Extensions {
|
||||
public static class Vector3Ex {
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Vector3 With(this Vector3 vec, float? x = null, float? y = null, float? z = null) {
|
||||
return new Vector3(x ?? vec.x,
|
||||
y ?? vec.y,
|
||||
z ?? vec.z);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool IsZero(this Vector3 vec, float epsilon = float.Epsilon) {
|
||||
return math.abs(vec.x) < epsilon && math.abs(vec.y) < epsilon && math.abs(vec.z) < epsilon;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool IsNonZero(this Vector3 vec, float epsilon = float.Epsilon) {
|
||||
return !vec.IsZero(epsilon);
|
||||
}
|
||||
}
|
||||
|
||||
public static class float3Ex {
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool IsZero(this float3 vec, float epsilon = float.Epsilon) {
|
||||
return math.abs(vec.x) < epsilon && math.abs(vec.y) < epsilon && math.abs(vec.z) < epsilon;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool IsNonZero(this float3 vec, float epsilon = float.Epsilon) {
|
||||
return !vec.IsZero(epsilon);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user