12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /****************************************************************************
- * Copyright 2019 Nreal Techonology Limited. All rights reserved.
- *
- * This file is part of NRSDK.
- *
- * https://www.nreal.ai/
- *
- *****************************************************************************/
- namespace NRKernal
- {
- using UnityEngine;
- public class NRTrackingDataProvider : ITrackingDataProvider
- {
- NativeHeadTracking m_NativeHeadTracking;
- NativeTracking m_NativeTracking;
- public NRTrackingDataProvider()
- {
- if (NRSessionManager.Instance.NativeAPI == null)
- {
- NRSessionManager.Instance.NativeAPI = new NativeInterface();
- }
- m_NativeHeadTracking = NRSessionManager.Instance.NativeAPI.NativeHeadTracking;
- m_NativeTracking = NRSessionManager.Instance.NativeAPI.NativeTracking;
- m_NativeTracking.Create();
- }
- public void Start()
- {
- m_NativeTracking.Start();
- m_NativeHeadTracking.Start();
- }
- public void Pause()
- {
- m_NativeTracking.Pause();
- }
- public void Recenter()
- {
- m_NativeTracking.Recenter();
- }
- public void Resume()
- {
- m_NativeTracking.Resume();
- }
- public void Stop()
- {
- m_NativeHeadTracking.Destroy();
- m_NativeTracking.Destroy();
- }
- public bool SwitchTrackingMode(TrackingMode mode)
- {
- return m_NativeTracking.SwitchTrackingMode(mode);
- }
- public bool GetFramePresentHeadPose(ref Pose pose, ref LostTrackingReason lostReason, ref ulong timestamp)
- {
- return m_NativeHeadTracking.GetFramePresentHeadPose(ref pose, ref lostReason, ref timestamp);
- }
- public bool GetHeadPose(ref Pose pose, ulong timestamp)
- {
- return m_NativeHeadTracking.GetHeadPose(ref pose, timestamp);
- }
- public bool InitTrackingMode(TrackingMode mode)
- {
- return m_NativeTracking.InitTrackingMode(mode);
- }
- public bool GetFramePresentTimeByCount(int count, ref ulong timestamp)
- {
- return m_NativeHeadTracking.GetFramePresentTimeByCount(count, ref timestamp);
- }
-
- public ulong GetHMDTimeNanos()
- {
- return m_NativeHeadTracking.GetHMDTimeNanos();
- }
- }
- }
|