OVRPlugin.cs 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491
  1. using System;
  2. using System.Runtime.InteropServices;
  3. internal static class OVRPlugin
  4. {
  5. public static Version version
  6. {
  7. get
  8. {
  9. if (OVRPlugin._version == null)
  10. {
  11. try
  12. {
  13. string text = OVRPlugin.OVRP_1_1_0.ovrp_GetVersion();
  14. if (text != null)
  15. {
  16. text = text.Split(new char[]
  17. {
  18. '-'
  19. })[0];
  20. OVRPlugin._version = new Version(text);
  21. }
  22. else
  23. {
  24. OVRPlugin._version = OVRPlugin._versionZero;
  25. }
  26. }
  27. catch
  28. {
  29. OVRPlugin._version = OVRPlugin._versionZero;
  30. }
  31. if (OVRPlugin._version == OVRPlugin.OVRP_0_5_0.version)
  32. {
  33. OVRPlugin._version = OVRPlugin.OVRP_0_1_0.version;
  34. }
  35. if (OVRPlugin._version > OVRPlugin._versionZero && OVRPlugin._version < OVRPlugin.OVRP_1_3_0.version)
  36. {
  37. throw new PlatformNotSupportedException(string.Concat(new object[]
  38. {
  39. "Oculus Utilities version ",
  40. OVRPlugin.wrapperVersion,
  41. " is too new for OVRPlugin version ",
  42. OVRPlugin._version.ToString(),
  43. ". Update to the latest version of Unity."
  44. }));
  45. }
  46. }
  47. return OVRPlugin._version;
  48. }
  49. }
  50. public static Version nativeSDKVersion
  51. {
  52. get
  53. {
  54. if (OVRPlugin._nativeSDKVersion == null)
  55. {
  56. try
  57. {
  58. string text = string.Empty;
  59. if (OVRPlugin.version >= OVRPlugin.OVRP_1_1_0.version)
  60. {
  61. text = OVRPlugin.OVRP_1_1_0.ovrp_GetNativeSDKVersion();
  62. }
  63. else
  64. {
  65. text = OVRPlugin._versionZero.ToString();
  66. }
  67. if (text != null)
  68. {
  69. text = text.Split(new char[]
  70. {
  71. '-'
  72. })[0];
  73. OVRPlugin._nativeSDKVersion = new Version(text);
  74. }
  75. else
  76. {
  77. OVRPlugin._nativeSDKVersion = OVRPlugin._versionZero;
  78. }
  79. }
  80. catch
  81. {
  82. OVRPlugin._nativeSDKVersion = OVRPlugin._versionZero;
  83. }
  84. }
  85. return OVRPlugin._nativeSDKVersion;
  86. }
  87. }
  88. public static bool initialized
  89. {
  90. get
  91. {
  92. return OVRPlugin.OVRP_1_1_0.ovrp_GetInitialized() == OVRPlugin.Bool.True;
  93. }
  94. }
  95. public static bool chromatic
  96. {
  97. get
  98. {
  99. return !(OVRPlugin.version >= OVRPlugin.OVRP_1_7_0.version) || OVRPlugin.OVRP_1_7_0.ovrp_GetAppChromaticCorrection() == OVRPlugin.Bool.True;
  100. }
  101. set
  102. {
  103. if (OVRPlugin.version >= OVRPlugin.OVRP_1_7_0.version)
  104. {
  105. OVRPlugin.OVRP_1_7_0.ovrp_SetAppChromaticCorrection(OVRPlugin.ToBool(value));
  106. }
  107. }
  108. }
  109. public static bool monoscopic
  110. {
  111. get
  112. {
  113. return OVRPlugin.OVRP_1_1_0.ovrp_GetAppMonoscopic() == OVRPlugin.Bool.True;
  114. }
  115. set
  116. {
  117. OVRPlugin.OVRP_1_1_0.ovrp_SetAppMonoscopic(OVRPlugin.ToBool(value));
  118. }
  119. }
  120. public static bool rotation
  121. {
  122. get
  123. {
  124. return OVRPlugin.OVRP_1_1_0.ovrp_GetTrackingOrientationEnabled() == OVRPlugin.Bool.True;
  125. }
  126. set
  127. {
  128. OVRPlugin.OVRP_1_1_0.ovrp_SetTrackingOrientationEnabled(OVRPlugin.ToBool(value));
  129. }
  130. }
  131. public static bool position
  132. {
  133. get
  134. {
  135. return OVRPlugin.OVRP_1_1_0.ovrp_GetTrackingPositionEnabled() == OVRPlugin.Bool.True;
  136. }
  137. set
  138. {
  139. OVRPlugin.OVRP_1_1_0.ovrp_SetTrackingPositionEnabled(OVRPlugin.ToBool(value));
  140. }
  141. }
  142. public static bool useIPDInPositionTracking
  143. {
  144. get
  145. {
  146. return !(OVRPlugin.version >= OVRPlugin.OVRP_1_6_0.version) || OVRPlugin.OVRP_1_6_0.ovrp_GetTrackingIPDEnabled() == OVRPlugin.Bool.True;
  147. }
  148. set
  149. {
  150. if (OVRPlugin.version >= OVRPlugin.OVRP_1_6_0.version)
  151. {
  152. OVRPlugin.OVRP_1_6_0.ovrp_SetTrackingIPDEnabled(OVRPlugin.ToBool(value));
  153. }
  154. }
  155. }
  156. public static bool positionSupported
  157. {
  158. get
  159. {
  160. return OVRPlugin.OVRP_1_1_0.ovrp_GetTrackingPositionSupported() == OVRPlugin.Bool.True;
  161. }
  162. }
  163. public static bool positionTracked
  164. {
  165. get
  166. {
  167. return OVRPlugin.OVRP_1_1_0.ovrp_GetNodePositionTracked(OVRPlugin.Node.EyeCenter) == OVRPlugin.Bool.True;
  168. }
  169. }
  170. public static bool powerSaving
  171. {
  172. get
  173. {
  174. return OVRPlugin.OVRP_1_1_0.ovrp_GetSystemPowerSavingMode() == OVRPlugin.Bool.True;
  175. }
  176. }
  177. public static bool hmdPresent
  178. {
  179. get
  180. {
  181. return OVRPlugin.OVRP_1_1_0.ovrp_GetNodePresent(OVRPlugin.Node.EyeCenter) == OVRPlugin.Bool.True;
  182. }
  183. }
  184. public static bool userPresent
  185. {
  186. get
  187. {
  188. return OVRPlugin.OVRP_1_1_0.ovrp_GetUserPresent() == OVRPlugin.Bool.True;
  189. }
  190. }
  191. public static bool headphonesPresent
  192. {
  193. get
  194. {
  195. return OVRPlugin.OVRP_1_3_0.ovrp_GetSystemHeadphonesPresent() == OVRPlugin.Bool.True;
  196. }
  197. }
  198. public static int recommendedMSAALevel
  199. {
  200. get
  201. {
  202. if (OVRPlugin.version >= OVRPlugin.OVRP_1_6_0.version)
  203. {
  204. return OVRPlugin.OVRP_1_6_0.ovrp_GetSystemRecommendedMSAALevel();
  205. }
  206. return 2;
  207. }
  208. }
  209. public static OVRPlugin.SystemRegion systemRegion
  210. {
  211. get
  212. {
  213. if (OVRPlugin.version >= OVRPlugin.OVRP_1_5_0.version)
  214. {
  215. return OVRPlugin.OVRP_1_5_0.ovrp_GetSystemRegion();
  216. }
  217. return OVRPlugin.SystemRegion.Unspecified;
  218. }
  219. }
  220. public static string audioOutId
  221. {
  222. get
  223. {
  224. try
  225. {
  226. IntPtr intPtr = OVRPlugin.OVRP_1_1_0.ovrp_GetAudioOutId();
  227. if (intPtr != IntPtr.Zero)
  228. {
  229. OVRPlugin.GUID guid = (OVRPlugin.GUID)Marshal.PtrToStructure(intPtr, typeof(OVRPlugin.GUID));
  230. Guid guid2 = new Guid(guid.a, guid.b, guid.c, guid.d0, guid.d1, guid.d2, guid.d3, guid.d4, guid.d5, guid.d6, guid.d7);
  231. if (guid2 != OVRPlugin._cachedAudioOutGuid)
  232. {
  233. OVRPlugin._cachedAudioOutGuid = guid2;
  234. OVRPlugin._cachedAudioOutString = OVRPlugin._cachedAudioOutGuid.ToString();
  235. }
  236. return OVRPlugin._cachedAudioOutString;
  237. }
  238. }
  239. catch
  240. {
  241. }
  242. return string.Empty;
  243. }
  244. }
  245. public static string audioInId
  246. {
  247. get
  248. {
  249. try
  250. {
  251. IntPtr intPtr = OVRPlugin.OVRP_1_1_0.ovrp_GetAudioInId();
  252. if (intPtr != IntPtr.Zero)
  253. {
  254. OVRPlugin.GUID guid = (OVRPlugin.GUID)Marshal.PtrToStructure(intPtr, typeof(OVRPlugin.GUID));
  255. Guid guid2 = new Guid(guid.a, guid.b, guid.c, guid.d0, guid.d1, guid.d2, guid.d3, guid.d4, guid.d5, guid.d6, guid.d7);
  256. if (guid2 != OVRPlugin._cachedAudioInGuid)
  257. {
  258. OVRPlugin._cachedAudioInGuid = guid2;
  259. OVRPlugin._cachedAudioInString = OVRPlugin._cachedAudioInGuid.ToString();
  260. }
  261. return OVRPlugin._cachedAudioInString;
  262. }
  263. }
  264. catch
  265. {
  266. }
  267. return string.Empty;
  268. }
  269. }
  270. public static bool hasVrFocus
  271. {
  272. get
  273. {
  274. return OVRPlugin.OVRP_1_1_0.ovrp_GetAppHasVrFocus() == OVRPlugin.Bool.True;
  275. }
  276. }
  277. public static bool shouldQuit
  278. {
  279. get
  280. {
  281. return OVRPlugin.OVRP_1_1_0.ovrp_GetAppShouldQuit() == OVRPlugin.Bool.True;
  282. }
  283. }
  284. public static bool shouldRecenter
  285. {
  286. get
  287. {
  288. return OVRPlugin.OVRP_1_1_0.ovrp_GetAppShouldRecenter() == OVRPlugin.Bool.True;
  289. }
  290. }
  291. public static string productName
  292. {
  293. get
  294. {
  295. return OVRPlugin.OVRP_1_1_0.ovrp_GetSystemProductName();
  296. }
  297. }
  298. public static string latency
  299. {
  300. get
  301. {
  302. return OVRPlugin.OVRP_1_1_0.ovrp_GetAppLatencyTimings();
  303. }
  304. }
  305. public static float eyeDepth
  306. {
  307. get
  308. {
  309. return OVRPlugin.OVRP_1_1_0.ovrp_GetUserEyeDepth();
  310. }
  311. set
  312. {
  313. OVRPlugin.OVRP_1_1_0.ovrp_SetUserEyeDepth(value);
  314. }
  315. }
  316. public static float eyeHeight
  317. {
  318. get
  319. {
  320. return OVRPlugin.OVRP_1_1_0.ovrp_GetUserEyeHeight();
  321. }
  322. set
  323. {
  324. OVRPlugin.OVRP_1_1_0.ovrp_SetUserEyeHeight(value);
  325. }
  326. }
  327. public static float batteryLevel
  328. {
  329. get
  330. {
  331. return OVRPlugin.OVRP_1_1_0.ovrp_GetSystemBatteryLevel();
  332. }
  333. }
  334. public static float batteryTemperature
  335. {
  336. get
  337. {
  338. return OVRPlugin.OVRP_1_1_0.ovrp_GetSystemBatteryTemperature();
  339. }
  340. }
  341. public static int cpuLevel
  342. {
  343. get
  344. {
  345. return OVRPlugin.OVRP_1_1_0.ovrp_GetSystemCpuLevel();
  346. }
  347. set
  348. {
  349. OVRPlugin.OVRP_1_1_0.ovrp_SetSystemCpuLevel(value);
  350. }
  351. }
  352. public static int gpuLevel
  353. {
  354. get
  355. {
  356. return OVRPlugin.OVRP_1_1_0.ovrp_GetSystemGpuLevel();
  357. }
  358. set
  359. {
  360. OVRPlugin.OVRP_1_1_0.ovrp_SetSystemGpuLevel(value);
  361. }
  362. }
  363. public static int vsyncCount
  364. {
  365. get
  366. {
  367. return OVRPlugin.OVRP_1_1_0.ovrp_GetSystemVSyncCount();
  368. }
  369. set
  370. {
  371. OVRPlugin.OVRP_1_2_0.ovrp_SetSystemVSyncCount(value);
  372. }
  373. }
  374. public static float systemVolume
  375. {
  376. get
  377. {
  378. return OVRPlugin.OVRP_1_1_0.ovrp_GetSystemVolume();
  379. }
  380. }
  381. public static float ipd
  382. {
  383. get
  384. {
  385. return OVRPlugin.OVRP_1_1_0.ovrp_GetUserIPD();
  386. }
  387. set
  388. {
  389. OVRPlugin.OVRP_1_1_0.ovrp_SetUserIPD(value);
  390. }
  391. }
  392. public static bool occlusionMesh
  393. {
  394. get
  395. {
  396. return OVRPlugin.OVRP_1_3_0.ovrp_GetEyeOcclusionMeshEnabled() == OVRPlugin.Bool.True;
  397. }
  398. set
  399. {
  400. OVRPlugin.OVRP_1_3_0.ovrp_SetEyeOcclusionMeshEnabled(OVRPlugin.ToBool(value));
  401. }
  402. }
  403. public static OVRPlugin.BatteryStatus batteryStatus
  404. {
  405. get
  406. {
  407. return OVRPlugin.OVRP_1_1_0.ovrp_GetSystemBatteryStatus();
  408. }
  409. }
  410. public static OVRPlugin.Posef GetEyeVelocity(OVRPlugin.Eye eyeId)
  411. {
  412. return OVRPlugin.GetNodeVelocity((OVRPlugin.Node)eyeId, false);
  413. }
  414. public static OVRPlugin.Posef GetEyeAcceleration(OVRPlugin.Eye eyeId)
  415. {
  416. return OVRPlugin.GetNodeAcceleration((OVRPlugin.Node)eyeId, false);
  417. }
  418. public static OVRPlugin.Frustumf GetEyeFrustum(OVRPlugin.Eye eyeId)
  419. {
  420. return OVRPlugin.OVRP_1_1_0.ovrp_GetNodeFrustum((OVRPlugin.Node)eyeId);
  421. }
  422. public static OVRPlugin.Sizei GetEyeTextureSize(OVRPlugin.Eye eyeId)
  423. {
  424. return OVRPlugin.OVRP_0_1_0.ovrp_GetEyeTextureSize(eyeId);
  425. }
  426. public static OVRPlugin.Posef GetTrackerPose(OVRPlugin.Tracker trackerId)
  427. {
  428. return OVRPlugin.GetNodePose((OVRPlugin.Node)(trackerId + 5), false);
  429. }
  430. public static OVRPlugin.Frustumf GetTrackerFrustum(OVRPlugin.Tracker trackerId)
  431. {
  432. return OVRPlugin.OVRP_1_1_0.ovrp_GetNodeFrustum((OVRPlugin.Node)(trackerId + 5));
  433. }
  434. public static bool ShowUI(OVRPlugin.PlatformUI ui)
  435. {
  436. return OVRPlugin.OVRP_1_1_0.ovrp_ShowSystemUI(ui) == OVRPlugin.Bool.True;
  437. }
  438. public static bool SetOverlayQuad(bool onTop, bool headLocked, IntPtr leftTexture, IntPtr rightTexture, IntPtr device, OVRPlugin.Posef pose, OVRPlugin.Vector3f scale, int layerIndex = 0, OVRPlugin.OverlayShape shape = OVRPlugin.OverlayShape.Quad)
  439. {
  440. if (OVRPlugin.version >= OVRPlugin.OVRP_1_6_0.version)
  441. {
  442. uint num = 0U;
  443. if (onTop)
  444. {
  445. num |= 1U;
  446. }
  447. if (headLocked)
  448. {
  449. num |= 2U;
  450. }
  451. if (shape == OVRPlugin.OverlayShape.Cylinder || shape == OVRPlugin.OverlayShape.Cubemap)
  452. {
  453. if (shape != OVRPlugin.OverlayShape.Cubemap || !(OVRPlugin.version >= OVRPlugin.OVRP_1_10_0.version))
  454. {
  455. return false;
  456. }
  457. num |= (uint)((uint)shape << 4);
  458. }
  459. return OVRPlugin.OVRP_1_6_0.ovrp_SetOverlayQuad3(num, leftTexture, rightTexture, device, pose, scale, layerIndex) == OVRPlugin.Bool.True;
  460. }
  461. return layerIndex == 0 && OVRPlugin.OVRP_0_1_1.ovrp_SetOverlayQuad2(OVRPlugin.ToBool(onTop), OVRPlugin.ToBool(headLocked), leftTexture, device, pose, scale) == OVRPlugin.Bool.True;
  462. }
  463. public static bool UpdateNodePhysicsPoses(int frameIndex, double predictionSeconds)
  464. {
  465. return OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version && OVRPlugin.OVRP_1_8_0.ovrp_Update2(0, frameIndex, predictionSeconds) == OVRPlugin.Bool.True;
  466. }
  467. public static OVRPlugin.Posef GetNodePose(OVRPlugin.Node nodeId, bool usePhysicsPose)
  468. {
  469. if (OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version && usePhysicsPose)
  470. {
  471. return OVRPlugin.OVRP_1_8_0.ovrp_GetNodePose2(0, nodeId);
  472. }
  473. return OVRPlugin.OVRP_0_1_2.ovrp_GetNodePose(nodeId);
  474. }
  475. public static OVRPlugin.Posef GetNodeVelocity(OVRPlugin.Node nodeId, bool usePhysicsPose)
  476. {
  477. if (OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version && usePhysicsPose)
  478. {
  479. return OVRPlugin.OVRP_1_8_0.ovrp_GetNodeVelocity2(0, nodeId);
  480. }
  481. return OVRPlugin.OVRP_0_1_3.ovrp_GetNodeVelocity(nodeId);
  482. }
  483. public static OVRPlugin.Posef GetNodeAcceleration(OVRPlugin.Node nodeId, bool usePhysicsPose)
  484. {
  485. if (OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version && usePhysicsPose)
  486. {
  487. return OVRPlugin.OVRP_1_8_0.ovrp_GetNodeAcceleration2(0, nodeId);
  488. }
  489. return OVRPlugin.OVRP_0_1_3.ovrp_GetNodeAcceleration(nodeId);
  490. }
  491. public static bool GetNodePresent(OVRPlugin.Node nodeId)
  492. {
  493. return OVRPlugin.OVRP_1_1_0.ovrp_GetNodePresent(nodeId) == OVRPlugin.Bool.True;
  494. }
  495. public static bool GetNodeOrientationTracked(OVRPlugin.Node nodeId)
  496. {
  497. return OVRPlugin.OVRP_1_1_0.ovrp_GetNodeOrientationTracked(nodeId) == OVRPlugin.Bool.True;
  498. }
  499. public static bool GetNodePositionTracked(OVRPlugin.Node nodeId)
  500. {
  501. return OVRPlugin.OVRP_1_1_0.ovrp_GetNodePositionTracked(nodeId) == OVRPlugin.Bool.True;
  502. }
  503. public static OVRPlugin.ControllerState GetControllerState(uint controllerMask)
  504. {
  505. return OVRPlugin.OVRP_1_1_0.ovrp_GetControllerState(controllerMask);
  506. }
  507. public static bool SetControllerVibration(uint controllerMask, float frequency, float amplitude)
  508. {
  509. return OVRPlugin.OVRP_0_1_2.ovrp_SetControllerVibration(controllerMask, frequency, amplitude) == OVRPlugin.Bool.True;
  510. }
  511. public static OVRPlugin.HapticsDesc GetControllerHapticsDesc(uint controllerMask)
  512. {
  513. if (OVRPlugin.version >= OVRPlugin.OVRP_1_6_0.version)
  514. {
  515. return OVRPlugin.OVRP_1_6_0.ovrp_GetControllerHapticsDesc(controllerMask);
  516. }
  517. return default(OVRPlugin.HapticsDesc);
  518. }
  519. public static OVRPlugin.HapticsState GetControllerHapticsState(uint controllerMask)
  520. {
  521. if (OVRPlugin.version >= OVRPlugin.OVRP_1_6_0.version)
  522. {
  523. return OVRPlugin.OVRP_1_6_0.ovrp_GetControllerHapticsState(controllerMask);
  524. }
  525. return default(OVRPlugin.HapticsState);
  526. }
  527. public static bool SetControllerHaptics(uint controllerMask, OVRPlugin.HapticsBuffer hapticsBuffer)
  528. {
  529. return OVRPlugin.version >= OVRPlugin.OVRP_1_6_0.version && OVRPlugin.OVRP_1_6_0.ovrp_SetControllerHaptics(controllerMask, hapticsBuffer) == OVRPlugin.Bool.True;
  530. }
  531. public static float GetEyeRecommendedResolutionScale()
  532. {
  533. if (OVRPlugin.version >= OVRPlugin.OVRP_1_6_0.version)
  534. {
  535. return OVRPlugin.OVRP_1_6_0.ovrp_GetEyeRecommendedResolutionScale();
  536. }
  537. return 1f;
  538. }
  539. public static float GetAppCpuStartToGpuEndTime()
  540. {
  541. if (OVRPlugin.version >= OVRPlugin.OVRP_1_6_0.version)
  542. {
  543. return OVRPlugin.OVRP_1_6_0.ovrp_GetAppCpuStartToGpuEndTime();
  544. }
  545. return 0f;
  546. }
  547. public static bool GetBoundaryConfigured()
  548. {
  549. return OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version && OVRPlugin.OVRP_1_8_0.ovrp_GetBoundaryConfigured() == OVRPlugin.Bool.True;
  550. }
  551. public static OVRPlugin.BoundaryTestResult TestBoundaryNode(OVRPlugin.Node nodeId, OVRPlugin.BoundaryType boundaryType)
  552. {
  553. if (OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version)
  554. {
  555. return OVRPlugin.OVRP_1_8_0.ovrp_TestBoundaryNode(nodeId, boundaryType);
  556. }
  557. return default(OVRPlugin.BoundaryTestResult);
  558. }
  559. public static OVRPlugin.BoundaryTestResult TestBoundaryPoint(OVRPlugin.Vector3f point, OVRPlugin.BoundaryType boundaryType)
  560. {
  561. if (OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version)
  562. {
  563. return OVRPlugin.OVRP_1_8_0.ovrp_TestBoundaryPoint(point, boundaryType);
  564. }
  565. return default(OVRPlugin.BoundaryTestResult);
  566. }
  567. public static bool SetBoundaryLookAndFeel(OVRPlugin.BoundaryLookAndFeel lookAndFeel)
  568. {
  569. return OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version && OVRPlugin.OVRP_1_8_0.ovrp_SetBoundaryLookAndFeel(lookAndFeel) == OVRPlugin.Bool.True;
  570. }
  571. public static bool ResetBoundaryLookAndFeel()
  572. {
  573. return OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version && OVRPlugin.OVRP_1_8_0.ovrp_ResetBoundaryLookAndFeel() == OVRPlugin.Bool.True;
  574. }
  575. public static OVRPlugin.BoundaryGeometry GetBoundaryGeometry(OVRPlugin.BoundaryType boundaryType)
  576. {
  577. if (OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version)
  578. {
  579. return OVRPlugin.OVRP_1_8_0.ovrp_GetBoundaryGeometry(boundaryType);
  580. }
  581. return default(OVRPlugin.BoundaryGeometry);
  582. }
  583. public static bool GetBoundaryGeometry2(OVRPlugin.BoundaryType boundaryType, IntPtr points, ref int pointsCount)
  584. {
  585. if (OVRPlugin.version >= OVRPlugin.OVRP_1_9_0.version)
  586. {
  587. return OVRPlugin.OVRP_1_9_0.ovrp_GetBoundaryGeometry2(boundaryType, points, ref pointsCount) == OVRPlugin.Bool.True;
  588. }
  589. pointsCount = 0;
  590. return false;
  591. }
  592. public static OVRPlugin.AppPerfStats GetAppPerfStats()
  593. {
  594. if (OVRPlugin.version >= OVRPlugin.OVRP_1_9_0.version)
  595. {
  596. return OVRPlugin.OVRP_1_9_0.ovrp_GetAppPerfStats();
  597. }
  598. return default(OVRPlugin.AppPerfStats);
  599. }
  600. public static bool ResetAppPerfStats()
  601. {
  602. return OVRPlugin.version >= OVRPlugin.OVRP_1_9_0.version && OVRPlugin.OVRP_1_9_0.ovrp_ResetAppPerfStats() == OVRPlugin.Bool.True;
  603. }
  604. public static OVRPlugin.Vector3f GetBoundaryDimensions(OVRPlugin.BoundaryType boundaryType)
  605. {
  606. if (OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version)
  607. {
  608. return OVRPlugin.OVRP_1_8_0.ovrp_GetBoundaryDimensions(boundaryType);
  609. }
  610. return default(OVRPlugin.Vector3f);
  611. }
  612. public static bool GetBoundaryVisible()
  613. {
  614. return OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version && OVRPlugin.OVRP_1_8_0.ovrp_GetBoundaryVisible() == OVRPlugin.Bool.True;
  615. }
  616. public static bool SetBoundaryVisible(bool value)
  617. {
  618. return OVRPlugin.version >= OVRPlugin.OVRP_1_8_0.version && OVRPlugin.OVRP_1_8_0.ovrp_SetBoundaryVisible(OVRPlugin.ToBool(value)) == OVRPlugin.Bool.True;
  619. }
  620. public static OVRPlugin.SystemHeadset GetSystemHeadsetType()
  621. {
  622. if (OVRPlugin.version >= OVRPlugin.OVRP_1_9_0.version)
  623. {
  624. return OVRPlugin.OVRP_1_9_0.ovrp_GetSystemHeadsetType();
  625. }
  626. return OVRPlugin.SystemHeadset.None;
  627. }
  628. public static OVRPlugin.Controller GetActiveController()
  629. {
  630. if (OVRPlugin.version >= OVRPlugin.OVRP_1_9_0.version)
  631. {
  632. return OVRPlugin.OVRP_1_9_0.ovrp_GetActiveController();
  633. }
  634. return OVRPlugin.Controller.None;
  635. }
  636. public static OVRPlugin.Controller GetConnectedControllers()
  637. {
  638. if (OVRPlugin.version >= OVRPlugin.OVRP_1_9_0.version)
  639. {
  640. return OVRPlugin.OVRP_1_9_0.ovrp_GetConnectedControllers();
  641. }
  642. return OVRPlugin.Controller.None;
  643. }
  644. private static OVRPlugin.Bool ToBool(bool b)
  645. {
  646. return (!b) ? OVRPlugin.Bool.False : OVRPlugin.Bool.True;
  647. }
  648. public static OVRPlugin.TrackingOrigin GetTrackingOriginType()
  649. {
  650. return OVRPlugin.OVRP_1_0_0.ovrp_GetTrackingOriginType();
  651. }
  652. public static bool SetTrackingOriginType(OVRPlugin.TrackingOrigin originType)
  653. {
  654. return OVRPlugin.OVRP_1_0_0.ovrp_SetTrackingOriginType(originType) == OVRPlugin.Bool.True;
  655. }
  656. public static OVRPlugin.Posef GetTrackingCalibratedOrigin()
  657. {
  658. return OVRPlugin.OVRP_1_0_0.ovrp_GetTrackingCalibratedOrigin();
  659. }
  660. public static bool SetTrackingCalibratedOrigin()
  661. {
  662. return OVRPlugin.OVRP_1_2_0.ovrpi_SetTrackingCalibratedOrigin() == OVRPlugin.Bool.True;
  663. }
  664. public static bool RecenterTrackingOrigin(OVRPlugin.RecenterFlags flags)
  665. {
  666. return OVRPlugin.OVRP_1_0_0.ovrp_RecenterTrackingOrigin((uint)flags) == OVRPlugin.Bool.True;
  667. }
  668. internal static bool ignoreVrFocus
  669. {
  670. set
  671. {
  672. OVRPlugin.OVRP_1_2_1.ovrp_SetAppIgnoreVrFocus(OVRPlugin.ToBool(value));
  673. }
  674. }
  675. public static readonly Version wrapperVersion = OVRPlugin.OVRP_1_10_0.version;
  676. private static Version _version;
  677. private static Version _nativeSDKVersion;
  678. private const int OverlayShapeFlagShift = 4;
  679. public const int AppPerfFrameStatsMaxCount = 5;
  680. private static Guid _cachedAudioOutGuid;
  681. private static string _cachedAudioOutString;
  682. private static Guid _cachedAudioInGuid;
  683. private static string _cachedAudioInString;
  684. private const string pluginName = "OVRPlugin";
  685. private static Version _versionZero = new Version(0, 0, 0);
  686. private struct GUID
  687. {
  688. public int a;
  689. public short b;
  690. public short c;
  691. public byte d0;
  692. public byte d1;
  693. public byte d2;
  694. public byte d3;
  695. public byte d4;
  696. public byte d5;
  697. public byte d6;
  698. public byte d7;
  699. }
  700. public enum Bool
  701. {
  702. False,
  703. True
  704. }
  705. public enum Eye
  706. {
  707. None = -1,
  708. Left,
  709. Right,
  710. Count
  711. }
  712. public enum Tracker
  713. {
  714. None = -1,
  715. Zero,
  716. One,
  717. Two,
  718. Three,
  719. Count
  720. }
  721. public enum Node
  722. {
  723. None = -1,
  724. EyeLeft,
  725. EyeRight,
  726. EyeCenter,
  727. HandLeft,
  728. HandRight,
  729. TrackerZero,
  730. TrackerOne,
  731. TrackerTwo,
  732. TrackerThree,
  733. Head,
  734. Count
  735. }
  736. public enum Controller
  737. {
  738. None,
  739. LTouch,
  740. RTouch,
  741. Touch,
  742. Remote,
  743. Gamepad = 16,
  744. Touchpad = 134217728,
  745. Active = -2147483648,
  746. All = -1
  747. }
  748. public enum TrackingOrigin
  749. {
  750. EyeLevel,
  751. FloorLevel,
  752. Count
  753. }
  754. public enum RecenterFlags
  755. {
  756. Default,
  757. IgnoreAll = -2147483648,
  758. Count
  759. }
  760. public enum BatteryStatus
  761. {
  762. Charging,
  763. Discharging,
  764. Full,
  765. NotCharging,
  766. Unknown
  767. }
  768. public enum PlatformUI
  769. {
  770. None = -1,
  771. GlobalMenu,
  772. ConfirmQuit,
  773. GlobalMenuTutorial
  774. }
  775. public enum SystemRegion
  776. {
  777. Unspecified,
  778. Japan,
  779. China
  780. }
  781. public enum SystemHeadset
  782. {
  783. None,
  784. GearVR_R320,
  785. GearVR_R321,
  786. GearVR_R322,
  787. GearVR_R323,
  788. Rift_DK1 = 4096,
  789. Rift_DK2,
  790. Rift_CV1
  791. }
  792. public enum OverlayShape
  793. {
  794. Quad,
  795. Cylinder,
  796. Cubemap
  797. }
  798. private enum OverlayFlag
  799. {
  800. None,
  801. OnTop,
  802. HeadLocked,
  803. ShapeFlag_Quad = 0,
  804. ShapeFlag_Cylinder = 16,
  805. ShapeFlag_Cubemap = 32,
  806. ShapeFlagRangeMask = 240
  807. }
  808. public struct Vector2i
  809. {
  810. public int x;
  811. public int y;
  812. }
  813. public struct Vector2f
  814. {
  815. public float x;
  816. public float y;
  817. }
  818. public struct Vector3f
  819. {
  820. public float x;
  821. public float y;
  822. public float z;
  823. }
  824. public struct Quatf
  825. {
  826. public float x;
  827. public float y;
  828. public float z;
  829. public float w;
  830. }
  831. public struct Posef
  832. {
  833. public OVRPlugin.Quatf Orientation;
  834. public OVRPlugin.Vector3f Position;
  835. }
  836. public struct ControllerState
  837. {
  838. public uint ConnectedControllers;
  839. public uint Buttons;
  840. public uint Touches;
  841. public uint NearTouches;
  842. public float LIndexTrigger;
  843. public float RIndexTrigger;
  844. public float LHandTrigger;
  845. public float RHandTrigger;
  846. public OVRPlugin.Vector2f LThumbstick;
  847. public OVRPlugin.Vector2f RThumbstick;
  848. }
  849. public struct HapticsBuffer
  850. {
  851. public IntPtr Samples;
  852. public int SamplesCount;
  853. }
  854. public struct HapticsState
  855. {
  856. public int SamplesAvailable;
  857. public int SamplesQueued;
  858. }
  859. public struct HapticsDesc
  860. {
  861. public int SampleRateHz;
  862. public int SampleSizeInBytes;
  863. public int MinimumSafeSamplesQueued;
  864. public int MinimumBufferSamplesCount;
  865. public int OptimalBufferSamplesCount;
  866. public int MaximumBufferSamplesCount;
  867. }
  868. public struct AppPerfFrameStats
  869. {
  870. public int HmdVsyncIndex;
  871. public int AppFrameIndex;
  872. public int AppDroppedFrameCount;
  873. public float AppMotionToPhotonLatency;
  874. public float AppQueueAheadTime;
  875. public float AppCpuElapsedTime;
  876. public float AppGpuElapsedTime;
  877. public int CompositorFrameIndex;
  878. public int CompositorDroppedFrameCount;
  879. public float CompositorLatency;
  880. public float CompositorCpuElapsedTime;
  881. public float CompositorGpuElapsedTime;
  882. public float CompositorCpuStartToGpuEndElapsedTime;
  883. public float CompositorGpuEndToVsyncElapsedTime;
  884. }
  885. public struct AppPerfStats
  886. {
  887. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
  888. public OVRPlugin.AppPerfFrameStats[] FrameStats;
  889. public int FrameStatsCount;
  890. public OVRPlugin.Bool AnyFrameStatsDropped;
  891. public float AdaptiveGpuPerformanceScale;
  892. }
  893. public struct Sizei
  894. {
  895. public int w;
  896. public int h;
  897. }
  898. public struct Frustumf
  899. {
  900. public float zNear;
  901. public float zFar;
  902. public float fovX;
  903. public float fovY;
  904. }
  905. public enum BoundaryType
  906. {
  907. OuterBoundary = 1,
  908. PlayArea = 256
  909. }
  910. public struct BoundaryTestResult
  911. {
  912. public OVRPlugin.Bool IsTriggering;
  913. public float ClosestDistance;
  914. public OVRPlugin.Vector3f ClosestPoint;
  915. public OVRPlugin.Vector3f ClosestPointNormal;
  916. }
  917. public struct BoundaryLookAndFeel
  918. {
  919. public OVRPlugin.Colorf Color;
  920. }
  921. public struct BoundaryGeometry
  922. {
  923. public OVRPlugin.BoundaryType BoundaryType;
  924. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
  925. public OVRPlugin.Vector3f[] Points;
  926. public int PointsCount;
  927. }
  928. public struct Colorf
  929. {
  930. public float r;
  931. public float g;
  932. public float b;
  933. public float a;
  934. }
  935. private static class OVRP_0_1_0
  936. {
  937. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  938. public static extern OVRPlugin.Sizei ovrp_GetEyeTextureSize(OVRPlugin.Eye eyeId);
  939. public static readonly Version version = new Version(0, 1, 0);
  940. }
  941. private static class OVRP_0_1_1
  942. {
  943. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  944. public static extern OVRPlugin.Bool ovrp_SetOverlayQuad2(OVRPlugin.Bool onTop, OVRPlugin.Bool headLocked, IntPtr texture, IntPtr device, OVRPlugin.Posef pose, OVRPlugin.Vector3f scale);
  945. public static readonly Version version = new Version(0, 1, 1);
  946. }
  947. private static class OVRP_0_1_2
  948. {
  949. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  950. public static extern OVRPlugin.Posef ovrp_GetNodePose(OVRPlugin.Node nodeId);
  951. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  952. public static extern OVRPlugin.Bool ovrp_SetControllerVibration(uint controllerMask, float frequency, float amplitude);
  953. public static readonly Version version = new Version(0, 1, 2);
  954. }
  955. private static class OVRP_0_1_3
  956. {
  957. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  958. public static extern OVRPlugin.Posef ovrp_GetNodeVelocity(OVRPlugin.Node nodeId);
  959. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  960. public static extern OVRPlugin.Posef ovrp_GetNodeAcceleration(OVRPlugin.Node nodeId);
  961. public static readonly Version version = new Version(0, 1, 3);
  962. }
  963. private static class OVRP_0_5_0
  964. {
  965. public static readonly Version version = new Version(0, 5, 0);
  966. }
  967. private static class OVRP_1_0_0
  968. {
  969. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  970. public static extern OVRPlugin.TrackingOrigin ovrp_GetTrackingOriginType();
  971. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  972. public static extern OVRPlugin.Bool ovrp_SetTrackingOriginType(OVRPlugin.TrackingOrigin originType);
  973. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  974. public static extern OVRPlugin.Posef ovrp_GetTrackingCalibratedOrigin();
  975. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  976. public static extern OVRPlugin.Bool ovrp_RecenterTrackingOrigin(uint flags);
  977. public static readonly Version version = new Version(1, 0, 0);
  978. }
  979. private static class OVRP_1_1_0
  980. {
  981. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  982. public static extern OVRPlugin.Bool ovrp_GetInitialized();
  983. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl, EntryPoint = "ovrp_GetVersion")]
  984. private static extern IntPtr _ovrp_GetVersion();
  985. public static string ovrp_GetVersion()
  986. {
  987. return Marshal.PtrToStringAnsi(OVRPlugin.OVRP_1_1_0._ovrp_GetVersion());
  988. }
  989. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl, EntryPoint = "ovrp_GetNativeSDKVersion")]
  990. private static extern IntPtr _ovrp_GetNativeSDKVersion();
  991. public static string ovrp_GetNativeSDKVersion()
  992. {
  993. return Marshal.PtrToStringAnsi(OVRPlugin.OVRP_1_1_0._ovrp_GetNativeSDKVersion());
  994. }
  995. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  996. public static extern IntPtr ovrp_GetAudioOutId();
  997. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  998. public static extern IntPtr ovrp_GetAudioInId();
  999. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1000. public static extern float ovrp_GetEyeTextureScale();
  1001. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1002. public static extern OVRPlugin.Bool ovrp_SetEyeTextureScale(float value);
  1003. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1004. public static extern OVRPlugin.Bool ovrp_GetTrackingOrientationSupported();
  1005. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1006. public static extern OVRPlugin.Bool ovrp_GetTrackingOrientationEnabled();
  1007. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1008. public static extern OVRPlugin.Bool ovrp_SetTrackingOrientationEnabled(OVRPlugin.Bool value);
  1009. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1010. public static extern OVRPlugin.Bool ovrp_GetTrackingPositionSupported();
  1011. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1012. public static extern OVRPlugin.Bool ovrp_GetTrackingPositionEnabled();
  1013. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1014. public static extern OVRPlugin.Bool ovrp_SetTrackingPositionEnabled(OVRPlugin.Bool value);
  1015. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1016. public static extern OVRPlugin.Bool ovrp_GetNodePresent(OVRPlugin.Node nodeId);
  1017. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1018. public static extern OVRPlugin.Bool ovrp_GetNodeOrientationTracked(OVRPlugin.Node nodeId);
  1019. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1020. public static extern OVRPlugin.Bool ovrp_GetNodePositionTracked(OVRPlugin.Node nodeId);
  1021. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1022. public static extern OVRPlugin.Frustumf ovrp_GetNodeFrustum(OVRPlugin.Node nodeId);
  1023. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1024. public static extern OVRPlugin.ControllerState ovrp_GetControllerState(uint controllerMask);
  1025. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1026. public static extern int ovrp_GetSystemCpuLevel();
  1027. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1028. public static extern OVRPlugin.Bool ovrp_SetSystemCpuLevel(int value);
  1029. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1030. public static extern int ovrp_GetSystemGpuLevel();
  1031. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1032. public static extern OVRPlugin.Bool ovrp_SetSystemGpuLevel(int value);
  1033. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1034. public static extern OVRPlugin.Bool ovrp_GetSystemPowerSavingMode();
  1035. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1036. public static extern float ovrp_GetSystemDisplayFrequency();
  1037. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1038. public static extern int ovrp_GetSystemVSyncCount();
  1039. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1040. public static extern float ovrp_GetSystemVolume();
  1041. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1042. public static extern OVRPlugin.BatteryStatus ovrp_GetSystemBatteryStatus();
  1043. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1044. public static extern float ovrp_GetSystemBatteryLevel();
  1045. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1046. public static extern float ovrp_GetSystemBatteryTemperature();
  1047. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl, EntryPoint = "ovrp_GetSystemProductName")]
  1048. private static extern IntPtr _ovrp_GetSystemProductName();
  1049. public static string ovrp_GetSystemProductName()
  1050. {
  1051. return Marshal.PtrToStringAnsi(OVRPlugin.OVRP_1_1_0._ovrp_GetSystemProductName());
  1052. }
  1053. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1054. public static extern OVRPlugin.Bool ovrp_ShowSystemUI(OVRPlugin.PlatformUI ui);
  1055. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1056. public static extern OVRPlugin.Bool ovrp_GetAppMonoscopic();
  1057. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1058. public static extern OVRPlugin.Bool ovrp_SetAppMonoscopic(OVRPlugin.Bool value);
  1059. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1060. public static extern OVRPlugin.Bool ovrp_GetAppHasVrFocus();
  1061. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1062. public static extern OVRPlugin.Bool ovrp_GetAppShouldQuit();
  1063. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1064. public static extern OVRPlugin.Bool ovrp_GetAppShouldRecenter();
  1065. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl, EntryPoint = "ovrp_GetAppLatencyTimings")]
  1066. private static extern IntPtr _ovrp_GetAppLatencyTimings();
  1067. public static string ovrp_GetAppLatencyTimings()
  1068. {
  1069. return Marshal.PtrToStringAnsi(OVRPlugin.OVRP_1_1_0._ovrp_GetAppLatencyTimings());
  1070. }
  1071. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1072. public static extern OVRPlugin.Bool ovrp_GetUserPresent();
  1073. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1074. public static extern float ovrp_GetUserIPD();
  1075. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1076. public static extern OVRPlugin.Bool ovrp_SetUserIPD(float value);
  1077. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1078. public static extern float ovrp_GetUserEyeDepth();
  1079. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1080. public static extern OVRPlugin.Bool ovrp_SetUserEyeDepth(float value);
  1081. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1082. public static extern float ovrp_GetUserEyeHeight();
  1083. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1084. public static extern OVRPlugin.Bool ovrp_SetUserEyeHeight(float value);
  1085. public static readonly Version version = new Version(1, 1, 0);
  1086. }
  1087. private static class OVRP_1_2_0
  1088. {
  1089. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1090. public static extern OVRPlugin.Bool ovrp_SetSystemVSyncCount(int vsyncCount);
  1091. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1092. public static extern OVRPlugin.Bool ovrpi_SetTrackingCalibratedOrigin();
  1093. public static readonly Version version = new Version(1, 2, 0);
  1094. }
  1095. private static class OVRP_1_2_1
  1096. {
  1097. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1098. public static extern OVRPlugin.Bool ovrp_SetAppIgnoreVrFocus(OVRPlugin.Bool value);
  1099. public static readonly Version version = new Version(1, 2, 1);
  1100. }
  1101. private static class OVRP_1_3_0
  1102. {
  1103. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1104. public static extern OVRPlugin.Bool ovrp_GetEyeOcclusionMeshEnabled();
  1105. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1106. public static extern OVRPlugin.Bool ovrp_SetEyeOcclusionMeshEnabled(OVRPlugin.Bool value);
  1107. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1108. public static extern OVRPlugin.Bool ovrp_GetSystemHeadphonesPresent();
  1109. public static readonly Version version = new Version(1, 3, 0);
  1110. }
  1111. private static class OVRP_1_5_0
  1112. {
  1113. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1114. public static extern OVRPlugin.SystemRegion ovrp_GetSystemRegion();
  1115. public static readonly Version version = new Version(1, 5, 0);
  1116. }
  1117. private static class OVRP_1_6_0
  1118. {
  1119. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1120. public static extern OVRPlugin.Bool ovrp_GetTrackingIPDEnabled();
  1121. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1122. public static extern OVRPlugin.Bool ovrp_SetTrackingIPDEnabled(OVRPlugin.Bool value);
  1123. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1124. public static extern OVRPlugin.HapticsDesc ovrp_GetControllerHapticsDesc(uint controllerMask);
  1125. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1126. public static extern OVRPlugin.HapticsState ovrp_GetControllerHapticsState(uint controllerMask);
  1127. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1128. public static extern OVRPlugin.Bool ovrp_SetControllerHaptics(uint controllerMask, OVRPlugin.HapticsBuffer hapticsBuffer);
  1129. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1130. public static extern OVRPlugin.Bool ovrp_SetOverlayQuad3(uint flags, IntPtr textureLeft, IntPtr textureRight, IntPtr device, OVRPlugin.Posef pose, OVRPlugin.Vector3f scale, int layerIndex);
  1131. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1132. public static extern float ovrp_GetEyeRecommendedResolutionScale();
  1133. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1134. public static extern float ovrp_GetAppCpuStartToGpuEndTime();
  1135. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1136. public static extern int ovrp_GetSystemRecommendedMSAALevel();
  1137. public static readonly Version version = new Version(1, 6, 0);
  1138. }
  1139. private static class OVRP_1_7_0
  1140. {
  1141. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1142. public static extern OVRPlugin.Bool ovrp_GetAppChromaticCorrection();
  1143. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1144. public static extern OVRPlugin.Bool ovrp_SetAppChromaticCorrection(OVRPlugin.Bool value);
  1145. public static readonly Version version = new Version(1, 7, 0);
  1146. }
  1147. private static class OVRP_1_8_0
  1148. {
  1149. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1150. public static extern OVRPlugin.Bool ovrp_GetBoundaryConfigured();
  1151. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1152. public static extern OVRPlugin.BoundaryTestResult ovrp_TestBoundaryNode(OVRPlugin.Node nodeId, OVRPlugin.BoundaryType boundaryType);
  1153. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1154. public static extern OVRPlugin.BoundaryTestResult ovrp_TestBoundaryPoint(OVRPlugin.Vector3f point, OVRPlugin.BoundaryType boundaryType);
  1155. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1156. public static extern OVRPlugin.Bool ovrp_SetBoundaryLookAndFeel(OVRPlugin.BoundaryLookAndFeel lookAndFeel);
  1157. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1158. public static extern OVRPlugin.Bool ovrp_ResetBoundaryLookAndFeel();
  1159. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1160. public static extern OVRPlugin.BoundaryGeometry ovrp_GetBoundaryGeometry(OVRPlugin.BoundaryType boundaryType);
  1161. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1162. public static extern OVRPlugin.Vector3f ovrp_GetBoundaryDimensions(OVRPlugin.BoundaryType boundaryType);
  1163. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1164. public static extern OVRPlugin.Bool ovrp_GetBoundaryVisible();
  1165. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1166. public static extern OVRPlugin.Bool ovrp_SetBoundaryVisible(OVRPlugin.Bool value);
  1167. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1168. public static extern OVRPlugin.Bool ovrp_Update2(int stateId, int frameIndex, double predictionSeconds);
  1169. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1170. public static extern OVRPlugin.Posef ovrp_GetNodePose2(int stateId, OVRPlugin.Node nodeId);
  1171. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1172. public static extern OVRPlugin.Posef ovrp_GetNodeVelocity2(int stateId, OVRPlugin.Node nodeId);
  1173. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1174. public static extern OVRPlugin.Posef ovrp_GetNodeAcceleration2(int stateId, OVRPlugin.Node nodeId);
  1175. public static readonly Version version = new Version(1, 8, 0);
  1176. }
  1177. private static class OVRP_1_9_0
  1178. {
  1179. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1180. public static extern OVRPlugin.SystemHeadset ovrp_GetSystemHeadsetType();
  1181. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1182. public static extern OVRPlugin.Controller ovrp_GetActiveController();
  1183. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1184. public static extern OVRPlugin.Controller ovrp_GetConnectedControllers();
  1185. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1186. public static extern OVRPlugin.Bool ovrp_GetBoundaryGeometry2(OVRPlugin.BoundaryType boundaryType, IntPtr points, ref int pointsCount);
  1187. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1188. public static extern OVRPlugin.AppPerfStats ovrp_GetAppPerfStats();
  1189. [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
  1190. public static extern OVRPlugin.Bool ovrp_ResetAppPerfStats();
  1191. public static readonly Version version = new Version(1, 9, 0);
  1192. }
  1193. private static class OVRP_1_10_0
  1194. {
  1195. public static readonly Version version = new Version(1, 10, 0);
  1196. }
  1197. }