openvr.monkey2 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. Namespace openvr
  2. #If __DESKTOP_TARGET__
  3. #If __TARGET__="windows"
  4. #If __ARCH__="x86"
  5. #Import "bin/win32/openvr_api.dll"
  6. #Import "lib/win32/openvr_api.lib"
  7. #Elseif __ARCH__="x64"
  8. #Import "bin/win64/openvr_api.dll"
  9. #Import "lib/win64/openvr_api.lib"
  10. #endif
  11. #Elseif __TARGET__="macos"
  12. '#Import "bin/osx64/OpenVR.framework"
  13. #Elseif __TARGET__="linux"
  14. '#Import "bin/liux64/libopenvr_api.so"
  15. #Endif
  16. #Import "headers/*.h"
  17. #Import "glue.h"
  18. Extern
  19. Struct HmdMatrix34_t
  20. Field m:Float Ptr Ptr
  21. End
  22. Struct HmdMatrix44_t
  23. Field m:Float Ptr Ptr
  24. End
  25. Struct HmdVector3_t
  26. Field v:Float Ptr
  27. End
  28. Enum EVRApplicationType
  29. End
  30. Const VRApplication_Scene:EVRApplicationType 'Application will submit 3D frames
  31. Enum EVRInitError
  32. End
  33. Const VRInitError_None:EVRInitError
  34. Alias HmdError:EVRInitError
  35. Function VR_IsHmdPresent:Bool()
  36. Function VR_IsRuntimeInstalled:Bool()
  37. Function VR_RuntimePath:CString()
  38. Function VR_Init:IVRSystem( peError:HmdError Ptr,eApplicationType:EVRApplicationType )
  39. Function VR_GetVRInitErrorAsSymbol:CString( error:EVRInitError )
  40. Function VR_Shutdown()
  41. Function VRSystem:IVRSystem()
  42. Function VRCompositor:IVRCompositor()
  43. Function VROverlay:IVROverlay()
  44. '***** System *****
  45. Alias TrackedDeviceIndex_t:UInt
  46. Enum EVREye
  47. End
  48. Const Eye_Left:EVREye
  49. Const Eye_Right:EVREye
  50. Const k_unTrackedDeviceIndexInvalid:UInt
  51. Const k_unMaxTrackedDeviceCount:UInt
  52. Const k_unTrackedDeviceIndex_Hmd:UInt
  53. Enum ETrackingResult
  54. End
  55. Const TrackingResult_Uninitialized:ETrackingResult
  56. const TrackingResult_Calibrating_InProgress:ETrackingResult
  57. Const TrackingResult_Calibrating_OutOfRange:ETrackingResult
  58. Const TrackingResult_Running_OK:ETrackingResult
  59. Const TrackingResult_Running_OutOfRange:ETrackingResult
  60. Enum ETrackedDeviceClass
  61. End
  62. Const TrackedDeviceClass_Invalid:ETrackedDeviceClass '0: ID was not valid.
  63. Const TrackedDeviceClass_HMD:ETrackedDeviceClass '1: "Head-Mounted Displays
  64. Const TrackedDeviceClass_Controller:ETrackedDeviceClass '2: Tracked controllers
  65. Const TrackedDeviceClass_GenericTracker:ETrackedDeviceClass '3: Generic trackers, similar to controllers
  66. Const TrackedDeviceClass_TrackingReference:ETrackedDeviceClass '4: Camera and base stations that serve as tracking reference points
  67. Const TrackedDeviceClass_DisplayRedirect:ETrackedDeviceClass '5: Accessories that aren't necessarily tracked themselves, but may redirect video output from other tracked devices
  68. 'Describes what specific role associated with a tracked device */
  69. Enum ETrackedControllerRole
  70. End
  71. Const TrackedControllerRole_Invalid:ETrackedControllerRole 'Invalid value for controller type
  72. Const TrackedControllerRole_LeftHand:ETrackedControllerRole 'Tracked device associated with the left hand
  73. Const TrackedControllerRole_RightHand:ETrackedControllerRole 'Tracked device associated with the right hand
  74. 'describes a single pose for a tracked object
  75. Struct TrackedDevicePose_t
  76. Field mDeviceToAbsoluteTracking:HmdMatrix34_t
  77. Field vVelocity:HmdVector3_t 'velocity in tracker space in m/s
  78. field vAngularVelocity:HmdVector3_t 'angular velocity in radians/s (?)
  79. Field eTrackingResult:ETrackingResult
  80. Field bPoseIsValid:bool
  81. 'This indicates that there is a device connected for this spot in the pose array.
  82. 'It could go from true to false if the user unplugs the device.
  83. Field bDeviceIsConnected:Bool
  84. End
  85. enum ETrackingUniverseOrigin
  86. End
  87. Const TrackingUniverseSeated:ETrackingUniverseOrigin 'Poses are provided relative to the seated zero pose
  88. Const TrackingUniverseStanding:ETrackingUniverseOrigin 'Poses are provided relative to the safe bounds configured by the user
  89. Const TrackingUniverseRawAndUncalibrated:ETrackingUniverseOrigin 'Poses are provided in the coordinate system defined by the driver. It has Y up and is unified for devices of the same driver. You usually don't want this one.
  90. enum EVREventType
  91. End
  92. Const VREvent_None:EVREventType
  93. Const VREvent_TrackedDeviceActivated:EVREventType
  94. Const VREvent_TrackedDeviceDeactivated:EVREventType
  95. Const VREvent_TrackedDeviceUpdated:EVREventType
  96. Const VREvent_TrackedDeviceUserInteractionStarted:EVREventType
  97. Const VREvent_TrackedDeviceUserInteractionEnded:EVREventType
  98. Const VREvent_IpdChanged:EVREventType
  99. Const VREvent_EnterStandbyMode:EVREventType
  100. Const VREvent_LeaveStandbyMode:EVREventType
  101. Const VREvent_TrackedDeviceRoleChanged:EVREventType
  102. Const VREvent_WatchdogWakeUpRequested:EVREventType
  103. Const VREvent_LensDistortionChanged:EVREventType
  104. Const VREvent_PropertyChanged:EVREventType
  105. Const VREvent_WirelessDisconnect:EVREventType
  106. Const VREvent_WirelessReconnect:EVREventType
  107. Const VREvent_ButtonPress:EVREventType
  108. Const VREvent_ButtonUnpress:EVREventType
  109. Const VREvent_ButtonTouch:EVREventType
  110. Const VREvent_ButtonUntouch:EVREventType
  111. Const VREvent_MouseMove:EVREventType
  112. Const VREvent_MouseButtonDown:EVREventType
  113. Const VREvent_MouseButtonUp:EVREventType
  114. Const VREvent_FocusEnter:EVREventType
  115. Const VREvent_FocusLeave:EVREventType
  116. Const VREvent_Scroll:EVREventType
  117. Const VREvent_TouchPadMove:EVREventType
  118. Const VREvent_OverlayFocusChanged:EVREventType
  119. Const VREvent_InputFocusCaptured:EVREventType
  120. Const VREvent_InputFocusReleased:EVREventType
  121. Const VREvent_SceneFocusLost:EVREventType
  122. Const VREvent_SceneFocusGained:EVREventType
  123. Const VREvent_SceneApplicationChanged:EVREventType
  124. Const VREvent_SceneFocusChanged:EVREventType
  125. Const VREvent_InputFocusChanged:EVREventType
  126. Const VREvent_SceneApplicationSecondaryRenderingStarted:EVREventType
  127. Const VREvent_HideRenderModels:EVREventType
  128. Const VREvent_ShowRenderModels:EVREventType
  129. Const VREvent_OverlayShown:EVREventType
  130. Const VREvent_OverlayHidden:EVREventType
  131. Const VREvent_DashboardActivated:EVREventType
  132. Const VREvent_DashboardDeactivated:EVREventType
  133. Const VREvent_DashboardThumbSelected:EVREventType
  134. Const VREvent_DashboardRequested:EVREventType
  135. Const VREvent_ResetDashboard:EVREventType
  136. Const VREvent_RenderToast:EVREventType
  137. Const VREvent_ImageLoaded:EVREventType
  138. Const VREvent_ShowKeyboard:EVREventType
  139. Const VREvent_HideKeyboard:EVREventType
  140. Const VREvent_OverlayGamepadFocusGained:EVREventType
  141. Const VREvent_OverlayGamepadFocusLost:EVREventType
  142. Const VREvent_OverlaySharedTextureChanged:EVREventType
  143. Const VREvent_DashboardGuideButtonDown:EVREventType
  144. Const VREvent_DashboardGuideButtonUp:EVREventType
  145. Const VREvent_ScreenshotTriggered:EVREventType
  146. Const VREvent_ImageFailed:EVREventType
  147. Const VREvent_DashboardOverlayCreated:EVREventType
  148. Const VREvent_RequestScreenshot:EVREventType
  149. Const VREvent_ScreenshotTaken:EVREventType
  150. Const VREvent_ScreenshotFailed:EVREventType
  151. Const VREvent_SubmitScreenshotToDashboard:EVREventType
  152. Const VREvent_ScreenshotProgressToDashboard:EVREventType
  153. Const VREvent_PrimaryDashboardDeviceChanged:EVREventType
  154. Const VREvent_Notification_Shown:EVREventType
  155. Const VREvent_Notification_Hidden:EVREventType
  156. Const VREvent_Notification_BeginInteraction:EVREventType
  157. Const VREvent_Notification_Destroyed:EVREventType
  158. Const VREvent_Quit:EVREventType
  159. Const VREvent_ProcessQuit:EVREventType
  160. Const VREvent_QuitAborted_UserPrompt:EVREventType
  161. Const VREvent_QuitAcknowledged:EVREventType
  162. Const VREvent_DriverRequestedQuit:EVREventType
  163. Const VREvent_ChaperoneDataHasChanged:EVREventType
  164. Const VREvent_ChaperoneUniverseHasChanged:EVREventType
  165. Const VREvent_ChaperoneTempDataHasChanged:EVREventType
  166. Const VREvent_ChaperoneSettingsHaveChanged:EVREventType
  167. Const VREvent_SeatedZeroPoseReset:EVREventType
  168. Const VREvent_AudioSettingsHaveChanged:EVREventType
  169. Const VREvent_BackgroundSettingHasChanged:EVREventType
  170. Const VREvent_CameraSettingsHaveChanged:EVREventType
  171. Const VREvent_ReprojectionSettingHasChanged:EVREventType
  172. Const VREvent_ModelSkinSettingsHaveChanged:EVREventType
  173. Const VREvent_EnvironmentSettingsHaveChanged:EVREventType
  174. Const VREvent_PowerSettingsHaveChanged:EVREventType
  175. Const VREvent_EnableHomeAppSettingsHaveChanged:EVREventType
  176. Const VREvent_StatusUpdate:EVREventType
  177. Const VREvent_MCImageUpdated:EVREventType
  178. Const VREvent_FirmwareUpdateStarted:EVREventType
  179. Const VREvent_FirmwareUpdateFinished:EVREventType
  180. Const VREvent_KeyboardClosed:EVREventType
  181. Const VREvent_KeyboardCharInput:EVREventType
  182. Const VREvent_KeyboardDone:EVREventType
  183. Const VREvent_ApplicationTransitionStarted:EVREventType
  184. Const VREvent_ApplicationTransitionAborted:EVREventType
  185. Const VREvent_ApplicationTransitionNewAppStarted:EVREventType
  186. Const VREvent_ApplicationListUpdated:EVREventType
  187. Const VREvent_ApplicationMimeTypeLoad:EVREventType
  188. Const VREvent_ApplicationTransitionNewAppLaunchComplete:EVREventType
  189. Const VREvent_ProcessConnected:EVREventType
  190. Const VREvent_ProcessDisconnected:EVREventType
  191. Const VREvent_Compositor_MirrorWindowShown:EVREventType
  192. Const VREvent_Compositor_MirrorWindowHidden:EVREventType
  193. Const VREvent_Compositor_ChaperoneBoundsShown:EVREventType
  194. Const VREvent_Compositor_ChaperoneBoundsHidden:EVREventType
  195. Const VREvent_TrackedCamera_StartVideoStream:EVREventType
  196. Const VREvent_TrackedCamera_StopVideoStream:EVREventType
  197. Const VREvent_TrackedCamera_PauseVideoStream:EVREventType
  198. Const VREvent_TrackedCamera_ResumeVideoStream:EVREventType
  199. Const VREvent_TrackedCamera_EditingSurface:EVREventType
  200. Const VREvent_PerformanceTest_EnableCapture:EVREventType
  201. Const VREvent_PerformanceTest_DisableCapture:EVREventType
  202. Const VREvent_PerformanceTest_FidelityLevel:EVREventType
  203. Const VREvent_MessageOverlay_Closed:EVREventType
  204. Const VREvent_MessageOverlayCloseRequested:EVREventType
  205. Const VREvent_VendorSpecific_Reserved_Start:EVREventType
  206. Const VREvent_VendorSpecific_Reserved_End:EVREventType
  207. Enum EVRButtonId
  208. End
  209. Const k_EButton_System:EVRButtonId
  210. Const k_EButton_ApplicationMenu:EVRButtonId
  211. Const k_EButton_Grip:EVRButtonId
  212. Const k_EButton_DPad_Left:EVRButtonId
  213. Const k_EButton_DPad_Up:EVRButtonId
  214. Const k_EButton_DPad_Right:EVRButtonId
  215. Const k_EButton_DPad_Down:EVRButtonId
  216. Const k_EButton_A:EVRButtonId
  217. Const k_EButton_ProximitySensor:EVRButtonId
  218. Const k_EButton_Axis0:EVRButtonId
  219. Const k_EButton_Axis1:EVRButtonId
  220. Const k_EButton_Axis2:EVRButtonId
  221. Const k_EButton_Axis3:EVRButtonId
  222. Const k_EButton_Axis4:EVRButtonId
  223. Const k_EButton_SteamVR_Touchpad:EVRButtonId
  224. Const k_EButton_SteamVR_Trigger:EVRButtonId
  225. Const k_EButton_Dashboard_Back:EVRButtonId
  226. Const k_EButton_Max:EVRButtonId
  227. Struct VREvent_Controller_t
  228. Field button:UInt 'EVRButtonId Enum
  229. End
  230. 'Hmmm, not actually the controller touchpad!
  231. struct VREvent_TouchPadMove_t
  232. Field bFingerDown:Bool
  233. Field flSecondsFingerDown:Float
  234. Field fValueXFirst:Float
  235. Field fValueYFirst:Float
  236. Field fValueXRaw:Float
  237. Field fValueYRaw:Float
  238. End
  239. Struct VREvent_Data_t
  240. Field controller:VREvent_Controller_t
  241. Field touchPadMove:VREvent_TouchPadMove_t
  242. End
  243. Struct VREvent_t
  244. '
  245. Field eventType:UInt 'EVREventType enum
  246. Field trackedDeviceIndex:UInt
  247. Field eventAgeSeconds:Float
  248. '
  249. Field data:VREvent_Data_t
  250. End
  251. Enum EVRControllerAxisType
  252. End
  253. Const k_eControllerAxis_None:EVRControllerAxisType
  254. Const k_eControllerAxis_TrackPad:EVRControllerAxisType
  255. Const k_eControllerAxis_Joystick:EVRControllerAxisType
  256. Const k_eControllerAxis_Trigger:EVRControllerAxisType
  257. Struct VRControllerAxis_t
  258. Field x:Float 'Ranges from -1.0 to 1.0 for joysticks and track pads. Ranges from 0.0 to 1.0 for triggers were 0 is fully released.
  259. Field y:Float 'Ranges from -1.0 to 1.0 for joysticks and track pads. Is always 0.0 for triggers.
  260. End
  261. Const k_unControllerStateAxisCount:UInt
  262. Struct VRControllerState001_t
  263. 'If packet num matches that on your prior call, then the controller state hasn't been changed since
  264. 'your last call and there is no need to process it
  265. Field unPacketNum:Uint
  266. 'bit flags for each of the buttons. Use ButtonMaskFromId to turn an ID into a mask
  267. Field ulButtonPressed:ULong
  268. Field ulButtonTouched:ULong
  269. 'Axis data for the controller's analog inputs
  270. Field rAxis:VRControllerAxis_t Ptr '[k_unControllerStateAxisCount]
  271. End
  272. Alias VRControllerState_t:VRControllerState001_t
  273. Class IVRSystem Extends Void
  274. '------------------------------------
  275. 'Display Methods
  276. '------------------------------------
  277. 'Suggested size for the intermediate render target that the distortion pulls from.
  278. Method GetRecommendedRenderTargetSize( pnWidth:UInt Ptr,pnHeight:UInt Ptr )
  279. 'The projection matrix for the specified eye
  280. Method GetProjectionMatrix:HmdMatrix44_t( eEye:EVREye,fNearZ:float,fFarZ:Float )
  281. 'The components necessary to build your own projection matrix in case your
  282. 'application is doing something fancy like infinite Z
  283. Method GetProjectionRaw( eEye:EVREye,pfLeft:Float Ptr,pfRight:Float Ptr,pfTop:Float Ptr,pfBottom:Float Ptr )
  284. 'Returns the transform from eye space to the head space. Eye space is the per-eye flavor of head
  285. 'space that provides stereo disparity. Instead of Model * View * Projection the sequence is Model * View * Eye^-1 * Projection.
  286. 'Normally View and Eye^-1 will be multiplied together and treated as View in your application.
  287. Method GetEyeToHeadTransform:HmdMatrix34_t( eEye:EVREye )
  288. 'Returns the number of elapsed seconds since the last recorded vsync event. This
  289. 'will come from a vsync timer event in the timer if possible or from the application-reported
  290. 'time if that is not available. If no vsync times are available the function will
  291. 'return zero for vsync time and frame counter and return false from the method. */
  292. Method GetTimeSinceLastVsync:Bool( pfSecondsSinceLastVsync:Float Ptr,pulFrameCounter:ULong Ptr )
  293. ' ------------------------------------
  294. 'Tracking Methods
  295. '------------------------------------
  296. 'The pose that the tracker thinks that the HMD will be in at the specified number of seconds into the
  297. 'future. Pass 0 to get the state at the instant the method is called. Most of the time the application should
  298. 'calculate the time until the photons will be emitted from the display and pass that time into the method.
  299. '
  300. 'This is roughly analogous to the inverse of the view matrix in most applications, though
  301. 'many games will need to do some additional rotation or translation on top of the rotation
  302. 'and translation provided by the head pose.
  303. '
  304. 'For devices where bPoseIsValid is true the application can use the pose to position the device
  305. 'in question. The provided array can be any size up to k_unMaxTrackedDeviceCount.
  306. '
  307. 'Seated experiences should call this method with TrackingUniverseSeated and receive poses relative
  308. 'to the seated zero pose. Standing experiences should call this method with TrackingUniverseStanding
  309. 'and receive poses relative to the Chaperone Play Area. TrackingUniverseRawAndUncalibrated should
  310. 'probably not be used unless the application is the Chaperone calibration tool itself, but will provide
  311. 'poses relative to the hardware-specific coordinate system in the driver.
  312. Method GetDeviceToAbsoluteTrackingPose( eOrigin:ETrackingUniverseOrigin,fPredictedSecondsToPhotonsFromNow:Float,pTrackedDevicePoseArray:TrackedDevicePose_t Ptr,trackedDevicePoseArrayCount:UInt )
  313. 'Sets the zero pose for the seated tracker coordinate system to the current position and yaw of the HMD. After
  314. 'ResetSeatedZeroPose all GetDeviceToAbsoluteTrackingPose calls that pass TrackingUniverseSeated as the origin
  315. 'will be relative to this new zero pose. The new zero coordinate system will not change the fact that the Y axis
  316. 'is up in the real world, so the next pose returned from GetDeviceToAbsoluteTrackingPose after a call to
  317. 'ResetSeatedZeroPose may not be exactly an identity matrix.
  318. '
  319. 'NOTE: This function overrides the user's previously saved seated zero pose and should only be called as the result of a user action.
  320. 'Users are also able to set their seated zero pose via the OpenVR Dashboard.
  321. '
  322. Method ResetSeatedZeroPose()
  323. 'Returns the transform from the seated zero pose to the standing absolute tracking system. This allows
  324. 'applications to represent the seated origin to used or transform object positions from one coordinate
  325. 'system to the other.
  326. '
  327. 'The seated origin may or may not be inside the Play Area or Collision Bounds returned by IVRChaperone. Its position
  328. 'depends on what the user has set from the Dashboard settings and previous calls to ResetSeatedZeroPose. */
  329. Method GetSeatedZeroPoseToStandingAbsoluteTrackingPose:HmdMatrix34_t()
  330. 'Get a sorted array of device indices of a given class of tracked devices (e.g. controllers). Devices are sorted right to left
  331. 'relative to the specified tracked device (default: hmd -- pass in -1 for absolute tracking space). Returns the number of devices
  332. 'in the list, or the size of the array needed if not large enough. */
  333. Method GetSortedTrackedDeviceIndicesOfClass:UInt(
  334. eTrackedDeviceClass:ETrackedDeviceClass,
  335. punTrackedDeviceIndexArray:TrackedDeviceIndex_t Ptr,unTrackedDeviceIndexArrayCount:UInt,
  336. unRelativeToTrackedDeviceIndex:TrackedDeviceIndex_t = k_unTrackedDeviceIndex_Hmd )
  337. 'Returns the device index associated with a specific role, for example the left hand or the right hand. */
  338. Method GetTrackedDeviceIndexForControllerRole:TrackedDeviceIndex_t( unDeviceType:ETrackedControllerRole )
  339. 'Returns the controller type associated with a device index. */
  340. Method GetControllerRoleForTrackedDeviceIndex:ETrackedControllerRole( unDeviceIndex:TrackedDeviceIndex_t )
  341. '------------------------------------
  342. 'Property methods
  343. '------------------------------------
  344. 'Returns the device class of a tracked device. If there has not been a device connected in this slot
  345. 'since the application started this function will return TrackedDevice_Invalid. For previous detected
  346. 'devices the function will return the previously observed device class.
  347. '
  348. 'To determine which devices exist on the system, just loop from 0 to k_unMaxTrackedDeviceCount and check
  349. 'the device class. Every device with something other than TrackedDevice_Invalid is associated with an
  350. 'actual tracked device. */
  351. Method GetTrackedDeviceClass:ETrackedDeviceClass( unDeviceIndex:TrackedDeviceIndex_t )
  352. 'Returns true if there is a device connected in this slot. */
  353. Method IsTrackedDeviceConnected:Bool( unDeviceIndex:TrackedDeviceIndex_t )
  354. '------------------------------------
  355. 'Event methods
  356. '------------------------------------
  357. 'Returns true and fills the event with the next event on the queue if there is one. If there are no events
  358. 'this method returns false. uncbVREvent should be the size in bytes of the VREvent_t struct */
  359. method PollNextEvent:bool( pEvent:VREvent_t Ptr,uncbVREvent:UInt )
  360. 'Returns true and fills the event with the next event on the queue if there is one. If there are no events
  361. 'this method returns false. Fills in the pose of the associated tracked device in the provided pose struct.
  362. 'This pose will always be older than the call to this function and should not be used to render the device.
  363. 'uncbVREvent should be the size in bytes of the VREvent_t struct */
  364. Method PollNextEventWithPose:Bool( oRigin:ETrackingUniverseOrigin,pEvent:VREvent_t Ptr,uncbVREvent:UInt,pTrackedDevicePose:TrackedDevicePose_t Ptr )
  365. 'returns the name of an EVREvent enum value */
  366. Method GetEventTypeNameFromEnum:CString( eType:EVREventType )
  367. '------------------------------------
  368. 'Controller methods
  369. '------------------------------------
  370. 'Fills the supplied struct with the current state of the controller. Returns false if the controller index
  371. 'is invalid.
  372. Method GetControllerState:Bool( unControllerDeviceIndex:TrackedDeviceIndex_t,pControllerState:VRControllerState_t Ptr,unControllerStateSize:uint )
  373. 'fills the supplied struct with the current state of the controller and the provided pose with the pose of
  374. 'the controller when the controller state was updated most recently. Use this form if you need a precise controller
  375. 'pose as input to your application when the user presses or releases a button. */
  376. Method GetControllerStateWithPose:Bool( eOrigin:ETrackingUniverseOrigin,unControllerDeviceIndex:TrackedDeviceIndex_t,pControllerState:VRControllerState_t Ptr,unControllerStateSize:UInt,pTrackedDevicePose:TrackedDevicePose_t Ptr )
  377. 'Trigger a single haptic pulse on a controller. After this call the application may not trigger another haptic pulse on this controller
  378. 'and axis combination for 5ms. */
  379. Method TriggerHapticPulse:Void( unControllerDeviceIndex:TrackedDeviceIndex_t,unAxisId:UInt,usDurationMicroSec:UShort )
  380. 'returns the name of an EVRButtonId enum value */
  381. Method GetButtonIdNameFromEnum:CString( eButtonId:EVRButtonId )
  382. 'returns the name of an EVRControllerAxisType enum value */
  383. Method GetControllerAxisTypeNameFromEnum:CString( eAxisType:EVRControllerAxisType )
  384. End
  385. '***** Compositor *****
  386. enum EVRCompositorError
  387. End
  388. Const VRCompositorError_None:EVRCompositorError
  389. Const VRCompositorError_RequestFailed:EVRCompositorError
  390. Const VRCompositorError_IncompatibleVersion:EVRCompositorError
  391. Const VRCompositorError_DoNotHaveFocus:EVRCompositorError
  392. Const VRCompositorError_InvalidTexture:EVRCompositorError
  393. Const VRCompositorError_IsNotSceneApplication:EVRCompositorError
  394. Const VRCompositorError_TextureIsOnWrongDevice:EVRCompositorError
  395. Const VRCompositorError_TextureUsesUnsupportedFormat:EVRCompositorError
  396. Const VRCompositorError_SharedTexturesNotSupported:EVRCompositorError
  397. Const VRCompositorError_IndexOutOfRange:EVRCompositorError
  398. Const VRCompositorError_AlreadySubmitted:EVRCompositorError
  399. Const VRCompositorError_InvalidBounds:EVRCompositorError
  400. enum EVRSubmitFlags
  401. End
  402. 'Simple render path. App submits rendered left and right eye images with no lens distortion correction applied.
  403. Const Submit_Default:EVRSubmitFlags
  404. 'App submits final left and right eye images with lens distortion already applied (lens distortion makes the images appear
  405. 'barrel distorted with chromatic aberration correction applied). The app would have used the data returned by
  406. 'vr::IVRSystem::ComputeDistortion() to apply the correct distortion to the rendered images before calling Submit().
  407. Const Submit_LensDistortionAlreadyApplied:EVRSubmitFlags
  408. 'If the texture pointer passed in is actually a renderbuffer (e.g. for MSAA in OpenGL) then set this flag.
  409. Const Submit_GlRenderBuffer:EVRSubmitFlags
  410. 'Do not use
  411. Const Submit_Reserved:EVRSubmitFlags
  412. 'Set to indicate that pTexture is a pointer to a VRTextureWithPose_t.
  413. Const Submit_TextureWithPose:EVRSubmitFlags
  414. enum ETextureType
  415. End
  416. Const TextureType_OpenGL:ETextureType 'Handle is an OpenGL texture name or an OpenGL render buffer name, depending on submit flags
  417. Const TextureType_Vulkan:ETextureType 'Handle is a pointer to a VRVulkanTextureData_t structure
  418. enum EColorSpace
  419. End
  420. Const ColorSpace_Auto:EColorSpace 'Assumes 'gamma' for 8-bit per component formats, otherwise 'linear'. This mirrors the DXGI formats which have _SRGB variants.
  421. Const ColorSpace_Gamma:EColorSpace 'Texture data can be displayed directly on the display without any conversion (a.k.a. display native format).
  422. Const ColorSpace_Linear:EColorSpace 'Same as gamma but has been converted to a linear representation using DXGI's sRGB conversion algorithm.
  423. struct Texture_t
  424. Field handle:Void Ptr
  425. Field eType:ETextureType
  426. Field eColorSpace:EColorSpace
  427. End
  428. 'Allows the application to control what part of the provided texture will be used in the
  429. 'frame buffer.
  430. struct VRTextureBounds_t
  431. Field uMin:Float
  432. Field vMin:Float
  433. Field uMax:Float
  434. Field vMax:Float
  435. End
  436. Class IVRCompositor Extends Void
  437. 'Sets tracking space returned by WaitGetPoses */
  438. Method SetTrackingSpace( eOrigin:ETrackingUniverseOrigin )
  439. 'Scene applications should call this function to get poses to render with (and optionally poses predicted an additional frame out to use for gameplay).
  440. 'This function will block until "running start" milliseconds before the start of the frame, and should be called at the last moment before needing to
  441. 'start rendering.
  442. '
  443. 'Return codes:
  444. ' - IsNotSceneApplication (make sure to call VR_Init with VRApplicaiton_Scene)
  445. ' - DoNotHaveFocus (some other app has taken focus - this will throttle the call to 10hz to reduce the impact on that app)
  446. Method WaitGetPoses:EVRCompositorError(
  447. pRenderPoseArray:TrackedDevicePose_t Ptr,unRenderPoseArrayCount:UInt,
  448. pGamePoseArray:TrackedDevicePose_t Ptr,unGamePoseArrayCount:UInt )
  449. 'Updated scene texture to display. If pBounds is NULL the entire texture will be used. If called from an OpenGL app, consider adding a glFlush after
  450. 'Submitting both frames to signal the driver to start processing, otherwise it may wait until the command buffer fills up, causing the app to miss frames.
  451. '
  452. 'OpenGL dirty state:
  453. ' glBindTexture
  454. '
  455. 'Return codes:
  456. ' - IsNotSceneApplication (make sure to call VR_Init with VRApplicaiton_Scene)
  457. ' - DoNotHaveFocus (some other app has taken focus)
  458. ' - TextureIsOnWrongDevice (application did not use proper AdapterIndex - see IVRSystem.GetDXGIOutputInfo)
  459. ' - SharedTexturesNotSupported (application needs to call CreateDXGIFactory1 or later before creating DX device)
  460. ' - TextureUsesUnsupportedFormat (scene textures must be compatible with DXGI sharing rules - e.g. uncompressed, no mips, etc.)
  461. ' - InvalidTexture (usually means bad arguments passed in)
  462. ' - AlreadySubmitted (app has submitted two left textures or two right textures in a single frame - i.e. before calling WaitGetPoses again)
  463. Method Submit:EVRCompositorError( eEye:EVREye,pTexture:Texture_t Ptr,pBounds:VRTextureBounds_t Ptr=Null,nSubmitFlags:EVRSubmitFlags=Submit_Default )
  464. 'Clears the frame that was sent with the last call to Submit. This will cause the
  465. 'compositor to show the grid until Submit is called again. */
  466. Method ClearLastSubmittedFrame()
  467. 'Call immediately after presenting your app's window (i.e. companion window) to unblock the compositor.
  468. 'This is an optional call, which only needs to be used if you can't instead call WaitGetPoses immediately after Present.
  469. 'For example, if your engine's render and game loop are not on separate threads, or blocking the render thread until 3ms before the next vsync would
  470. 'introduce a deadlock of some sort. This function tells the compositor that you have finished all rendering after having Submitted buffers for both
  471. 'eyes, and it is free to start its rendering work. This should only be called from the same thread you are rendering on. */
  472. Method PostPresentHandoff()
  473. End
  474. Class IVROverlay Extends Void
  475. '** Returns true if the dashboard is visible */
  476. Method IsDashboardVisible:Bool()
  477. End
  478. #end