NRTrackableImageSubsystem.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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;
  12. using UnityEngine;
  13. public class NRTrackableImageSubsystemDescriptor : IntegratedSubsystemDescriptor<NRTrackableImageSubsystem>
  14. {
  15. public const string Name = "Subsystem.Trackable.Image";
  16. public override string id => Name;
  17. }
  18. public class NRTrackableImageSubsystem : IntegratedSubsystem<NRTrackableImageSubsystemDescriptor>
  19. {
  20. private ITrackableImageDataProvider m_Provider;
  21. public NRTrackableImageSubsystem(NRTrackableImageSubsystemDescriptor descriptor) : base(descriptor)
  22. {
  23. #if UNITY_EDITOR
  24. m_Provider = new NREmulatorTrackImageProvider();
  25. #else
  26. m_Provider = new NRTrackableImageProvider();
  27. #endif
  28. }
  29. public UInt64 CreateDataBase()
  30. {
  31. return m_Provider.CreateDataBase();
  32. }
  33. public bool DestroyDataBase(UInt64 database_handle)
  34. {
  35. return m_Provider.DestroyDataBase(database_handle);
  36. }
  37. public bool LoadDataBase(UInt64 database_handle, string path)
  38. {
  39. return m_Provider.LoadDataBase(database_handle, path);
  40. }
  41. public Pose GetCenterPose(UInt64 trackable_handle)
  42. {
  43. return m_Provider.GetCenterPose(trackable_handle);
  44. }
  45. public Vector2 GetSize(UInt64 trackable_handle)
  46. {
  47. return m_Provider.GetSize(trackable_handle);
  48. }
  49. }
  50. }