namespace UnityEngine.XR.ARSubsystems
{
public partial struct XRCpuImage
{
///
/// Represents the status of an asynchronous camera image request.
///
public enum AsyncConversionStatus
{
///
/// The request is not valid or has been disposed.
///
Disposed,
///
/// The request is waiting to be processed.
///
Pending,
///
/// The request is currently being processed.
///
Processing,
///
/// The request succeeded and image data is ready.
///
Ready,
///
/// The request failed. No data is available.
///
Failed
}
}
///
/// Extension methods for the enum.
///
public static class XRCpuImageAsyncConversionStatusExtensions
{
///
/// Whether the request has completed. It might have completed with an error or be
/// an invalid or disposed request. See .
///
/// The being extended.
/// true if the has completed.
public static bool IsDone(this XRCpuImage.AsyncConversionStatus status)
{
switch (status)
{
case XRCpuImage.AsyncConversionStatus.Pending:
case XRCpuImage.AsyncConversionStatus.Processing:
return false;
default:
return true;
}
}
///
/// Whether the request status represents an error. If the request has been disposed, IsError
/// will be true.
///
/// The being extended.
/// true if the represents an error.
public static bool IsError(this XRCpuImage.AsyncConversionStatus status)
{
switch (status)
{
case XRCpuImage.AsyncConversionStatus.Pending:
case XRCpuImage.AsyncConversionStatus.Processing:
case XRCpuImage.AsyncConversionStatus.Ready:
return false;
default:
return true;
}
}
}
}