public bool Open(FieldOfUse fieldOfUse, StreamEngineTracker_Description description) { IntPtr apiContext; if (Context != null) { throw new InvalidOperationException("There is already an instantiated connection"); } if (CreateApiContext(_interop, out apiContext, _customLog) == false) { return(false); } List <string> connectedDevices; if (GetAvailableTrackers(_interop, apiContext, out connectedDevices) == false) { DestroyApiContext(_interop, apiContext); return(false); } IntPtr deviceContext; string hmdEyeTrackerUrl; var interopFieldOfUse = fieldOfUse == FieldOfUse.Interactive ? Interop.tobii_field_of_use_t.TOBII_FIELD_OF_USE_INTERACTIVE : Interop.tobii_field_of_use_t.TOBII_FIELD_OF_USE_ANALYTICAL; if (GetFirstSupportedTracker(_interop, apiContext, interopFieldOfUse, connectedDevices, description, out deviceContext, out hmdEyeTrackerUrl) == false) { DestroyApiContext(_interop, apiContext); return(false); } Context = new StreamEngineContext(apiContext, deviceContext, hmdEyeTrackerUrl); return(true); }
public StreamEngineTracker(FieldOfUse fieldOfUse, StreamEngineTracker_Description description = null, StreamEngineConnection connection = null) { if (description == null) { description = new StreamEngineTracker_Description(); } if (connection == null) { connection = new StreamEngineConnection(new InteropWrapper()); } LocalLatestData = new TobiiXR_EyeTrackingData(); _connection = connection; if (TryConnectToTracker(fieldOfUse, _connection, _stopwatch, description) == false) { throw new Exception("Failed to connect to tracker"); } _nativePointerToSelf = GCHandle.Alloc(this); if (SubscribeToWearableData(_connection.Context.Device, GCHandle.ToIntPtr(_nativePointerToSelf)) == false) { throw new Exception("Failed to subscribe to tracker"); } CheckForCapabilities(_connection.Context.Device); }
public bool Initialize(FieldOfUse fieldOfUse) { _eyeTrackingDataLocal.GazeRay.Origin = Vector3.zero; _eyeTrackingDataLocal.GazeRay.Direction = Vector3.forward; _eyeTrackingDataLocal.GazeRay.IsValid = true; return(true); }
public bool Initialize(FieldOfUse fieldOfUse) { EyeTrackingDataLocal = new TobiiXR_EyeTrackingData(); var result = Pvr_UnitySDKAPI.System.UPvr_setTrackingMode((int)Pvr_UnitySDKAPI.TrackingMode.PVR_TRACKING_MODE_POSITION | (int)Pvr_UnitySDKAPI.TrackingMode.PVR_TRACKING_MODE_EYE); if (!result) { Debug.LogWarning("Failed to enable eye tracking"); } return(result); }
public bool Initialize(FieldOfUse fieldOfUse) { if (!SRanipal_Eye_API.IsViveProEye()) { return(false); } _hmdToWorldTransformer = new HmdToWorldTransformer(estimatedEyeTrackerLatency_s: 0.040f); EnsureHTCFrameworkRunning(); return(SRanipal_Eye_Framework.Status == SRanipal_Eye_Framework.FrameworkStatus.WORKING); }
public bool Initialize(FieldOfUse fieldOfUse, StreamEngineTracker streamEngineTracker) { try { if (streamEngineTracker == null) { _streamEngineTracker = new StreamEngineTracker(fieldOfUse); } else { _streamEngineTracker = streamEngineTracker; } _hmdToWorldTransformer = new HmdToWorldTransformer(estimatedEyeTrackerLatency_s: 0.012f); } catch (System.Exception) { return(false); } return(true); }
private static bool TryConnectToTracker(FieldOfUse fieldOfUse, StreamEngineConnection connection, Stopwatch stopwatch, StreamEngineTracker_Description description) { StartStopwatch(stopwatch); try { if (connection.Open(fieldOfUse, description) == false) { return(false); } } catch (Exception e) { UnityEngine.Debug.LogError("Error connecting to eye tracker: " + e.ToString()); return(false); } var elapsedTime = StopStopwatch(stopwatch); UnityEngine.Debug.Log(string.Format("Connected to SE tracker: {0} and it took {1}ms", connection.Context.Url, elapsedTime)); return(true); }
public bool Initialize(FieldOfUse fieldOfUse) { Debug.LogError(string.Format("Scripting define symbol \"{0}\" not set for {1}.", AssemblyUtils.GetProviderCompilerFlag(this), this.GetType().Name)); return(false); }
public bool Initialize(FieldOfUse fieldOfUse) { return(true); }
public bool Initialize(FieldOfUse fieldOfUse) { return(Initialize(fieldOfUse, null)); }