@babylonjs/core 5.22.1 → 5.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/Actions/abstractActionManager.d.ts +6 -6
  2. package/Actions/abstractActionManager.js +1 -1
  3. package/Actions/abstractActionManager.js.map +1 -1
  4. package/Actions/actionManager.d.ts +5 -5
  5. package/Actions/actionManager.js +5 -5
  6. package/Actions/actionManager.js.map +1 -1
  7. package/Animations/animatable.js +2 -1
  8. package/Animations/animatable.js.map +1 -1
  9. package/Animations/animation.js +137 -139
  10. package/Animations/animation.js.map +1 -1
  11. package/Animations/animationGroup.d.ts +3 -3
  12. package/Animations/animationGroup.js +3 -3
  13. package/Animations/animationGroup.js.map +1 -1
  14. package/Animations/runtimeAnimation.js +6 -7
  15. package/Animations/runtimeAnimation.js.map +1 -1
  16. package/Audio/audioSceneComponent.d.ts +1 -1
  17. package/Audio/audioSceneComponent.js.map +1 -1
  18. package/Audio/sound.d.ts +2 -1
  19. package/Audio/sound.js +21 -9
  20. package/Audio/sound.js.map +1 -1
  21. package/Behaviors/Cameras/autoRotationBehavior.d.ts +1 -1
  22. package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
  23. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  24. package/Behaviors/Cameras/bouncingBehavior.d.ts +1 -1
  25. package/Behaviors/Cameras/bouncingBehavior.js +1 -1
  26. package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
  27. package/Behaviors/Cameras/framingBehavior.d.ts +1 -1
  28. package/Behaviors/Cameras/framingBehavior.js +1 -1
  29. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  30. package/Bones/bone.d.ts +1 -1
  31. package/Bones/bone.js +1 -1
  32. package/Bones/bone.js.map +1 -1
  33. package/Bones/skeleton.d.ts +2 -2
  34. package/Bones/skeleton.js +11 -5
  35. package/Bones/skeleton.js.map +1 -1
  36. package/Cameras/Inputs/BaseCameraMouseWheelInput.js +3 -22
  37. package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
  38. package/Cameras/Inputs/BaseCameraPointersInput.js +3 -3
  39. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  40. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +1 -11
  41. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
  42. package/Cameras/Inputs/flyCameraMouseInput.js +3 -3
  43. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  44. package/Cameras/Inputs/followCameraMouseWheelInput.js +1 -4
  45. package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
  46. package/Cameras/Inputs/freeCameraMouseInput.js +3 -3
  47. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  48. package/Cameras/arcRotateCamera.d.ts +1 -1
  49. package/Cameras/arcRotateCamera.js +1 -1
  50. package/Cameras/arcRotateCamera.js.map +1 -1
  51. package/Cameras/camera.d.ts +2 -2
  52. package/Cameras/camera.js +2 -2
  53. package/Cameras/camera.js.map +1 -1
  54. package/Cameras/freeCamera.d.ts +1 -1
  55. package/Cameras/freeCamera.js +1 -1
  56. package/Cameras/freeCamera.js.map +1 -1
  57. package/Cameras/gamepadCamera.d.ts +1 -1
  58. package/Cameras/gamepadCamera.js +1 -1
  59. package/Cameras/gamepadCamera.js.map +1 -1
  60. package/Cameras/targetCamera.d.ts +1 -1
  61. package/Cameras/targetCamera.js +1 -1
  62. package/Cameras/targetCamera.js.map +1 -1
  63. package/Cameras/touchCamera.d.ts +1 -1
  64. package/Cameras/touchCamera.js +1 -1
  65. package/Cameras/touchCamera.js.map +1 -1
  66. package/Cameras/universalCamera.d.ts +1 -1
  67. package/Cameras/universalCamera.js +1 -1
  68. package/Cameras/universalCamera.js.map +1 -1
  69. package/Cameras/virtualJoysticksCamera.d.ts +1 -1
  70. package/Cameras/virtualJoysticksCamera.js +1 -1
  71. package/Cameras/virtualJoysticksCamera.js.map +1 -1
  72. package/Culling/boundingBox.d.ts +2 -2
  73. package/Culling/boundingBox.js +2 -2
  74. package/Culling/boundingBox.js.map +1 -1
  75. package/Culling/ray.d.ts +1 -1
  76. package/Culling/ray.js +1 -1
  77. package/Culling/ray.js.map +1 -1
  78. package/Debug/debugLayer.d.ts +1 -1
  79. package/Debug/debugLayer.js +1 -1
  80. package/Debug/debugLayer.js.map +1 -1
  81. package/DeviceInput/webDeviceInputSystem.js +20 -2
  82. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  83. package/Engines/Extensions/engine.multiRender.js +8 -10
  84. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  85. package/Engines/Extensions/engine.query.d.ts +2 -2
  86. package/Engines/Extensions/engine.query.js.map +1 -1
  87. package/Engines/ICanvas.d.ts +11 -0
  88. package/Engines/ICanvas.js.map +1 -1
  89. package/Engines/WebGL/webGLPipelineContext.d.ts +29 -19
  90. package/Engines/WebGL/webGLPipelineContext.js +99 -311
  91. package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
  92. package/Engines/WebGL/webGLRenderTargetWrapper.js +1 -1
  93. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  94. package/Engines/engine.d.ts +2 -2
  95. package/Engines/engine.js +2 -2
  96. package/Engines/engine.js.map +1 -1
  97. package/Engines/nativeEngine.d.ts +2 -2
  98. package/Engines/nativeEngine.js +2 -2
  99. package/Engines/nativeEngine.js.map +1 -1
  100. package/Engines/renderTargetWrapper.d.ts +1 -0
  101. package/Engines/renderTargetWrapper.js +5 -2
  102. package/Engines/renderTargetWrapper.js.map +1 -1
  103. package/Engines/thinEngine.d.ts +6 -5
  104. package/Engines/thinEngine.js +11 -7
  105. package/Engines/thinEngine.js.map +1 -1
  106. package/Engines/webgpuEngine.js +4 -1
  107. package/Engines/webgpuEngine.js.map +1 -1
  108. package/Events/clipboardEvents.d.ts +1 -1
  109. package/Events/clipboardEvents.js +1 -1
  110. package/Events/clipboardEvents.js.map +1 -1
  111. package/Events/deviceInputEvents.d.ts +11 -4
  112. package/Events/deviceInputEvents.js.map +1 -1
  113. package/Gamepads/Controllers/windowsMotionController.d.ts +1 -1
  114. package/Gamepads/Controllers/windowsMotionController.js +1 -1
  115. package/Gamepads/Controllers/windowsMotionController.js.map +1 -1
  116. package/Gizmos/boundingBoxGizmo.d.ts +4 -0
  117. package/Gizmos/boundingBoxGizmo.js +6 -0
  118. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  119. package/Inputs/scene.inputManager.js +4 -4
  120. package/Inputs/scene.inputManager.js.map +1 -1
  121. package/Layers/effectLayer.d.ts +3 -3
  122. package/Layers/effectLayer.js +1 -1
  123. package/Layers/effectLayer.js.map +1 -1
  124. package/Layers/glowLayer.d.ts +3 -3
  125. package/Layers/glowLayer.js +2 -2
  126. package/Layers/glowLayer.js.map +1 -1
  127. package/Layers/highlightLayer.d.ts +3 -3
  128. package/Layers/highlightLayer.js +2 -2
  129. package/Layers/highlightLayer.js.map +1 -1
  130. package/Lights/directionalLight.d.ts +2 -2
  131. package/Lights/directionalLight.js +2 -2
  132. package/Lights/directionalLight.js.map +1 -1
  133. package/Lights/hemisphericLight.d.ts +3 -3
  134. package/Lights/hemisphericLight.js +3 -3
  135. package/Lights/hemisphericLight.js.map +1 -1
  136. package/Lights/light.d.ts +2 -2
  137. package/Lights/light.js +2 -2
  138. package/Lights/light.js.map +1 -1
  139. package/Lights/lightConstants.d.ts +1 -1
  140. package/Lights/lightConstants.js +1 -1
  141. package/Lights/lightConstants.js.map +1 -1
  142. package/Loading/Plugins/babylonFileLoader.js +3 -0
  143. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  144. package/Loading/sceneLoader.d.ts +1 -1
  145. package/Loading/sceneLoader.js.map +1 -1
  146. package/Materials/Background/backgroundMaterial.js +4 -0
  147. package/Materials/Background/backgroundMaterial.js.map +1 -1
  148. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +4 -1
  149. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  150. package/Materials/Node/nodeMaterial.d.ts +1 -1
  151. package/Materials/Node/nodeMaterial.js +5 -1
  152. package/Materials/Node/nodeMaterial.js.map +1 -1
  153. package/Materials/PBR/pbrBaseMaterial.js +4 -1
  154. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  155. package/Materials/Textures/Filtering/hdrFiltering.d.ts +1 -1
  156. package/Materials/Textures/Filtering/hdrFiltering.js +1 -1
  157. package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
  158. package/Materials/Textures/Procedurals/customProceduralTexture.d.ts +2 -1
  159. package/Materials/Textures/Procedurals/customProceduralTexture.js +9 -3
  160. package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
  161. package/Materials/Textures/Procedurals/proceduralTexture.d.ts +9 -9
  162. package/Materials/Textures/Procedurals/proceduralTexture.js +9 -9
  163. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  164. package/Materials/Textures/colorGradingTexture.d.ts +1 -1
  165. package/Materials/Textures/colorGradingTexture.js +1 -1
  166. package/Materials/Textures/colorGradingTexture.js.map +1 -1
  167. package/Materials/Textures/cubeTexture.d.ts +2 -2
  168. package/Materials/Textures/cubeTexture.js +2 -2
  169. package/Materials/Textures/cubeTexture.js.map +1 -1
  170. package/Materials/Textures/rawCubeTexture.d.ts +1 -1
  171. package/Materials/Textures/rawCubeTexture.js +1 -1
  172. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  173. package/Materials/Textures/renderTargetTexture.d.ts +3 -5
  174. package/Materials/Textures/renderTargetTexture.js +19 -19
  175. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  176. package/Materials/colorCurves.d.ts +3 -3
  177. package/Materials/colorCurves.js +3 -3
  178. package/Materials/colorCurves.js.map +1 -1
  179. package/Materials/effect.d.ts +27 -27
  180. package/Materials/effect.js +22 -288
  181. package/Materials/effect.js.map +1 -1
  182. package/Materials/fresnelParameters.d.ts +1 -1
  183. package/Materials/fresnelParameters.js +1 -1
  184. package/Materials/fresnelParameters.js.map +1 -1
  185. package/Materials/imageProcessingConfiguration.d.ts +4 -4
  186. package/Materials/imageProcessingConfiguration.js +4 -4
  187. package/Materials/imageProcessingConfiguration.js.map +1 -1
  188. package/Materials/shaderMaterial.d.ts +25 -25
  189. package/Materials/shaderMaterial.js +25 -25
  190. package/Materials/shaderMaterial.js.map +1 -1
  191. package/Materials/standardMaterial.js +4 -1
  192. package/Materials/standardMaterial.js.map +1 -1
  193. package/Maths/index.d.ts +1 -0
  194. package/Maths/index.js +1 -0
  195. package/Maths/index.js.map +1 -1
  196. package/Maths/math.functions.d.ts +2 -2
  197. package/Maths/math.functions.js +2 -2
  198. package/Maths/math.functions.js.map +1 -1
  199. package/Maths/math.polar.d.ts +77 -0
  200. package/Maths/math.polar.js +114 -0
  201. package/Maths/math.polar.js.map +1 -0
  202. package/Maths/math.scalar.d.ts +2 -2
  203. package/Maths/math.scalar.js +2 -2
  204. package/Maths/math.scalar.js.map +1 -1
  205. package/Maths/math.vector.d.ts +13 -12
  206. package/Maths/math.vector.js +13 -12
  207. package/Maths/math.vector.js.map +1 -1
  208. package/Meshes/abstractMesh.d.ts +1 -1
  209. package/Meshes/abstractMesh.js +13 -2
  210. package/Meshes/abstractMesh.js.map +1 -1
  211. package/Meshes/geometry.d.ts +3 -3
  212. package/Meshes/geometry.js +3 -3
  213. package/Meshes/geometry.js.map +1 -1
  214. package/Meshes/groundMesh.d.ts +5 -4
  215. package/Meshes/groundMesh.js +5 -4
  216. package/Meshes/groundMesh.js.map +1 -1
  217. package/Meshes/instancedMesh.d.ts +1 -1
  218. package/Meshes/instancedMesh.js +1 -1
  219. package/Meshes/instancedMesh.js.map +1 -1
  220. package/Meshes/mesh.d.ts +3 -3
  221. package/Meshes/mesh.js +7 -3
  222. package/Meshes/mesh.js.map +1 -1
  223. package/Meshes/subMesh.d.ts +1 -1
  224. package/Meshes/subMesh.js +1 -1
  225. package/Meshes/subMesh.js.map +1 -1
  226. package/Meshes/thinInstanceMesh.d.ts +1 -1
  227. package/Meshes/thinInstanceMesh.js.map +1 -1
  228. package/Meshes/transformNode.js +6 -0
  229. package/Meshes/transformNode.js.map +1 -1
  230. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +2 -2
  231. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +2 -2
  232. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  233. package/Misc/HighDynamicRange/hdr.d.ts +3 -3
  234. package/Misc/HighDynamicRange/hdr.js +3 -3
  235. package/Misc/HighDynamicRange/hdr.js.map +1 -1
  236. package/Misc/HighDynamicRange/panoramaToCubemap.d.ts +1 -1
  237. package/Misc/HighDynamicRange/panoramaToCubemap.js +1 -1
  238. package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
  239. package/Misc/arrayTools.d.ts +13 -12
  240. package/Misc/arrayTools.js +70 -39
  241. package/Misc/arrayTools.js.map +1 -1
  242. package/Misc/assetsManager.d.ts +3 -3
  243. package/Misc/assetsManager.js +3 -3
  244. package/Misc/assetsManager.js.map +1 -1
  245. package/Misc/basis.js +17 -3
  246. package/Misc/basis.js.map +1 -1
  247. package/Misc/environmentTextureTools.d.ts +4 -4
  248. package/Misc/environmentTextureTools.js +5 -5
  249. package/Misc/environmentTextureTools.js.map +1 -1
  250. package/Misc/fileTools.d.ts +3 -3
  251. package/Misc/fileTools.js +19 -12
  252. package/Misc/fileTools.js.map +1 -1
  253. package/Misc/logger.js +1 -1
  254. package/Misc/logger.js.map +1 -1
  255. package/Misc/observable.d.ts +1 -1
  256. package/Misc/observable.js +1 -1
  257. package/Misc/observable.js.map +1 -1
  258. package/Misc/performanceMonitor.d.ts +3 -3
  259. package/Misc/performanceMonitor.js +3 -3
  260. package/Misc/performanceMonitor.js.map +1 -1
  261. package/Misc/rgbdTextureTools.d.ts +1 -1
  262. package/Misc/rgbdTextureTools.js +1 -1
  263. package/Misc/rgbdTextureTools.js.map +1 -1
  264. package/Misc/sceneOptimizer.d.ts +7 -7
  265. package/Misc/sceneOptimizer.js +7 -7
  266. package/Misc/sceneOptimizer.js.map +1 -1
  267. package/Misc/stringDictionary.d.ts +6 -6
  268. package/Misc/stringDictionary.js +6 -6
  269. package/Misc/stringDictionary.js.map +1 -1
  270. package/Misc/textureTools.d.ts +4 -4
  271. package/Misc/textureTools.js +4 -4
  272. package/Misc/textureTools.js.map +1 -1
  273. package/Misc/tools.d.ts +6 -6
  274. package/Misc/tools.js +6 -6
  275. package/Misc/tools.js.map +1 -1
  276. package/Misc/videoRecorder.d.ts +1 -1
  277. package/Misc/videoRecorder.js +1 -1
  278. package/Misc/videoRecorder.js.map +1 -1
  279. package/Offline/database.js +3 -3
  280. package/Offline/database.js.map +1 -1
  281. package/Particles/IParticleSystem.d.ts +1 -1
  282. package/Particles/IParticleSystem.js.map +1 -1
  283. package/Particles/gpuParticleSystem.d.ts +1 -1
  284. package/Particles/gpuParticleSystem.js +1 -1
  285. package/Particles/gpuParticleSystem.js.map +1 -1
  286. package/Particles/particleSystem.d.ts +1 -1
  287. package/Particles/particleSystem.js +1 -1
  288. package/Particles/particleSystem.js.map +1 -1
  289. package/Particles/solidParticleSystem.d.ts +4 -0
  290. package/Particles/solidParticleSystem.js +25 -3
  291. package/Particles/solidParticleSystem.js.map +1 -1
  292. package/Physics/Plugins/ammoJSPlugin.d.ts +1 -1
  293. package/Physics/Plugins/ammoJSPlugin.js +1 -1
  294. package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
  295. package/Physics/Plugins/oimoJSPlugin.js +1 -1
  296. package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
  297. package/Physics/physicsEngineComponent.d.ts +1 -1
  298. package/Physics/physicsEngineComponent.js +1 -1
  299. package/Physics/physicsEngineComponent.js.map +1 -1
  300. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +3 -3
  301. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  302. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +1 -2
  303. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
  304. package/PostProcesses/blurPostProcess.d.ts +3 -3
  305. package/PostProcesses/blurPostProcess.js +3 -3
  306. package/PostProcesses/blurPostProcess.js.map +1 -1
  307. package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +3 -3
  308. package/PostProcesses/volumetricLightScatteringPostProcess.js +3 -3
  309. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  310. package/Rendering/depthPeelingRenderer.d.ts +1 -0
  311. package/Rendering/depthPeelingRenderer.js +32 -5
  312. package/Rendering/depthPeelingRenderer.js.map +1 -1
  313. package/Rendering/edgesRenderer.d.ts +2 -2
  314. package/Rendering/edgesRenderer.js +1 -1
  315. package/Rendering/edgesRenderer.js.map +1 -1
  316. package/Rendering/geometryBufferRenderer.d.ts +4 -2
  317. package/Rendering/geometryBufferRenderer.js +5 -3
  318. package/Rendering/geometryBufferRenderer.js.map +1 -1
  319. package/Rendering/geometryBufferRendererSceneComponent.d.ts +2 -1
  320. package/Rendering/geometryBufferRendererSceneComponent.js +3 -2
  321. package/Rendering/geometryBufferRendererSceneComponent.js.map +1 -1
  322. package/Rendering/prePassRenderer.d.ts +11 -3
  323. package/Rendering/prePassRenderer.js +18 -3
  324. package/Rendering/prePassRenderer.js.map +1 -1
  325. package/Rendering/subSurfaceConfiguration.d.ts +2 -2
  326. package/Rendering/subSurfaceConfiguration.js +2 -2
  327. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  328. package/Sprites/spriteSceneComponent.js +4 -1
  329. package/Sprites/spriteSceneComponent.js.map +1 -1
  330. package/XR/features/WebXRControllerTeleportation.d.ts +4 -0
  331. package/XR/features/WebXRControllerTeleportation.js +24 -19
  332. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  333. package/XR/motionController/webXRAbstractMotionController.d.ts +2 -2
  334. package/XR/motionController/webXRAbstractMotionController.js +2 -2
  335. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  336. package/XR/motionController/webXRControllerComponent.d.ts +1 -1
  337. package/XR/motionController/webXRControllerComponent.js +1 -1
  338. package/XR/motionController/webXRControllerComponent.js.map +1 -1
  339. package/XR/motionController/webXRMotionControllerManager.d.ts +3 -3
  340. package/XR/motionController/webXRMotionControllerManager.js +3 -3
  341. package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
  342. package/node.d.ts +4 -4
  343. package/node.js +3 -3
  344. package/node.js.map +1 -1
  345. package/package.json +1 -1
  346. package/readme.md +0 -4
  347. package/scene.d.ts +80 -63
  348. package/scene.js +92 -46
  349. package/scene.js.map +1 -1
  350. package/sceneComponent.d.ts +1 -1
  351. package/sceneComponent.js.map +1 -1
