/// <summary>
        /// Creates a <c>XRCameraSubsystemDescriptor</c> based on the given parameters validating that the
        /// <see cref="XRCameraSubsystemCinfo.id"/> and <see cref="XRCameraSubsystemCinfo.implementationType"/>
        /// properties are properly specified.
        /// </summary>
        /// <param name="cameraSubsystemParams">The parameters defining how to initialize the descriptor.</param>
        /// <returns>
        /// The created <c>XRCameraSubsystemDescriptor</c>.
        /// </returns>
        /// <exception cref="System.ArgumentException">Thrown when the values specified in the
        /// <see cref="XRCameraSubsystemCinfo"/> parameter are invalid. Typically, this will occur
        /// <list type="bullet">
        /// <item>
        /// <description>if <see cref="XRCameraSubsystemCinfo.id"/> is <c>null</c> or empty</description>
        /// </item>
        /// <item>
        /// <description>if <see cref="XRCameraSubsystemCinfo.implementationType"/> is <c>null</c></description>
        /// </item>
        /// <item>
        /// <description>if <see cref="XRCameraSubsystemCinfo.implementationType"/> does not derive from the
        /// <see cref="XRCameraSubsystem"/> class
        /// </description>
        /// </item>
        /// </list>
        /// </exception>
        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 UNITY_2020_2_OR_NEWER
            if (cameraSubsystemParams.providerType == null ||
                !cameraSubsystemParams.providerType.IsSubclassOf(typeof(XRCameraSubsystem.Provider)))
            {
                throw new ArgumentException("Cannot create camera subsystem descriptor because providerType is invalid", "cameraSubsystemParams");
            }

            if (cameraSubsystemParams.subsystemTypeOverride != null &&
                !cameraSubsystemParams.subsystemTypeOverride.IsSubclassOf(typeof(XRCameraSubsystem)))
            {
                throw new ArgumentException("Cannot create camera subsystem descriptor because subsystemTypeOverride is invalid", "cameraSubsystemParams");
            }
#else
            if ((cameraSubsystemParams.implementationType == null) ||
                !cameraSubsystemParams.implementationType.IsSubclassOf(typeof(XRCameraSubsystem)))
            {
                throw new ArgumentException("Cannot create camera subsystem descriptor because implementationType is invalid",
                                            "cameraSubsystemParams");
            }
