Table of Contents

Class XROcclusionFrameExtensions

Extensions for Unity's XROcclusionFrame.

public static class XROcclusionFrameExtensions
Inheritance
object
XROcclusionFrameExtensions

Methods

GetBaseFrameData(XROcclusionFrame, Matrix4x4[], Matrix4x4[], out Vector4)

Constructs:

  • A perspective projection matrix for each eye
  • The view matrix for each eye from its Pose
  • Parameters used for handling the depth buffer for shaders using "_EnvironmentDepthZBufferParams".
    for a given XROcclusionFrame.
public static bool GetBaseFrameData(this XROcclusionFrame frame, Matrix4x4[] projectionMatrices, Matrix4x4[] viewMatrices, out Vector4 zBufferParams)

Parameters

frame XROcclusionFrame
projectionMatrices Matrix4x4[]

The array to populate the projection matrices in, must be of length 2.

viewMatrices Matrix4x4[]

The array to populate the view matrices in, must be of length 2.

zBufferParams Vector4

Resulting depth buffer parameters for "_EnvironmentDepthZBufferParams".

Returns

bool

A boolean representing the success of the operation.

GetZBufferParams(XRNearFarPlanes)

Calculates parameters used for handling the depth buffer for shaders using "_EnvironmentDepthZBufferParams".

public static Vector4 GetZBufferParams(this XRNearFarPlanes planes)

Parameters

planes XRNearFarPlanes

Returns

Vector4

The depth buffer parameters.

TryGetReprojectionMatrices(XROcclusionFrame, Matrix4x4, Matrix4x4[], Matrix4x4[], Matrix4x4[], out Vector4)

Uses data from GetBaseFrameData(XROcclusionFrame, Matrix4x4[], Matrix4x4[], out Vector4) to construct reprojection matrices which can be used to convert world space points to points in the depth texture.

public static bool TryGetReprojectionMatrices(this XROcclusionFrame frame, Matrix4x4 worldToLocalMatrix, Matrix4x4[] reprojectionMatrices, Matrix4x4[] projectionMatrices, Matrix4x4[] viewMatrices, out Vector4 zBufferParams)

Parameters

frame XROcclusionFrame
worldToLocalMatrix Matrix4x4

A matrix used to convert world space points into the local space of the XR session.

reprojectionMatrices Matrix4x4[]

The array to populate the reprojection matrices in, must be of length 2.

projectionMatrices Matrix4x4[]
viewMatrices Matrix4x4[]
zBufferParams Vector4

Returns

bool