API_SVR.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. [Obsolete("Please Use API_GSXR_Slam")]
  6. public class API_SVR {
  7. public enum TrackMode {
  8. Mode_3Dof,
  9. Mode_6Dof,
  10. }
  11. ///API-No.1
  12. /// <summary>
  13. /// 设置眼镜进入模式,运行过程中可修改
  14. /// </summary>
  15. public static void SetTrackMode(TrackMode mode) {
  16. API_GSXR_Slam.GSXR_Set_TrackMode((API_GSXR_Slam.TrackMode)mode);
  17. }
  18. ///API-No.2
  19. /// <summary>
  20. /// Svr系统是否在运行
  21. /// </summary>
  22. /// <returns>true表示在运行,false表示未运行(Pause时为false)</returns>
  23. public static bool IsSvrRunning() {
  24. return API_GSXR_Slam.GSXR_Is_SlamRunning();
  25. }
  26. ///API-No.3
  27. /// <summary>
  28. /// Svr系统是否初始化完成
  29. /// </summary>
  30. /// <returns></returns>
  31. public static bool IsSvrInitialized() {
  32. return API_GSXR_Slam.GSXR_Is_SlamInitialized();
  33. }
  34. ///API-No.4
  35. /// <summary>
  36. /// 设置Svr初始化完成时的回调
  37. /// </summary>
  38. /// <param name="action"></param>
  39. public static void AddInitializedCallBack(Action action) {
  40. API_GSXR_Slam.GSXR_Add_InitializedCallBack(action);
  41. }
  42. ///API-No.5
  43. public static void RemoveInitializedCallBack(Action action) {
  44. API_GSXR_Slam.GSXR_Remove_InitializedCallBack(action);
  45. }
  46. ///API-No.6
  47. /// <summary>
  48. /// 设置渲染帧率,只能在Start中调用
  49. /// </summary>
  50. /// <param name="frameRate">默认-1表示系统默认帧率,设置范围0-200</param>
  51. public static void SetRenderFrame(int frameRate = -1) {
  52. API_GSXR_Slam.GSXR_Set_RenderFrame(frameRate);
  53. }
  54. ///API-No.7
  55. /// <summary>
  56. /// 获取左右眼摄像头
  57. /// </summary>
  58. /// <returns>List[0]左眼 List[1]右眼,空表示系统未启动完成</returns>
  59. public static List<Camera> GetEyeCameras() {
  60. return API_GSXR_Slam.GSXR_Get_EyeCameras();
  61. }
  62. ///API-No.8
  63. /// <summary>
  64. /// 获取左右眼渲染的画面,为获取当前帧的渲染结果,当前帧结束时调用
  65. /// </summary>
  66. /// <returns>List[0]左眼 List[1]右眼,空表示系统未启动完成</returns>
  67. public static List<RenderTexture> GetRenderTexure() {
  68. return API_GSXR_Slam.GSXR_Get_RenderTexure();
  69. }
  70. ///API-No.9
  71. /// <summary>
  72. /// 获取头部物体,如果想获取头部的旋转移动等数据,在LateUpdate方法里调用
  73. /// </summary>
  74. /// <returns>空表示系统未启动完成</returns>
  75. public static Transform GetHead() {
  76. return API_GSXR_Slam.GSXR_Get_Head();
  77. }
  78. ///API-No.10
  79. /// <summary>
  80. /// 设置瞳距,Awake时调用,Start后调用无效
  81. /// </summary>
  82. /// <param name="offset">瞳距的偏移量,单位米</param>
  83. public static void SetPD(float offset = 0) {
  84. API_GSXR_Slam.GSXR_Set_PD(offset);
  85. }
  86. ///API-No.11
  87. /// <summary>
  88. /// 重定位,若无效果,表示系统初始化未完成,且只有在眼镜上有效
  89. /// </summary>
  90. public static void RecenterTracking() {
  91. API_GSXR_Slam.GSXR_RecenterTracking();
  92. }
  93. ///API-No.12
  94. /// <summary>
  95. /// StartSlam
  96. /// </summary>
  97. public static void StartSlam() {
  98. API_GSXR_Slam.GSXR_Start_Slam();
  99. }
  100. ///API-No.13
  101. /// <summary>
  102. /// StopSlam
  103. /// When a StartSlam is running (not completed), calling StopSlam will not work
  104. /// </summary>
  105. public static void StopSlam() {
  106. API_GSXR_Slam.GSXR_Stop_Slam();
  107. }
  108. ///API-No.14
  109. /// <summary>
  110. /// ResetSlam
  111. /// </summary>
  112. public static void ResetSlam() {
  113. API_GSXR_Slam.GSXR_Reset_Slam();
  114. }
  115. ///API-No.15
  116. /// <summary>
  117. /// IS Slam 6Dof DataLost
  118. /// </summary>
  119. public static bool IsSlamDataLost {
  120. get {
  121. return API_GSXR_Slam.GSXR_Is_SlamDataLost;
  122. }
  123. }
  124. ///API-No.16
  125. /// <summary>
  126. /// Get QvrCamera Data
  127. /// </summary>
  128. public static int GetLatestQVRCameraBinocularData(ref bool outBUdate, ref uint outCurrFrameIndex, ref ulong outFrameExposureNano, byte[] outLeftFrameData, byte[] outRightFrameData) {
  129. return API_GSXR_Slam.GSXR_Get_LatestQVRCameraBinocularData(ref outBUdate, ref outCurrFrameIndex, ref outFrameExposureNano, outLeftFrameData, outRightFrameData);
  130. }
  131. public static GSXRManager SlamManager {
  132. get {
  133. return API_GSXR_Slam.SlamManager;
  134. }
  135. }
  136. }