NRPlaneSubsystem.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 System.Collections.Generic;
  13. using UnityEngine;
  14. public class NRPlaneSubsystemDescriptor : IntegratedSubsystemDescriptor<NRPlaneSubsystem>
  15. {
  16. public const string Name = "Subsystem.Trackable.Plane";
  17. public override string id => Name;
  18. }
  19. public class NRPlaneSubsystem : IntegratedSubsystem<NRPlaneSubsystemDescriptor>
  20. {
  21. private ITrackablePlaneDataProvider m_Provider;
  22. public NRPlaneSubsystem(NRPlaneSubsystemDescriptor descriptor) : base(descriptor)
  23. {
  24. #if UNITY_EDITOR
  25. m_Provider = new NREmulatorTrackPlaneProvider();
  26. #else
  27. m_Provider = new NRTrackablePlaneProvider();
  28. #endif
  29. }
  30. public TrackablePlaneType GetPlaneType(UInt64 trackable_handle)
  31. {
  32. return m_Provider.GetPlaneType(trackable_handle);
  33. }
  34. public Pose GetCenterPose(UInt64 trackable_handle)
  35. {
  36. return m_Provider.GetCenterPose(trackable_handle);
  37. }
  38. public float GetExtentX(UInt64 trackable_handle)
  39. {
  40. return m_Provider.GetExtentX(trackable_handle);
  41. }
  42. public float GetExtentZ(UInt64 trackable_handle)
  43. {
  44. return m_Provider.GetExtentZ(trackable_handle);
  45. }
  46. public void GetBoundaryPolygon(UInt64 trackable_handle, List<Vector3> polygonList)
  47. {
  48. m_Provider.GetBoundaryPolygon(trackable_handle, polygonList);
  49. }
  50. }
  51. }