SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.6 KiB

4 years ago
  1. using System;
  2. namespace UnityEngine.XR.ARKit
  3. {
  4. /// <summary>
  5. /// Represents an asynchronous world map request.
  6. /// Use this to determine the status of the request,
  7. /// and get the <see cref="ARWorldMap"/> once the request is complete.
  8. /// </summary>
  9. public struct ARWorldMapRequest : IDisposable, IEquatable<ARWorldMapRequest>
  10. {
  11. /// <summary>
  12. /// Get the status of the request.
  13. /// </summary>
  14. public ARWorldMapRequestStatus status
  15. {
  16. get
  17. {
  18. return Api.UnityARKit_getWorldMapRequestStatus(m_RequestId);
  19. }
  20. }
  21. /// <summary>
  22. /// Retrieve the <see cref="ARWorldMap"/>.
  23. /// It is an error to call this method when <see cref="status"/> is
  24. /// not <see cref="ARWorldMapRequestStatus.Success"/>.
  25. /// </summary>
  26. /// <returns>An <see cref="ARWorldMap"/> representing the state of the session at the time the request was made.</returns>
  27. public ARWorldMap GetWorldMap()
  28. {
  29. if (status != ARWorldMapRequestStatus.Success)
  30. throw new InvalidOperationException("Cannot GetWorldMap unless status is ARWorldMapRequestStatus.Success.");
  31. var worldMapId = Api.UnityARKit_getWorldMapIdFromRequestId(m_RequestId);
  32. if (worldMapId == ARWorldMap.k_InvalidHandle)
  33. throw new InvalidOperationException("Internal error.");
  34. return new ARWorldMap(worldMapId);
  35. }
  36. /// <summary>
  37. /// Dispose of the request. You must dispose of the request to avoid
  38. /// leaking resources.
  39. /// </summary>
  40. public void Dispose()
  41. {
  42. Api.UnityARKit_disposeWorldMapRequest(m_RequestId);
  43. }
  44. public override int GetHashCode()
  45. {
  46. return m_RequestId.GetHashCode();
  47. }
  48. public override bool Equals(object obj)
  49. {
  50. if (!(obj is ARWorldMapRequest))
  51. return false;
  52. return Equals((ARWorldMapRequest)obj);
  53. }
  54. public bool Equals(ARWorldMapRequest other)
  55. {
  56. return (m_RequestId == other.m_RequestId);
  57. }
  58. public static bool operator ==(ARWorldMapRequest lhs, ARWorldMapRequest rhs)
  59. {
  60. return lhs.Equals(rhs);
  61. }
  62. public static bool operator !=(ARWorldMapRequest lhs, ARWorldMapRequest rhs)
  63. {
  64. return !lhs.Equals(rhs);
  65. }
  66. internal ARWorldMapRequest(int requestId)
  67. {
  68. m_RequestId = requestId;
  69. }
  70. int m_RequestId;
  71. }
  72. }