using System;
using System.Runtime.InteropServices;
using System.Text;
namespace UnityEngine.XR.ARKit
{
///
/// Represents the minimum and maximum supported exposure duration and ISO values.
///
[StructLayout(LayoutKind.Sequential)]
public struct ARKitExposureRange : IEquatable
{
double m_MinimumDuration;
double m_MaximumDuration;
float m_MinimumIso;
float m_MaximumIso;
///
/// Minimum supported exposure duration in seconds with sub-millisecond precision.
///
public double minimumDuration => m_MinimumDuration;
///
/// Maximum supported exposure duration in seconds with sub-millisecond precision.
///
public double maximumDuration => m_MaximumDuration;
///
/// Minimum supported exposure ISO value.
///
public float minimumIso => m_MinimumIso;
///
/// Maximum supported exposure ISO value.
///
public float maximumIso => m_MaximumIso;
///
/// Tests for equality.
///
///
/// Two s are considered equal if their minimum duration, maximum duration, minimum ISO, and maximum ISO values are equal.
///
/// The to compare against.
/// if the duration range and ISO range are the same. Otherwise, .
public bool Equals(ARKitExposureRange other)
{
return m_MinimumDuration.Equals(other.m_MinimumDuration)
&& m_MaximumDuration.Equals(other.m_MaximumDuration)
&& m_MinimumIso.Equals(other.m_MinimumIso)
&& m_MaximumIso.Equals(other.m_MaximumIso);
}
///
/// Tests for equality.
///
/// An to compare against.
/// if is an and is
/// equal to this instance using .
public override bool Equals(object obj)
{
return obj is ARKitExposureRange 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_MinimumDuration.GetHashCode();
hashCode = (hashCode * 486187739) + m_MaximumDuration.GetHashCode();
hashCode = (hashCode * 486187739) + m_MinimumIso.GetHashCode();
hashCode = (hashCode * 486187739) + m_MaximumIso.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 ==(ARKitExposureRange lhs, ARKitExposureRange 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 !=(ARKitExposureRange lhs, ARKitExposureRange 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($" MinimumDuration: {m_MinimumDuration:0.000}");
sb.AppendLine($" MaximumDuration: {m_MaximumDuration:0.000}");
sb.AppendLine($" MinimumISO: {m_MinimumIso:0.000}");
sb.AppendLine($" MaximumISO: {m_MaximumIso:0.000}");
sb.AppendLine("}");
return sb.ToString();
}
}
}