#endif

            return(new XRCameraSubsystemDescriptor(cameraSubsystemParams));
        }
        /// <summary>
        /// Constructs a <c>XRCameraSubsystemDescriptor</c> based on the given parameters.
        /// </summary>
        /// <param name="cameraSubsystemParams">The parameters required to initialize the descriptor.</param>
        XRCameraSubsystemDescriptor(XRCameraSubsystemCinfo cameraSubsystemParams)
        {
            id = cameraSubsystemParams.id;
#if UNITY_2020_2_OR_NEWER
            providerType          = cameraSubsystemParams.providerType;
            subsystemTypeOverride = cameraSubsystemParams.subsystemTypeOverride;
#else
            subsystemImplementationType = cameraSubsystemParams.implementationType;
#endif
            supportsAverageBrightness       = cameraSubsystemParams.supportsAverageBrightness;
            supportsAverageColorTemperature = cameraSubsystemParams.supportsAverageColorTemperature;
            supportsColorCorrection         = cameraSubsystemParams.supportsColorCorrection;
            supportsDisplayMatrix           = cameraSubsystemParams.supportsDisplayMatrix;
            supportsProjectionMatrix        = cameraSubsystemParams.supportsProjectionMatrix;
            supportsTimestamp                = cameraSubsystemParams.supportsTimestamp;
            supportsCameraConfigurations     = cameraSubsystemParams.supportsCameraConfigurations;
            supportsCameraImage              = cameraSubsystemParams.supportsCameraImage;
            supportsAverageIntensityInLumens = cameraSubsystemParams.supportsAverageIntensityInLumens;
            supportsFocusModes               = cameraSubsystemParams.supportsFocusModes;
            supportsFaceTrackingAmbientIntensityLightEstimation = cameraSubsystemParams.supportsFaceTrackingAmbientIntensityLightEstimation;
            supportsFaceTrackingHDRLightEstimation = cameraSubsystemParams.supportsFaceTrackingHDRLightEstimation;
            supportsWorldTrackingAmbientIntensityLightEstimation = cameraSubsystemParams.supportsWorldTrackingAmbientIntensityLightEstimation;
            supportsWorldTrackingHDRLightEstimation = cameraSubsystemParams.supportsWorldTrackingHDRLightEstimation;
            supportsCameraGrain = cameraSubsystemParams.supportsCameraGrain;
        }
 /// <summary>
 /// Constructs a <c>XRCameraSubsystemDescriptor</c> based on the given parameters.
 /// </summary>
 /// <param name="cameraSubsystemParams">The parameters required to initialize the descriptor.</param>
 XRCameraSubsystemDescriptor(XRCameraSubsystemCinfo cameraSubsystemParams)
 {
     id = cameraSubsystemParams.id;
     subsystemImplementationType     = cameraSubsystemParams.implementationType;
     supportsAverageBrightness       = cameraSubsystemParams.supportsAverageBrightness;
     supportsAverageColorTemperature = cameraSubsystemParams.supportsAverageColorTemperature;
     supportsDisplayMatrix           = cameraSubsystemParams.supportsDisplayMatrix;
     supportsProjectionMatrix        = cameraSubsystemParams.supportsProjectionMatrix;
     supportsTimestamp = cameraSubsystemParams.supportsTimestamp;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructs a <c>XRCameraSubsystemDescriptor</c> based on the given parameters.
 /// </summary>
 /// <param name="cameraSubsystemParams">The parameters required to initialize the descriptor.</param>
 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;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates a <c>XRCameraSubsystemDescriptor</c> based on the given parameters validating that the
        /// <see cref="XRCameraSubsystemCinfo.id"/> and <see cref="XRCameraSubsystemCinfo.implementationType"/>
        /// properties are properly specified.
        /// </summary>
        /// <param name="cameraSubsystemParams">The parameters defining how to initialize the descriptor.</param>
        /// <returns>
        /// The created <c>XRCameraSubsystemDescriptor</c>.
        /// </returns>
        /// <exception cref="System.ArgumentException">Thrown when the values specified in the
        /// <see cref="XRCameraSubsystemCinfo"/> parameter are invalid. Typically, this will occur
        /// <list type="bullet">
        /// <item>
        /// <description>if <see cref="XRCameraSubsystemCinfo.id"/> is <c>null</c> or empty</description>
        /// </item>
        /// <item>
        /// <description>if <see cref="XRCameraSubsystemCinfo.implementationType"/> is <c>null</c></description>
        /// </item>
        /// <item>
        /// <description>if <see cref="XRCameraSubsystemCinfo.implementationType"/> does not derive from the
        /// <see cref="XRCameraSubsystem"/> class
        /// </description>
        /// </item>
        /// </list>
        /// </exception>
        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));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Registers a camera subsystem implementation based on the given subsystem parameters.
        /// </summary>
        /// <param name="cameraSubsystemParams">The parameters defining the camera subsystem functionality implemented
        /// by the subsystem provider.</param>
        /// <returns>
        /// <c>true</c> if the subsystem implementation is registered. Otherwise, <c>false</c>.
        /// </returns>
        /// <exception cref="System.ArgumentException">Thrown when the values specified in the
        /// <see cref="XRCameraSubsystemCinfo"/> parameter are invalid. Typically, this will occur
        /// <list type="bullet">
        /// <item>
        /// <description>if <see cref="XRCameraSubsystemCinfo.id"/> is <c>null</c> or empty</description>
        /// </item>
        /// <item>
        /// <description>if <see cref="XRCameraSubsystemCinfo.implementationType"/> is <c>null</c></description>
        /// </item>
        /// <item>
        /// <description>if <see cref="XRCameraSubsystemCinfo.implementationType"/> does not derive from the
        /// <see cref="XRCameraSubsystem"/> class
        /// </description>
        /// </item>
        /// </list>
        /// </exception>
        public static bool Register(XRCameraSubsystemCinfo cameraSubsystemParams)
        {
            XRCameraSubsystemDescriptor cameraSubsystemDescriptor = XRCameraSubsystemDescriptor.Create(cameraSubsystemParams);

            return(SubsystemRegistration.CreateDescriptor(cameraSubsystemDescriptor));
        }