Class OpenXRLayerUtility
A general-purpose helper class for composition layer support.
Inheritance
OpenXRLayerUtility
Assembly: solution.dll
Syntax
public static class OpenXRLayerUtility
Methods
AddActiveLayersToEndFrame(void*, void*, int, int)
Add native layer structs to the endFrameInfo struct inside the UnityOpenXR lib - for custom layer type support
Declaration
public static void AddActiveLayersToEndFrame(void* layers, void* orders, int count, int layerByteSize)
Parameters
| Type |
Name |
Description |
| void* |
layers |
|
| void* |
orders |
|
| int |
count |
|
| int |
layerByteSize |
|
Recalculate layers position and rotation based on tracking space change, like teleporting.
Declaration
public static OpenXRLayerUtility.TransformPose ComputePoseTrackingSpace(Transform layerTransform)
Parameters
| Type |
Name |
Description |
| Transform |
layerTransform |
|
Returns
CreateStereoSwapchain(int, XrSwapchainCreateInfo, StereoSwapchainCallbackDelegate)
Create the XrSwapchainCreateInfo struct that is passed to OpenXR SDK to create a swapchain for stereo projection, like Projection layer type.
Declaration
public static void CreateStereoSwapchain(int id, XrSwapchainCreateInfo createInfo, OpenXRLayerUtility.StereoSwapchainCallbackDelegate callback = null)
Parameters
CreateSwapchain(int, XrSwapchainCreateInfo, bool, SwapchainCallbackDelegate)
Declaration
public static void CreateSwapchain(int id, XrSwapchainCreateInfo createInfo, bool isExternalSurface = false, OpenXRLayerUtility.SwapchainCallbackDelegate callback = null)
Parameters
GetCurrentAppSpace()
Helper method used get the current app space for any native composition layer structs that may require an associated XrSpace.
Declaration
public static ulong GetCurrentAppSpace()
Returns
Return swapchain supported color format.
Declaration
public static long GetDefaultColorFormat()
Returns
GetExtensionsChain(LayerInfo, ExtensionTarget)
Helper method used to gather the extension components attached to a CompositionLayer GameObject.
This method chains the native extension struct pointers of those extension components to initialize an OpenXR native object's Next pointer struct chain.
Declaration
public static void* GetExtensionsChain(CompositionLayerManager.LayerInfo layer, CompositionLayerExtension.ExtensionTarget extensionTarget)
Parameters
| Type |
Name |
Description |
| LayerInfo |
layer |
|
| ExtensionTarget |
extensionTarget |
|
Returns
GetLayerAndroidSurfaceObject(int)
Return the Surface object for Android External Surface support (Android only).
Declaration
public static IntPtr GetLayerAndroidSurfaceObject(int layerId)
Parameters
| Type |
Name |
Description |
| int |
layerId |
|
Returns
ReleaseSwapchain(int)
Release swapchain according to the id provided.
Declaration
public static void ReleaseSwapchain(int id)
Parameters
| Type |
Name |
Description |
| int |
id |
|
SetActiveLayerAndGetTexture(LayerInfo)
Query the correct XR Textures for rendering and blit the layer textures.
Declaration
public static void SetActiveLayerAndGetTexture(CompositionLayerManager.LayerInfo layerInfo)
Parameters
| Type |
Name |
Description |
| LayerInfo |
layerInfo |
|
SetActiveLayerAndGetTexturesForProjectionLayer(LayerInfo)
Query the correct XR Textures for rendering and blit the layer textures (For Projection Layer type).
Declaration
public static void SetActiveLayerAndGetTexturesForProjectionLayer(CompositionLayerManager.LayerInfo layerInfo)
Parameters
| Type |
Name |
Description |
| LayerInfo |
layerInfo |
|
Convert Transform to TransformPose
Declaration
public static OpenXRLayerUtility.TransformPose ToTransformPose(this Transform t, bool isLocal = false)
Parameters
Returns