@@ -44,7 +44,7 @@ export declare class ClipboardInfo {
44
44
  /**
45
45
  * Get the clipboard event's type from the keycode.
46
46
  * @param keyCode Defines the keyCode for the current keyboard event.
47
- * @return {number}
47
+ * @returns {number}
48
48
  */
49
49
  static GetTypeFromCharacter(keyCode: number): number;
50
50
  }
@@ -39,7 +39,7 @@ export class ClipboardInfo {
39
39
  /**
40
40
  * Get the clipboard event's type from the keycode.
41
41
  * @param keyCode Defines the keyCode for the current keyboard event.
42
- * @return {number}
42
+ * @returns {number}
43
43
  */
44
44
  static GetTypeFromCharacter(keyCode) {
45
45
  const charCode = keyCode;
@@ -1 +1 @@
1
- {"version":3,"file":"clipboardEvents.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Events/clipboardEvents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,mBAAmB;;AAC5B;;GAEG;AACoB,wBAAI,GAAG,IAAI,CAAC,CAAC,EAAE;AACtC;;GAEG;AACoB,uBAAG,GAAG,IAAI,CAAC;AAElC;;GAEG;AACoB,yBAAK,GAAG,IAAI,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,aAAa;IACtB;;;;OAIG;IACH;IACI;;OAEG;IACI,IAAY;IACnB;;OAEG;IACI,KAAqB;QAJrB,SAAI,GAAJ,IAAI,CAAQ;QAIZ,UAAK,GAAL,KAAK,CAAgB;IAC7B,CAAC;IAEJ;;;;OAIG;IACI,MAAM,CAAC,oBAAoB,CAAC,OAAe;QAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC;QACzB,oCAAoC;QACpC,QAAQ,QAAQ,EAAE;YACd,KAAK,EAAE;gBACH,OAAO,mBAAmB,CAAC,IAAI,CAAC;YACpC,KAAK,EAAE;gBACH,OAAO,mBAAmB,CAAC,KAAK,CAAC;YACrC,KAAK,EAAE;gBACH,OAAO,mBAAmB,CAAC,GAAG,CAAC;YACnC;gBACI,OAAO,CAAC,CAAC,CAAC;SACjB;IACL,CAAC;CACJ","sourcesContent":["/**\r\n * Gather the list of clipboard event types as constants.\r\n */\r\nexport class ClipboardEventTypes {\r\n /**\r\n * The clipboard event is fired when a copy command is active (pressed).\r\n */\r\n public static readonly COPY = 0x01; //\r\n /**\r\n * The clipboard event is fired when a cut command is active (pressed).\r\n */\r\n public static readonly CUT = 0x02;\r\n\r\n /**\r\n * The clipboard event is fired when a paste command is active (pressed).\r\n */\r\n public static readonly PASTE = 0x03;\r\n}\r\n/**\r\n * This class is used to store clipboard related info for the onClipboardObservable event.\r\n */\r\nexport class ClipboardInfo {\r\n /**\r\n *Creates an instance of ClipboardInfo.\r\n * @param type Defines the type of event (BABYLON.ClipboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n constructor(\r\n /**\r\n * Defines the type of event (BABYLON.ClipboardEventTypes)\r\n */\r\n public type: number,\r\n /**\r\n * Defines the related dom event\r\n */\r\n public event: ClipboardEvent\r\n ) {}\r\n\r\n /**\r\n * Get the clipboard event's type from the keycode.\r\n * @param keyCode Defines the keyCode for the current keyboard event.\r\n * @return {number}\r\n */\r\n public static GetTypeFromCharacter(keyCode: number): number {\r\n const charCode = keyCode;\r\n //TODO: add codes for extended ASCII\r\n switch (charCode) {\r\n case 67:\r\n return ClipboardEventTypes.COPY;\r\n case 86:\r\n return ClipboardEventTypes.PASTE;\r\n case 88:\r\n return ClipboardEventTypes.CUT;\r\n default:\r\n return -1;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"clipboardEvents.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Events/clipboardEvents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,mBAAmB;;AAC5B;;GAEG;AACoB,wBAAI,GAAG,IAAI,CAAC,CAAC,EAAE;AACtC;;GAEG;AACoB,uBAAG,GAAG,IAAI,CAAC;AAElC;;GAEG;AACoB,yBAAK,GAAG,IAAI,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,aAAa;IACtB;;;;OAIG;IACH;IACI;;OAEG;IACI,IAAY;IACnB;;OAEG;IACI,KAAqB;QAJrB,SAAI,GAAJ,IAAI,CAAQ;QAIZ,UAAK,GAAL,KAAK,CAAgB;IAC7B,CAAC;IAEJ;;;;OAIG;IACI,MAAM,CAAC,oBAAoB,CAAC,OAAe;QAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC;QACzB,oCAAoC;QACpC,QAAQ,QAAQ,EAAE;YACd,KAAK,EAAE;gBACH,OAAO,mBAAmB,CAAC,IAAI,CAAC;YACpC,KAAK,EAAE;gBACH,OAAO,mBAAmB,CAAC,KAAK,CAAC;YACrC,KAAK,EAAE;gBACH,OAAO,mBAAmB,CAAC,GAAG,CAAC;YACnC;gBACI,OAAO,CAAC,CAAC,CAAC;SACjB;IACL,CAAC;CACJ","sourcesContent":["/**\r\n * Gather the list of clipboard event types as constants.\r\n */\r\nexport class ClipboardEventTypes {\r\n /**\r\n * The clipboard event is fired when a copy command is active (pressed).\r\n */\r\n public static readonly COPY = 0x01; //\r\n /**\r\n * The clipboard event is fired when a cut command is active (pressed).\r\n */\r\n public static readonly CUT = 0x02;\r\n\r\n /**\r\n * The clipboard event is fired when a paste command is active (pressed).\r\n */\r\n public static readonly PASTE = 0x03;\r\n}\r\n/**\r\n * This class is used to store clipboard related info for the onClipboardObservable event.\r\n */\r\nexport class ClipboardInfo {\r\n /**\r\n *Creates an instance of ClipboardInfo.\r\n * @param type Defines the type of event (BABYLON.ClipboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n constructor(\r\n /**\r\n * Defines the type of event (BABYLON.ClipboardEventTypes)\r\n */\r\n public type: number,\r\n /**\r\n * Defines the related dom event\r\n */\r\n public event: ClipboardEvent\r\n ) {}\r\n\r\n /**\r\n * Get the clipboard event's type from the keycode.\r\n * @param keyCode Defines the keyCode for the current keyboard event.\r\n * @returns {number}\r\n */\r\n public static GetTypeFromCharacter(keyCode: number): number {\r\n const charCode = keyCode;\r\n //TODO: add codes for extended ASCII\r\n switch (charCode) {\r\n case 67:\r\n return ClipboardEventTypes.COPY;\r\n case 86:\r\n return ClipboardEventTypes.PASTE;\r\n case 88:\r\n return ClipboardEventTypes.CUT;\r\n default:\r\n return -1;\r\n }\r\n }\r\n}\r\n"]}
@@ -129,20 +129,24 @@ export interface IMouseEvent extends IUIEvent {
129
129
  movementY: number;
130
130
  /**
131
131
  * Delta of movement on X axis
132
+ * @deprecated Use 'movementX' instead
132
133
  */
133
134
  mozMovementX?: number;
134
135
  /**
135
136
  * Delta of movement on Y axis
137
+ * @deprecated Use 'movementY' instead
136
138
  */
137
139
  mozMovementY?: number;
138
140
  /**
139
141
  * Delta of movement on X axis
142
+ * @deprecated Use 'movementX' instead
140
143
  */
141
- msMovementX?: any;
144
+ msMovementX?: number;
142
145
  /**
143
146
  * Delta of movement on Y axis
147
+ * @deprecated Use 'movementY' instead
144
148
  */
145
- msMovementY?: any;
149
+ msMovementY?: number;
146
150
  /**
147
151
  * Current coordinate of X within container
148
152
  */
@@ -165,12 +169,14 @@ export interface IMouseEvent extends IUIEvent {
165
169
  shiftKey: boolean;
166
170
  /**
167
171
  * Delta of movement on X axis
172
+ * @deprecated Use 'movementX' instead
168
173
  */
169
- webkitMovementX?: any;
174
+ webkitMovementX?: number;
170
175
  /**
171
176
  * Delta of movement on Y axis
177
+ * @deprecated Use 'movementY' instead
172
178
  */
173
- webkitMovementY?: any;
179
+ webkitMovementY?: number;
174
180
  /**
175
181
  * Alias of clientX
176
182
  */
@@ -223,6 +229,7 @@ export interface IWheelEvent extends IMouseEvent {
223
229
  deltaZ: number;
224
230
  /**
225
231
  * WheelDelta (From MouseWheel Event)
232
+ * @deprecated
226
233
  */
227
234
  wheelDelta?: number;
228
235
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deviceInputEvents.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Events/deviceInputEvents.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,oBAQX;AARD,WAAY,oBAAoB;IAC5B,WAAW;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,gBAAgB;IAChB,yEAAS,CAAA;AACb,CAAC,EARW,oBAAoB,KAApB,oBAAoB,QAQ/B;AAwQD;;GAEG;AACH,MAAM,OAAO,cAAc;;AACvB;;GAEG;AACW,8BAAe,GAAG,IAAI,CAAC;AAErC;;GAEG;AACW,6BAAc,GAAG,IAAI,CAAC;AAEpC;;GAEG;AACW,6BAAc,GAAG,IAAI,CAAC","sourcesContent":["import type { PointerInput } from \"../DeviceInput/InputDevices/deviceEnums\";\r\n\r\n/**\r\n * Event Types\r\n */\r\nexport enum DeviceInputEventType {\r\n // Pointers\r\n /** PointerMove */\r\n PointerMove,\r\n /** PointerDown */\r\n PointerDown,\r\n /** PointerUp */\r\n PointerUp,\r\n}\r\n\r\n/**\r\n * Native friendly interface for Event Object\r\n */\r\nexport interface IUIEvent {\r\n /**\r\n * Input array index\r\n */\r\n inputIndex: number;\r\n\r\n /**\r\n * Current target for an event\r\n */\r\n currentTarget?: any;\r\n\r\n /**\r\n * Alias for target\r\n * @deprecated Use target instead\r\n */\r\n srcElement?: any;\r\n\r\n /**\r\n * Type of event\r\n */\r\n type: string;\r\n\r\n /**\r\n * Reference to object where object was dispatched\r\n */\r\n target: any;\r\n\r\n /**\r\n * Tells user agent what to do when not explicitly handled\r\n */\r\n preventDefault: () => void;\r\n}\r\n\r\n/**\r\n * Native friendly interface for KeyboardEvent Object\r\n */\r\nexport interface IKeyboardEvent extends IUIEvent {\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Unicode value of character pressed\r\n * @deprecated Required for event, use keyCode instead.\r\n */\r\n charCode?: number;\r\n\r\n /**\r\n * Code for key based on layout\r\n */\r\n code: string;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * String representation of key\r\n */\r\n key: string;\r\n /**\r\n * ASCII value of key\r\n * @deprecated Used with DeviceSourceManager\r\n */\r\n keyCode: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n}\r\n\r\n/**\r\n * Native friendly interface for MouseEvent Object\r\n */\r\nexport interface IMouseEvent extends IUIEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical>;\r\n\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Value of single mouse button pressed\r\n */\r\n button: number;\r\n\r\n /**\r\n * Value of all mouse buttons pressed\r\n */\r\n buttons: number;\r\n\r\n /**\r\n * Current X coordinate\r\n */\r\n clientX: number;\r\n\r\n /**\r\n * Current Y coordinate\r\n */\r\n clientY: number;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * Provides current click count\r\n */\r\n detail?: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n movementX: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n movementY: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n mozMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n mozMovementY?: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n msMovementX?: any;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n msMovementY?: any;\r\n\r\n /**\r\n * Current coordinate of X within container\r\n */\r\n offsetX: number;\r\n\r\n /**\r\n * Current coordinate of Y within container\r\n */\r\n offsetY: number;\r\n\r\n /**\r\n * Horizontal coordinate of event\r\n */\r\n pageX: number;\r\n\r\n /**\r\n * Vertical coordinate of event\r\n */\r\n pageY: number;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n webkitMovementX?: any;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n webkitMovementY?: any;\r\n\r\n /**\r\n * Alias of clientX\r\n */\r\n x: number;\r\n\r\n /**\r\n * Alias of clientY\r\n */\r\n y: number;\r\n}\r\n\r\n/**\r\n * Native friendly interface for PointerEvent Object\r\n */\r\nexport interface IPointerEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically and mouse wheel values\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical | PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ>;\r\n\r\n /**\r\n * Pointer Event ID\r\n */\r\n pointerId: number;\r\n\r\n /**\r\n * Type of pointer\r\n */\r\n pointerType: string;\r\n}\r\n\r\n/**\r\n * Native friendly interface for WheelEvent Object\r\n */\r\nexport interface IWheelEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events that can only be used with mouse wheel\r\n */\r\n inputIndex: PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ;\r\n\r\n /**\r\n * Units for delta value\r\n */\r\n deltaMode: number;\r\n\r\n /**\r\n * Horizontal scroll delta\r\n */\r\n deltaX: number;\r\n\r\n /**\r\n * Vertical scroll delta\r\n */\r\n deltaY: number;\r\n\r\n /**\r\n * Z-Axis scroll delta\r\n */\r\n deltaZ: number;\r\n\r\n /**\r\n * WheelDelta (From MouseWheel Event)\r\n */\r\n wheelDelta?: number;\r\n}\r\n\r\n/**\r\n * Constants used for Events\r\n */\r\nexport class EventConstants {\r\n /**\r\n * Pixel delta for Wheel Events (Default)\r\n */\r\n public static DOM_DELTA_PIXEL = 0x00;\r\n\r\n /**\r\n * Line delta for Wheel Events\r\n */\r\n public static DOM_DELTA_LINE = 0x01;\r\n\r\n /**\r\n * Page delta for Wheel Events\r\n */\r\n public static DOM_DELTA_PAGE = 0x02;\r\n}\r\n"]}
1
+ {"version":3,"file":"deviceInputEvents.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Events/deviceInputEvents.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,oBAQX;AARD,WAAY,oBAAoB;IAC5B,WAAW;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,gBAAgB;IAChB,yEAAS,CAAA;AACb,CAAC,EARW,oBAAoB,KAApB,oBAAoB,QAQ/B;AA+QD;;GAEG;AACH,MAAM,OAAO,cAAc;;AACvB;;GAEG;AACW,8BAAe,GAAG,IAAI,CAAC;AAErC;;GAEG;AACW,6BAAc,GAAG,IAAI,CAAC;AAEpC;;GAEG;AACW,6BAAc,GAAG,IAAI,CAAC","sourcesContent":["import type { PointerInput } from \"../DeviceInput/InputDevices/deviceEnums\";\r\n\r\n/**\r\n * Event Types\r\n */\r\nexport enum DeviceInputEventType {\r\n // Pointers\r\n /** PointerMove */\r\n PointerMove,\r\n /** PointerDown */\r\n PointerDown,\r\n /** PointerUp */\r\n PointerUp,\r\n}\r\n\r\n/**\r\n * Native friendly interface for Event Object\r\n */\r\nexport interface IUIEvent {\r\n /**\r\n * Input array index\r\n */\r\n inputIndex: number;\r\n\r\n /**\r\n * Current target for an event\r\n */\r\n currentTarget?: any;\r\n\r\n /**\r\n * Alias for target\r\n * @deprecated Use target instead\r\n */\r\n srcElement?: any;\r\n\r\n /**\r\n * Type of event\r\n */\r\n type: string;\r\n\r\n /**\r\n * Reference to object where object was dispatched\r\n */\r\n target: any;\r\n\r\n /**\r\n * Tells user agent what to do when not explicitly handled\r\n */\r\n preventDefault: () => void;\r\n}\r\n\r\n/**\r\n * Native friendly interface for KeyboardEvent Object\r\n */\r\nexport interface IKeyboardEvent extends IUIEvent {\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Unicode value of character pressed\r\n * @deprecated Required for event, use keyCode instead.\r\n */\r\n charCode?: number;\r\n\r\n /**\r\n * Code for key based on layout\r\n */\r\n code: string;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * String representation of key\r\n */\r\n key: string;\r\n /**\r\n * ASCII value of key\r\n * @deprecated Used with DeviceSourceManager\r\n */\r\n keyCode: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n}\r\n\r\n/**\r\n * Native friendly interface for MouseEvent Object\r\n */\r\nexport interface IMouseEvent extends IUIEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical>;\r\n\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Value of single mouse button pressed\r\n */\r\n button: number;\r\n\r\n /**\r\n * Value of all mouse buttons pressed\r\n */\r\n buttons: number;\r\n\r\n /**\r\n * Current X coordinate\r\n */\r\n clientX: number;\r\n\r\n /**\r\n * Current Y coordinate\r\n */\r\n clientY: number;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * Provides current click count\r\n */\r\n detail?: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n movementX: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n movementY: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n * @deprecated Use 'movementX' instead\r\n */\r\n mozMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n * @deprecated Use 'movementY' instead\r\n */\r\n mozMovementY?: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n * @deprecated Use 'movementX' instead\r\n */\r\n msMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n * @deprecated Use 'movementY' instead\r\n */\r\n msMovementY?: number;\r\n\r\n /**\r\n * Current coordinate of X within container\r\n */\r\n offsetX: number;\r\n\r\n /**\r\n * Current coordinate of Y within container\r\n */\r\n offsetY: number;\r\n\r\n /**\r\n * Horizontal coordinate of event\r\n */\r\n pageX: number;\r\n\r\n /**\r\n * Vertical coordinate of event\r\n */\r\n pageY: number;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n * @deprecated Use 'movementX' instead\r\n */\r\n webkitMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n * @deprecated Use 'movementY' instead\r\n */\r\n webkitMovementY?: number;\r\n\r\n /**\r\n * Alias of clientX\r\n */\r\n x: number;\r\n\r\n /**\r\n * Alias of clientY\r\n */\r\n y: number;\r\n}\r\n\r\n/**\r\n * Native friendly interface for PointerEvent Object\r\n */\r\nexport interface IPointerEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically and mouse wheel values\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical | PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ>;\r\n\r\n /**\r\n * Pointer Event ID\r\n */\r\n pointerId: number;\r\n\r\n /**\r\n * Type of pointer\r\n */\r\n pointerType: string;\r\n}\r\n\r\n/**\r\n * Native friendly interface for WheelEvent Object\r\n */\r\nexport interface IWheelEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events that can only be used with mouse wheel\r\n */\r\n inputIndex: PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ;\r\n\r\n /**\r\n * Units for delta value\r\n */\r\n deltaMode: number;\r\n\r\n /**\r\n * Horizontal scroll delta\r\n */\r\n deltaX: number;\r\n\r\n /**\r\n * Vertical scroll delta\r\n */\r\n deltaY: number;\r\n\r\n /**\r\n * Z-Axis scroll delta\r\n */\r\n deltaZ: number;\r\n\r\n /**\r\n * WheelDelta (From MouseWheel Event)\r\n * @deprecated\r\n */\r\n wheelDelta?: number;\r\n}\r\n\r\n/**\r\n * Constants used for Events\r\n */\r\nexport class EventConstants {\r\n /**\r\n * Pixel delta for Wheel Events (Default)\r\n */\r\n public static DOM_DELTA_PIXEL = 0x00;\r\n\r\n /**\r\n * Line delta for Wheel Events\r\n */\r\n public static DOM_DELTA_LINE = 0x01;\r\n\r\n /**\r\n * Page delta for Wheel Events\r\n */\r\n public static DOM_DELTA_PAGE = 0x02;\r\n}\r\n"]}
@@ -127,7 +127,7 @@ export declare class WindowsMotionController extends WebVRController {
127
127
  *
128
128
  * @param scene scene in which the meshes exist
129
129
  * @param meshes list of meshes that make up the controller model to process
130
- * @return structured view of the given meshes, with mapping of buttons and axes to meshes that can be transformed.
130
+ * @returns structured view of the given meshes, with mapping of buttons and axes to meshes that can be transformed.
131
131
  */
132
132
  private _processModel;
133
133
  private _createMeshInfo;
@@ -249,7 +249,7 @@ export class WindowsMotionController extends WebVRController {
249
249
  *
250
250
  * @param scene scene in which the meshes exist
251
251
  * @param meshes list of meshes that make up the controller model to process
252
- * @return structured view of the given meshes, with mapping of buttons and axes to meshes that can be transformed.
252
+ * @returns structured view of the given meshes, with mapping of buttons and axes to meshes that can be transformed.
253
253
  */
254
254
  _processModel(scene, meshes) {
255
255
  let loadedMeshInfo = null;
@@ -1 +1 @@
1
- {"version":3,"file":"windowsMotionController.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Gamepads/Controllers/windowsMotionController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAGxH;;GAEG;AACH,MAAM,cAAc;IAApB;QASI;;WAEG;QACI,iBAAY,GAAsC,EAAE,CAAC;QAC5D;;WAEG;QACI,eAAU,GAAoC,EAAE,CAAC;IAC5D,CAAC;CAAA;AA4CD;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,eAAe;IAqExD;;;OAGG;IACH,YAAY,SAAc;QACtB,KAAK,CAAC,SAAS,CAAC,CAAC;QAjDF,aAAQ,GAAG;YAC1B,wBAAwB;YACxB,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS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mCAAmC,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC3E;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,kCAAkC,CAAC,KAAK,EAAE,CAAC;QAChD,IAAI,CAAC,mCAAmC,CAAC,KAAK,EAAE,CAAC;IACrD,CAAC;CACJ;AAED,2BAA2B,CAAC,oBAAoB,CAAC,IAAI,CAAC;IAClD,SAAS,EAAE,CAAC,WAAW,EAAE,EAAE;QACvB,OAAO,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACnF,CAAC;IACD,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE;QACpB,OAAO,IAAI,uBAAuB,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import { Logger } from \"../../Misc/logger\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Quaternion, Vector3 } from \"../../Maths/math.vector\";\r\nimport type { Node } from \"../../node\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport { Ray } from \"../../Culling/ray\";\r\nimport { SceneLoader } from \"../../Loading/sceneLoader\";\r\nimport { WebVRController } from \"./webVRController\";\r\nimport { GenericController } from \"./genericController\";\r\nimport type { ExtendedGamepadButton } from \"./poseEnabledController\";\r\nimport { PoseEnabledController, PoseEnabledControllerType, PoseEnabledControllerHelper } from \"./poseEnabledController\";\r\nimport type { StickValues } from \"../../Gamepads/gamepad\";\r\n\r\n/**\r\n * Defines the LoadedMeshInfo object that describes information about the loaded webVR controller mesh\r\n */\r\nclass LoadedMeshInfo {\r\n /**\r\n * Root of the mesh\r\n */\r\n public rootNode: AbstractMesh;\r\n /**\r\n * Node of the mesh corresponding to the direction the ray should be cast from the controller\r\n */\r\n public pointingPoseNode: TransformNode;\r\n /**\r\n * Map of the button meshes contained in the controller\r\n */\r\n public buttonMeshes: { [id: string]: IButtonMeshInfo } = {};\r\n /**\r\n * Map of the axis meshes contained in the controller\r\n */\r\n public axisMeshes: { [id: number]: IAxisMeshInfo } = {};\r\n}\r\n\r\n/**\r\n * Defines the IMeshInfo object that describes information a webvr controller mesh\r\n */\r\ninterface IMeshInfo {\r\n /**\r\n * Index of the mesh inside the root mesh\r\n */\r\n index: number;\r\n /**\r\n * The mesh\r\n */\r\n value: TransformNode;\r\n}\r\n\r\n/**\r\n * Defines the IButtonMeshInfo object that describes a button mesh\r\n */\r\ninterface IButtonMeshInfo extends IMeshInfo {\r\n /**\r\n * The mesh that should be displayed when pressed\r\n */\r\n pressed: TransformNode;\r\n /**\r\n * The mesh that should be displayed when not pressed\r\n */\r\n unpressed: TransformNode;\r\n}\r\n\r\n/**\r\n * Defines the IAxisMeshInfo object that describes an axis mesh\r\n */\r\ninterface IAxisMeshInfo extends IMeshInfo {\r\n /**\r\n * The mesh that should be set when at its min\r\n */\r\n min: TransformNode;\r\n /**\r\n * The mesh that should be set when at its max\r\n */\r\n max: TransformNode;\r\n}\r\n\r\n/**\r\n * Defines the WindowsMotionController object that the state of the windows motion controller\r\n */\r\nexport class WindowsMotionController extends WebVRController {\r\n /**\r\n * The base url used to load the left and right controller models\r\n */\r\n public static MODEL_BASE_URL: string = \"https://controllers.babylonjs.com/microsoft/\";\r\n /**\r\n * The name of the left controller model file\r\n */\r\n public static MODEL_LEFT_FILENAME: string = \"left.glb\";\r\n /**\r\n * The name of the right controller model file\r\n */\r\n public static MODEL_RIGHT_FILENAME: string = \"right.glb\";\r\n\r\n /**\r\n * The controller name prefix for this controller type\r\n */\r\n public static readonly GAMEPAD_ID_PREFIX: string = \"Spatial Controller (Spatial Interaction Source) \";\r\n /**\r\n * The controller id pattern for this controller type\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private static readonly GAMEPAD_ID_PATTERN = /([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/;\r\n\r\n private _loadedMeshInfo: Nullable<LoadedMeshInfo>;\r\n protected readonly _mapping = {\r\n // Semantic button names\r\n buttons: [\"thumbstick\", \"trigger\", \"grip\", \"menu\", \"trackpad\"],\r\n // trigger, grip, trackpad, thumbstick, menu\r\n\r\n // A mapping of the button name to glTF model node name\r\n // that should be transformed by button value.\r\n buttonMeshNames: {\r\n trigger: \"SELECT\",\r\n menu: \"MENU\",\r\n grip: \"GRASP\",\r\n thumbstick: \"THUMBSTICK_PRESS\",\r\n trackpad: \"TOUCHPAD_PRESS\",\r\n },\r\n // This mapping is used to translate from the Motion Controller to Babylon semantics\r\n buttonObservableNames: {\r\n trigger: \"onTriggerStateChangedObservable\",\r\n menu: \"onSecondaryButtonStateChangedObservable\",\r\n grip: \"onMainButtonStateChangedObservable\",\r\n thumbstick: \"onPadStateChangedObservable\",\r\n trackpad: \"onTrackpadChangedObservable\",\r\n },\r\n // A mapping of the axis name to glTF model node name\r\n // that should be transformed by axis value.\r\n // This array mirrors the browserGamepad.axes array, such that\r\n // the mesh corresponding to axis 0 is in this array index 0.\r\n axisMeshNames: [\"THUMBSTICK_X\", \"THUMBSTICK_Y\", \"TOUCHPAD_TOUCH_X\", \"TOUCHPAD_TOUCH_Y\"],\r\n // upside down in webxr\r\n pointingPoseMeshName: PoseEnabledController.POINTING_POSE,\r\n };\r\n\r\n /**\r\n * Fired when the trackpad on this controller is clicked\r\n */\r\n public onTrackpadChangedObservable = new Observable<ExtendedGamepadButton>();\r\n /**\r\n * Fired when the trackpad on this controller is modified\r\n */\r\n public onTrackpadValuesChangedObservable = new Observable<StickValues>();\r\n /**\r\n * The current x and y values of this controller's trackpad\r\n */\r\n public trackpad: StickValues = { x: 0, y: 0 };\r\n\r\n /**\r\n * Creates a new WindowsMotionController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n constructor(vrGamepad: any) {\r\n super(vrGamepad);\r\n this.controllerType = PoseEnabledControllerType.WINDOWS;\r\n this._loadedMeshInfo = null;\r\n }\r\n\r\n /**\r\n * Fired when the trigger on this controller is modified\r\n */\r\n public get onTriggerButtonStateChangedObservable(): Observable<ExtendedGamepadButton> {\r\n return this.onTriggerStateChangedObservable;\r\n }\r\n\r\n /**\r\n * Fired when the menu button on this controller is modified\r\n */\r\n public get onMenuButtonStateChangedObservable(): Observable<ExtendedGamepadButton> {\r\n return this.onSecondaryButtonStateChangedObservable;\r\n }\r\n\r\n /**\r\n * Fired when the grip button on this controller is modified\r\n */\r\n public get onGripButtonStateChangedObservable(): Observable<ExtendedGamepadButton> {\r\n return this.onMainButtonStateChangedObservable;\r\n }\r\n\r\n /**\r\n * Fired when the thumbstick button on this controller is modified\r\n */\r\n public get onThumbstickButtonStateChangedObservable(): Observable<ExtendedGamepadButton> {\r\n return this.onPadStateChangedObservable;\r\n }\r\n\r\n /**\r\n * Fired when the touchpad button on this controller is modified\r\n */\r\n public get onTouchpadButtonStateChangedObservable(): Observable<ExtendedGamepadButton> {\r\n return this.onTrackpadChangedObservable;\r\n }\r\n\r\n /**\r\n * Fired when the touchpad values on this controller are modified\r\n */\r\n public get onTouchpadValuesChangedObservable(): Observable<StickValues> {\r\n return this.onTrackpadValuesChangedObservable;\r\n }\r\n\r\n protected _updateTrackpad() {\r\n if (this.browserGamepad.axes && (this.browserGamepad.axes[2] != this.trackpad.x || this.browserGamepad.axes[3] != this.trackpad.y)) {\r\n this.trackpad.x = this.browserGamepad[\"axes\"][this._mapping.axisMeshNames.indexOf(\"TOUCHPAD_TOUCH_X\")];\r\n this.trackpad.y = this.browserGamepad[\"axes\"][this._mapping.axisMeshNames.indexOf(\"TOUCHPAD_TOUCH_Y\")];\r\n this.onTrackpadValuesChangedObservable.notifyObservers(this.trackpad);\r\n }\r\n }\r\n\r\n /**\r\n * Called once per frame by the engine.\r\n */\r\n public update() {\r\n super.update();\r\n if (this.browserGamepad.axes) {\r\n this._updateTrackpad();\r\n // Only need to animate axes if there is a loaded mesh\r\n if (this._loadedMeshInfo) {\r\n for (let axis = 0; axis < this._mapping.axisMeshNames.length; axis++) {\r\n this._lerpAxisTransform(axis, this.browserGamepad.axes[axis]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n */\r\n protected _handleButtonChange(buttonIdx: number, state: ExtendedGamepadButton) {\r\n const buttonName = this._mapping.buttons[buttonIdx];\r\n if (!buttonName) {\r\n return;\r\n }\r\n\r\n // Update the trackpad to ensure trackpad.x/y are accurate during button events between frames\r\n this._updateTrackpad();\r\n\r\n // Only emit events for buttons that we know how to map from index to name\r\n const observable = (<any>this)[(<any>this._mapping.buttonObservableNames)[buttonName]];\r\n if (observable) {\r\n observable.notifyObservers(state);\r\n }\r\n\r\n this._lerpButtonTransform(buttonName, state.value);\r\n }\r\n\r\n /**\r\n * Moves the buttons on the controller mesh based on their current state\r\n * @param buttonName the name of the button to move\r\n * @param buttonValue the value of the button which determines the buttons new position\r\n */\r\n protected _lerpButtonTransform(buttonName: string, buttonValue: number) {\r\n // If there is no loaded mesh, there is nothing to transform.\r\n if (!this._loadedMeshInfo) {\r\n return;\r\n }\r\n\r\n const meshInfo = this._loadedMeshInfo.buttonMeshes[buttonName];\r\n\r\n if (!meshInfo || !meshInfo.unpressed.rotationQuaternion || !meshInfo.pressed.rotationQuaternion || !meshInfo.value.rotationQuaternion) {\r\n return;\r\n }\r\n\r\n Quaternion.SlerpToRef(meshInfo.unpressed.rotationQuaternion, meshInfo.pressed.rotationQuaternion, buttonValue, meshInfo.value.rotationQuaternion);\r\n Vector3.LerpToRef(meshInfo.unpressed.position, meshInfo.pressed.position, buttonValue, meshInfo.value.position);\r\n }\r\n\r\n /**\r\n * Moves the axis on the controller mesh based on its current state\r\n * @param axis the index of the axis\r\n * @param axisValue the value of the axis which determines the meshes new position\r\n * @hidden\r\n */\r\n protected _lerpAxisTransform(axis: number, axisValue: number) {\r\n if (!this._loadedMeshInfo) {\r\n return;\r\n }\r\n\r\n const meshInfo = this._loadedMeshInfo.axisMeshes[axis];\r\n if (!meshInfo) {\r\n return;\r\n }\r\n\r\n if (!meshInfo.min.rotationQuaternion || !meshInfo.max.rotationQuaternion || !meshInfo.value.rotationQuaternion) {\r\n return;\r\n }\r\n\r\n // Convert from gamepad value range (-1 to +1) to lerp range (0 to 1)\r\n const lerpValue = axisValue * 0.5 + 0.5;\r\n Quaternion.SlerpToRef(meshInfo.min.rotationQuaternion, meshInfo.max.rotationQuaternion, lerpValue, meshInfo.value.rotationQuaternion);\r\n Vector3.LerpToRef(meshInfo.min.position, meshInfo.max.position, lerpValue, meshInfo.value.position);\r\n }\r\n\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n * @param forceDefault\r\n */\r\n public initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void, forceDefault = false) {\r\n let path: string;\r\n let filename: string;\r\n\r\n // Checking if GLB loader is present\r\n if (SceneLoader.IsPluginForExtensionAvailable(\".glb\")) {\r\n // Determine the device specific folder based on the ID suffix\r\n let device = \"default\";\r\n if (this.id && !forceDefault) {\r\n const match = this.id.match(WindowsMotionController.GAMEPAD_ID_PATTERN);\r\n device = (match && match[0]) || device;\r\n }\r\n\r\n // Hand\r\n if (this.hand === \"left\") {\r\n filename = WindowsMotionController.MODEL_LEFT_FILENAME;\r\n } else {\r\n // Right is the default if no hand is specified\r\n filename = WindowsMotionController.MODEL_RIGHT_FILENAME;\r\n }\r\n\r\n path = WindowsMotionController.MODEL_BASE_URL + device + \"/\";\r\n } else {\r\n Logger.Warn(\"You need to reference GLTF loader to load Windows Motion Controllers model. Falling back to generic models\");\r\n path = GenericController.MODEL_BASE_URL;\r\n filename = GenericController.MODEL_FILENAME;\r\n }\r\n\r\n SceneLoader.ImportMesh(\r\n \"\",\r\n path,\r\n filename,\r\n scene,\r\n (meshes: AbstractMesh[]) => {\r\n // glTF files successfully loaded from the remote server, now process them to ensure they are in the right format.\r\n this._loadedMeshInfo = this._processModel(scene, meshes);\r\n\r\n if (!this._loadedMeshInfo) {\r\n return;\r\n }\r\n\r\n this._defaultModel = this._loadedMeshInfo.rootNode;\r\n this.attachToMesh(this._defaultModel);\r\n\r\n if (meshLoaded) {\r\n meshLoaded(this._defaultModel);\r\n }\r\n },\r\n null,\r\n (scene: Scene, message: string) => {\r\n Logger.Log(message);\r\n Logger.Warn(\"Failed to retrieve controller model from the remote server: \" + path + filename);\r\n if (!forceDefault) {\r\n this.initControllerMesh(scene, meshLoaded, true);\r\n }\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Takes a list of meshes (as loaded from the glTF file) and finds the root node, as well as nodes that\r\n * can be transformed by button presses and axes values, based on this._mapping.\r\n *\r\n * @param scene scene in which the meshes exist\r\n * @param meshes list of meshes that make up the controller model to process\r\n * @return structured view of the given meshes, with mapping of buttons and axes to meshes that can be transformed.\r\n */\r\n private _processModel(scene: Scene, meshes: AbstractMesh[]): Nullable<LoadedMeshInfo> {\r\n let loadedMeshInfo = null;\r\n\r\n // Create a new mesh to contain the glTF hierarchy\r\n const parentMesh = new Mesh(this.id + \" \" + this.hand, scene);\r\n\r\n // Find the root node in the loaded glTF scene, and attach it as a child of 'parentMesh'\r\n let childMesh: Nullable<AbstractMesh> = null;\r\n for (let i = 0; i < meshes.length; i++) {\r\n const mesh = meshes[i];\r\n\r\n if (!mesh.parent) {\r\n // Exclude controller meshes from picking results\r\n mesh.isPickable = false;\r\n\r\n // Handle root node, attach to the new parentMesh\r\n childMesh = mesh;\r\n break;\r\n }\r\n }\r\n\r\n if (childMesh) {\r\n childMesh.setParent(parentMesh);\r\n\r\n // Create our mesh info. Note that this method will always return non-null.\r\n loadedMeshInfo = this._createMeshInfo(parentMesh);\r\n } else {\r\n Logger.Warn(\"Could not find root node in model file.\");\r\n }\r\n\r\n return loadedMeshInfo;\r\n }\r\n\r\n private _createMeshInfo(rootNode: AbstractMesh): LoadedMeshInfo {\r\n const loadedMeshInfo = new LoadedMeshInfo();\r\n let i;\r\n loadedMeshInfo.rootNode = rootNode;\r\n\r\n // Reset the caches\r\n loadedMeshInfo.buttonMeshes = {};\r\n loadedMeshInfo.axisMeshes = {};\r\n\r\n // Button Meshes\r\n for (i = 0; i < this._mapping.buttons.length; i++) {\r\n const buttonMeshName = (<any>this._mapping.buttonMeshNames)[this._mapping.buttons[i]];\r\n if (!buttonMeshName) {\r\n Logger.Log(\"Skipping unknown button at index: \" + i + \" with mapped name: \" + this._mapping.buttons[i]);\r\n continue;\r\n }\r\n\r\n const buttonMesh = getChildByName(rootNode, buttonMeshName);\r\n if (!buttonMesh) {\r\n Logger.Warn(\"Missing button mesh with name: \" + buttonMeshName);\r\n continue;\r\n }\r\n\r\n const buttonMeshInfo = {\r\n index: i,\r\n value: getImmediateChildByName(buttonMesh, \"VALUE\"),\r\n pressed: getImmediateChildByName(buttonMesh, \"PRESSED\"),\r\n unpressed: getImmediateChildByName(buttonMesh, \"UNPRESSED\"),\r\n };\r\n if (buttonMeshInfo.value && buttonMeshInfo.pressed && buttonMeshInfo.unpressed) {\r\n loadedMeshInfo.buttonMeshes[this._mapping.buttons[i]] = buttonMeshInfo;\r\n } else {\r\n // If we didn't find the mesh, it simply means this button won't have transforms applied as mapped button value changes.\r\n Logger.Warn(\r\n \"Missing button submesh under mesh with name: \" +\r\n buttonMeshName +\r\n \"(VALUE: \" +\r\n !!buttonMeshInfo.value +\r\n \", PRESSED: \" +\r\n !!buttonMeshInfo.pressed +\r\n \", UNPRESSED:\" +\r\n !!buttonMeshInfo.unpressed +\r\n \")\"\r\n );\r\n }\r\n }\r\n\r\n // Axis Meshes\r\n for (i = 0; i < this._mapping.axisMeshNames.length; i++) {\r\n const axisMeshName = this._mapping.axisMeshNames[i];\r\n if (!axisMeshName) {\r\n Logger.Log(\"Skipping unknown axis at index: \" + i);\r\n continue;\r\n }\r\n\r\n const axisMesh = getChildByName(rootNode, axisMeshName);\r\n if (!axisMesh) {\r\n Logger.Warn(\"Missing axis mesh with name: \" + axisMeshName);\r\n continue;\r\n }\r\n\r\n const axisMeshInfo = {\r\n index: i,\r\n value: getImmediateChildByName(axisMesh, \"VALUE\"),\r\n min: getImmediateChildByName(axisMesh, \"MIN\"),\r\n max: getImmediateChildByName(axisMesh, \"MAX\"),\r\n };\r\n if (axisMeshInfo.value && axisMeshInfo.min && axisMeshInfo.max) {\r\n loadedMeshInfo.axisMeshes[i] = axisMeshInfo;\r\n } else {\r\n // If we didn't find the mesh, it simply means thit axis won't have transforms applied as mapped axis values change.\r\n Logger.Warn(\r\n \"Missing axis submesh under mesh with name: \" +\r\n axisMeshName +\r\n \"(VALUE: \" +\r\n !!axisMeshInfo.value +\r\n \", MIN: \" +\r\n !!axisMeshInfo.min +\r\n \", MAX:\" +\r\n !!axisMeshInfo.max +\r\n \")\"\r\n );\r\n }\r\n }\r\n\r\n // Pointing Ray\r\n loadedMeshInfo.pointingPoseNode = getChildByName(rootNode, this._mapping.pointingPoseMeshName);\r\n if (!loadedMeshInfo.pointingPoseNode) {\r\n Logger.Warn(\"Missing pointing pose mesh with name: \" + this._mapping.pointingPoseMeshName);\r\n } else {\r\n this._pointingPoseNode = loadedMeshInfo.pointingPoseNode;\r\n }\r\n\r\n return loadedMeshInfo;\r\n\r\n // Look through all children recursively. This will return null if no mesh exists with the given name.\r\n function getChildByName(node: Node, name: string) {\r\n return <TransformNode>node.getChildren((n) => n.name === name, false)[0];\r\n }\r\n // Look through only immediate children. This will return null if no mesh exists with the given name.\r\n function getImmediateChildByName(node: Node, name: string): TransformNode {\r\n return <TransformNode>node.getChildren((n) => n.name == name, true)[0];\r\n }\r\n }\r\n\r\n /**\r\n * Gets the ray of the controller in the direction the controller is pointing\r\n * @param length the length the resulting ray should be\r\n * @returns a ray in the direction the controller is pointing\r\n */\r\n public getForwardRay(length = 100): Ray {\r\n if (!(this._loadedMeshInfo && this._loadedMeshInfo.pointingPoseNode)) {\r\n return super.getForwardRay(length);\r\n }\r\n\r\n const m = this._loadedMeshInfo.pointingPoseNode.getWorldMatrix();\r\n const origin = m.getTranslation();\r\n\r\n const forward = new Vector3(0, 0, -1);\r\n const forwardWorld = Vector3.TransformNormal(forward, m);\r\n\r\n const direction = Vector3.Normalize(forwardWorld);\r\n\r\n return new Ray(origin, direction, length);\r\n }\r\n\r\n /**\r\n * Disposes of the controller\r\n */\r\n public dispose(): void {\r\n super.dispose();\r\n\r\n this.onTrackpadChangedObservable.clear();\r\n this.onTrackpadValuesChangedObservable.clear();\r\n }\r\n}\r\n\r\n/**\r\n * This class represents a new windows motion controller in XR.\r\n */\r\nexport class XRWindowsMotionController extends WindowsMotionController {\r\n /**\r\n * Changing the original WIndowsMotionController mapping to fir the new mapping\r\n */\r\n protected readonly _mapping = {\r\n // Semantic button names\r\n buttons: [\"trigger\", \"grip\", \"trackpad\", \"thumbstick\", \"menu\"],\r\n // trigger, grip, trackpad, thumbstick, menu\r\n\r\n // A mapping of the button name to glTF model node name\r\n // that should be transformed by button value.\r\n buttonMeshNames: {\r\n trigger: \"SELECT\",\r\n menu: \"MENU\",\r\n grip: \"GRASP\",\r\n thumbstick: \"THUMBSTICK_PRESS\",\r\n trackpad: \"TOUCHPAD_PRESS\",\r\n },\r\n // This mapping is used to translate from the Motion Controller to Babylon semantics\r\n buttonObservableNames: {\r\n trigger: \"onTriggerStateChangedObservable\",\r\n menu: \"onSecondaryButtonStateChangedObservable\",\r\n grip: \"onMainButtonStateChangedObservable\",\r\n thumbstick: \"onThumbstickStateChangedObservable\",\r\n trackpad: \"onTrackpadChangedObservable\",\r\n },\r\n // A mapping of the axis name to glTF model node name\r\n // that should be transformed by axis value.\r\n // This array mirrors the browserGamepad.axes array, such that\r\n // the mesh corresponding to axis 0 is in this array index 0.\r\n axisMeshNames: [\"TOUCHPAD_TOUCH_X\", \"TOUCHPAD_TOUCH_Y\", \"THUMBSTICK_X\", \"THUMBSTICK_Y\"],\r\n // upside down in webxr\r\n pointingPoseMeshName: PoseEnabledController.POINTING_POSE,\r\n };\r\n\r\n /**\r\n * Construct a new XR-Based windows motion controller\r\n *\r\n * @param gamepadInfo the gamepad object from the browser\r\n */\r\n constructor(gamepadInfo: any) {\r\n super(gamepadInfo);\r\n }\r\n\r\n /**\r\n * holds the thumbstick values (X,Y)\r\n */\r\n public thumbstickValues: StickValues = { x: 0, y: 0 };\r\n\r\n /**\r\n * Fired when the thumbstick on this controller is clicked\r\n */\r\n public onThumbstickStateChangedObservable = new Observable<ExtendedGamepadButton>();\r\n /**\r\n * Fired when the thumbstick on this controller is modified\r\n */\r\n public onThumbstickValuesChangedObservable = new Observable<StickValues>();\r\n\r\n /**\r\n * Fired when the touchpad button on this controller is modified\r\n */\r\n public onTrackpadChangedObservable = this.onPadStateChangedObservable;\r\n\r\n /**\r\n * Fired when the touchpad values on this controller are modified\r\n */\r\n public onTrackpadValuesChangedObservable = this.onPadValuesChangedObservable;\r\n\r\n /**\r\n * Fired when the thumbstick button on this controller is modified\r\n * here to prevent breaking changes\r\n */\r\n public get onThumbstickButtonStateChangedObservable(): Observable<ExtendedGamepadButton> {\r\n return this.onThumbstickStateChangedObservable;\r\n }\r\n\r\n /**\r\n * updating the thumbstick(!) and not the trackpad.\r\n * This is named this way due to the difference between WebVR and XR and to avoid\r\n * changing the parent class.\r\n */\r\n protected _updateTrackpad() {\r\n if (this.browserGamepad.axes && (this.browserGamepad.axes[2] != this.thumbstickValues.x || this.browserGamepad.axes[3] != this.thumbstickValues.y)) {\r\n this.trackpad.x = this.browserGamepad[\"axes\"][2];\r\n this.trackpad.y = this.browserGamepad[\"axes\"][3];\r\n this.onThumbstickValuesChangedObservable.notifyObservers(this.trackpad);\r\n }\r\n }\r\n\r\n /**\r\n * Disposes the class with joy\r\n */\r\n public dispose() {\r\n super.dispose();\r\n this.onThumbstickStateChangedObservable.clear();\r\n this.onThumbstickValuesChangedObservable.clear();\r\n }\r\n}\r\n\r\nPoseEnabledControllerHelper._ControllerFactories.push({\r\n canCreate: (gamepadInfo) => {\r\n return gamepadInfo.id.indexOf(WindowsMotionController.GAMEPAD_ID_PREFIX) === 0;\r\n },\r\n create: (gamepadInfo) => {\r\n return new WindowsMotionController(gamepadInfo);\r\n },\r\n});\r\n"]}
1
+ {"version":3,"file":"windowsMotionController.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Gamepads/Controllers/windowsMotionController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAGxH;;GAEG;AACH,MAAM,cAAc;IAApB;QASI;;WAEG;QACI,iBAAY,GAAsC,EAAE,CAAC;QAC5D;;WAEG;QACI,eAAU,GAAoC,EAAE,CAAC;IAC5D,CAAC;CAAA;AA4CD;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,eAAe;IAqExD;;;OAGG;IACH,YAAY,SAAc;QACtB,KAAK,CAAC,SAAS,CAAC,CAAC;QAjDF,aAAQ,GAAG;YAC1B,wBAAwB;YACxB,OAAO,EAAE,CAAC,YAAY,EAAE,S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AC,mCAAmC,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC3E;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,kCAAkC,CAAC,KAAK,EAAE,CAAC;QAChD,IAAI,CAAC,mCAAmC,CAAC,KAAK,EAAE,CAAC;IACrD,CAAC;CACJ;AAED,2BAA2B,CAAC,oBAAoB,CAAC,IAAI,CAAC;IAClD,SAAS,EAAE,CAAC,WAAW,EAAE,EAAE;QACvB,OAAO,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACnF,CAAC;IACD,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE;QACpB,OAAO,IAAI,uBAAuB,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import { Logger } from \"../../Misc/logger\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Quaternion, Vector3 } from \"../../Maths/math.vector\";\r\nimport type { Node } from \"../../node\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport { Ray } from \"../../Culling/ray\";\r\nimport { SceneLoader } from \"../../Loading/sceneLoader\";\r\nimport { WebVRController } from \"./webVRController\";\r\nimport { GenericController } from \"./genericController\";\r\nimport type { ExtendedGamepadButton } from \"./poseEnabledController\";\r\nimport { PoseEnabledController, PoseEnabledControllerType, PoseEnabledControllerHelper } from \"./poseEnabledController\";\r\nimport type { StickValues } from \"../../Gamepads/gamepad\";\r\n\r\n/**\r\n * Defines the LoadedMeshInfo object that describes information about the loaded webVR controller mesh\r\n */\r\nclass LoadedMeshInfo {\r\n /**\r\n * Root of the mesh\r\n */\r\n public rootNode: AbstractMesh;\r\n /**\r\n * Node of the mesh corresponding to the direction the ray should be cast from the controller\r\n */\r\n public pointingPoseNode: TransformNode;\r\n /**\r\n * Map of the button meshes contained in the controller\r\n */\r\n public buttonMeshes: { [id: string]: IButtonMeshInfo } = {};\r\n /**\r\n * Map of the axis meshes contained in the controller\r\n */\r\n public axisMeshes: { [id: number]: IAxisMeshInfo } = {};\r\n}\r\n\r\n/**\r\n * Defines the IMeshInfo object that describes information a webvr controller mesh\r\n */\r\ninterface IMeshInfo {\r\n /**\r\n * Index of the mesh inside the root mesh\r\n */\r\n index: number;\r\n /**\r\n * The mesh\r\n */\r\n value: TransformNode;\r\n}\r\n\r\n/**\r\n * Defines the IButtonMeshInfo object that describes a button mesh\r\n */\r\ninterface IButtonMeshInfo extends IMeshInfo {\r\n /**\r\n * The mesh that should be displayed when pressed\r\n */\r\n pressed: TransformNode;\r\n /**\r\n * The mesh that should be displayed when not pressed\r\n */\r\n unpressed: TransformNode;\r\n}\r\n\r\n/**\r\n * Defines the IAxisMeshInfo object that describes an axis mesh\r\n */\r\ninterface IAxisMeshInfo extends IMeshInfo {\r\n /**\r\n * The mesh that should be set when at its min\r\n */\r\n min: TransformNode;\r\n /**\r\n * The mesh that should be set when at its max\r\n */\r\n max: TransformNode;\r\n}\r\n\r\n/**\r\n * Defines the WindowsMotionController object that the state of the windows motion controller\r\n */\r\nexport class WindowsMotionController extends WebVRController {\r\n /**\r\n * The base url used to load the left and right controller models\r\n */\r\n public static MODEL_BASE_URL: string = \"https://controllers.babylonjs.com/microsoft/\";\r\n /**\r\n * The name of the left controller model file\r\n */\r\n public static MODEL_LEFT_FILENAME: string = \"left.glb\";\r\n /**\r\n * The name of the right controller model file\r\n */\r\n public static MODEL_RIGHT_FILENAME: string = \"right.glb\";\r\n\r\n /**\r\n * The controller name prefix for this controller type\r\n */\r\n public static readonly GAMEPAD_ID_PREFIX: string = \"Spatial Controller (Spatial Interaction Source) \";\r\n /**\r\n * The controller id pattern for this controller type\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private static readonly GAMEPAD_ID_PATTERN = /([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/;\r\n\r\n private _loadedMeshInfo: Nullable<LoadedMeshInfo>;\r\n protected readonly _mapping = {\r\n // Semantic button names\r\n buttons: [\"thumbstick\", \"trigger\", \"grip\", \"menu\", \"trackpad\"],\r\n // trigger, grip, trackpad, thumbstick, menu\r\n\r\n // A mapping of the button name to glTF model node name\r\n // that should be transformed by button value.\r\n buttonMeshNames: {\r\n trigger: \"SELECT\",\r\n menu: \"MENU\",\r\n grip: \"GRASP\",\r\n thumbstick: \"THUMBSTICK_PRESS\",\r\n trackpad: \"TOUCHPAD_PRESS\",\r\n },\r\n // This mapping is used to translate from the Motion Controller to Babylon semantics\r\n buttonObservableNames: {\r\n trigger: \"onTriggerStateChangedObservable\",\r\n menu: \"onSecondaryButtonStateChangedObservable\",\r\n grip: \"onMainButtonStateChangedObservable\",\r\n thumbstick: \"onPadStateChangedObservable\",\r\n trackpad: \"onTrackpadChangedObservable\",\r\n },\r\n // A mapping of the axis name to glTF model node name\r\n // that should be transformed by axis value.\r\n // This array mirrors the browserGamepad.axes array, such that\r\n // the mesh corresponding to axis 0 is in this array index 0.\r\n axisMeshNames: [\"THUMBSTICK_X\", \"THUMBSTICK_Y\", \"TOUCHPAD_TOUCH_X\", \"TOUCHPAD_TOUCH_Y\"],\r\n // upside down in webxr\r\n pointingPoseMeshName: PoseEnabledController.POINTING_POSE,\r\n };\r\n\r\n /**\r\n * Fired when the trackpad on this controller is clicked\r\n */\r\n public onTrackpadChangedObservable = new Observable<ExtendedGamepadButton>();\r\n /**\r\n * Fired when the trackpad on this controller is modified\r\n */\r\n public onTrackpadValuesChangedObservable = new Observable<StickValues>();\r\n /**\r\n * The current x and y values of this controller's trackpad\r\n */\r\n public trackpad: StickValues = { x: 0, y: 0 };\r\n\r\n /**\r\n * Creates a new WindowsMotionController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n constructor(vrGamepad: any) {\r\n super(vrGamepad);\r\n this.controllerType = PoseEnabledControllerType.WINDOWS;\r\n this._loadedMeshInfo = null;\r\n }\r\n\r\n /**\r\n * Fired when the trigger on this controller is modified\r\n */\r\n public get onTriggerButtonStateChangedObservable(): Observable<ExtendedGamepadButton> {\r\n return this.onTriggerStateChangedObservable;\r\n }\r\n\r\n /**\r\n * Fired when the menu button on this controller is modified\r\n */\r\n public get onMenuButtonStateChangedObservable(): Observable<ExtendedGamepadButton> {\r\n return this.onSecondaryButtonStateChangedObservable;\r\n }\r\n\r\n /**\r\n * Fired when the grip button on this controller is modified\r\n */\r\n public get onGripButtonStateChangedObservable(): Observable<ExtendedGamepadButton> {\r\n return this.onMainButtonStateChangedObservable;\r\n }\r\n\r\n /**\r\n * Fired when the thumbstick button on this controller is modified\r\n */\r\n public get onThumbstickButtonStateChangedObservable(): Observable<ExtendedGamepadButton> {\r\n return this.onPadStateChangedObservable;\r\n }\r\n\r\n /**\r\n * Fired when the touchpad button on this controller is modified\r\n */\r\n public get onTouchpadButtonStateChangedObservable(): Observable<ExtendedGamepadButton> {\r\n return this.onTrackpadChangedObservable;\r\n }\r\n\r\n /**\r\n * Fired when the touchpad values on this controller are modified\r\n */\r\n public get onTouchpadValuesChangedObservable(): Observable<StickValues> {\r\n return this.onTrackpadValuesChangedObservable;\r\n }\r\n\r\n protected _updateTrackpad() {\r\n if (this.browserGamepad.axes && (this.browserGamepad.axes[2] != this.trackpad.x || this.browserGamepad.axes[3] != this.trackpad.y)) {\r\n this.trackpad.x = this.browserGamepad[\"axes\"][this._mapping.axisMeshNames.indexOf(\"TOUCHPAD_TOUCH_X\")];\r\n this.trackpad.y = this.browserGamepad[\"axes\"][this._mapping.axisMeshNames.indexOf(\"TOUCHPAD_TOUCH_Y\")];\r\n this.onTrackpadValuesChangedObservable.notifyObservers(this.trackpad);\r\n }\r\n }\r\n\r\n /**\r\n * Called once per frame by the engine.\r\n */\r\n public update() {\r\n super.update();\r\n if (this.browserGamepad.axes) {\r\n this._updateTrackpad();\r\n // Only need to animate axes if there is a loaded mesh\r\n if (this._loadedMeshInfo) {\r\n for (let axis = 0; axis < this._mapping.axisMeshNames.length; axis++) {\r\n this._lerpAxisTransform(axis, this.browserGamepad.axes[axis]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n */\r\n protected _handleButtonChange(buttonIdx: number, state: ExtendedGamepadButton) {\r\n const buttonName = this._mapping.buttons[buttonIdx];\r\n if (!buttonName) {\r\n return;\r\n }\r\n\r\n // Update the trackpad to ensure trackpad.x/y are accurate during button events between frames\r\n this._updateTrackpad();\r\n\r\n // Only emit events for buttons that we know how to map from index to name\r\n const observable = (<any>this)[(<any>this._mapping.buttonObservableNames)[buttonName]];\r\n if (observable) {\r\n observable.notifyObservers(state);\r\n }\r\n\r\n this._lerpButtonTransform(buttonName, state.value);\r\n }\r\n\r\n /**\r\n * Moves the buttons on the controller mesh based on their current state\r\n * @param buttonName the name of the button to move\r\n * @param buttonValue the value of the button which determines the buttons new position\r\n */\r\n protected _lerpButtonTransform(buttonName: string, buttonValue: number) {\r\n // If there is no loaded mesh, there is nothing to transform.\r\n if (!this._loadedMeshInfo) {\r\n return;\r\n }\r\n\r\n const meshInfo = this._loadedMeshInfo.buttonMeshes[buttonName];\r\n\r\n if (!meshInfo || !meshInfo.unpressed.rotationQuaternion || !meshInfo.pressed.rotationQuaternion || !meshInfo.value.rotationQuaternion) {\r\n return;\r\n }\r\n\r\n Quaternion.SlerpToRef(meshInfo.unpressed.rotationQuaternion, meshInfo.pressed.rotationQuaternion, buttonValue, meshInfo.value.rotationQuaternion);\r\n Vector3.LerpToRef(meshInfo.unpressed.position, meshInfo.pressed.position, buttonValue, meshInfo.value.position);\r\n }\r\n\r\n /**\r\n * Moves the axis on the controller mesh based on its current state\r\n * @param axis the index of the axis\r\n * @param axisValue the value of the axis which determines the meshes new position\r\n * @hidden\r\n */\r\n protected _lerpAxisTransform(axis: number, axisValue: number) {\r\n if (!this._loadedMeshInfo) {\r\n return;\r\n }\r\n\r\n const meshInfo = this._loadedMeshInfo.axisMeshes[axis];\r\n if (!meshInfo) {\r\n return;\r\n }\r\n\r\n if (!meshInfo.min.rotationQuaternion || !meshInfo.max.rotationQuaternion || !meshInfo.value.rotationQuaternion) {\r\n return;\r\n }\r\n\r\n // Convert from gamepad value range (-1 to +1) to lerp range (0 to 1)\r\n const lerpValue = axisValue * 0.5 + 0.5;\r\n Quaternion.SlerpToRef(meshInfo.min.rotationQuaternion, meshInfo.max.rotationQuaternion, lerpValue, meshInfo.value.rotationQuaternion);\r\n Vector3.LerpToRef(meshInfo.min.position, meshInfo.max.position, lerpValue, meshInfo.value.position);\r\n }\r\n\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n * @param forceDefault\r\n */\r\n public initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void, forceDefault = false) {\r\n let path: string;\r\n let filename: string;\r\n\r\n // Checking if GLB loader is present\r\n if (SceneLoader.IsPluginForExtensionAvailable(\".glb\")) {\r\n // Determine the device specific folder based on the ID suffix\r\n let device = \"default\";\r\n if (this.id && !forceDefault) {\r\n const match = this.id.match(WindowsMotionController.GAMEPAD_ID_PATTERN);\r\n device = (match && match[0]) || device;\r\n }\r\n\r\n // Hand\r\n if (this.hand === \"left\") {\r\n filename = WindowsMotionController.MODEL_LEFT_FILENAME;\r\n } else {\r\n // Right is the default if no hand is specified\r\n filename = WindowsMotionController.MODEL_RIGHT_FILENAME;\r\n }\r\n\r\n path = WindowsMotionController.MODEL_BASE_URL + device + \"/\";\r\n } else {\r\n Logger.Warn(\"You need to reference GLTF loader to load Windows Motion Controllers model. Falling back to generic models\");\r\n path = GenericController.MODEL_BASE_URL;\r\n filename = GenericController.MODEL_FILENAME;\r\n }\r\n\r\n SceneLoader.ImportMesh(\r\n \"\",\r\n path,\r\n filename,\r\n scene,\r\n (meshes: AbstractMesh[]) => {\r\n // glTF files successfully loaded from the remote server, now process them to ensure they are in the right format.\r\n this._loadedMeshInfo = this._processModel(scene, meshes);\r\n\r\n if (!this._loadedMeshInfo) {\r\n return;\r\n }\r\n\r\n this._defaultModel = this._loadedMeshInfo.rootNode;\r\n this.attachToMesh(this._defaultModel);\r\n\r\n if (meshLoaded) {\r\n meshLoaded(this._defaultModel);\r\n }\r\n },\r\n null,\r\n (scene: Scene, message: string) => {\r\n Logger.Log(message);\r\n Logger.Warn(\"Failed to retrieve controller model from the remote server: \" + path + filename);\r\n if (!forceDefault) {\r\n this.initControllerMesh(scene, meshLoaded, true);\r\n }\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Takes a list of meshes (as loaded from the glTF file) and finds the root node, as well as nodes that\r\n * can be transformed by button presses and axes values, based on this._mapping.\r\n *\r\n * @param scene scene in which the meshes exist\r\n * @param meshes list of meshes that make up the controller model to process\r\n * @returns structured view of the given meshes, with mapping of buttons and axes to meshes that can be transformed.\r\n */\r\n private _processModel(scene: Scene, meshes: AbstractMesh[]): Nullable<LoadedMeshInfo> {\r\n let loadedMeshInfo = null;\r\n\r\n // Create a new mesh to contain the glTF hierarchy\r\n const parentMesh = new Mesh(this.id + \" \" + this.hand, scene);\r\n\r\n // Find the root node in the loaded glTF scene, and attach it as a child of 'parentMesh'\r\n let childMesh: Nullable<AbstractMesh> = null;\r\n for (let i = 0; i < meshes.length; i++) {\r\n const mesh = meshes[i];\r\n\r\n if (!mesh.parent) {\r\n // Exclude controller meshes from picking results\r\n mesh.isPickable = false;\r\n\r\n // Handle root node, attach to the new parentMesh\r\n childMesh = mesh;\r\n break;\r\n }\r\n }\r\n\r\n if (childMesh) {\r\n childMesh.setParent(parentMesh);\r\n\r\n // Create our mesh info. Note that this method will always return non-null.\r\n loadedMeshInfo = this._createMeshInfo(parentMesh);\r\n } else {\r\n Logger.Warn(\"Could not find root node in model file.\");\r\n }\r\n\r\n return loadedMeshInfo;\r\n }\r\n\r\n private _createMeshInfo(rootNode: AbstractMesh): LoadedMeshInfo {\r\n const loadedMeshInfo = new LoadedMeshInfo();\r\n let i;\r\n loadedMeshInfo.rootNode = rootNode;\r\n\r\n // Reset the caches\r\n loadedMeshInfo.buttonMeshes = {};\r\n loadedMeshInfo.axisMeshes = {};\r\n\r\n // Button Meshes\r\n for (i = 0; i < this._mapping.buttons.length; i++) {\r\n const buttonMeshName = (<any>this._mapping.buttonMeshNames)[this._mapping.buttons[i]];\r\n if (!buttonMeshName) {\r\n Logger.Log(\"Skipping unknown button at index: \" + i + \" with mapped name: \" + this._mapping.buttons[i]);\r\n continue;\r\n }\r\n\r\n const buttonMesh = getChildByName(rootNode, buttonMeshName);\r\n if (!buttonMesh) {\r\n Logger.Warn(\"Missing button mesh with name: \" + buttonMeshName);\r\n continue;\r\n }\r\n\r\n const buttonMeshInfo = {\r\n index: i,\r\n value: getImmediateChildByName(buttonMesh, \"VALUE\"),\r\n pressed: getImmediateChildByName(buttonMesh, \"PRESSED\"),\r\n unpressed: getImmediateChildByName(buttonMesh, \"UNPRESSED\"),\r\n };\r\n if (buttonMeshInfo.value && buttonMeshInfo.pressed && buttonMeshInfo.unpressed) {\r\n loadedMeshInfo.buttonMeshes[this._mapping.buttons[i]] = buttonMeshInfo;\r\n } else {\r\n // If we didn't find the mesh, it simply means this button won't have transforms applied as mapped button value changes.\r\n Logger.Warn(\r\n \"Missing button submesh under mesh with name: \" +\r\n buttonMeshName +\r\n \"(VALUE: \" +\r\n !!buttonMeshInfo.value +\r\n \", PRESSED: \" +\r\n !!buttonMeshInfo.pressed +\r\n \", UNPRESSED:\" +\r\n !!buttonMeshInfo.unpressed +\r\n \")\"\r\n );\r\n }\r\n }\r\n\r\n // Axis Meshes\r\n for (i = 0; i < this._mapping.axisMeshNames.length; i++) {\r\n const axisMeshName = this._mapping.axisMeshNames[i];\r\n if (!axisMeshName) {\r\n Logger.Log(\"Skipping unknown axis at index: \" + i);\r\n continue;\r\n }\r\n\r\n const axisMesh = getChildByName(rootNode, axisMeshName);\r\n if (!axisMesh) {\r\n Logger.Warn(\"Missing axis mesh with name: \" + axisMeshName);\r\n continue;\r\n }\r\n\r\n const axisMeshInfo = {\r\n index: i,\r\n value: getImmediateChildByName(axisMesh, \"VALUE\"),\r\n min: getImmediateChildByName(axisMesh, \"MIN\"),\r\n max: getImmediateChildByName(axisMesh, \"MAX\"),\r\n };\r\n if (axisMeshInfo.value && axisMeshInfo.min && axisMeshInfo.max) {\r\n loadedMeshInfo.axisMeshes[i] = axisMeshInfo;\r\n } else {\r\n // If we didn't find the mesh, it simply means thit axis won't have transforms applied as mapped axis values change.\r\n Logger.Warn(\r\n \"Missing axis submesh under mesh with name: \" +\r\n axisMeshName +\r\n \"(VALUE: \" +\r\n !!axisMeshInfo.value +\r\n \", MIN: \" +\r\n !!axisMeshInfo.min +\r\n \", MAX:\" +\r\n !!axisMeshInfo.max +\r\n \")\"\r\n );\r\n }\r\n }\r\n\r\n // Pointing Ray\r\n loadedMeshInfo.pointingPoseNode = getChildByName(rootNode, this._mapping.pointingPoseMeshName);\r\n if (!loadedMeshInfo.pointingPoseNode) {\r\n Logger.Warn(\"Missing pointing pose mesh with name: \" + this._mapping.pointingPoseMeshName);\r\n } else {\r\n this._pointingPoseNode = loadedMeshInfo.pointingPoseNode;\r\n }\r\n\r\n return loadedMeshInfo;\r\n\r\n // Look through all children recursively. This will return null if no mesh exists with the given name.\r\n function getChildByName(node: Node, name: string) {\r\n return <TransformNode>node.getChildren((n) => n.name === name, false)[0];\r\n }\r\n // Look through only immediate children. This will return null if no mesh exists with the given name.\r\n function getImmediateChildByName(node: Node, name: string): TransformNode {\r\n return <TransformNode>node.getChildren((n) => n.name == name, true)[0];\r\n }\r\n }\r\n\r\n /**\r\n * Gets the ray of the controller in the direction the controller is pointing\r\n * @param length the length the resulting ray should be\r\n * @returns a ray in the direction the controller is pointing\r\n */\r\n public getForwardRay(length = 100): Ray {\r\n if (!(this._loadedMeshInfo && this._loadedMeshInfo.pointingPoseNode)) {\r\n return super.getForwardRay(length);\r\n }\r\n\r\n const m = this._loadedMeshInfo.pointingPoseNode.getWorldMatrix();\r\n const origin = m.getTranslation();\r\n\r\n const forward = new Vector3(0, 0, -1);\r\n const forwardWorld = Vector3.TransformNormal(forward, m);\r\n\r\n const direction = Vector3.Normalize(forwardWorld);\r\n\r\n return new Ray(origin, direction, length);\r\n }\r\n\r\n /**\r\n * Disposes of the controller\r\n */\r\n public dispose(): void {\r\n super.dispose();\r\n\r\n this.onTrackpadChangedObservable.clear();\r\n this.onTrackpadValuesChangedObservable.clear();\r\n }\r\n}\r\n\r\n/**\r\n * This class represents a new windows motion controller in XR.\r\n */\r\nexport class XRWindowsMotionController extends WindowsMotionController {\r\n /**\r\n * Changing the original WIndowsMotionController mapping to fir the new mapping\r\n */\r\n protected readonly _mapping = {\r\n // Semantic button names\r\n buttons: [\"trigger\", \"grip\", \"trackpad\", \"thumbstick\", \"menu\"],\r\n // trigger, grip, trackpad, thumbstick, menu\r\n\r\n // A mapping of the button name to glTF model node name\r\n // that should be transformed by button value.\r\n buttonMeshNames: {\r\n trigger: \"SELECT\",\r\n menu: \"MENU\",\r\n grip: \"GRASP\",\r\n thumbstick: \"THUMBSTICK_PRESS\",\r\n trackpad: \"TOUCHPAD_PRESS\",\r\n },\r\n // This mapping is used to translate from the Motion Controller to Babylon semantics\r\n buttonObservableNames: {\r\n trigger: \"onTriggerStateChangedObservable\",\r\n menu: \"onSecondaryButtonStateChangedObservable\",\r\n grip: \"onMainButtonStateChangedObservable\",\r\n thumbstick: \"onThumbstickStateChangedObservable\",\r\n trackpad: \"onTrackpadChangedObservable\",\r\n },\r\n // A mapping of the axis name to glTF model node name\r\n // that should be transformed by axis value.\r\n // This array mirrors the browserGamepad.axes array, such that\r\n // the mesh corresponding to axis 0 is in this array index 0.\r\n axisMeshNames: [\"TOUCHPAD_TOUCH_X\", \"TOUCHPAD_TOUCH_Y\", \"THUMBSTICK_X\", \"THUMBSTICK_Y\"],\r\n // upside down in webxr\r\n pointingPoseMeshName: PoseEnabledController.POINTING_POSE,\r\n };\r\n\r\n /**\r\n * Construct a new XR-Based windows motion controller\r\n *\r\n * @param gamepadInfo the gamepad object from the browser\r\n */\r\n constructor(gamepadInfo: any) {\r\n super(gamepadInfo);\r\n }\r\n\r\n /**\r\n * holds the thumbstick values (X,Y)\r\n */\r\n public thumbstickValues: StickValues = { x: 0, y: 0 };\r\n\r\n /**\r\n * Fired when the thumbstick on this controller is clicked\r\n */\r\n public onThumbstickStateChangedObservable = new Observable<ExtendedGamepadButton>();\r\n /**\r\n * Fired when the thumbstick on this controller is modified\r\n */\r\n public onThumbstickValuesChangedObservable = new Observable<StickValues>();\r\n\r\n /**\r\n * Fired when the touchpad button on this controller is modified\r\n */\r\n public onTrackpadChangedObservable = this.onPadStateChangedObservable;\r\n\r\n /**\r\n * Fired when the touchpad values on this controller are modified\r\n */\r\n public onTrackpadValuesChangedObservable = this.onPadValuesChangedObservable;\r\n\r\n /**\r\n * Fired when the thumbstick button on this controller is modified\r\n * here to prevent breaking changes\r\n */\r\n public get onThumbstickButtonStateChangedObservable(): Observable<ExtendedGamepadButton> {\r\n return this.onThumbstickStateChangedObservable;\r\n }\r\n\r\n /**\r\n * updating the thumbstick(!) and not the trackpad.\r\n * This is named this way due to the difference between WebVR and XR and to avoid\r\n * changing the parent class.\r\n */\r\n protected _updateTrackpad() {\r\n if (this.browserGamepad.axes && (this.browserGamepad.axes[2] != this.thumbstickValues.x || this.browserGamepad.axes[3] != this.thumbstickValues.y)) {\r\n this.trackpad.x = this.browserGamepad[\"axes\"][2];\r\n this.trackpad.y = this.browserGamepad[\"axes\"][3];\r\n this.onThumbstickValuesChangedObservable.notifyObservers(this.trackpad);\r\n }\r\n }\r\n\r\n /**\r\n * Disposes the class with joy\r\n */\r\n public dispose() {\r\n super.dispose();\r\n this.onThumbstickStateChangedObservable.clear();\r\n this.onThumbstickValuesChangedObservable.clear();\r\n }\r\n}\r\n\r\nPoseEnabledControllerHelper._ControllerFactories.push({\r\n canCreate: (gamepadInfo) => {\r\n return gamepadInfo.id.indexOf(WindowsMotionController.GAMEPAD_ID_PREFIX) === 0;\r\n },\r\n create: (gamepadInfo) => {\r\n return new WindowsMotionController(gamepadInfo);\r\n },\r\n});\r\n"]}
@@ -182,6 +182,10 @@ export declare class BoundingBoxGizmo extends Gizmo implements IBoundingBoxGizmo
182
182
  protected _pointerDragBehavior: PointerDragBehavior;
183
183
  protected _coloredMaterial: StandardMaterial;
184
184
  protected _hoverColoredMaterial: StandardMaterial;
185
+ /**
186
+ * Get the pointerDragBehavior
187
+ */
188
+ get pointerDragBehavior(): PointerDragBehavior;
185
189
  /**
186
190
  * Sets the color of the bounding box gizmo
187
191
  * @param color the color to set
@@ -389,6 +389,12 @@ export class BoundingBoxGizmo extends Gizmo {
389
389
  get scaleDragSpeed() {
390
390
  return this._scaleDragSpeed;
391
391
  }
392
+ /**
393
+ * Get the pointerDragBehavior
394
+ */
395
+ get pointerDragBehavior() {
396
+ return this._pointerDragBehavior;
397
+ }
392
398
  /**
393
399
  * Sets the color of the bounding box gizmo
394
400
  * @param color the color to set