using System; using UnityEngine.SubsystemsImplementation; namespace UnityEngine.XR.ARSubsystems { /// /// Contains the parameters for creating a new . /// public struct XREnvironmentProbeSubsystemCinfo : 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 providerType { get; set; } /// /// Specifies the XREnvironmentProbeSubsystem-derived type that forwards casted calls to its provider. /// /// /// The type of the subsystem to use for instantiation. If null, XREnvironmentProbeSubsystem will be instantiated. /// public Type subsystemTypeOverride { get; set; } /// /// Specifies the provider implementation type to use for instantiation. /// /// /// Specifies the provider implementation type to use for instantiation. /// [Obsolete("XREnvironmentProbeSubsystem no longer supports the deprecated set of base classes for subsystems as of Unity 2020.2. Use providerType and, optionally, subsystemTypeOverride instead.", true)] public Type implementationType { get; set; } /// /// Whether the implementation supports manual placement of environment probes. /// /// /// true if manual placement of environment probes is supported. Otherwise, false. /// public bool supportsManualPlacement { get; set; } /// /// Whether the implementation supports removal of manually placed environment probes. /// /// /// true if removal of manually placed environment probes is supported. Otherwise, false. /// public bool supportsRemovalOfManual { get; set; } /// /// Whether the implementation supports automatic placement of environment probes. /// /// /// true if automatic placement of environment probes is supported. Otherwise, false. /// public bool supportsAutomaticPlacement { get; set; } /// /// Whether the implementation supports removal of automatically placed environment probes. /// /// /// true if removal of automatically placed environment probes is supported. Otherwise, false. /// public bool supportsRemovalOfAutomatic { get; set; } /// /// Whether the implementation supports generation of environment textures. /// /// /// true if the generation of environment textures is supported. Otherwise, false. /// public bool supportsEnvironmentTexture { get; set; } /// /// Whether the implementation supports generation of HDR environment textures. /// /// /// true if the generation of HDR environment textures is supported. Otherwise, false. /// public bool supportsEnvironmentTextureHDR { get; set; } /// /// Tests for equality. /// /// The other to compare against. /// `True` if every field in is equal to this , otherwise false. public bool Equals(XREnvironmentProbeSubsystemCinfo other) { return ReferenceEquals(id, other.id) && ReferenceEquals(providerType, other.providerType) && ReferenceEquals(subsystemTypeOverride, other.subsystemTypeOverride) && supportsManualPlacement.Equals(other.supportsManualPlacement) && supportsRemovalOfManual.Equals(other.supportsRemovalOfManual) && supportsAutomaticPlacement.Equals(other.supportsAutomaticPlacement) && supportsRemovalOfAutomatic.Equals(other.supportsRemovalOfAutomatic) && supportsEnvironmentTexture.Equals(other.supportsEnvironmentTexture) && supportsEnvironmentTextureHDR.Equals(other.supportsEnvironmentTextureHDR); } /// /// Tests for equality. /// /// The `object` to compare against. /// `True` if is of type and /// also returns `true`; otherwise `false`. public override bool Equals(System.Object obj) { return ((obj is XREnvironmentProbeSubsystemCinfo) && Equals((XREnvironmentProbeSubsystemCinfo)obj)); } /// /// Tests for equality. Same as . /// /// The left-hand side of the comparison. /// The right-hand side of the comparison. /// `True` if is equal to , otherwise `false`. public static bool operator ==(XREnvironmentProbeSubsystemCinfo lhs, XREnvironmentProbeSubsystemCinfo rhs) { return lhs.Equals(rhs); } /// /// Tests for inequality. Same as `!`. /// /// The left-hand side of the comparison. /// The right-hand side of the comparison. /// `True` if is not equal to , otherwise `false`. public static bool operator !=(XREnvironmentProbeSubsystemCinfo lhs, XREnvironmentProbeSubsystemCinfo rhs) { return !(lhs == rhs); } /// /// Generates a hash suitable for use with containers like `HashSet` and `Dictionary`. /// /// A hash code generated from this object's fields. public override int GetHashCode() { int hashCode = 486187739; unchecked { hashCode = (hashCode * 486187739) + HashCodeUtil.ReferenceHash(id); hashCode = (hashCode * 486187739) + HashCodeUtil.ReferenceHash(providerType); hashCode = (hashCode * 486187739) + HashCodeUtil.ReferenceHash(subsystemTypeOverride); hashCode = (hashCode * 486187739) + supportsManualPlacement.GetHashCode(); hashCode = (hashCode * 486187739) + supportsRemovalOfManual.GetHashCode(); hashCode = (hashCode * 486187739) + supportsAutomaticPlacement.GetHashCode(); hashCode = (hashCode * 486187739) + supportsRemovalOfAutomatic.GetHashCode(); hashCode = (hashCode * 486187739) + supportsEnvironmentTexture.GetHashCode(); hashCode = (hashCode * 486187739) + supportsEnvironmentTextureHDR.GetHashCode(); } return hashCode; } } /// /// Specifies a functionality description that can be registered for each implementation that provides the /// interface. /// public class XREnvironmentProbeSubsystemDescriptor : SubsystemDescriptorWithProvider { /// /// Constructs a XREnvironmentProbeSubsystemDescriptor based on the given parameters. /// /// The parameters required to initialize the descriptor. XREnvironmentProbeSubsystemDescriptor(XREnvironmentProbeSubsystemCinfo environmentProbeSubsystemCinfo) { id = environmentProbeSubsystemCinfo.id; providerType = environmentProbeSubsystemCinfo.providerType; subsystemTypeOverride = environmentProbeSubsystemCinfo.subsystemTypeOverride; supportsManualPlacement = environmentProbeSubsystemCinfo.supportsManualPlacement; supportsRemovalOfManual = environmentProbeSubsystemCinfo.supportsRemovalOfManual; supportsAutomaticPlacement = environmentProbeSubsystemCinfo.supportsAutomaticPlacement; supportsRemovalOfAutomatic = environmentProbeSubsystemCinfo.supportsRemovalOfAutomatic; supportsEnvironmentTexture = environmentProbeSubsystemCinfo.supportsEnvironmentTexture; supportsEnvironmentTextureHDR = environmentProbeSubsystemCinfo.supportsEnvironmentTextureHDR; } /// /// Whether the implementation supports manual placement of environment probes. /// /// /// true if manual placement of environment probes is supported. Otherwise, false. /// public bool supportsManualPlacement { get; private set; } /// /// Whether the implementation supports removal of manually-placed environment probes. /// /// /// true if removal of manually-placed environment probes is supported. Otherwise, false. /// public bool supportsRemovalOfManual { get; private set; } /// /// Whether the implementation supports automatic placement of environment probes. /// /// /// true if automatic placement of environment probes is supported. Otherwise, false. /// public bool supportsAutomaticPlacement { get; private set; } /// /// Whether the implementation supports removal of automatically-placed environment probes. /// /// /// true if removal of automatically-placed environment probes is supported. Otherwise, false. /// public bool supportsRemovalOfAutomatic { get; private set; } /// /// Whether the implementation supports generation of environment textures. /// /// /// true if the generation of environment textures is supported. Otherwise, false. /// public bool supportsEnvironmentTexture { get; private set; } /// /// Whether the implementation supports generation of HDR environment textures. /// /// /// true if the generation of HDR environment textures is supported. Otherwise, false. /// public bool supportsEnvironmentTextureHDR { get; private set; } /// /// Creates a XREnvironmentProbeSubsystemDescriptor based on the given parameters and validates that the /// id and implentationType properties are specified. /// /// The parameters required to initialize the descriptor. /// /// The created XREnvironmentProbeSubsystemDescriptor. /// /// Thrown when the values specified in the /// parameter are invalid. Typically, this happens: /// /// /// If is null or empty. /// /// /// If is null. /// /// /// /// If does not derive from the /// XREnvironmentProbeSubsystem class. /// /// /// /// internal static XREnvironmentProbeSubsystemDescriptor Create(XREnvironmentProbeSubsystemCinfo environmentProbeSubsystemCinfo) { if (String.IsNullOrEmpty(environmentProbeSubsystemCinfo.id)) { throw new ArgumentException("Cannot create environment probe subsystem descriptor because id is invalid", "environmentProbeSubsystemCinfo"); } if (environmentProbeSubsystemCinfo.providerType == null || !environmentProbeSubsystemCinfo.providerType.IsSubclassOf(typeof(XREnvironmentProbeSubsystem.Provider))) { throw new ArgumentException("Cannot create environment probe subsystem descriptor because providerType is invalid", "environmentProbeSubsystemCinfo"); } if (environmentProbeSubsystemCinfo.subsystemTypeOverride != null && !environmentProbeSubsystemCinfo.subsystemTypeOverride.IsSubclassOf(typeof(XREnvironmentProbeSubsystem))) { throw new ArgumentException("Cannot create environment probe subsystem descriptor because subsystemTypeOverride is invalid", "environmentProbeSubsystemCinfo"); } return new XREnvironmentProbeSubsystemDescriptor(environmentProbeSubsystemCinfo); } } }