using System;
using System.Runtime.InteropServices;
using System.Text;
namespace UnityEngine.XR.ARKit
{
///
/// Represents the white balance gain values.
///
[StructLayout(LayoutKind.Sequential)]
public struct ARKitWhiteBalanceGains : IEquatable
{
float m_Blue;
float m_Green;
float m_Red;
///
/// The blue gain component of the white balance value.
///
public float blue => m_Blue;
///
/// The green gain component of the white balance value.
///
public float green => m_Green;
///
/// The red gain component of the white balance value.
///
public float red => m_Red;
///
/// Constructs an instance with given white balance gain values.
///
/// The blue gain.
/// The green gain.
/// The red gain.
public ARKitWhiteBalanceGains(float blue, float green, float red)
{
m_Blue = blue;
m_Green = green;
m_Red = red;
}
///
/// Tests for equality.
///
///
/// Two s are considered equal if their underlying blue, green,
/// and red gain values are equal.
///
/// The to compare against.
/// if the underlying blue, green, and red gains are the same.
/// Otherwise, .
public bool Equals(ARKitWhiteBalanceGains other)
{
return m_Blue.Equals(other.m_Blue)
&& m_Green.Equals(other.m_Green)
&& m_Red.Equals(other.m_Red);
}
///
/// Tests for equality.
///
/// An to compare against.
/// if is an and it compares
/// equal to this one using .
public override bool Equals(object obj)
{
return obj is ARKitWhiteBalanceGains 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_Blue.GetHashCode();
hashCode = (hashCode * 486187739) + m_Green.GetHashCode();
hashCode = (hashCode * 486187739) + m_Red.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 ==(ARKitWhiteBalanceGains lhs, ARKitWhiteBalanceGains rhs) => lhs.Equals(rhs);
///
/// Tests for inequality. Same as the negation of .
///
/// The to compare with .
/// The to compare with .
/// if is equal to using
/// . Otherwise, .
public static bool operator !=(ARKitWhiteBalanceGains lhs, ARKitWhiteBalanceGains 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($" Blue gain: {m_Blue:0.000}");
sb.AppendLine($" Green gain: {m_Green:0.000}");
sb.AppendLine($" Red gain: {m_Red:0.000}");
sb.AppendLine("}");
return sb.ToString();
}
}
}