WebXREyeTracking.d.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { WebXRAbstractFeature } from "./WebXRAbstractFeature";
  2. import type { WebXRSessionManager } from "../webXRSessionManager";
  3. import { Observable } from "../../Misc/observable";
  4. import { Ray } from "../../Culling/ray";
  5. import type { Nullable } from "../../types";
  6. /**
  7. * The WebXR Eye Tracking feature grabs eye data from the device and provides it in an easy-access format.
  8. * Currently only enabled for BabylonNative applications.
  9. */
  10. export declare class WebXREyeTracking extends WebXRAbstractFeature {
  11. private _latestEyeSpace;
  12. private _gazeRay;
  13. /**
  14. * The module's name
  15. */
  16. static readonly Name = "xr-eye-tracking";
  17. /**
  18. * The (Babylon) version of this module.
  19. * This is an integer representing the implementation version.
  20. * This number does not correspond to the WebXR specs version
  21. */
  22. static readonly Version = 1;
  23. /**
  24. * This observable will notify registered observers when eye tracking starts
  25. */
  26. readonly onEyeTrackingStartedObservable: Observable<Ray>;
  27. /**
  28. * This observable will notify registered observers when eye tracking ends
  29. */
  30. readonly onEyeTrackingEndedObservable: Observable<void>;
  31. /**
  32. * This observable will notify registered observers on each frame that has valid tracking
  33. */
  34. readonly onEyeTrackingFrameUpdateObservable: Observable<Ray>;
  35. /**
  36. * Creates a new instance of the XR eye tracking feature.
  37. * @param _xrSessionManager An instance of WebXRSessionManager.
  38. */
  39. constructor(_xrSessionManager: WebXRSessionManager);
  40. /**
  41. * Dispose this feature and all of the resources attached.
  42. */
  43. dispose(): void;
  44. /**
  45. * Returns whether the gaze data is valid or not
  46. * @returns true if the data is valid
  47. */
  48. get isEyeGazeValid(): boolean;
  49. /**
  50. * Get a reference to the gaze ray. This data is valid while eye tracking persists, and will be set to null when gaze data is no longer available
  51. * @returns a reference to the gaze ray if it exists and is valid, returns null otherwise.
  52. */
  53. getEyeGaze(): Nullable<Ray>;
  54. protected _onXRFrame(frame: XRFrame): void;
  55. private _eyeTrackingStartListener;
  56. private _eyeTrackingEndListener;
  57. private _init;
  58. }