Exemplo n.º 1
0
        /// <summary>
        /// Start the image conversion using this class to interact with the asynchronous conversion and results.
        /// </summary>
        /// <param name="cameraSubsystem">The camera subsystem performing the image conversion.</param>
        /// <param name="nativeHandle">The native handle for the camera image.</param>
        /// <param name="conversionParams">The parameters for image conversion.</param>
        internal XRAsyncCameraImageConversion(XRCameraSubsystem cameraSubsystem, int nativeHandle,
                                              XRCameraImageConversionParams conversionParams)
        {
            m_CameraSubsystem     = cameraSubsystem;
            m_RequestId           = m_CameraSubsystem.ConvertAsync(nativeHandle, conversionParams);
            this.conversionParams = conversionParams;

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            m_SafetyHandle = AtomicSafetyHandle.Create();
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// Dispose native resources associated with this request, including the raw image data. The <c>NativeArray</c>
        /// returned by <see cref="GetData"/> is invalidated immediately after calling <c>Dispose</c>.
        /// </summary>
        public void Dispose()
        {
            if (m_CameraSubsystem == null || m_RequestId == 0)
            {
                return;
            }

            m_CameraSubsystem.DisposeAsyncRequest(m_RequestId);
            m_CameraSubsystem = null;
            m_RequestId       = 0;
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            AtomicSafetyHandle.Release(m_SafetyHandle);
#endif
        }
Exemplo n.º 3
0
        /// <summary>
        /// Dispose native resources associated with this request, including the raw image data. Any
        /// <see cref="XRCameraImagePlane"/>s returned by <see cref="GetPlane"/> are invalidated immediately after
        /// calling <c>Dispose</c>.
        /// </summary>
        public void Dispose()
        {
            if (m_CameraSubsystem == null || m_NativeHandle == 0)
            {
                return;
            }

            m_CameraSubsystem.DisposeImage(m_NativeHandle);
            m_NativeHandle    = 0;
            m_CameraSubsystem = null;

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            AtomicSafetyHandle.Release(m_SafetyHandle);
#endif
        }
Exemplo n.º 4
0
        /// <summary>
        /// Construct the <c>XRCameraImage</c> with the given native image information.
        /// </summary>
        /// <param name="cameraSubsystem">The camera subsystem to use for interacting with the native image.</param>
        /// <param name="nativeHandle">The native image handle.</param>
        /// <param name="dimensions">The dimensions of the native image.</param>
        /// <param name="planeCount">The number of video planes in the native image.</param>
        /// <param name="timestamp">The timestamp for when the native image was captured.</param>
        /// <param name="format">The camera image format of the native image.</param>
        internal XRCameraImage(
            XRCameraSubsystem cameraSubsystem,
            int nativeHandle,
            Vector2Int dimensions,
            int planeCount,
            double timestamp,
            CameraImageFormat format)
        {
            m_CameraSubsystem = cameraSubsystem;
            m_NativeHandle    = nativeHandle;
            this.dimensions   = dimensions;
            this.planeCount   = planeCount;
            this.timestamp    = timestamp;
            this.format       = format;

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            m_SafetyHandle = AtomicSafetyHandle.Create();
#endif
        }
 /// <summary>
 /// Constructs a <c>XRCameraFrameReceivedArgs</c>.
 /// </summary>
 /// <param name="cameraSubsystem">The camera subsystem that is raising the event.</param>
 internal XRCameraFrameReceivedArgs(XRCameraSubsystem cameraSubsystem, XRCameraFrame cameraFrame)
 {
     this.cameraSubsystem = cameraSubsystem;
     this.cameraFrame     = cameraFrame;
 }