using System; using System.Runtime.InteropServices; using System.Text; namespace UnityEngine.XR.ARKit { /// /// Represents the minimum and maximum supported white balance gain values. /// [StructLayout(LayoutKind.Sequential)] public struct ARKitWhiteBalanceRange : IEquatable { float m_MinimumGain; float m_MaximumGain; /// /// Minimum supported white balance gain value. /// public float minimumGain => m_MinimumGain; /// /// Maximum supported white balance gain value. /// public float maximumGain => m_MaximumGain; /// /// Tests for equality. /// /// /// Two s are considered equal if their underlying minimum gain, and /// maximum gain values are equal. /// /// The to compare against. /// if the underlying white balance gain range are the same. /// Otherwise, . public bool Equals(ARKitWhiteBalanceRange other) { return m_MinimumGain.Equals(other.m_MinimumGain) && m_MaximumGain.Equals(other.m_MaximumGain); } /// /// Tests for equality. /// /// An to compare against. /// if is an and it compares /// equal to this one using . Otherwise, . public override bool Equals(object obj) { return obj is ARKitWhiteBalanceRange other && Equals(other); } /// /// Generates a hash code suitable for use with a `HashSet` or `Dictionary` /// /// A hash code for this . public override int GetHashCode() { int hashCode = 486187739; unchecked { hashCode = (hashCode * 486187739) + m_MinimumGain.GetHashCode(); hashCode = (hashCode * 486187739) + m_MaximumGain.GetHashCode(); } return hashCode; } /// /// Tests for equality. Same as . /// /// The to compare with . /// The to compare with . /// if is equal to using /// . Otherwise, . public static bool operator ==(ARKitWhiteBalanceRange lhs, ARKitWhiteBalanceRange rhs) => lhs.Equals(rhs); /// /// Tests for inequality. Equivalent to the negation of . /// /// The to compare with . /// The to compare with . /// if is equal to using /// . Otherwise, . public static bool operator !=(ARKitWhiteBalanceRange lhs, ARKitWhiteBalanceRange rhs) => !lhs.Equals(rhs); /// /// Generates a string representation of this suitable for debugging purposes. /// /// A string representation of this . public override string ToString() { var sb = new StringBuilder(); sb.AppendLine("{"); sb.AppendLine($" MinimumGain: {m_MinimumGain:0.000}"); sb.AppendLine($" MaximumGain: {m_MaximumGain:0.000}"); sb.AppendLine("}"); return sb.ToString(); } } }