Class PassthroughAPI
Inherited Members
Namespace: VIVE.OpenXR.Passthrough
Assembly: VIVE.OpenXR.dll
Syntax
public static class PassthroughAPI
Methods
CreatePlanarPassthrough(out XrPassthroughHTC, LayerType, OnPassthroughSessionDestroyDelegate, float, uint)
Creates a fullscreen passthrough. Passthroughs will be destroyed automatically when the current XrSession is destroyed.
Declaration
public static XrResult CreatePlanarPassthrough(out XrPassthroughHTC passthrough, LayerType layerType, VivePassthrough.OnPassthroughSessionDestroyDelegate onDestroyPassthroughSessionHandler = null, float alpha = 1, uint compositionDepth = 0)
Parameters
Type | Name | Description |
---|---|---|
XrPassthroughHTC | passthrough | The created XrPassthroughHTC |
LayerType | layerType | The |
VivePassthrough.OnPassthroughSessionDestroyDelegate | onDestroyPassthroughSessionHandler | A delegate will be invoked when the current OpenXR Session is going to be destroyed. |
float | alpha | The alpha value of the passthrough layer within the range [0, 1] where 1 (Opaque) is default. |
uint | compositionDepth | The composition depth relative to other composition layers if present where 0 is default. |
Returns
Type | Description |
---|---|
XrResult | XR_SUCCESS for success. |
CreateProjectedPassthrough(out XrPassthroughHTC, LayerType, Vector3[], int[], ProjectedPassthroughSpaceType, Vector3, Quaternion, Vector3, OnPassthroughSessionDestroyDelegate, float, uint, bool, bool)
Creates a projected passthrough (i.e. Passthrough is only partially visible). Visible region of the projected passthrough is determined by the mesh and its transform. Passthroughs will be destroyed automatically when the current XrSession is destroyed.
Declaration
public static XrResult CreateProjectedPassthrough(out XrPassthroughHTC passthrough, LayerType layerType, Vector3[] vertexBuffer, int[] indexBuffer, ProjectedPassthroughSpaceType spaceType, Vector3 meshPosition, Quaternion meshOrientation, Vector3 meshScale, VivePassthrough.OnPassthroughSessionDestroyDelegate onDestroyPassthroughSessionHandler = null, float alpha = 1, uint compositionDepth = 0, bool trackingToWorldSpace = true, bool convertFromUnityToOpenXR = true)
Parameters
Type | Name | Description |
---|---|---|
XrPassthroughHTC | passthrough | The created XrPassthroughHTC |
LayerType | layerType | The |
Vector3[] | vertexBuffer | Positions of the vertices in the mesh. |
int[] | indexBuffer | List of triangles represented by indices into the |
ProjectedPassthroughSpaceType | spaceType | The projected passthrough's ProjectedPassthroughSpaceType |
Vector3 | meshPosition | Position of the mesh. |
Quaternion | meshOrientation | Orientation of the mesh. |
Vector3 | meshScale | Scale of the mesh. |
VivePassthrough.OnPassthroughSessionDestroyDelegate | onDestroyPassthroughSessionHandler | A delegate will be invoked when the current OpenXR Session is going to be destroyed. |
float | alpha | The alpha value of the passthrough layer within the range [0, 1] where 1 (Opaque) is default. |
uint | compositionDepth | The composition depth relative to other composition layers if present where 0 is default. |
bool | trackingToWorldSpace | Specify whether or not the position and rotation of the mesh transform have to be converted from tracking space to world space. |
bool | convertFromUnityToOpenXR | Specify whether or not the parameters |
Returns
Type | Description |
---|---|
XrResult | XR_SUCCESS for success. |
CreateProjectedPassthrough(out XrPassthroughHTC, LayerType, OnPassthroughSessionDestroyDelegate, float, uint)
Creates a projected passthrough (i.e. Passthrough is only partially visible). Visible region of the projected passthrough is determined by the mesh and its transform. Passthroughs will be destroyed automatically when the current XrSession is destroyed.
Declaration
public static XrResult CreateProjectedPassthrough(out XrPassthroughHTC passthrough, LayerType layerType, VivePassthrough.OnPassthroughSessionDestroyDelegate onDestroyPassthroughSessionHandler = null, float alpha = 1, uint compositionDepth = 0)
Parameters
Type | Name | Description |
---|---|---|
XrPassthroughHTC | passthrough | The created XrPassthroughHTC |
LayerType | layerType | The |
VivePassthrough.OnPassthroughSessionDestroyDelegate | onDestroyPassthroughSessionHandler | A delegate will be invoked when the current OpenXR Session is going to be destroyed. |
float | alpha | The alpha value of the passthrough layer within the range [0, 1] where 1 (Opaque) is default. |
uint | compositionDepth | The composition depth relative to other composition layers if present where 0 is default. |
Returns
Type | Description |
---|---|
XrResult | XR_SUCCESS for success. |
DestroyPassthrough(XrPassthroughHTC)
To Destroying a passthrough. You should call this function when the delegate is invoked.
Declaration
public static XrResult DestroyPassthrough(XrPassthroughHTC passthrough)
Parameters
Type | Name | Description |
---|---|---|
XrPassthroughHTC | passthrough | The created XrPassthroughHTC |
Returns
Type | Description |
---|---|
XrResult | XR_SUCCESS for success. |
GetCurrentPassthroughLayerIDs()
To get the list of IDs of active passthrough layers.
Declaration
public static List<XrPassthroughHTC> GetCurrentPassthroughLayerIDs()
Returns
Type | Description |
---|---|
List<XrPassthroughHTC> | The a copy of the list of IDs of active passthrough layers. |
SetPassthroughAlpha(XrPassthroughHTC, float, bool)
Modifies the opacity of a specific passthrough layer. Can be used for both Planar and Projected passthroughs.
Declaration
public static bool SetPassthroughAlpha(XrPassthroughHTC passthrough, float alpha, bool autoClamp = true)
Parameters
Type | Name | Description |
---|---|---|
XrPassthroughHTC | passthrough | The created XrPassthroughHTC |
float | alpha | The alpha value of the passthrough layer within the range [0, 1] where 1 (Opaque) is default. |
bool | autoClamp | Specify whether out of range alpha values should be clamped automatically. When set to true, the function will clamp and apply the alpha value automatically. When set to false, the function will return false if the alpha is out of range. Default is true. |
Returns
Type | Description |
---|---|
bool | XR_SUCCESS for success. |
SetPassthroughLayerType(XrPassthroughHTC, LayerType, uint)
Modifies layer type and composition depth of a passthrough layer.
Declaration
public static bool SetPassthroughLayerType(XrPassthroughHTC passthrough, LayerType layerType, uint compositionDepth = 0)
Parameters
Type | Name | Description |
---|---|---|
XrPassthroughHTC | passthrough | The created XrPassthroughHTC |
LayerType | layerType | The |
uint | compositionDepth | The composition depth relative to other composition layers if present where 0 is default. |
Returns
Type | Description |
---|---|
bool | XR_SUCCESS for success. |
SetProjectedPassthroughMesh(XrPassthroughHTC, Vector3[], int[], bool)
Modifies the mesh data of a projected passthrough layer.
Declaration
public static bool SetProjectedPassthroughMesh(XrPassthroughHTC passthrough, Vector3[] vertexBuffer, int[] indexBuffer, bool convertFromUnityToOpenXR = true)
Parameters
Type | Name | Description |
---|---|---|
XrPassthroughHTC | passthrough | The created XrPassthroughHTC |
Vector3[] | vertexBuffer | Positions of the vertices in the mesh. |
int[] | indexBuffer | List of triangles represented by indices into the |
bool | convertFromUnityToOpenXR | Specify whether or not the parameters |
Returns
Type | Description |
---|---|
bool | XR_SUCCESS for success. |
SetProjectedPassthroughMeshOrientation(XrPassthroughHTC, Quaternion, bool, bool)
Modifies the mesh orientation of a projected passthrough layer.
Declaration
public static bool SetProjectedPassthroughMeshOrientation(XrPassthroughHTC passthrough, Quaternion meshOrientation, bool trackingToWorldSpace = true, bool convertFromUnityToOpenXR = true)
Parameters
Type | Name | Description |
---|---|---|
XrPassthroughHTC | passthrough | The created XrPassthroughHTC |
Quaternion | meshOrientation | Orientation of the mesh. |
bool | trackingToWorldSpace | Specify whether or not the position and rotation of the mesh transform have to be converted from tracking space to world space. |
bool | convertFromUnityToOpenXR | Specify whether or not the parameters |
Returns
Type | Description |
---|---|
bool | XR_SUCCESS for success. |
SetProjectedPassthroughMeshPosition(XrPassthroughHTC, Vector3, bool, bool)
Modifies the mesh position of a projected passthrough layer.
Declaration
public static bool SetProjectedPassthroughMeshPosition(XrPassthroughHTC passthrough, Vector3 meshPosition, bool trackingToWorldSpace = true, bool convertFromUnityToOpenXR = true)
Parameters
Type | Name | Description |
---|---|---|
XrPassthroughHTC | passthrough | The created XrPassthroughHTC |
Vector3 | meshPosition | Position of the mesh. |
bool | trackingToWorldSpace | Specify whether or not the position and rotation of the mesh transform have to be converted from tracking space to world space. |
bool | convertFromUnityToOpenXR | Specify whether or not the parameters |
Returns
Type | Description |
---|---|
bool | XR_SUCCESS for success. |
SetProjectedPassthroughMeshTransform(XrPassthroughHTC, ProjectedPassthroughSpaceType, Vector3, Quaternion, Vector3, bool, bool)
Modifies the mesh transform of a projected passthrough layer.
Declaration
public static bool SetProjectedPassthroughMeshTransform(XrPassthroughHTC passthrough, ProjectedPassthroughSpaceType spaceType, Vector3 meshPosition, Quaternion meshOrientation, Vector3 meshScale, bool trackingToWorldSpace = true, bool convertFromUnityToOpenXR = true)
Parameters
Type | Name | Description |
---|---|---|
XrPassthroughHTC | passthrough | The created XrPassthroughHTC |
ProjectedPassthroughSpaceType | spaceType | The projected passthrough's ProjectedPassthroughSpaceType |
Vector3 | meshPosition | Position of the mesh. |
Quaternion | meshOrientation | Orientation of the mesh. |
Vector3 | meshScale | Scale of the mesh. |
bool | trackingToWorldSpace | Specify whether or not the position and rotation of the mesh transform have to be converted from tracking space to world space. |
bool | convertFromUnityToOpenXR | Specify whether or not the parameters |
Returns
Type | Description |
---|---|
bool | XR_SUCCESS for success. |
SetProjectedPassthroughScale(XrPassthroughHTC, Vector3)
Modifies the mesh scale of a passthrough layer.
Declaration
public static bool SetProjectedPassthroughScale(XrPassthroughHTC passthrough, Vector3 meshScale)
Parameters
Type | Name | Description |
---|---|---|
XrPassthroughHTC | passthrough | The created XrPassthroughHTC |
Vector3 | meshScale | Scale of the mesh. |
Returns
Type | Description |
---|---|
bool | XR_SUCCESS for success. |
SetProjectedPassthroughSpaceType(XrPassthroughHTC, ProjectedPassthroughSpaceType)
Modifies the space of a projected passthrough layer.
Declaration
public static bool SetProjectedPassthroughSpaceType(XrPassthroughHTC passthrough, ProjectedPassthroughSpaceType spaceType)
Parameters
Type | Name | Description |
---|---|---|
XrPassthroughHTC | passthrough | The created XrPassthroughHTC |
ProjectedPassthroughSpaceType | spaceType | The projected passthrough's ProjectedPassthroughSpaceType |
Returns
Type | Description |
---|---|
bool | XR_SUCCESS for success. |