NRTrackableSubsystem.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /****************************************************************************
  2. * Copyright 2019 Nreal Techonology Limited. All rights reserved.
  3. *
  4. * This file is part of NRSDK.
  5. *
  6. * https://www.nreal.ai/
  7. *
  8. *****************************************************************************/
  9. namespace NRKernal
  10. {
  11. using System.Collections.Generic;
  12. public class NRTrackableSubsystemDescriptor : IntegratedSubsystemDescriptor<NRTrackableSubsystem>
  13. {
  14. public const string Name = "Subsystem.Trackable";
  15. public override string id => Name;
  16. }
  17. public class NRTrackableSubsystem : IntegratedSubsystem<NRTrackableSubsystemDescriptor>
  18. {
  19. private ITrackableDataProvider m_Provider;
  20. public NRTrackableSubsystem(NRTrackableSubsystemDescriptor descriptor) : base(descriptor)
  21. {
  22. #if UNITY_EDITOR
  23. m_Provider = new NREmulatorTrackableProvider();
  24. #else
  25. m_Provider = new NRTrackableProvider();
  26. #endif
  27. }
  28. public uint GetIdentify(ulong trackable_handle)
  29. {
  30. return m_Provider.GetIdentify(trackable_handle);
  31. }
  32. public TrackableType GetTrackableType(ulong trackable_handle)
  33. {
  34. return m_Provider.GetTrackableType(trackable_handle);
  35. }
  36. public TrackingState GetTrackingState(ulong trackable_handle)
  37. {
  38. return m_Provider.GetTrackingState(trackable_handle);
  39. }
  40. public bool UpdateTrackables(TrackableType trackable_type, List<ulong> trackables)
  41. {
  42. return m_Provider.UpdateTrackables(trackable_type, trackables);
  43. }
  44. }
  45. }