Skip to main content
Version: 3.5

class XRDisplayContext

(Niantic.Lightship.AR.Utilities.XRDisplayContext)

Overview

Container for data relevant to rendering in relation to the XR camera's display

class XRDisplayContext {
public:
// fields

static float OccludeeEyeDepth = DefaultOccludeeEyeDepth;

// methods

static ScreenOrientation GetScreenOrientation();
};

Detailed Documentation

Container for data relevant to rendering in relation to the XR camera's display

Fields

OccludeeEyeDepth

static float OccludeeEyeDepth = DefaultOccludeeEyeDepth

Linear eye-depth from the camera to the occludee.

Methods

GetScreenOrientation

static ScreenOrientation GetScreenOrientation()

For Lightship, it is important to know the screen orientation in order to know how to rotate the camera input image received from the XRCameraSubsystem. UnityEngine.Screen.orientation property only returns ScreenOrientation.Portrait when called in Editor, presumably because there is no rotation offset between the camera image and the displayed screen image in Editor. Thus, use this method to get the screen orientation value expected by Lightship's APIs, regardless of the active platform.

    Returns:

    The corrected screen orientation. When playing a scene in Lightship's Playback mode, the returned value will match the screen orientation recorded in the dataset's current frame. Else, will return the UnityEngine.Screen.orientation value.