using System; namespace UnityEngine.XR.ARSubsystems { /// /// Encapsulates the parameters for creating a new . /// public struct XRCameraSubsystemCinfo : IEquatable { /// /// Specifies an identifier for the provider implementation of the subsystem. /// /// /// The identifier for the provider implementation of the subsystem. /// public string id { get; set; } /// /// Specifies the provider implementation type to use for instantiation. /// /// /// The provider implementation type to use for instantiation. /// public Type implementationType { get; set; } /// /// Specifies if current subsystem is allowed to provide average brightness. /// /// /// true if current subsystem is allowed to provide average brightness. Otherwise, false. /// public bool supportsAverageBrightness { get; set; } /// /// Specifies if current subsystem is allowed to provide average camera temperature. /// /// /// true if current subsystem is allowed to provide average camera temperature. Otherwise, false. /// public bool supportsAverageColorTemperature { get; set; } /// /// True if color correction is supported. /// public bool supportsColorCorrection { get; set; } /// /// Specifies if current subsystem is allowed to provide display matrix. /// /// /// true if current subsystem is allowed to provide display matrix. Otherwise, false. /// public bool supportsDisplayMatrix { get; set; } /// /// Specifies if current subsystem is allowed to provide projection matrix. /// /// /// true if current subsystem is allowed to provide projection matrix. Otherwise, false. /// public bool supportsProjectionMatrix { get; set; } /// /// Specifies if current subsystem is allowed to provide timestamp. /// /// /// true if current subsystem is allowed to provide timestamp. Otherwise, false. /// public bool supportsTimestamp { get; set; } /// /// Specifies if the current subsystem supports camera configurations. /// /// /// true if the current subsystem supports camera configurations. Otherwise, false. /// public bool supportsCameraConfigurations { get; set; } /// /// Specifies if the current subsystem is allowed to provide camera images. /// /// /// true if the current subsystem is allowed to provide camera images. Otherwise, false. /// public bool supportsCameraImage { get; set; } /// /// Specifies if current subsystem is allowed to provide average intensity in lumens. /// /// /// true if current subsystem is allowed to provide average intensity in lumens. Otherwise, false. /// public bool supportsAverageIntensityInLumens { get; set; } /// /// Specifies whether the subsystem supports setting the camera's focus mode. /// public bool supportsFocusModes { get; set; } public bool Equals(XRCameraSubsystemCinfo other) { return (id == other.id) && (implementationType == other.implementationType) && supportsAverageBrightness.Equals(other.supportsAverageBrightness) && supportsAverageColorTemperature.Equals(other.supportsAverageColorTemperature) && supportsDisplayMatrix.Equals(other.supportsDisplayMatrix) && supportsProjectionMatrix.Equals(other.supportsProjectionMatrix) && supportsTimestamp.Equals(other.supportsTimestamp) && supportsCameraConfigurations.Equals(other.supportsCameraConfigurations) && supportsCameraImage.Equals(other.supportsCameraImage) && supportsAverageIntensityInLumens.Equals(other.supportsAverageIntensityInLumens) && supportsFocusModes.Equals(other.supportsFocusModes); } public override bool Equals(System.Object obj) { return ((obj is XRCameraSubsystemCinfo) && Equals((XRCameraSubsystemCinfo)obj)); } public static bool operator ==(XRCameraSubsystemCinfo lhs, XRCameraSubsystemCinfo rhs) { return lhs.Equals(rhs); } public static bool operator !=(XRCameraSubsystemCinfo lhs, XRCameraSubsystemCinfo rhs) { return !lhs.Equals(rhs); } public override int GetHashCode() { int hashCode = 486187739; unchecked { hashCode = (hashCode * 486187739) + (ReferenceEquals(id, null) ? 0 : id.GetHashCode()); hashCode = (hashCode * 486187739) + (ReferenceEquals(implementationType, null) ? 0 : implementationType.GetHashCode()); hashCode = (hashCode * 486187739) + supportsAverageBrightness.GetHashCode(); hashCode = (hashCode * 486187739) + supportsAverageColorTemperature.GetHashCode(); hashCode = (hashCode * 486187739) + supportsDisplayMatrix.GetHashCode(); hashCode = (hashCode * 486187739) + supportsProjectionMatrix.GetHashCode(); hashCode = (hashCode * 486187739) + supportsTimestamp.GetHashCode(); hashCode = (hashCode * 486187739) + supportsCameraConfigurations.GetHashCode(); hashCode = (hashCode * 486187739) + supportsCameraImage.GetHashCode(); hashCode = (hashCode * 486187739) + supportsAverageIntensityInLumens.GetHashCode(); hashCode = (hashCode * 486187739) + supportsFocusModes.GetHashCode(); } return hashCode; } } /// /// Specifies a functionality description that may be registered for each implementation that provides the /// interface. /// public sealed class XRCameraSubsystemDescriptor : SubsystemDescriptor { /// /// Constructs a XRCameraSubsystemDescriptor based on the given parameters. /// /// The parameters required to initialize the descriptor. XRCameraSubsystemDescriptor(XRCameraSubsystemCinfo cameraSubsystemParams) { id = cameraSubsystemParams.id; subsystemImplementationType = cameraSubsystemParams.implementationType; supportsAverageBrightness = cameraSubsystemParams.supportsAverageBrightness; supportsAverageColorTemperature = cameraSubsystemParams.supportsAverageColorTemperature; supportsDisplayMatrix = cameraSubsystemParams.supportsDisplayMatrix; supportsProjectionMatrix = cameraSubsystemParams.supportsProjectionMatrix; supportsTimestamp = cameraSubsystemParams.supportsTimestamp; supportsCameraConfigurations = cameraSubsystemParams.supportsCameraConfigurations; supportsCameraImage = cameraSubsystemParams.supportsCameraImage; supportsAverageIntensityInLumens = cameraSubsystemParams.supportsAverageIntensityInLumens; supportsFocusModes = cameraSubsystemParams.supportsFocusModes; } /// /// Specifies if current subsystem is allowed to provide average brightness. /// /// /// true if current subsystem is allowed to provide average brightness. Otherwise, false. /// public bool supportsAverageBrightness { get; private set; } /// /// Specifies if current subsystem is allowed to provide average camera temperature. /// /// /// true if current subsystem is allowed to provide average camera temperature. Otherwise, false. /// public bool supportsAverageColorTemperature { get; private set; } /// /// Specifies if current subsystem is allowed to provide display matrix. /// /// /// true if current subsystem is allowed to provide display matrix. Otherwise, false. /// public bool supportsDisplayMatrix { get; private set; } /// /// Specifies if current subsystem is allowed to provide projection matrix. /// /// /// true if current subsystem is allowed to provide projection matrix. Otherwise, false. /// public bool supportsProjectionMatrix { get; private set; } /// /// Specifies if current subsystem is allowed to provide timestamp. /// /// /// true if current subsystem is allowed to provide timestamp. Otherwise, false. /// public bool supportsTimestamp { get; private set; } /// /// Specifies if the current subsystem supports camera configurations. /// /// /// true if the current subsystem supports camera configurations. Otherwise, false. /// public bool supportsCameraConfigurations { get; private set; } /// /// Specifies if the current subsystem is allowed to provide camera images. /// /// /// true if the current subsystem is allowed to provide camera images. Otherwise, false. /// public bool supportsCameraImage { get; private set; } /// /// Specifies if current subsystem is allowed to provide average intensity in lumens. /// /// /// true if current subsystem is allowed to provide average intensity in lumens. Otherwise, false. /// public bool supportsAverageIntensityInLumens { get; private set; } /// /// Specifies whether the subsystem supports setting the camera's focus mode. /// public bool supportsFocusModes { get; private set; } /// /// Creates a XRCameraSubsystemDescriptor based on the given parameters validating that the /// and /// properties are properly specified. /// /// The parameters defining how to initialize the descriptor. /// /// The created XRCameraSubsystemDescriptor. /// /// Thrown when the values specified in the /// parameter are invalid. Typically, this will occur /// /// /// if is null or empty /// /// /// if is null /// /// /// if does not derive from the /// class /// /// /// /// internal static XRCameraSubsystemDescriptor Create(XRCameraSubsystemCinfo cameraSubsystemParams) { if (String.IsNullOrEmpty(cameraSubsystemParams.id)) { throw new ArgumentException("Cannot create camera subsystem descriptor because id is invalid", "cameraSubsystemParams"); } if ((cameraSubsystemParams.implementationType == null) || !cameraSubsystemParams.implementationType.IsSubclassOf(typeof(XRCameraSubsystem))) { throw new ArgumentException("Cannot create camera subsystem descriptor because implementationType is invalid", "cameraSubsystemParams"); } return new XRCameraSubsystemDescriptor(cameraSubsystemParams); } } }