docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Class OpenXRLayerUtility

    A general-purpose helper class for composition layer support.

    Inheritance
    object
    OpenXRLayerUtility
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: UnityEngine.XR.OpenXR.CompositionLayers
    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

    ComputePoseTrackingSpace(Transform)

    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
    Type Description
    OpenXRLayerUtility.TransformPose

    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
    Type Name Description
    int id
    XrSwapchainCreateInfo createInfo
    OpenXRLayerUtility.StereoSwapchainCallbackDelegate callback

    CreateSwapchain(int, XrSwapchainCreateInfo, bool, SwapchainCallbackDelegate)

    Create the XrSwapchainCreateInfo struct that is passed to OpenXR SDK to create a swapchain.

    Declaration
    public static void CreateSwapchain(int id, XrSwapchainCreateInfo createInfo, bool isExternalSurface = false, OpenXRLayerUtility.SwapchainCallbackDelegate callback = null)
    Parameters
    Type Name Description
    int id
    XrSwapchainCreateInfo createInfo
    bool isExternalSurface
    OpenXRLayerUtility.SwapchainCallbackDelegate callback

    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
    Type Description
    ulong

    GetDefaultColorFormat()

    Return swapchain supported color format.

    Declaration
    public static long GetDefaultColorFormat()
    Returns
    Type Description
    long

    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
    Type Description
    void*

    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
    Type Description
    IntPtr

    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

    ToTransformPose(Transform, bool)

    Convert Transform to TransformPose

    Declaration
    public static OpenXRLayerUtility.TransformPose ToTransformPose(this Transform t, bool isLocal = false)
    Parameters
    Type Name Description
    Transform t
    bool isLocal
    Returns
    Type Description
    OpenXRLayerUtility.TransformPose
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)