using System; namespace UnityEngine.ProBuilder { /// /// A container for normal, tangent, and bitangent values. /// public struct Normal : IEquatable { /// /// A unit normal. /// public Vector3 normal { get; set; } /// /// A unit tangent. /// public Vector4 tangent { get; set; } /// /// A unit bitangent (sometimes called binormal). /// public Vector3 bitangent { get; set; } public override bool Equals(object obj) { return obj is Normal && Equals((Normal)obj); } public override int GetHashCode() { unchecked { int hashCode = VectorHash.GetHashCode(normal); hashCode = (hashCode * 397) ^ VectorHash.GetHashCode(tangent); hashCode = (hashCode * 397) ^ VectorHash.GetHashCode(bitangent); return hashCode; } } public bool Equals(Normal other) { return Math.Approx3(normal, other.normal) && Math.Approx3(tangent, other.tangent) && Math.Approx3(bitangent, other.bitangent); } public static bool operator==(Normal a, Normal b) { return a.Equals(b); } public static bool operator!=(Normal a, Normal b) { return !(a == b); } } }