LKGDisplaySystem.cs

Contains access to Looking Glass display calibration data for all currently-connected Looking Glass displays to the system.

Note that this class is NOT thread safe and is expected to only be accessed on the Unity main thread.

This class automatically connects to LKG Bridge on start (via static constructor, and InitializeOnLoad in the editor) and queries for connected displays, but you may manually call LKGDisplaySystem.Reconnect() or LKGDisplaySystem.ReloadCalibrations() yourself as well.

Additionally, LKG Bridge is queried every few seconds to detect device changes. LKG Bridge uses web sockets events to notify listeners of display changes, but these currently don't work with WebSocketSharp and Unity currently.

Fields & Properties

bool IsLoading

Is the system currently connecting to LKG Bridge and/or awaiting the list of connected LKG displays and their calibrations?

Methods

static LookingGlass.Toolkit.Display Get(int index)

Gets a copy of the LKG display in the array of connected displays that are found to be currently connected. int index is an arbitrary index, and should NOT be relied on for persistence.

static Task WaitForConnected()

If LKGDisplaySystem.Reconnect() is currently waiting to connect to LKG Bridge, this returns a Task that will complete once that connection has been established. If there is no in-progress connection attempt at the moment, a completed Task is returned instead.

static Task WaitForCalibrations()

Waits for all currently-pending requests resulting from LKGDisplaySystem.ReloadCalibrations() at the moment of calling this method.

Subsequent calls to LKGDisplaySystem.ReloadCalibrations() after this method is called will not be awaited in this call.

static Task<bool> Reconnect()

Attempts to asynchronously connect to Looking Glass Bridge and query it for the Looking Glass displays that are currently connected to your system.

Note that this is automatically called on start (via static constructor, and InitializeOnLoad in the editor), but you may manually call this method yourself as well.

This includes a call to LKGDisplaySystem.ReloadCalibrations().

static Task<bool> ReloadCalibrations()

Asynchronously queries LKG Bridge for all currently connected LKG displays, updates this class's list of them (see LKGDisplaySystem.LKGDisplayCount and LKGDisplaySystem.Get(int index)), and updates all Hologram Cameras to ensure they are targeting the correct, up-to-date displays.

Returns true upon successful calibration reload from LKG Bridge and successful handling of the data internally, false otherwise.

Last updated

Change request #502: August 18 Changes