Class XRCpuImageFormatExtensions
Extensions to convert between UnityEngine.TextureFormat and XRCpuImage.Format.
Inherited Members
Namespace: UnityEngine.XR.ARSubsystems
Assembly: Unity.XR.ARSubsystems.dll
Syntax
public static class XRCpuImageFormatExtensions
Methods
AsTextureFormat(Format)
Attempts to convert an XRCpuImage.Format to a UnityEngine.TextureFormat.
Declaration
public static TextureFormat AsTextureFormat(this XRCpuImage.Format @this)
Parameters
Type | Name | Description |
---|---|---|
XRCpuImage.Format | this | Defines an extension of XRCpuImage.Format. |
Returns
Type | Description |
---|---|
TextureFormat | Returns a texture format that matches |
ToXRCpuImageFormat(TextureFormat)
Attempts to convert a UnityEngine.TextureFormat to an XRCpuImage.Format.
Declaration
public static XRCpuImage.Format ToXRCpuImageFormat(this TextureFormat @this)
Parameters
Type | Name | Description |
---|---|---|
TextureFormat | this | Defines an extension of UnityEngine.TextureFormat. |
Returns
Type | Description |
---|---|
XRCpuImage.Format | Returns a XRCpuImage.Format that matches |
Remarks
For some formats, there may be multiple XRCpuImage.Formats that match the format. In this case this method will return a generalized format. For example, UnityEngine.TextureFormat.RFloat will return OneComponent32 instead of DepthFloat32 as it's possible that the single channel is not depth. In these cases, you should also check the image type.