NativePluginApi.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Runtime.InteropServices;
  5. using UnityEngine;
  6. namespace Ximmerse.XR
  7. {
  8. public class NativePluginApi
  9. {
  10. private const string LibraryName = "unity_native_api";
  11. public enum GraphicsApi
  12. {
  13. kOpenGlEs2 = 1,
  14. kOpenGlEs3 = 2,
  15. kMetal = 3,
  16. kNone = -1,
  17. }
  18. public enum DeviceType
  19. {
  20. Device_CardBoard = 0,
  21. Device_RhinoXPro = 1,
  22. Devicc_HMD20 = 2,
  23. Device_AUTO = 0xef
  24. }
  25. [DllImport(LibraryName)]
  26. public static extern void Unity_setScreenParams(int screen_width, int screen_height, int viewport_x, int viewport_y, int viewport_width, int viewport_height);
  27. [DllImport(LibraryName)]
  28. public static extern void Unity_setGraphicsApi(GraphicsApi graphics_api);
  29. [DllImport(LibraryName)]
  30. public static extern void Unity_initializeAndroid(IntPtr context);
  31. [DllImport(LibraryName)]
  32. public static extern void Unity_setDeviceType(int device);
  33. [DllImport(LibraryName)]
  34. public static extern int Unity_TagPredict(long predTimestampNano);
  35. [DllImport(LibraryName)]
  36. public static extern bool Unity_getTagTracking2(int track_id,
  37. ref int index, ref long timestamp, ref int state,
  38. ref float posX, ref float posY, ref float posZ,
  39. ref float rotX, ref float rotY, ref float rotZ, ref float rotW,
  40. ref float confidence, ref float marker_distance);
  41. [DllImport(LibraryName)]
  42. public static extern bool Unity_getTagTracking(int track_id, long predTimestampNano,
  43. ref int index, ref long timestamp, ref int state,
  44. ref float posX, ref float posY, ref float posZ,
  45. ref float rotX, ref float rotY, ref float rotZ, ref float rotW,
  46. ref float confidence, ref float marker_distance);
  47. [DllImport(LibraryName)]
  48. public static extern void Unity_setTrackingMode(int mode);
  49. [DllImport(LibraryName)]
  50. public static extern void Unity_setVsync(int vsync);
  51. [DllImport(LibraryName)]
  52. public static extern void Unity_setRenderResolution(int width, int height);
  53. [DllImport(LibraryName)]
  54. public static extern void Unity_setCustomViewFrustum(float lLeft, float lRight, float lTop, float lBottom,
  55. float rLeft, float rRight, float rTop, float rBottom);
  56. [DllImport(LibraryName)]
  57. public static extern void Unity_resetViewFrustum();
  58. [DllImport(LibraryName)]
  59. public static extern void Unity_Vibration(int index, float amplitude, float duration);
  60. [DllImport(LibraryName)]
  61. public static extern bool Unity_getFusionResult(long predictedTimeNs,
  62. ref int beacon_id,
  63. ref long beacon_timestamp,
  64. ref float beacon_pos0,
  65. ref float beacon_pos1,
  66. ref float beacon_pos2,
  67. ref float beacon_rot0,
  68. ref float beacon_rot1,
  69. ref float beacon_rot2,
  70. ref float beacon_rot3,
  71. ref float beacon_tracking_confidence,
  72. ref float beacon_min_distance,
  73. ref float beacon_correct_weight);
  74. [DllImport(LibraryName)]
  75. public static extern void Unity_setMaxPredictTime(float time);
  76. [DllImport(LibraryName)]
  77. public static extern void Unity_setHalfExposureTime(float time);
  78. }
  79. }