NativeInterface.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #if UNITY_STANDALONE_WIN
  13. using System.Runtime.InteropServices;
  14. using UnityEngine;
  15. #endif
  16. /// <summary> Manage the Total Native API. </summary>
  17. public class NativeInterface
  18. {
  19. /// <summary> Default constructor. </summary>
  20. public NativeInterface()
  21. {
  22. //Add Standalone plugin search path.
  23. #if UNITY_STANDALONE_WIN
  24. NativeApi.SetDllDirectory(System.IO.Path.Combine(Application.dataPath, "Plugins"));
  25. #endif
  26. NativeHeadTracking = new NativeHeadTracking(this);
  27. NativeTracking = new NativeTracking(this);
  28. NativeTrackableImage = new NativeTrackableImage(this);
  29. NativePlane = new NativePlane(this);
  30. NativeTrackable = new NativeTrackable(this);
  31. Configration = new NativeConfigration(this);
  32. NativeRenderring = new NativeRenderring();
  33. }
  34. /// <summary> Gets or sets the handle of the tracking. </summary>
  35. /// <value> The tracking handle. </value>
  36. public UInt64 TrackingHandle { get; set; }
  37. /// <summary> Gets or sets the native head tracking. </summary>
  38. /// <value> The native head tracking. </value>
  39. internal NativeHeadTracking NativeHeadTracking { get; set; }
  40. /// <summary> Gets or sets the native tracking. </summary>
  41. /// <value> The native tracking. </value>
  42. internal NativeTracking NativeTracking { get; set; }
  43. /// <summary> Gets or sets the native trackable image. </summary>
  44. /// <value> The native trackable image. </value>
  45. internal NativeTrackableImage NativeTrackableImage { get; set; }
  46. /// <summary> Gets or sets the native plane. </summary>
  47. /// <value> The native plane. </value>
  48. internal NativePlane NativePlane { get; set; }
  49. /// <summary> Gets or sets the native trackable. </summary>
  50. /// <value> The native trackable. </value>
  51. internal NativeTrackable NativeTrackable { get; set; }
  52. /// <summary> Gets or sets the configration. </summary>
  53. /// <value> The configration. </value>
  54. internal NativeConfigration Configration { get; set; }
  55. /// <summary> Gets or sets the configration. </summary>
  56. /// <value> The configration. </value>
  57. internal NativeRenderring NativeRenderring { get; set; }
  58. private partial struct NativeApi
  59. {
  60. #if UNITY_STANDALONE_WIN
  61. [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
  62. public static extern bool SetDllDirectory(string lpPathName);
  63. #endif
  64. }
  65. }
  66. }