123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
-
- namespace NRKernal
- {
- using System;
- using System.Runtime.InteropServices;
-
- public partial class NativeTracking
- {
-
- private NativeInterface m_NativeInterface;
-
- private UInt64 m_TrackingHandle;
-
-
- public NativeTracking(NativeInterface nativeInterface)
- {
- m_NativeInterface = nativeInterface;
- }
-
-
- public bool Create()
- {
- NativeResult result = NativeApi.NRTrackingCreate(ref m_TrackingHandle);
- NativeErrorListener.Check(result, this, "Create");
- m_NativeInterface.TrackingHandle = m_TrackingHandle;
- return result == NativeResult.Success;
- }
-
-
-
- public bool InitTrackingMode(TrackingMode mode)
- {
- if (m_TrackingHandle == 0)
- {
- return false;
- }
- NativeResult result = NativeApi.NRTrackingInitSetTrackingMode(m_TrackingHandle, mode);
- NativeErrorListener.Check(result, this, "InitTrackingMode");
- return result == NativeResult.Success;
- }
-
-
- public bool Start()
- {
- if (m_TrackingHandle == 0)
- {
- return false;
- }
- NativeResult result = NativeApi.NRTrackingStart(m_TrackingHandle);
- NativeErrorListener.Check(result, this, "Start");
- return result == NativeResult.Success;
- }
-
-
-
- public bool SwitchTrackingMode(TrackingMode mode)
- {
- NativeResult result = NativeApi.NRTrackingSetTrackingMode(m_TrackingHandle, mode);
- NativeErrorListener.Check(result, this, "SwitchTrackingMode");
- return result == NativeResult.Success;
- }
-
-
- public bool Pause()
- {
- if (m_TrackingHandle == 0)
- {
- return false;
- }
- NativeResult result = NativeApi.NRTrackingPause(m_TrackingHandle);
- NativeErrorListener.Check(result, this, "Pause");
- return result == NativeResult.Success;
- }
-
-
- public bool Resume()
- {
- if (m_TrackingHandle == 0)
- {
- return false;
- }
- NativeResult result = NativeApi.NRTrackingResume(m_TrackingHandle);
- NativeErrorListener.Check(result, this, "Resume");
- return result == NativeResult.Success;
- }
-
- public void Recenter()
- {
- if (m_TrackingHandle == 0)
- {
- return;
- }
- var result = NativeApi.NRTrackingRecenter(m_TrackingHandle);
- NativeErrorListener.Check(result, this, "Recenter");
- }
-
-
- public bool Destroy()
- {
- if (m_TrackingHandle == 0)
- {
- return false;
- }
- NativeResult result = NativeApi.NRTrackingDestroy(m_TrackingHandle);
- NativeErrorListener.Check(result, this, "Destroy");
- m_TrackingHandle = 0;
- m_NativeInterface.TrackingHandle = m_TrackingHandle;
- return result == NativeResult.Success;
- }
- private partial struct NativeApi
- {
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRTrackingCreate(ref UInt64 out_tracking_handle);
-
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRTrackingInitSetTrackingMode(UInt64 tracking_handle, TrackingMode tracking_mode);
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRTrackingStart(UInt64 tracking_handle);
-
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRTrackingSetTrackingMode(UInt64 tracking_handle, TrackingMode tracking_mode);
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRTrackingDestroy(UInt64 tracking_handle);
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRTrackingPause(UInt64 tracking_handle);
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRTrackingResume(UInt64 tracking_handle);
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRTrackingRecenter(UInt64 tracking_handle);
- };
- }
- }
|