@babylonjs/core 6.36.0 → 6.37.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 (194) hide show
  1. package/Cameras/Inputs/arcRotateCameraGamepadInput.js +4 -0
  2. package/Cameras/Inputs/arcRotateCameraGamepadInput.js.map +1 -1
  3. package/Engines/Extensions/engine.dynamicTexture.d.ts +2 -2
  4. package/Engines/Extensions/engine.dynamicTexture.js.map +1 -1
  5. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +28 -3
  6. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
  7. package/Engines/WebGPU/Extensions/engine.rawTexture.js +4 -0
  8. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  9. package/Engines/WebGPU/webgpuBufferManager.js +6 -2
  10. package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
  11. package/Engines/WebGPU/webgpuCacheBindGroups.d.ts +1 -0
  12. package/Engines/WebGPU/webgpuCacheBindGroups.js +12 -0
  13. package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
  14. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +2 -1
  15. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  16. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.d.ts +2 -2
  17. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js +5 -2
  18. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
  19. package/Engines/WebGPU/webgpuCacheSampler.js +3 -0
  20. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  21. package/Engines/WebGPU/webgpuClearQuad.js +2 -1
  22. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  23. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +1 -1
  24. package/Engines/WebGPU/webgpuHardwareTexture.js +23 -5
  25. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  26. package/Engines/WebGPU/webgpuPipelineContext.js +4 -5
  27. package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
  28. package/Engines/WebGPU/webgpuQuerySet.js +10 -4
  29. package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
  30. package/Engines/WebGPU/webgpuTextureHelper.d.ts +8 -53
  31. package/Engines/WebGPU/webgpuTextureHelper.js +4 -996
  32. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  33. package/Engines/WebGPU/webgpuTextureManager.d.ts +56 -0
  34. package/Engines/WebGPU/webgpuTextureManager.js +1012 -0
  35. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -0
  36. package/Engines/engine.d.ts +1 -0
  37. package/Engines/engine.js +9 -2
  38. package/Engines/engine.js.map +1 -1
  39. package/Engines/renderTargetWrapper.d.ts +1 -0
  40. package/Engines/renderTargetWrapper.js +5 -1
  41. package/Engines/renderTargetWrapper.js.map +1 -1
  42. package/Engines/thinEngine.d.ts +1 -0
  43. package/Engines/thinEngine.js +11 -7
  44. package/Engines/thinEngine.js.map +1 -1
  45. package/Engines/webgpuEngine.d.ts +9 -2
  46. package/Engines/webgpuEngine.js +75 -3
  47. package/Engines/webgpuEngine.js.map +1 -1
  48. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +23 -6
  49. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +14 -3
  50. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
  51. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +14 -3
  52. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +12 -11
  53. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  54. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +1 -1
  55. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +1 -1
  56. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  57. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +22 -7
  58. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +15 -9
  59. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  60. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +1 -1
  61. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +1 -1
  62. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  63. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +1 -1
  64. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +1 -1
  65. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +1 -1
  66. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.d.ts +1 -1
  67. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +1 -1
  68. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +1 -1
  69. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +1 -1
  70. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +1 -1
  71. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  72. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +1 -1
  73. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +1 -1
  74. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  75. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +1 -1
  76. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +1 -1
  77. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  78. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +1 -1
  79. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +1 -1
  80. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  81. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +1 -1
  82. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +1 -1
  83. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  84. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +1 -1
  85. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +1 -1
  86. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  87. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +1 -1
  88. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +1 -1
  89. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  90. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +1 -1
  91. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +1 -1
  92. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  93. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +1 -1
  94. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +1 -1
  95. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
  96. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +13 -5
  97. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +9 -5
  98. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  99. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +1 -1
  100. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +1 -1
  101. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  102. package/FlowGraph/flowGraph.d.ts +24 -6
  103. package/FlowGraph/flowGraph.js +12 -12
  104. package/FlowGraph/flowGraph.js.map +1 -1
  105. package/FlowGraph/flowGraphBlock.d.ts +31 -2
  106. package/FlowGraph/flowGraphBlock.js +8 -3
  107. package/FlowGraph/flowGraphBlock.js.map +1 -1
  108. package/FlowGraph/flowGraphContext.d.ts +5 -1
  109. package/FlowGraph/flowGraphContext.js +4 -2
  110. package/FlowGraph/flowGraphContext.js.map +1 -1
  111. package/FlowGraph/flowGraphCoordinator.d.ts +22 -2
  112. package/FlowGraph/flowGraphCoordinator.js +7 -11
  113. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  114. package/FlowGraph/{flowGraphWithOnDoneExecutionBlock.js → flowGraphExecutionBlockWithOutSignal.js} +1 -1
  115. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js.map +1 -0
  116. package/FlowGraph/flowGraphPathConverter.d.ts +13 -0
  117. package/FlowGraph/flowGraphPathConverter.js +31 -0
  118. package/FlowGraph/flowGraphPathConverter.js.map +1 -0
  119. package/FlowGraph/flowGraphPathConverterComponent.d.ts +19 -0
  120. package/FlowGraph/flowGraphPathConverterComponent.js +31 -0
  121. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -0
  122. package/FlowGraph/index.d.ts +0 -1
  123. package/FlowGraph/index.js +0 -1
  124. package/FlowGraph/index.js.map +1 -1
  125. package/FlowGraph/serialization.d.ts +8 -0
  126. package/FlowGraph/serialization.js +12 -4
  127. package/FlowGraph/serialization.js.map +1 -1
  128. package/FlowGraph/typeDefinitions.d.ts +86 -1
  129. package/FlowGraph/typeDefinitions.js.map +1 -1
  130. package/Materials/Textures/dynamicTexture.js +2 -1
  131. package/Materials/Textures/dynamicTexture.js.map +1 -1
  132. package/Materials/Textures/hardwareTextureWrapper.d.ts +1 -1
  133. package/Materials/Textures/hardwareTextureWrapper.js.map +1 -1
  134. package/Materials/Textures/internalTexture.d.ts +6 -2
  135. package/Materials/Textures/internalTexture.js +6 -4
  136. package/Materials/Textures/internalTexture.js.map +1 -1
  137. package/Materials/Textures/renderTargetTexture.js +10 -10
  138. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  139. package/Materials/material.d.ts +1 -1
  140. package/Materials/material.js +3 -1
  141. package/Materials/material.js.map +1 -1
  142. package/Materials/shaderMaterial.js +2 -2
  143. package/Materials/shaderMaterial.js.map +1 -1
  144. package/Materials/uniformBuffer.d.ts +2 -0
  145. package/Materials/uniformBuffer.js +16 -0
  146. package/Materials/uniformBuffer.js.map +1 -1
  147. package/Meshes/GreasedLine/greasedLineMesh.d.ts +2 -1
  148. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  149. package/Meshes/GreasedLine/greasedLineRibbonMesh.d.ts +2 -1
  150. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  151. package/Meshes/WebGPU/webgpuDataBuffer.d.ts +1 -0
  152. package/Meshes/WebGPU/webgpuDataBuffer.js +2 -0
  153. package/Meshes/WebGPU/webgpuDataBuffer.js.map +1 -1
  154. package/Meshes/geometry.js +3 -3
  155. package/Meshes/geometry.js.map +1 -1
  156. package/Misc/brdfTextureTools.js +9 -7
  157. package/Misc/brdfTextureTools.js.map +1 -1
  158. package/Misc/rgbdTextureTools.js +37 -37
  159. package/Misc/rgbdTextureTools.js.map +1 -1
  160. package/ObjectModel/index.d.ts +1 -0
  161. package/ObjectModel/index.js +2 -0
  162. package/ObjectModel/index.js.map +1 -0
  163. package/ObjectModel/objectModelInterfaces.d.ts +21 -0
  164. package/ObjectModel/objectModelInterfaces.js +2 -0
  165. package/ObjectModel/objectModelInterfaces.js.map +1 -0
  166. package/Particles/computeShaderParticleSystem.js +2 -2
  167. package/Particles/computeShaderParticleSystem.js.map +1 -1
  168. package/Particles/gpuParticleSystem.js +1 -1
  169. package/Particles/gpuParticleSystem.js.map +1 -1
  170. package/Particles/particleSystem.js +2 -5
  171. package/Particles/particleSystem.js.map +1 -1
  172. package/Rendering/fluidRenderer/fluidRenderer.js +1 -6
  173. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  174. package/Rendering/renderingManager.js +1 -1
  175. package/Rendering/renderingManager.js.map +1 -1
  176. package/XR/features/WebXRControllerTeleportation.d.ts +9 -1
  177. package/XR/features/WebXRControllerTeleportation.js +10 -0
  178. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  179. package/XR/webXRCamera.js.map +1 -1
  180. package/index.d.ts +1 -0
  181. package/index.js +1 -0
  182. package/index.js.map +1 -1
  183. package/package.json +1 -1
  184. package/types.d.ts +5 -1
  185. package/types.js +0 -2
  186. package/types.js.map +1 -1
  187. package/FlowGraph/flowGraphPath.d.ts +0 -45
  188. package/FlowGraph/flowGraphPath.js +0 -156
  189. package/FlowGraph/flowGraphPath.js.map +0 -1
  190. package/FlowGraph/flowGraphPathComponent.d.ts +0 -42
  191. package/FlowGraph/flowGraphPathComponent.js +0 -51
  192. package/FlowGraph/flowGraphPathComponent.js.map +0 -1
  193. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js.map +0 -1
  194. /package/FlowGraph/{flowGraphWithOnDoneExecutionBlock.d.ts → flowGraphExecutionBlockWithOutSignal.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"WebXRControllerTeleportation.js","sourceRoot":"","sources":["../../../../../dev/core/src/XR/features/WebXRControllerTeleportation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAExF,OAAO,EAAE,OAAO,EAAE,UAAU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BAAgB,CAAC,aAAa,AAAjC,CAAkC;AAC7D;;;;GAIG;AACoB,0CAAO,GAAG,CAAC,AAAJ,CAAK;AA0wBvC,oBAAoB,CAAC,eAAe,CAChC,kCAAkC,CAAC,IAAI,EACvC,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE;IAC1B,OAAO,GAAG,EAAE,CAAC,IAAI,kCAAkC,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AACnF,CAAC,EACD,kCAAkC,CAAC,OAAO,EAC1C,IAAI,CACP,CAAC","sourcesContent":["import type { IWebXRFeature } from \"../webXRFeaturesManager\";\r\nimport { WebXRFeaturesManager, WebXRFeatureName } from \"../webXRFeaturesManager\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { WebXRSessionManager } from \"../webXRSessionManager\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { WebXRInput } from \"../webXRInput\";\r\nimport type { WebXRInputSource } from \"../webXRInputSource\";\r\nimport type { IWebXRMotionControllerAxesValue } from \"../motionController/webXRControllerComponent\";\r\nimport { WebXRControllerComponent } from \"../motionController/webXRControllerComponent\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport { Ray } from \"../../Culling/ray\";\r\nimport type { Material } from \"../../Materials/material\";\r\nimport { DynamicTexture } from \"../../Materials/Textures/dynamicTexture\";\r\nimport { CreateCylinder } from \"../../Meshes/Builders/cylinderBuilder\";\r\nimport { SineEase, EasingFunction } from \"../../Animations/easing\";\r\nimport { Animation } from \"../../Animations/animation\";\r\nimport { Axis } from \"../../Maths/math.axis\";\r\nimport { StandardMaterial } from \"../../Materials/standardMaterial\";\r\nimport { CreateGround } from \"../../Meshes/Builders/groundBuilder\";\r\nimport { CreateTorus } from \"../../Meshes/Builders/torusBuilder\";\r\nimport type { PickingInfo } from \"../../Collisions/pickingInfo\";\r\nimport { Curve3 } from \"../../Maths/math.path\";\r\nimport { CreateLines } from \"../../Meshes/Builders/linesBuilder\";\r\nimport { WebXRAbstractFeature } from \"./WebXRAbstractFeature\";\r\nimport { Color3, Color4 } from \"../../Maths/math.color\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { UtilityLayerRenderer } from \"../../Rendering/utilityLayerRenderer\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { setAndStartTimer } from \"../../Misc/timer\";\r\nimport type { LinesMesh } from \"../../Meshes/linesMesh\";\r\n\r\n/**\r\n * The options container for the teleportation module\r\n */\r\nexport interface IWebXRTeleportationOptions {\r\n /**\r\n * if provided, this scene will be used to render meshes.\r\n */\r\n customUtilityLayerScene?: Scene;\r\n /**\r\n * Values to configure the default target mesh\r\n */\r\n defaultTargetMeshOptions?: {\r\n /**\r\n * Fill color of the teleportation area\r\n */\r\n teleportationFillColor?: string;\r\n /**\r\n * Border color for the teleportation area\r\n */\r\n teleportationBorderColor?: string;\r\n /**\r\n * Disable the mesh's animation sequence\r\n */\r\n disableAnimation?: boolean;\r\n /**\r\n * Disable lighting on the material or the ring and arrow\r\n */\r\n disableLighting?: boolean;\r\n /**\r\n * Override the default material of the torus and arrow\r\n */\r\n torusArrowMaterial?: Material;\r\n /**\r\n * Override the default material of the Landing Zone\r\n */\r\n teleportationCircleMaterial?: Material;\r\n };\r\n /**\r\n * A list of meshes to use as floor meshes.\r\n * Meshes can be added and removed after initializing the feature using the\r\n * addFloorMesh and removeFloorMesh functions\r\n * If empty, rotation will still work\r\n */\r\n floorMeshes?: AbstractMesh[];\r\n /**\r\n * use this rendering group id for the meshes (optional)\r\n */\r\n renderingGroupId?: number;\r\n /**\r\n * Should teleportation move only to snap points\r\n */\r\n snapPointsOnly?: boolean;\r\n /**\r\n * An array of points to which the teleportation will snap to.\r\n * If the teleportation ray is in the proximity of one of those points, it will be corrected to this point.\r\n */\r\n snapPositions?: Vector3[];\r\n /**\r\n * How close should the teleportation ray be in order to snap to position.\r\n * Default to 0.8 units (meters)\r\n */\r\n snapToPositionRadius?: number;\r\n /**\r\n * Provide your own teleportation mesh instead of babylon's wonderful doughnut.\r\n * If you want to support rotation, make sure your mesh has a direction indicator.\r\n *\r\n * When left untouched, the default mesh will be initialized.\r\n */\r\n teleportationTargetMesh?: AbstractMesh;\r\n /**\r\n * If main component is used (no thumbstick), how long should the \"long press\" take before teleport\r\n */\r\n timeToTeleport?: number;\r\n /**\r\n * Disable using the thumbstick and use the main component (usually trigger) on long press.\r\n * This will be automatically true if the controller doesn't have a thumbstick or touchpad.\r\n */\r\n useMainComponentOnly?: boolean;\r\n /**\r\n * Should meshes created here be added to a utility layer or the main scene\r\n */\r\n useUtilityLayer?: boolean;\r\n /**\r\n * Babylon XR Input class for controller\r\n */\r\n xrInput: WebXRInput;\r\n\r\n /**\r\n * Meshes that the teleportation ray cannot go through\r\n */\r\n pickBlockerMeshes?: AbstractMesh[];\r\n\r\n /**\r\n * Color of the teleportation ray when it is blocked by a mesh in the pickBlockerMeshes array\r\n * Defaults to red.\r\n */\r\n blockedRayColor?: Color4;\r\n\r\n /**\r\n * Should teleport work only on a specific hand?\r\n */\r\n forceHandedness?: XRHandedness;\r\n\r\n /**\r\n * If provided, this function will be used to generate the ray mesh instead of the lines mesh being used per default\r\n */\r\n generateRayPathMesh?: (points: Vector3[], pickingInfo: PickingInfo) => AbstractMesh;\r\n}\r\n\r\n/**\r\n * This is a teleportation feature to be used with WebXR-enabled motion controllers.\r\n * When enabled and attached, the feature will allow a user to move around and rotate in the scene using\r\n * the input of the attached controllers.\r\n */\r\nexport class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {\r\n private _controllers: {\r\n [controllerUniqueId: string]: {\r\n xrController: WebXRInputSource;\r\n teleportationComponent?: WebXRControllerComponent;\r\n teleportationState: {\r\n forward: boolean;\r\n backwards: boolean;\r\n currentRotation: number;\r\n baseRotation: number;\r\n rotating: boolean;\r\n blocked: boolean;\r\n };\r\n onAxisChangedObserver?: Nullable<Observer<IWebXRMotionControllerAxesValue>>;\r\n onButtonChangedObserver?: Nullable<Observer<WebXRControllerComponent>>;\r\n };\r\n } = {};\r\n private _currentTeleportationControllerId: string;\r\n private _floorMeshes: AbstractMesh[];\r\n private _quadraticBezierCurve: Nullable<AbstractMesh>;\r\n private _selectionFeature: Nullable<IWebXRFeature>;\r\n private _snapToPositions: Vector3[];\r\n private _snappedToPoint: boolean = false;\r\n private _teleportationRingMaterial?: StandardMaterial;\r\n private _blockedRayColor: Color4;\r\n private _cachedColor4White = new Color4(1, 1, 1, 1);\r\n private _tmpRay = new Ray(new Vector3(), new Vector3());\r\n private _tmpVector = new Vector3();\r\n private _tmpQuaternion = new Quaternion();\r\n\r\n /**\r\n * Skip the next teleportation. This can be controlled by the user to prevent the user from teleportation\r\n * to sections that are not yet \"unlocked\", but should still show the teleportation mesh.\r\n */\r\n public skipNextTeleportation = false;\r\n\r\n /**\r\n * The module's name\r\n */\r\n public static readonly Name = WebXRFeatureName.TELEPORTATION;\r\n /**\r\n * The (Babylon) version of this module.\r\n * This is an integer representing the implementation version.\r\n * This number does not correspond to the webxr specs version\r\n */\r\n public static readonly Version = 1;\r\n\r\n /**\r\n * Is movement backwards enabled\r\n */\r\n public backwardsMovementEnabled = true;\r\n /**\r\n * Distance to travel when moving backwards\r\n */\r\n public backwardsTeleportationDistance: number = 0.7;\r\n /**\r\n * The distance from the user to the inspection point in the direction of the controller\r\n * A higher number will allow the user to move further\r\n * defaults to 5 (meters, in xr units)\r\n */\r\n public parabolicCheckRadius: number = 5;\r\n /**\r\n * Should the module support parabolic ray on top of direct ray\r\n * If enabled, the user will be able to point \"at the sky\" and move according to predefined radius distance\r\n * Very helpful when moving between floors / different heights\r\n */\r\n public parabolicRayEnabled: boolean = true;\r\n\r\n /**\r\n * The second type of ray - straight line.\r\n * Should it be enabled or should the parabolic line be the only one.\r\n */\r\n public straightRayEnabled: boolean = true;\r\n /**\r\n * How much rotation should be applied when rotating right and left\r\n */\r\n public rotationAngle: number = Math.PI / 8;\r\n\r\n /**\r\n * This observable will notify when the target mesh position was updated.\r\n * The picking info it provides contains the point to which the target mesh will move ()\r\n */\r\n public onTargetMeshPositionUpdatedObservable: Observable<PickingInfo> = new Observable();\r\n\r\n /**\r\n * Is teleportation enabled. Can be used to allow rotation only.\r\n */\r\n public teleportationEnabled: boolean = true;\r\n\r\n private _rotationEnabled: boolean = true;\r\n\r\n /**\r\n * Is rotation enabled when moving forward?\r\n * Disabling this feature will prevent the user from deciding the direction when teleporting\r\n */\r\n public get rotationEnabled(): boolean {\r\n return this._rotationEnabled;\r\n }\r\n\r\n /**\r\n * Sets whether rotation is enabled or not\r\n * @param enabled is rotation enabled when teleportation is shown\r\n */\r\n public set rotationEnabled(enabled: boolean) {\r\n this._rotationEnabled = enabled;\r\n\r\n if (this._options.teleportationTargetMesh) {\r\n const children = this._options.teleportationTargetMesh.getChildMeshes(false, (node) => node.name === \"rotationCone\");\r\n if (children[0]) {\r\n children[0].setEnabled(enabled);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Exposes the currently set teleportation target mesh.\r\n */\r\n public get teleportationTargetMesh(): Nullable<AbstractMesh> {\r\n return this._options.teleportationTargetMesh || null;\r\n }\r\n\r\n /**\r\n * constructs a new teleportation system\r\n * @param _xrSessionManager an instance of WebXRSessionManager\r\n * @param _options configuration object for this feature\r\n */\r\n constructor(\r\n _xrSessionManager: WebXRSessionManager,\r\n private _options: IWebXRTeleportationOptions\r\n ) {\r\n super(_xrSessionManager);\r\n // create default mesh if not provided\r\n if (!this._options.teleportationTargetMesh) {\r\n this._createDefaultTargetMesh();\r\n }\r\n\r\n this._floorMeshes = this._options.floorMeshes || [];\r\n this._snapToPositions = this._options.snapPositions || [];\r\n this._blockedRayColor = this._options.blockedRayColor || new Color4(1, 0, 0, 0.75);\r\n\r\n this._setTargetMeshVisibility(false);\r\n }\r\n\r\n /**\r\n * Get the snapPointsOnly flag\r\n */\r\n public get snapPointsOnly(): boolean {\r\n return !!this._options.snapPointsOnly;\r\n }\r\n\r\n /**\r\n * Sets the snapPointsOnly flag\r\n * @param snapToPoints should teleportation be exclusively to snap points\r\n */\r\n public set snapPointsOnly(snapToPoints: boolean) {\r\n this._options.snapPointsOnly = snapToPoints;\r\n }\r\n\r\n /**\r\n * Add a new mesh to the floor meshes array\r\n * @param mesh the mesh to use as floor mesh\r\n */\r\n public addFloorMesh(mesh: AbstractMesh) {\r\n this._floorMeshes.push(mesh);\r\n }\r\n\r\n /**\r\n * Add a mesh to the list of meshes blocking the teleportation ray\r\n * @param mesh The mesh to add to the teleportation-blocking meshes\r\n */\r\n public addBlockerMesh(mesh: AbstractMesh) {\r\n this._options.pickBlockerMeshes = this._options.pickBlockerMeshes || [];\r\n this._options.pickBlockerMeshes.push(mesh);\r\n }\r\n\r\n /**\r\n * Add a new snap-to point to fix teleportation to this position\r\n * @param newSnapPoint The new Snap-To point\r\n */\r\n public addSnapPoint(newSnapPoint: Vector3) {\r\n this._snapToPositions.push(newSnapPoint);\r\n }\r\n\r\n public attach(): boolean {\r\n if (!super.attach()) {\r\n return false;\r\n }\r\n\r\n // Safety reset\r\n this._currentTeleportationControllerId = \"\";\r\n\r\n this._options.xrInput.controllers.forEach(this._attachController);\r\n this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable, this._attachController);\r\n this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable, (controller) => {\r\n // REMOVE the controller\r\n this._detachController(controller.uniqueId);\r\n });\r\n\r\n return true;\r\n }\r\n\r\n public detach(): boolean {\r\n if (!super.detach()) {\r\n return false;\r\n }\r\n\r\n Object.keys(this._controllers).forEach((controllerId) => {\r\n this._detachController(controllerId);\r\n });\r\n\r\n this._setTargetMeshVisibility(false);\r\n this._currentTeleportationControllerId = \"\";\r\n this._controllers = {};\r\n\r\n return true;\r\n }\r\n\r\n public dispose(): void {\r\n super.dispose();\r\n this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.dispose(false, true);\r\n }\r\n\r\n /**\r\n * Remove a mesh from the floor meshes array\r\n * @param mesh the mesh to remove\r\n */\r\n public removeFloorMesh(mesh: AbstractMesh) {\r\n const index = this._floorMeshes.indexOf(mesh);\r\n if (index !== -1) {\r\n this._floorMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the blocker meshes array\r\n * @param mesh the mesh to remove\r\n */\r\n public removeBlockerMesh(mesh: AbstractMesh) {\r\n this._options.pickBlockerMeshes = this._options.pickBlockerMeshes || [];\r\n const index = this._options.pickBlockerMeshes.indexOf(mesh);\r\n if (index !== -1) {\r\n this._options.pickBlockerMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the floor meshes array using its name\r\n * @param name the mesh name to remove\r\n */\r\n public removeFloorMeshByName(name: string) {\r\n const mesh = this._xrSessionManager.scene.getMeshByName(name);\r\n if (mesh) {\r\n this.removeFloorMesh(mesh);\r\n }\r\n }\r\n\r\n /**\r\n * This function will iterate through the array, searching for this point or equal to it. It will then remove it from the snap-to array\r\n * @param snapPointToRemove the point (or a clone of it) to be removed from the array\r\n * @returns was the point found and removed or not\r\n */\r\n public removeSnapPoint(snapPointToRemove: Vector3): boolean {\r\n // check if the object is in the array\r\n let index = this._snapToPositions.indexOf(snapPointToRemove);\r\n // if not found as an object, compare to the points\r\n if (index === -1) {\r\n for (let i = 0; i < this._snapToPositions.length; ++i) {\r\n // equals? index is i, break the loop\r\n if (this._snapToPositions[i].equals(snapPointToRemove)) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n }\r\n // index is not -1? remove the object\r\n if (index !== -1) {\r\n this._snapToPositions.splice(index, 1);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * This function sets a selection feature that will be disabled when\r\n * the forward ray is shown and will be reattached when hidden.\r\n * This is used to remove the selection rays when moving.\r\n * @param selectionFeature the feature to disable when forward movement is enabled\r\n */\r\n public setSelectionFeature(selectionFeature: Nullable<IWebXRFeature>) {\r\n this._selectionFeature = selectionFeature;\r\n }\r\n\r\n protected _onXRFrame(_xrFrame: XRFrame) {\r\n const frame = this._xrSessionManager.currentFrame;\r\n const scene = this._xrSessionManager.scene;\r\n if (!this.attach || !frame) {\r\n return;\r\n }\r\n\r\n // render target if needed\r\n const targetMesh = this._options.teleportationTargetMesh;\r\n if (this._currentTeleportationControllerId) {\r\n if (!targetMesh) {\r\n return;\r\n }\r\n targetMesh.rotationQuaternion = targetMesh.rotationQuaternion || new Quaternion();\r\n const controllerData = this._controllers[this._currentTeleportationControllerId];\r\n if (controllerData && controllerData.teleportationState.forward) {\r\n // set the rotation\r\n Quaternion.RotationYawPitchRollToRef(\r\n controllerData.teleportationState.currentRotation + controllerData.teleportationState.baseRotation,\r\n 0,\r\n 0,\r\n targetMesh.rotationQuaternion\r\n );\r\n // set the ray and position\r\n\r\n let hitPossible = false;\r\n controllerData.xrController.getWorldPointerRayToRef(this._tmpRay);\r\n if (this.straightRayEnabled) {\r\n // first check if direct ray possible\r\n // pick grounds that are LOWER only. upper will use parabolic path\r\n const pick = scene.pickWithRay(this._tmpRay, (o) => {\r\n // check for mesh-blockers\r\n if (this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(o) !== -1) {\r\n return true;\r\n }\r\n const index = this._floorMeshes.indexOf(o);\r\n if (index === -1) {\r\n return false;\r\n }\r\n return this._floorMeshes[index].absolutePosition.y < this._options.xrInput.xrCamera.globalPosition.y;\r\n });\r\n if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {\r\n controllerData.teleportationState.blocked = true;\r\n this._setTargetMeshVisibility(false);\r\n this._showParabolicPath(pick);\r\n return;\r\n } else if (pick && pick.pickedPoint) {\r\n controllerData.teleportationState.blocked = false;\r\n hitPossible = true;\r\n this._setTargetMeshPosition(pick);\r\n this._setTargetMeshVisibility(true);\r\n this._showParabolicPath(pick);\r\n }\r\n }\r\n // straight ray is still the main ray, but disabling the straight line will force parabolic line.\r\n if (this.parabolicRayEnabled && !hitPossible) {\r\n // radius compensation according to pointer rotation around X\r\n const xRotation = controllerData.xrController.pointer.rotationQuaternion!.toEulerAngles().x;\r\n const compensation = 1 + (Math.PI / 2 - Math.abs(xRotation));\r\n // check parabolic ray\r\n const radius = this.parabolicCheckRadius * compensation;\r\n this._tmpRay.origin.addToRef(this._tmpRay.direction.scale(radius * 2), this._tmpVector);\r\n this._tmpVector.y = this._tmpRay.origin.y;\r\n this._tmpRay.origin.addInPlace(this._tmpRay.direction.scale(radius));\r\n this._tmpVector.subtractToRef(this._tmpRay.origin, this._tmpRay.direction);\r\n this._tmpRay.direction.normalize();\r\n\r\n const pick = scene.pickWithRay(this._tmpRay, (o) => {\r\n // check for mesh-blockers\r\n if (this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(o) !== -1) {\r\n return true;\r\n }\r\n return this._floorMeshes.indexOf(o) !== -1;\r\n });\r\n if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {\r\n controllerData.teleportationState.blocked = true;\r\n this._setTargetMeshVisibility(false);\r\n this._showParabolicPath(pick);\r\n return;\r\n } else if (pick && pick.pickedPoint) {\r\n controllerData.teleportationState.blocked = false;\r\n hitPossible = true;\r\n this._setTargetMeshPosition(pick);\r\n this._setTargetMeshVisibility(true);\r\n this._showParabolicPath(pick);\r\n }\r\n }\r\n\r\n // if needed, set visible:\r\n this._setTargetMeshVisibility(hitPossible);\r\n } else {\r\n this._setTargetMeshVisibility(false);\r\n }\r\n } else {\r\n this._disposeBezierCurve();\r\n this._setTargetMeshVisibility(false);\r\n }\r\n }\r\n\r\n private _attachController = (xrController: WebXRInputSource) => {\r\n if (this._controllers[xrController.uniqueId] || (this._options.forceHandedness && xrController.inputSource.handedness !== this._options.forceHandedness)) {\r\n // already attached\r\n return;\r\n }\r\n this._controllers[xrController.uniqueId] = {\r\n xrController,\r\n teleportationState: {\r\n forward: false,\r\n backwards: false,\r\n rotating: false,\r\n currentRotation: 0,\r\n baseRotation: 0,\r\n blocked: false,\r\n },\r\n };\r\n const controllerData = this._controllers[xrController.uniqueId];\r\n // motion controller only available to gamepad-enabled input sources.\r\n if (controllerData.xrController.inputSource.targetRayMode === \"tracked-pointer\" && controllerData.xrController.inputSource.gamepad) {\r\n // motion controller support\r\n const initMotionController = () => {\r\n if (xrController.motionController) {\r\n const movementController =\r\n xrController.motionController.getComponentOfType(WebXRControllerComponent.THUMBSTICK_TYPE) ||\r\n xrController.motionController.getComponentOfType(WebXRControllerComponent.TOUCHPAD_TYPE);\r\n if (!movementController || this._options.useMainComponentOnly) {\r\n // use trigger to move on long press\r\n const mainComponent = xrController.motionController.getMainComponent();\r\n if (!mainComponent) {\r\n return;\r\n }\r\n controllerData.teleportationComponent = mainComponent;\r\n controllerData.onButtonChangedObserver = mainComponent.onButtonStateChangedObservable.add(() => {\r\n if (!this.teleportationEnabled) {\r\n return;\r\n }\r\n // did \"pressed\" changed?\r\n if (mainComponent.changes.pressed) {\r\n if (mainComponent.changes.pressed.current) {\r\n // simulate \"forward\" thumbstick push\r\n controllerData.teleportationState.forward = true;\r\n this._currentTeleportationControllerId = controllerData.xrController.uniqueId;\r\n controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;\r\n controllerData.teleportationState.currentRotation = 0;\r\n const timeToSelect = this._options.timeToTeleport || 3000;\r\n setAndStartTimer({\r\n timeout: timeToSelect,\r\n contextObservable: this._xrSessionManager.onXRFrameObservable,\r\n breakCondition: () => !mainComponent.pressed,\r\n onEnded: () => {\r\n if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId && controllerData.teleportationState.forward) {\r\n this._teleportForward(xrController.uniqueId);\r\n }\r\n },\r\n });\r\n } else {\r\n controllerData.teleportationState.forward = false;\r\n this._currentTeleportationControllerId = \"\";\r\n }\r\n }\r\n });\r\n } else {\r\n controllerData.teleportationComponent = movementController;\r\n // use thumbstick (or touchpad if thumbstick not available)\r\n controllerData.onAxisChangedObserver = movementController.onAxisValueChangedObservable.add((axesData) => {\r\n if (axesData.y <= 0.7 && controllerData.teleportationState.backwards) {\r\n controllerData.teleportationState.backwards = false;\r\n }\r\n if (axesData.y > 0.7 && !controllerData.teleportationState.forward && this.backwardsMovementEnabled && !this.snapPointsOnly) {\r\n // teleport backwards\r\n\r\n // General gist: Go Back N units, cast a ray towards the floor. If collided, move.\r\n if (!controllerData.teleportationState.backwards) {\r\n controllerData.teleportationState.backwards = true;\r\n // teleport backwards ONCE\r\n this._tmpQuaternion.copyFrom(this._options.xrInput.xrCamera.rotationQuaternion!);\r\n this._tmpQuaternion.toEulerAnglesToRef(this._tmpVector);\r\n // get only the y rotation\r\n this._tmpVector.x = 0;\r\n this._tmpVector.z = 0;\r\n // get the quaternion\r\n Quaternion.FromEulerVectorToRef(this._tmpVector, this._tmpQuaternion);\r\n this._tmpVector.set(0, 0, this.backwardsTeleportationDistance * (this._xrSessionManager.scene.useRightHandedSystem ? 1.0 : -1.0));\r\n this._tmpVector.rotateByQuaternionToRef(this._tmpQuaternion, this._tmpVector);\r\n this._tmpVector.addInPlace(this._options.xrInput.xrCamera.position);\r\n this._tmpRay.origin.copyFrom(this._tmpVector);\r\n // This will prevent the user from \"falling\" to a lower platform!\r\n // TODO - should this be a flag? 'allow falling to lower platforms'?\r\n this._tmpRay.length = this._options.xrInput.xrCamera.realWorldHeight + 0.1;\r\n // Right handed system had here \"1\" instead of -1. This is unneeded.\r\n this._tmpRay.direction.set(0, -1, 0);\r\n const pick = this._xrSessionManager.scene.pickWithRay(this._tmpRay, (o) => {\r\n return this._floorMeshes.indexOf(o) !== -1;\r\n });\r\n\r\n // pick must exist, but stay safe\r\n if (pick && pick.pickedPoint) {\r\n // Teleport the users feet to where they targeted. Ignore the Y axis.\r\n // If the \"falling to lower platforms\" feature is implemented the Y axis should be set here as well\r\n this._options.xrInput.xrCamera.position.x = pick.pickedPoint.x;\r\n this._options.xrInput.xrCamera.position.z = pick.pickedPoint.z;\r\n }\r\n }\r\n }\r\n if (axesData.y < -0.7 && !this._currentTeleportationControllerId && !controllerData.teleportationState.rotating && this.teleportationEnabled) {\r\n controllerData.teleportationState.forward = true;\r\n this._currentTeleportationControllerId = controllerData.xrController.uniqueId;\r\n controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;\r\n }\r\n if (axesData.x) {\r\n if (!controllerData.teleportationState.forward) {\r\n if (!controllerData.teleportationState.rotating && Math.abs(axesData.x) > 0.7) {\r\n // rotate in the right direction positive is right\r\n controllerData.teleportationState.rotating = true;\r\n const rotation = this.rotationAngle * (axesData.x > 0 ? 1 : -1) * (this._xrSessionManager.scene.useRightHandedSystem ? -1 : 1);\r\n Quaternion.FromEulerAngles(0, rotation, 0).multiplyToRef(\r\n this._options.xrInput.xrCamera.rotationQuaternion,\r\n this._options.xrInput.xrCamera.rotationQuaternion\r\n );\r\n }\r\n } else {\r\n if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId) {\r\n // set the rotation of the forward movement\r\n if (this.rotationEnabled) {\r\n setTimeout(() => {\r\n controllerData.teleportationState.currentRotation = Math.atan2(\r\n axesData.x,\r\n axesData.y * (this._xrSessionManager.scene.useRightHandedSystem ? 1 : -1)\r\n );\r\n });\r\n } else {\r\n controllerData.teleportationState.currentRotation = 0;\r\n }\r\n }\r\n }\r\n } else {\r\n controllerData.teleportationState.rotating = false;\r\n }\r\n\r\n if (axesData.x === 0 && axesData.y === 0) {\r\n if (controllerData.teleportationState.blocked) {\r\n controllerData.teleportationState.blocked = false;\r\n this._setTargetMeshVisibility(false);\r\n }\r\n if (controllerData.teleportationState.forward) {\r\n this._teleportForward(xrController.uniqueId);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n };\r\n if (xrController.motionController) {\r\n initMotionController();\r\n } else {\r\n xrController.onMotionControllerInitObservable.addOnce(() => {\r\n initMotionController();\r\n });\r\n }\r\n } else {\r\n this._xrSessionManager.scene.onPointerObservable.add((pointerInfo) => {\r\n if (pointerInfo.type === PointerEventTypes.POINTERDOWN) {\r\n controllerData.teleportationState.forward = true;\r\n this._currentTeleportationControllerId = controllerData.xrController.uniqueId;\r\n controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;\r\n controllerData.teleportationState.currentRotation = 0;\r\n const timeToSelect = this._options.timeToTeleport || 3000;\r\n setAndStartTimer({\r\n timeout: timeToSelect,\r\n contextObservable: this._xrSessionManager.onXRFrameObservable,\r\n onEnded: () => {\r\n if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId && controllerData.teleportationState.forward) {\r\n this._teleportForward(xrController.uniqueId);\r\n }\r\n },\r\n });\r\n } else if (pointerInfo.type === PointerEventTypes.POINTERUP) {\r\n controllerData.teleportationState.forward = false;\r\n this._currentTeleportationControllerId = \"\";\r\n }\r\n });\r\n }\r\n };\r\n\r\n private _createDefaultTargetMesh() {\r\n // set defaults\r\n this._options.defaultTargetMeshOptions = this._options.defaultTargetMeshOptions || {};\r\n const sceneToRenderTo = this._options.useUtilityLayer\r\n ? this._options.customUtilityLayerScene || UtilityLayerRenderer.DefaultUtilityLayer.utilityLayerScene\r\n : this._xrSessionManager.scene;\r\n const teleportationTarget = CreateGround(\"teleportationTarget\", { width: 2, height: 2, subdivisions: 2 }, sceneToRenderTo);\r\n teleportationTarget.isPickable = false;\r\n\r\n if (this._options.defaultTargetMeshOptions.teleportationCircleMaterial) {\r\n teleportationTarget.material = this._options.defaultTargetMeshOptions.teleportationCircleMaterial;\r\n } else {\r\n const length = 512;\r\n const dynamicTexture = new DynamicTexture(\"teleportationPlaneDynamicTexture\", length, sceneToRenderTo, true);\r\n dynamicTexture.hasAlpha = true;\r\n const context = dynamicTexture.getContext();\r\n const centerX = length / 2;\r\n const centerY = length / 2;\r\n const radius = 200;\r\n context.beginPath();\r\n context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);\r\n context.fillStyle = this._options.defaultTargetMeshOptions.teleportationFillColor || \"#444444\";\r\n context.fill();\r\n context.lineWidth = 10;\r\n context.strokeStyle = this._options.defaultTargetMeshOptions.teleportationBorderColor || \"#FFFFFF\";\r\n context.stroke();\r\n context.closePath();\r\n dynamicTexture.update();\r\n const teleportationCircleMaterial = new StandardMaterial(\"teleportationPlaneMaterial\", sceneToRenderTo);\r\n teleportationCircleMaterial.diffuseTexture = dynamicTexture;\r\n teleportationTarget.material = teleportationCircleMaterial;\r\n }\r\n\r\n const torus = CreateTorus(\r\n \"torusTeleportation\",\r\n {\r\n diameter: 0.75,\r\n thickness: 0.1,\r\n tessellation: 20,\r\n },\r\n sceneToRenderTo\r\n );\r\n torus.isPickable = false;\r\n torus.parent = teleportationTarget;\r\n if (!this._options.defaultTargetMeshOptions.disableAnimation) {\r\n const animationInnerCircle = new Animation(\"animationInnerCircle\", \"position.y\", 30, Animation.ANIMATIONTYPE_FLOAT, Animation.ANIMATIONLOOPMODE_CYCLE);\r\n const keys = [];\r\n keys.push({\r\n frame: 0,\r\n value: 0,\r\n });\r\n keys.push({\r\n frame: 30,\r\n value: 0.4,\r\n });\r\n keys.push({\r\n frame: 60,\r\n value: 0,\r\n });\r\n animationInnerCircle.setKeys(keys);\r\n const easingFunction = new SineEase();\r\n easingFunction.setEasingMode(EasingFunction.EASINGMODE_EASEINOUT);\r\n animationInnerCircle.setEasingFunction(easingFunction);\r\n torus.animations = [];\r\n torus.animations.push(animationInnerCircle);\r\n sceneToRenderTo.beginAnimation(torus, 0, 60, true);\r\n }\r\n\r\n const cone = CreateCylinder(\"rotationCone\", { diameterTop: 0, tessellation: 4 }, sceneToRenderTo);\r\n cone.isPickable = false;\r\n cone.scaling.set(0.5, 0.12, 0.2);\r\n\r\n cone.rotate(Axis.X, Math.PI / 2);\r\n\r\n cone.position.z = 0.6;\r\n cone.parent = torus;\r\n\r\n if (this._options.defaultTargetMeshOptions.torusArrowMaterial) {\r\n torus.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;\r\n cone.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;\r\n } else {\r\n const torusConeMaterial = new StandardMaterial(\"torusConsMat\", sceneToRenderTo);\r\n torusConeMaterial.disableLighting = !!this._options.defaultTargetMeshOptions.disableLighting;\r\n if (torusConeMaterial.disableLighting) {\r\n torusConeMaterial.emissiveColor = new Color3(0.3, 0.3, 1.0);\r\n } else {\r\n torusConeMaterial.diffuseColor = new Color3(0.3, 0.3, 1.0);\r\n }\r\n torusConeMaterial.alpha = 0.9;\r\n torus.material = torusConeMaterial;\r\n cone.material = torusConeMaterial;\r\n this._teleportationRingMaterial = torusConeMaterial;\r\n }\r\n\r\n if (this._options.renderingGroupId !== undefined) {\r\n teleportationTarget.renderingGroupId = this._options.renderingGroupId;\r\n torus.renderingGroupId = this._options.renderingGroupId;\r\n cone.renderingGroupId = this._options.renderingGroupId;\r\n }\r\n\r\n this._options.teleportationTargetMesh = teleportationTarget;\r\n // hide the teleportation target mesh right after creating it.\r\n this._setTargetMeshVisibility(false);\r\n }\r\n\r\n private _detachController(xrControllerUniqueId: string) {\r\n const controllerData = this._controllers[xrControllerUniqueId];\r\n if (!controllerData) {\r\n return;\r\n }\r\n if (controllerData.teleportationComponent) {\r\n if (controllerData.onAxisChangedObserver) {\r\n controllerData.teleportationComponent.onAxisValueChangedObservable.remove(controllerData.onAxisChangedObserver);\r\n }\r\n if (controllerData.onButtonChangedObserver) {\r\n controllerData.teleportationComponent.onButtonStateChangedObservable.remove(controllerData.onButtonChangedObserver);\r\n }\r\n }\r\n // remove from the map\r\n delete this._controllers[xrControllerUniqueId];\r\n }\r\n\r\n private _findClosestSnapPointWithRadius(realPosition: Vector3, radius: number = this._options.snapToPositionRadius || 0.8) {\r\n let closestPoint: Nullable<Vector3> = null;\r\n let closestDistance = Number.MAX_VALUE;\r\n if (this._snapToPositions.length) {\r\n const radiusSquared = radius * radius;\r\n this._snapToPositions.forEach((position) => {\r\n const dist = Vector3.DistanceSquared(position, realPosition);\r\n if (dist <= radiusSquared && dist < closestDistance) {\r\n closestDistance = dist;\r\n closestPoint = position;\r\n }\r\n });\r\n }\r\n return closestPoint;\r\n }\r\n\r\n private _setTargetMeshPosition(pickInfo: PickingInfo) {\r\n const newPosition = pickInfo.pickedPoint;\r\n if (!this._options.teleportationTargetMesh || !newPosition) {\r\n return;\r\n }\r\n const snapPosition = this._findClosestSnapPointWithRadius(newPosition);\r\n this._snappedToPoint = !!snapPosition;\r\n if (this.snapPointsOnly && !this._snappedToPoint && this._teleportationRingMaterial) {\r\n this._teleportationRingMaterial.diffuseColor.set(1.0, 0.3, 0.3);\r\n } else if (this.snapPointsOnly && this._snappedToPoint && this._teleportationRingMaterial) {\r\n this._teleportationRingMaterial.diffuseColor.set(0.3, 0.3, 1.0);\r\n }\r\n this._options.teleportationTargetMesh.position.copyFrom(snapPosition || newPosition);\r\n this._options.teleportationTargetMesh.position.y += 0.01;\r\n this.onTargetMeshPositionUpdatedObservable.notifyObservers(pickInfo);\r\n }\r\n\r\n private _setTargetMeshVisibility(visible: boolean, force?: boolean) {\r\n if (!this._options.teleportationTargetMesh) {\r\n return;\r\n }\r\n if (this._options.teleportationTargetMesh.isVisible === visible && !force) {\r\n return;\r\n }\r\n this._options.teleportationTargetMesh.isVisible = visible;\r\n this._options.teleportationTargetMesh.getChildren(undefined, false).forEach((m) => {\r\n (<any>m).isVisible = visible;\r\n });\r\n\r\n if (!visible) {\r\n if (this._quadraticBezierCurve) {\r\n this._quadraticBezierCurve.dispose();\r\n this._quadraticBezierCurve = null;\r\n }\r\n if (this._selectionFeature) {\r\n this._selectionFeature.attach();\r\n }\r\n } else {\r\n if (this._selectionFeature) {\r\n this._selectionFeature.detach();\r\n }\r\n }\r\n }\r\n\r\n private _disposeBezierCurve() {\r\n if (this._quadraticBezierCurve) {\r\n this._quadraticBezierCurve.dispose();\r\n this._quadraticBezierCurve = null;\r\n }\r\n }\r\n\r\n private _showParabolicPath(pickInfo: PickingInfo) {\r\n if (!pickInfo.pickedPoint || !this._currentTeleportationControllerId) {\r\n return;\r\n }\r\n\r\n const sceneToRenderTo = this._options.useUtilityLayer\r\n ? this._options.customUtilityLayerScene || UtilityLayerRenderer.DefaultUtilityLayer.utilityLayerScene\r\n : this._xrSessionManager.scene;\r\n\r\n const controllerData = this._controllers[this._currentTeleportationControllerId];\r\n\r\n const quadraticBezierVectors = Curve3.CreateQuadraticBezier(controllerData.xrController.pointer.absolutePosition, pickInfo.ray!.origin, pickInfo.pickedPoint, 25);\r\n const color = controllerData.teleportationState.blocked ? this._blockedRayColor : undefined;\r\n const colorsArray = new Array(26).fill(color || this._cachedColor4White);\r\n if (!this._options.generateRayPathMesh) {\r\n this._quadraticBezierCurve = CreateLines(\r\n \"teleportation path line\",\r\n { points: quadraticBezierVectors.getPoints(), instance: this._quadraticBezierCurve as LinesMesh, updatable: true, colors: colorsArray },\r\n sceneToRenderTo\r\n );\r\n } else {\r\n this._quadraticBezierCurve = this._options.generateRayPathMesh(quadraticBezierVectors.getPoints(), pickInfo);\r\n }\r\n this._quadraticBezierCurve.isPickable = false;\r\n if (this._options.renderingGroupId !== undefined) {\r\n this._quadraticBezierCurve.renderingGroupId = this._options.renderingGroupId;\r\n }\r\n }\r\n\r\n private _teleportForward(controllerId: string) {\r\n const controllerData = this._controllers[controllerId];\r\n if (!controllerData || !controllerData.teleportationState.forward || !this.teleportationEnabled) {\r\n return;\r\n }\r\n controllerData.teleportationState.forward = false;\r\n this._currentTeleportationControllerId = \"\";\r\n if (this.snapPointsOnly && !this._snappedToPoint) {\r\n return;\r\n }\r\n\r\n if (this.skipNextTeleportation) {\r\n this.skipNextTeleportation = false;\r\n return;\r\n }\r\n // do the movement forward here\r\n if (this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.isVisible) {\r\n const height = this._options.xrInput.xrCamera.realWorldHeight;\r\n this._options.xrInput.xrCamera.onBeforeCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);\r\n this._options.xrInput.xrCamera.position.copyFrom(this._options.teleportationTargetMesh.position);\r\n this._options.xrInput.xrCamera.position.y += height;\r\n Quaternion.FromEulerAngles(0, controllerData.teleportationState.currentRotation - (this._xrSessionManager.scene.useRightHandedSystem ? Math.PI : 0), 0).multiplyToRef(\r\n this._options.xrInput.xrCamera.rotationQuaternion,\r\n this._options.xrInput.xrCamera.rotationQuaternion\r\n );\r\n this._options.xrInput.xrCamera.onAfterCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);\r\n }\r\n }\r\n}\r\n\r\nWebXRFeaturesManager.AddWebXRFeature(\r\n WebXRMotionControllerTeleportation.Name,\r\n (xrSessionManager, options) => {\r\n return () => new WebXRMotionControllerTeleportation(xrSessionManager, options);\r\n },\r\n WebXRMotionControllerTeleportation.Version,\r\n true\r\n);\r\n"]}
1
+ {"version":3,"file":"WebXRControllerTeleportation.js","sourceRoot":"","sources":["../../../../../dev/core/src/XR/features/WebXRControllerTeleportation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAExF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAA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AAE,OAAO,EAAE,EAAE;IAC1B,OAAO,GAAG,EAAE,CAAC,IAAI,kCAAkC,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AACnF,CAAC,EACD,kCAAkC,CAAC,OAAO,EAC1C,IAAI,CACP,CAAC","sourcesContent":["import type { IWebXRFeature } from \"../webXRFeaturesManager\";\r\nimport { WebXRFeaturesManager, WebXRFeatureName } from \"../webXRFeaturesManager\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { WebXRSessionManager } from \"../webXRSessionManager\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { WebXRInput } from \"../webXRInput\";\r\nimport type { WebXRInputSource } from \"../webXRInputSource\";\r\nimport type { IWebXRMotionControllerAxesValue } from \"../motionController/webXRControllerComponent\";\r\nimport { WebXRControllerComponent } from \"../motionController/webXRControllerComponent\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport { Ray } from \"../../Culling/ray\";\r\nimport type { Material } from \"../../Materials/material\";\r\nimport { DynamicTexture } from \"../../Materials/Textures/dynamicTexture\";\r\nimport { CreateCylinder } from \"../../Meshes/Builders/cylinderBuilder\";\r\nimport { SineEase, EasingFunction } from \"../../Animations/easing\";\r\nimport { Animation } from \"../../Animations/animation\";\r\nimport { Axis } from \"../../Maths/math.axis\";\r\nimport { StandardMaterial } from \"../../Materials/standardMaterial\";\r\nimport { CreateGround } from \"../../Meshes/Builders/groundBuilder\";\r\nimport { CreateTorus } from \"../../Meshes/Builders/torusBuilder\";\r\nimport type { PickingInfo } from \"../../Collisions/pickingInfo\";\r\nimport { Curve3 } from \"../../Maths/math.path\";\r\nimport { CreateLines } from \"../../Meshes/Builders/linesBuilder\";\r\nimport { WebXRAbstractFeature } from \"./WebXRAbstractFeature\";\r\nimport { Color3, Color4 } from \"../../Maths/math.color\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { UtilityLayerRenderer } from \"../../Rendering/utilityLayerRenderer\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { setAndStartTimer } from \"../../Misc/timer\";\r\nimport type { LinesMesh } from \"../../Meshes/linesMesh\";\r\n\r\n/**\r\n * The options container for the teleportation module\r\n */\r\nexport interface IWebXRTeleportationOptions {\r\n /**\r\n * if provided, this scene will be used to render meshes.\r\n */\r\n customUtilityLayerScene?: Scene;\r\n /**\r\n * Values to configure the default target mesh\r\n */\r\n defaultTargetMeshOptions?: {\r\n /**\r\n * Fill color of the teleportation area\r\n */\r\n teleportationFillColor?: string;\r\n /**\r\n * Border color for the teleportation area\r\n */\r\n teleportationBorderColor?: string;\r\n /**\r\n * Disable the mesh's animation sequence\r\n */\r\n disableAnimation?: boolean;\r\n /**\r\n * Disable lighting on the material or the ring and arrow\r\n */\r\n disableLighting?: boolean;\r\n /**\r\n * Override the default material of the torus and arrow\r\n */\r\n torusArrowMaterial?: Material;\r\n /**\r\n * Override the default material of the Landing Zone\r\n */\r\n teleportationCircleMaterial?: Material;\r\n };\r\n /**\r\n * A list of meshes to use as floor meshes.\r\n * Meshes can be added and removed after initializing the feature using the\r\n * addFloorMesh and removeFloorMesh functions\r\n * If empty, rotation will still work\r\n */\r\n floorMeshes?: AbstractMesh[];\r\n /**\r\n * use this rendering group id for the meshes (optional)\r\n */\r\n renderingGroupId?: number;\r\n /**\r\n * Should teleportation move only to snap points\r\n */\r\n snapPointsOnly?: boolean;\r\n /**\r\n * An array of points to which the teleportation will snap to.\r\n * If the teleportation ray is in the proximity of one of those points, it will be corrected to this point.\r\n */\r\n snapPositions?: Vector3[];\r\n /**\r\n * How close should the teleportation ray be in order to snap to position.\r\n * Default to 0.8 units (meters)\r\n */\r\n snapToPositionRadius?: number;\r\n /**\r\n * Provide your own teleportation mesh instead of babylon's wonderful doughnut.\r\n * If you want to support rotation, make sure your mesh has a direction indicator.\r\n *\r\n * When left untouched, the default mesh will be initialized.\r\n */\r\n teleportationTargetMesh?: AbstractMesh;\r\n /**\r\n * If main component is used (no thumbstick), how long should the \"long press\" take before teleport\r\n */\r\n timeToTeleport?: number;\r\n /**\r\n * Disable using the thumbstick and use the main component (usually trigger) on long press.\r\n * This will be automatically true if the controller doesn't have a thumbstick or touchpad.\r\n */\r\n useMainComponentOnly?: boolean;\r\n /**\r\n * Should meshes created here be added to a utility layer or the main scene\r\n */\r\n useUtilityLayer?: boolean;\r\n /**\r\n * Babylon XR Input class for controller\r\n */\r\n xrInput: WebXRInput;\r\n\r\n /**\r\n * Meshes that the teleportation ray cannot go through\r\n */\r\n pickBlockerMeshes?: AbstractMesh[];\r\n\r\n /**\r\n * Color of the teleportation ray when it is blocked by a mesh in the pickBlockerMeshes array\r\n * Defaults to red.\r\n */\r\n blockedRayColor?: Color4;\r\n\r\n /**\r\n * Should teleport work only on a specific hand?\r\n */\r\n forceHandedness?: XRHandedness;\r\n\r\n /**\r\n * If provided, this function will be used to generate the ray mesh instead of the lines mesh being used per default\r\n */\r\n generateRayPathMesh?: (points: Vector3[], pickingInfo: PickingInfo) => AbstractMesh;\r\n}\r\n\r\n/**\r\n * This is a teleportation feature to be used with WebXR-enabled motion controllers.\r\n * When enabled and attached, the feature will allow a user to move around and rotate in the scene using\r\n * the input of the attached controllers.\r\n */\r\nexport class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {\r\n private _controllers: {\r\n [controllerUniqueId: string]: {\r\n xrController: WebXRInputSource;\r\n teleportationComponent?: WebXRControllerComponent;\r\n teleportationState: {\r\n forward: boolean;\r\n backwards: boolean;\r\n currentRotation: number;\r\n baseRotation: number;\r\n rotating: boolean;\r\n blocked: boolean;\r\n };\r\n onAxisChangedObserver?: Nullable<Observer<IWebXRMotionControllerAxesValue>>;\r\n onButtonChangedObserver?: Nullable<Observer<WebXRControllerComponent>>;\r\n };\r\n } = {};\r\n private _currentTeleportationControllerId: string;\r\n private _floorMeshes: AbstractMesh[];\r\n private _quadraticBezierCurve: Nullable<AbstractMesh>;\r\n private _selectionFeature: Nullable<IWebXRFeature>;\r\n private _snapToPositions: Vector3[];\r\n private _snappedToPoint: boolean = false;\r\n private _teleportationRingMaterial?: StandardMaterial;\r\n private _blockedRayColor: Color4;\r\n private _cachedColor4White = new Color4(1, 1, 1, 1);\r\n private _tmpRay = new Ray(new Vector3(), new Vector3());\r\n private _tmpVector = new Vector3();\r\n private _tmpQuaternion = new Quaternion();\r\n\r\n /**\r\n * Skip the next teleportation. This can be controlled by the user to prevent the user from teleportation\r\n * to sections that are not yet \"unlocked\", but should still show the teleportation mesh.\r\n */\r\n public skipNextTeleportation = false;\r\n\r\n /**\r\n * The module's name\r\n */\r\n public static readonly Name = WebXRFeatureName.TELEPORTATION;\r\n /**\r\n * The (Babylon) version of this module.\r\n * This is an integer representing the implementation version.\r\n * This number does not correspond to the webxr specs version\r\n */\r\n public static readonly Version = 1;\r\n\r\n /**\r\n * Is movement backwards enabled\r\n */\r\n public backwardsMovementEnabled = true;\r\n /**\r\n * Distance to travel when moving backwards\r\n */\r\n public backwardsTeleportationDistance: number = 0.7;\r\n /**\r\n * The distance from the user to the inspection point in the direction of the controller\r\n * A higher number will allow the user to move further\r\n * defaults to 5 (meters, in xr units)\r\n */\r\n public parabolicCheckRadius: number = 5;\r\n /**\r\n * Should the module support parabolic ray on top of direct ray\r\n * If enabled, the user will be able to point \"at the sky\" and move according to predefined radius distance\r\n * Very helpful when moving between floors / different heights\r\n */\r\n public parabolicRayEnabled: boolean = true;\r\n\r\n /**\r\n * The second type of ray - straight line.\r\n * Should it be enabled or should the parabolic line be the only one.\r\n */\r\n public straightRayEnabled: boolean = true;\r\n /**\r\n * How much rotation should be applied when rotating right and left\r\n */\r\n public rotationAngle: number = Math.PI / 8;\r\n\r\n /**\r\n * This observable will notify when the target mesh position was updated.\r\n * The picking info it provides contains the point to which the target mesh will move ()\r\n */\r\n public onTargetMeshPositionUpdatedObservable: Observable<PickingInfo> = new Observable();\r\n\r\n /**\r\n * Is teleportation enabled. Can be used to allow rotation only.\r\n */\r\n public teleportationEnabled: boolean = true;\r\n\r\n private _rotationEnabled: boolean = true;\r\n\r\n /**\r\n * Observable raised before camera rotation\r\n */\r\n public onBeforeCameraTeleportRotation = new Observable<Number>();\r\n\r\n /**\r\n * Observable raised after camera rotation\r\n */\r\n public onAfterCameraTeleportRotation = new Observable<Quaternion>();\r\n\r\n /**\r\n * Is rotation enabled when moving forward?\r\n * Disabling this feature will prevent the user from deciding the direction when teleporting\r\n */\r\n public get rotationEnabled(): boolean {\r\n return this._rotationEnabled;\r\n }\r\n\r\n /**\r\n * Sets whether rotation is enabled or not\r\n * @param enabled is rotation enabled when teleportation is shown\r\n */\r\n public set rotationEnabled(enabled: boolean) {\r\n this._rotationEnabled = enabled;\r\n\r\n if (this._options.teleportationTargetMesh) {\r\n const children = this._options.teleportationTargetMesh.getChildMeshes(false, (node) => node.name === \"rotationCone\");\r\n if (children[0]) {\r\n children[0].setEnabled(enabled);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Exposes the currently set teleportation target mesh.\r\n */\r\n public get teleportationTargetMesh(): Nullable<AbstractMesh> {\r\n return this._options.teleportationTargetMesh || null;\r\n }\r\n\r\n /**\r\n * constructs a new teleportation system\r\n * @param _xrSessionManager an instance of WebXRSessionManager\r\n * @param _options configuration object for this feature\r\n */\r\n constructor(\r\n _xrSessionManager: WebXRSessionManager,\r\n private _options: IWebXRTeleportationOptions\r\n ) {\r\n super(_xrSessionManager);\r\n // create default mesh if not provided\r\n if (!this._options.teleportationTargetMesh) {\r\n this._createDefaultTargetMesh();\r\n }\r\n\r\n this._floorMeshes = this._options.floorMeshes || [];\r\n this._snapToPositions = this._options.snapPositions || [];\r\n this._blockedRayColor = this._options.blockedRayColor || new Color4(1, 0, 0, 0.75);\r\n\r\n this._setTargetMeshVisibility(false);\r\n }\r\n\r\n /**\r\n * Get the snapPointsOnly flag\r\n */\r\n public get snapPointsOnly(): boolean {\r\n return !!this._options.snapPointsOnly;\r\n }\r\n\r\n /**\r\n * Sets the snapPointsOnly flag\r\n * @param snapToPoints should teleportation be exclusively to snap points\r\n */\r\n public set snapPointsOnly(snapToPoints: boolean) {\r\n this._options.snapPointsOnly = snapToPoints;\r\n }\r\n\r\n /**\r\n * Add a new mesh to the floor meshes array\r\n * @param mesh the mesh to use as floor mesh\r\n */\r\n public addFloorMesh(mesh: AbstractMesh) {\r\n this._floorMeshes.push(mesh);\r\n }\r\n\r\n /**\r\n * Add a mesh to the list of meshes blocking the teleportation ray\r\n * @param mesh The mesh to add to the teleportation-blocking meshes\r\n */\r\n public addBlockerMesh(mesh: AbstractMesh) {\r\n this._options.pickBlockerMeshes = this._options.pickBlockerMeshes || [];\r\n this._options.pickBlockerMeshes.push(mesh);\r\n }\r\n\r\n /**\r\n * Add a new snap-to point to fix teleportation to this position\r\n * @param newSnapPoint The new Snap-To point\r\n */\r\n public addSnapPoint(newSnapPoint: Vector3) {\r\n this._snapToPositions.push(newSnapPoint);\r\n }\r\n\r\n public attach(): boolean {\r\n if (!super.attach()) {\r\n return false;\r\n }\r\n\r\n // Safety reset\r\n this._currentTeleportationControllerId = \"\";\r\n\r\n this._options.xrInput.controllers.forEach(this._attachController);\r\n this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable, this._attachController);\r\n this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable, (controller) => {\r\n // REMOVE the controller\r\n this._detachController(controller.uniqueId);\r\n });\r\n\r\n return true;\r\n }\r\n\r\n public detach(): boolean {\r\n if (!super.detach()) {\r\n return false;\r\n }\r\n\r\n Object.keys(this._controllers).forEach((controllerId) => {\r\n this._detachController(controllerId);\r\n });\r\n\r\n this._setTargetMeshVisibility(false);\r\n this._currentTeleportationControllerId = \"\";\r\n this._controllers = {};\r\n\r\n return true;\r\n }\r\n\r\n public dispose(): void {\r\n super.dispose();\r\n this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.dispose(false, true);\r\n }\r\n\r\n /**\r\n * Remove a mesh from the floor meshes array\r\n * @param mesh the mesh to remove\r\n */\r\n public removeFloorMesh(mesh: AbstractMesh) {\r\n const index = this._floorMeshes.indexOf(mesh);\r\n if (index !== -1) {\r\n this._floorMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the blocker meshes array\r\n * @param mesh the mesh to remove\r\n */\r\n public removeBlockerMesh(mesh: AbstractMesh) {\r\n this._options.pickBlockerMeshes = this._options.pickBlockerMeshes || [];\r\n const index = this._options.pickBlockerMeshes.indexOf(mesh);\r\n if (index !== -1) {\r\n this._options.pickBlockerMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the floor meshes array using its name\r\n * @param name the mesh name to remove\r\n */\r\n public removeFloorMeshByName(name: string) {\r\n const mesh = this._xrSessionManager.scene.getMeshByName(name);\r\n if (mesh) {\r\n this.removeFloorMesh(mesh);\r\n }\r\n }\r\n\r\n /**\r\n * This function will iterate through the array, searching for this point or equal to it. It will then remove it from the snap-to array\r\n * @param snapPointToRemove the point (or a clone of it) to be removed from the array\r\n * @returns was the point found and removed or not\r\n */\r\n public removeSnapPoint(snapPointToRemove: Vector3): boolean {\r\n // check if the object is in the array\r\n let index = this._snapToPositions.indexOf(snapPointToRemove);\r\n // if not found as an object, compare to the points\r\n if (index === -1) {\r\n for (let i = 0; i < this._snapToPositions.length; ++i) {\r\n // equals? index is i, break the loop\r\n if (this._snapToPositions[i].equals(snapPointToRemove)) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n }\r\n // index is not -1? remove the object\r\n if (index !== -1) {\r\n this._snapToPositions.splice(index, 1);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * This function sets a selection feature that will be disabled when\r\n * the forward ray is shown and will be reattached when hidden.\r\n * This is used to remove the selection rays when moving.\r\n * @param selectionFeature the feature to disable when forward movement is enabled\r\n */\r\n public setSelectionFeature(selectionFeature: Nullable<IWebXRFeature>) {\r\n this._selectionFeature = selectionFeature;\r\n }\r\n\r\n protected _onXRFrame(_xrFrame: XRFrame) {\r\n const frame = this._xrSessionManager.currentFrame;\r\n const scene = this._xrSessionManager.scene;\r\n if (!this.attach || !frame) {\r\n return;\r\n }\r\n\r\n // render target if needed\r\n const targetMesh = this._options.teleportationTargetMesh;\r\n if (this._currentTeleportationControllerId) {\r\n if (!targetMesh) {\r\n return;\r\n }\r\n targetMesh.rotationQuaternion = targetMesh.rotationQuaternion || new Quaternion();\r\n const controllerData = this._controllers[this._currentTeleportationControllerId];\r\n if (controllerData && controllerData.teleportationState.forward) {\r\n // set the rotation\r\n Quaternion.RotationYawPitchRollToRef(\r\n controllerData.teleportationState.currentRotation + controllerData.teleportationState.baseRotation,\r\n 0,\r\n 0,\r\n targetMesh.rotationQuaternion\r\n );\r\n // set the ray and position\r\n\r\n let hitPossible = false;\r\n controllerData.xrController.getWorldPointerRayToRef(this._tmpRay);\r\n if (this.straightRayEnabled) {\r\n // first check if direct ray possible\r\n // pick grounds that are LOWER only. upper will use parabolic path\r\n const pick = scene.pickWithRay(this._tmpRay, (o) => {\r\n // check for mesh-blockers\r\n if (this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(o) !== -1) {\r\n return true;\r\n }\r\n const index = this._floorMeshes.indexOf(o);\r\n if (index === -1) {\r\n return false;\r\n }\r\n return this._floorMeshes[index].absolutePosition.y < this._options.xrInput.xrCamera.globalPosition.y;\r\n });\r\n if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {\r\n controllerData.teleportationState.blocked = true;\r\n this._setTargetMeshVisibility(false);\r\n this._showParabolicPath(pick);\r\n return;\r\n } else if (pick && pick.pickedPoint) {\r\n controllerData.teleportationState.blocked = false;\r\n hitPossible = true;\r\n this._setTargetMeshPosition(pick);\r\n this._setTargetMeshVisibility(true);\r\n this._showParabolicPath(pick);\r\n }\r\n }\r\n // straight ray is still the main ray, but disabling the straight line will force parabolic line.\r\n if (this.parabolicRayEnabled && !hitPossible) {\r\n // radius compensation according to pointer rotation around X\r\n const xRotation = controllerData.xrController.pointer.rotationQuaternion!.toEulerAngles().x;\r\n const compensation = 1 + (Math.PI / 2 - Math.abs(xRotation));\r\n // check parabolic ray\r\n const radius = this.parabolicCheckRadius * compensation;\r\n this._tmpRay.origin.addToRef(this._tmpRay.direction.scale(radius * 2), this._tmpVector);\r\n this._tmpVector.y = this._tmpRay.origin.y;\r\n this._tmpRay.origin.addInPlace(this._tmpRay.direction.scale(radius));\r\n this._tmpVector.subtractToRef(this._tmpRay.origin, this._tmpRay.direction);\r\n this._tmpRay.direction.normalize();\r\n\r\n const pick = scene.pickWithRay(this._tmpRay, (o) => {\r\n // check for mesh-blockers\r\n if (this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(o) !== -1) {\r\n return true;\r\n }\r\n return this._floorMeshes.indexOf(o) !== -1;\r\n });\r\n if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {\r\n controllerData.teleportationState.blocked = true;\r\n this._setTargetMeshVisibility(false);\r\n this._showParabolicPath(pick);\r\n return;\r\n } else if (pick && pick.pickedPoint) {\r\n controllerData.teleportationState.blocked = false;\r\n hitPossible = true;\r\n this._setTargetMeshPosition(pick);\r\n this._setTargetMeshVisibility(true);\r\n this._showParabolicPath(pick);\r\n }\r\n }\r\n\r\n // if needed, set visible:\r\n this._setTargetMeshVisibility(hitPossible);\r\n } else {\r\n this._setTargetMeshVisibility(false);\r\n }\r\n } else {\r\n this._disposeBezierCurve();\r\n this._setTargetMeshVisibility(false);\r\n }\r\n }\r\n\r\n private _attachController = (xrController: WebXRInputSource) => {\r\n if (this._controllers[xrController.uniqueId] || (this._options.forceHandedness && xrController.inputSource.handedness !== this._options.forceHandedness)) {\r\n // already attached\r\n return;\r\n }\r\n this._controllers[xrController.uniqueId] = {\r\n xrController,\r\n teleportationState: {\r\n forward: false,\r\n backwards: false,\r\n rotating: false,\r\n currentRotation: 0,\r\n baseRotation: 0,\r\n blocked: false,\r\n },\r\n };\r\n const controllerData = this._controllers[xrController.uniqueId];\r\n // motion controller only available to gamepad-enabled input sources.\r\n if (controllerData.xrController.inputSource.targetRayMode === \"tracked-pointer\" && controllerData.xrController.inputSource.gamepad) {\r\n // motion controller support\r\n const initMotionController = () => {\r\n if (xrController.motionController) {\r\n const movementController =\r\n xrController.motionController.getComponentOfType(WebXRControllerComponent.THUMBSTICK_TYPE) ||\r\n xrController.motionController.getComponentOfType(WebXRControllerComponent.TOUCHPAD_TYPE);\r\n if (!movementController || this._options.useMainComponentOnly) {\r\n // use trigger to move on long press\r\n const mainComponent = xrController.motionController.getMainComponent();\r\n if (!mainComponent) {\r\n return;\r\n }\r\n controllerData.teleportationComponent = mainComponent;\r\n controllerData.onButtonChangedObserver = mainComponent.onButtonStateChangedObservable.add(() => {\r\n if (!this.teleportationEnabled) {\r\n return;\r\n }\r\n // did \"pressed\" changed?\r\n if (mainComponent.changes.pressed) {\r\n if (mainComponent.changes.pressed.current) {\r\n // simulate \"forward\" thumbstick push\r\n controllerData.teleportationState.forward = true;\r\n this._currentTeleportationControllerId = controllerData.xrController.uniqueId;\r\n controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;\r\n controllerData.teleportationState.currentRotation = 0;\r\n const timeToSelect = this._options.timeToTeleport || 3000;\r\n setAndStartTimer({\r\n timeout: timeToSelect,\r\n contextObservable: this._xrSessionManager.onXRFrameObservable,\r\n breakCondition: () => !mainComponent.pressed,\r\n onEnded: () => {\r\n if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId && controllerData.teleportationState.forward) {\r\n this._teleportForward(xrController.uniqueId);\r\n }\r\n },\r\n });\r\n } else {\r\n controllerData.teleportationState.forward = false;\r\n this._currentTeleportationControllerId = \"\";\r\n }\r\n }\r\n });\r\n } else {\r\n controllerData.teleportationComponent = movementController;\r\n // use thumbstick (or touchpad if thumbstick not available)\r\n controllerData.onAxisChangedObserver = movementController.onAxisValueChangedObservable.add((axesData) => {\r\n if (axesData.y <= 0.7 && controllerData.teleportationState.backwards) {\r\n controllerData.teleportationState.backwards = false;\r\n }\r\n if (axesData.y > 0.7 && !controllerData.teleportationState.forward && this.backwardsMovementEnabled && !this.snapPointsOnly) {\r\n // teleport backwards\r\n\r\n // General gist: Go Back N units, cast a ray towards the floor. If collided, move.\r\n if (!controllerData.teleportationState.backwards) {\r\n controllerData.teleportationState.backwards = true;\r\n // teleport backwards ONCE\r\n this._tmpQuaternion.copyFrom(this._options.xrInput.xrCamera.rotationQuaternion!);\r\n this._tmpQuaternion.toEulerAnglesToRef(this._tmpVector);\r\n // get only the y rotation\r\n this._tmpVector.x = 0;\r\n this._tmpVector.z = 0;\r\n // get the quaternion\r\n Quaternion.FromEulerVectorToRef(this._tmpVector, this._tmpQuaternion);\r\n this._tmpVector.set(0, 0, this.backwardsTeleportationDistance * (this._xrSessionManager.scene.useRightHandedSystem ? 1.0 : -1.0));\r\n this._tmpVector.rotateByQuaternionToRef(this._tmpQuaternion, this._tmpVector);\r\n this._tmpVector.addInPlace(this._options.xrInput.xrCamera.position);\r\n this._tmpRay.origin.copyFrom(this._tmpVector);\r\n // This will prevent the user from \"falling\" to a lower platform!\r\n // TODO - should this be a flag? 'allow falling to lower platforms'?\r\n this._tmpRay.length = this._options.xrInput.xrCamera.realWorldHeight + 0.1;\r\n // Right handed system had here \"1\" instead of -1. This is unneeded.\r\n this._tmpRay.direction.set(0, -1, 0);\r\n const pick = this._xrSessionManager.scene.pickWithRay(this._tmpRay, (o) => {\r\n return this._floorMeshes.indexOf(o) !== -1;\r\n });\r\n\r\n // pick must exist, but stay safe\r\n if (pick && pick.pickedPoint) {\r\n // Teleport the users feet to where they targeted. Ignore the Y axis.\r\n // If the \"falling to lower platforms\" feature is implemented the Y axis should be set here as well\r\n this._options.xrInput.xrCamera.position.x = pick.pickedPoint.x;\r\n this._options.xrInput.xrCamera.position.z = pick.pickedPoint.z;\r\n }\r\n }\r\n }\r\n if (axesData.y < -0.7 && !this._currentTeleportationControllerId && !controllerData.teleportationState.rotating && this.teleportationEnabled) {\r\n controllerData.teleportationState.forward = true;\r\n this._currentTeleportationControllerId = controllerData.xrController.uniqueId;\r\n controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;\r\n }\r\n if (axesData.x) {\r\n if (!controllerData.teleportationState.forward) {\r\n if (!controllerData.teleportationState.rotating && Math.abs(axesData.x) > 0.7) {\r\n // rotate in the right direction positive is right\r\n controllerData.teleportationState.rotating = true;\r\n const rotation = this.rotationAngle * (axesData.x > 0 ? 1 : -1) * (this._xrSessionManager.scene.useRightHandedSystem ? -1 : 1);\r\n this.onBeforeCameraTeleportRotation.notifyObservers(rotation);\r\n Quaternion.FromEulerAngles(0, rotation, 0).multiplyToRef(\r\n this._options.xrInput.xrCamera.rotationQuaternion,\r\n this._options.xrInput.xrCamera.rotationQuaternion\r\n );\r\n this.onAfterCameraTeleportRotation.notifyObservers(this._options.xrInput.xrCamera.rotationQuaternion);\r\n }\r\n } else {\r\n if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId) {\r\n // set the rotation of the forward movement\r\n if (this.rotationEnabled) {\r\n setTimeout(() => {\r\n controllerData.teleportationState.currentRotation = Math.atan2(\r\n axesData.x,\r\n axesData.y * (this._xrSessionManager.scene.useRightHandedSystem ? 1 : -1)\r\n );\r\n });\r\n } else {\r\n controllerData.teleportationState.currentRotation = 0;\r\n }\r\n }\r\n }\r\n } else {\r\n controllerData.teleportationState.rotating = false;\r\n }\r\n\r\n if (axesData.x === 0 && axesData.y === 0) {\r\n if (controllerData.teleportationState.blocked) {\r\n controllerData.teleportationState.blocked = false;\r\n this._setTargetMeshVisibility(false);\r\n }\r\n if (controllerData.teleportationState.forward) {\r\n this._teleportForward(xrController.uniqueId);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n };\r\n if (xrController.motionController) {\r\n initMotionController();\r\n } else {\r\n xrController.onMotionControllerInitObservable.addOnce(() => {\r\n initMotionController();\r\n });\r\n }\r\n } else {\r\n this._xrSessionManager.scene.onPointerObservable.add((pointerInfo) => {\r\n if (pointerInfo.type === PointerEventTypes.POINTERDOWN) {\r\n controllerData.teleportationState.forward = true;\r\n this._currentTeleportationControllerId = controllerData.xrController.uniqueId;\r\n controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;\r\n controllerData.teleportationState.currentRotation = 0;\r\n const timeToSelect = this._options.timeToTeleport || 3000;\r\n setAndStartTimer({\r\n timeout: timeToSelect,\r\n contextObservable: this._xrSessionManager.onXRFrameObservable,\r\n onEnded: () => {\r\n if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId && controllerData.teleportationState.forward) {\r\n this._teleportForward(xrController.uniqueId);\r\n }\r\n },\r\n });\r\n } else if (pointerInfo.type === PointerEventTypes.POINTERUP) {\r\n controllerData.teleportationState.forward = false;\r\n this._currentTeleportationControllerId = \"\";\r\n }\r\n });\r\n }\r\n };\r\n\r\n private _createDefaultTargetMesh() {\r\n // set defaults\r\n this._options.defaultTargetMeshOptions = this._options.defaultTargetMeshOptions || {};\r\n const sceneToRenderTo = this._options.useUtilityLayer\r\n ? this._options.customUtilityLayerScene || UtilityLayerRenderer.DefaultUtilityLayer.utilityLayerScene\r\n : this._xrSessionManager.scene;\r\n const teleportationTarget = CreateGround(\"teleportationTarget\", { width: 2, height: 2, subdivisions: 2 }, sceneToRenderTo);\r\n teleportationTarget.isPickable = false;\r\n\r\n if (this._options.defaultTargetMeshOptions.teleportationCircleMaterial) {\r\n teleportationTarget.material = this._options.defaultTargetMeshOptions.teleportationCircleMaterial;\r\n } else {\r\n const length = 512;\r\n const dynamicTexture = new DynamicTexture(\"teleportationPlaneDynamicTexture\", length, sceneToRenderTo, true);\r\n dynamicTexture.hasAlpha = true;\r\n const context = dynamicTexture.getContext();\r\n const centerX = length / 2;\r\n const centerY = length / 2;\r\n const radius = 200;\r\n context.beginPath();\r\n context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);\r\n context.fillStyle = this._options.defaultTargetMeshOptions.teleportationFillColor || \"#444444\";\r\n context.fill();\r\n context.lineWidth = 10;\r\n context.strokeStyle = this._options.defaultTargetMeshOptions.teleportationBorderColor || \"#FFFFFF\";\r\n context.stroke();\r\n context.closePath();\r\n dynamicTexture.update();\r\n const teleportationCircleMaterial = new StandardMaterial(\"teleportationPlaneMaterial\", sceneToRenderTo);\r\n teleportationCircleMaterial.diffuseTexture = dynamicTexture;\r\n teleportationTarget.material = teleportationCircleMaterial;\r\n }\r\n\r\n const torus = CreateTorus(\r\n \"torusTeleportation\",\r\n {\r\n diameter: 0.75,\r\n thickness: 0.1,\r\n tessellation: 20,\r\n },\r\n sceneToRenderTo\r\n );\r\n torus.isPickable = false;\r\n torus.parent = teleportationTarget;\r\n if (!this._options.defaultTargetMeshOptions.disableAnimation) {\r\n const animationInnerCircle = new Animation(\"animationInnerCircle\", \"position.y\", 30, Animation.ANIMATIONTYPE_FLOAT, Animation.ANIMATIONLOOPMODE_CYCLE);\r\n const keys = [];\r\n keys.push({\r\n frame: 0,\r\n value: 0,\r\n });\r\n keys.push({\r\n frame: 30,\r\n value: 0.4,\r\n });\r\n keys.push({\r\n frame: 60,\r\n value: 0,\r\n });\r\n animationInnerCircle.setKeys(keys);\r\n const easingFunction = new SineEase();\r\n easingFunction.setEasingMode(EasingFunction.EASINGMODE_EASEINOUT);\r\n animationInnerCircle.setEasingFunction(easingFunction);\r\n torus.animations = [];\r\n torus.animations.push(animationInnerCircle);\r\n sceneToRenderTo.beginAnimation(torus, 0, 60, true);\r\n }\r\n\r\n const cone = CreateCylinder(\"rotationCone\", { diameterTop: 0, tessellation: 4 }, sceneToRenderTo);\r\n cone.isPickable = false;\r\n cone.scaling.set(0.5, 0.12, 0.2);\r\n\r\n cone.rotate(Axis.X, Math.PI / 2);\r\n\r\n cone.position.z = 0.6;\r\n cone.parent = torus;\r\n\r\n if (this._options.defaultTargetMeshOptions.torusArrowMaterial) {\r\n torus.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;\r\n cone.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;\r\n } else {\r\n const torusConeMaterial = new StandardMaterial(\"torusConsMat\", sceneToRenderTo);\r\n torusConeMaterial.disableLighting = !!this._options.defaultTargetMeshOptions.disableLighting;\r\n if (torusConeMaterial.disableLighting) {\r\n torusConeMaterial.emissiveColor = new Color3(0.3, 0.3, 1.0);\r\n } else {\r\n torusConeMaterial.diffuseColor = new Color3(0.3, 0.3, 1.0);\r\n }\r\n torusConeMaterial.alpha = 0.9;\r\n torus.material = torusConeMaterial;\r\n cone.material = torusConeMaterial;\r\n this._teleportationRingMaterial = torusConeMaterial;\r\n }\r\n\r\n if (this._options.renderingGroupId !== undefined) {\r\n teleportationTarget.renderingGroupId = this._options.renderingGroupId;\r\n torus.renderingGroupId = this._options.renderingGroupId;\r\n cone.renderingGroupId = this._options.renderingGroupId;\r\n }\r\n\r\n this._options.teleportationTargetMesh = teleportationTarget;\r\n // hide the teleportation target mesh right after creating it.\r\n this._setTargetMeshVisibility(false);\r\n }\r\n\r\n private _detachController(xrControllerUniqueId: string) {\r\n const controllerData = this._controllers[xrControllerUniqueId];\r\n if (!controllerData) {\r\n return;\r\n }\r\n if (controllerData.teleportationComponent) {\r\n if (controllerData.onAxisChangedObserver) {\r\n controllerData.teleportationComponent.onAxisValueChangedObservable.remove(controllerData.onAxisChangedObserver);\r\n }\r\n if (controllerData.onButtonChangedObserver) {\r\n controllerData.teleportationComponent.onButtonStateChangedObservable.remove(controllerData.onButtonChangedObserver);\r\n }\r\n }\r\n // remove from the map\r\n delete this._controllers[xrControllerUniqueId];\r\n }\r\n\r\n private _findClosestSnapPointWithRadius(realPosition: Vector3, radius: number = this._options.snapToPositionRadius || 0.8) {\r\n let closestPoint: Nullable<Vector3> = null;\r\n let closestDistance = Number.MAX_VALUE;\r\n if (this._snapToPositions.length) {\r\n const radiusSquared = radius * radius;\r\n this._snapToPositions.forEach((position) => {\r\n const dist = Vector3.DistanceSquared(position, realPosition);\r\n if (dist <= radiusSquared && dist < closestDistance) {\r\n closestDistance = dist;\r\n closestPoint = position;\r\n }\r\n });\r\n }\r\n return closestPoint;\r\n }\r\n\r\n private _setTargetMeshPosition(pickInfo: PickingInfo) {\r\n const newPosition = pickInfo.pickedPoint;\r\n if (!this._options.teleportationTargetMesh || !newPosition) {\r\n return;\r\n }\r\n const snapPosition = this._findClosestSnapPointWithRadius(newPosition);\r\n this._snappedToPoint = !!snapPosition;\r\n if (this.snapPointsOnly && !this._snappedToPoint && this._teleportationRingMaterial) {\r\n this._teleportationRingMaterial.diffuseColor.set(1.0, 0.3, 0.3);\r\n } else if (this.snapPointsOnly && this._snappedToPoint && this._teleportationRingMaterial) {\r\n this._teleportationRingMaterial.diffuseColor.set(0.3, 0.3, 1.0);\r\n }\r\n this._options.teleportationTargetMesh.position.copyFrom(snapPosition || newPosition);\r\n this._options.teleportationTargetMesh.position.y += 0.01;\r\n this.onTargetMeshPositionUpdatedObservable.notifyObservers(pickInfo);\r\n }\r\n\r\n private _setTargetMeshVisibility(visible: boolean, force?: boolean) {\r\n if (!this._options.teleportationTargetMesh) {\r\n return;\r\n }\r\n if (this._options.teleportationTargetMesh.isVisible === visible && !force) {\r\n return;\r\n }\r\n this._options.teleportationTargetMesh.isVisible = visible;\r\n this._options.teleportationTargetMesh.getChildren(undefined, false).forEach((m) => {\r\n (<any>m).isVisible = visible;\r\n });\r\n\r\n if (!visible) {\r\n if (this._quadraticBezierCurve) {\r\n this._quadraticBezierCurve.dispose();\r\n this._quadraticBezierCurve = null;\r\n }\r\n if (this._selectionFeature) {\r\n this._selectionFeature.attach();\r\n }\r\n } else {\r\n if (this._selectionFeature) {\r\n this._selectionFeature.detach();\r\n }\r\n }\r\n }\r\n\r\n private _disposeBezierCurve() {\r\n if (this._quadraticBezierCurve) {\r\n this._quadraticBezierCurve.dispose();\r\n this._quadraticBezierCurve = null;\r\n }\r\n }\r\n\r\n private _showParabolicPath(pickInfo: PickingInfo) {\r\n if (!pickInfo.pickedPoint || !this._currentTeleportationControllerId) {\r\n return;\r\n }\r\n\r\n const sceneToRenderTo = this._options.useUtilityLayer\r\n ? this._options.customUtilityLayerScene || UtilityLayerRenderer.DefaultUtilityLayer.utilityLayerScene\r\n : this._xrSessionManager.scene;\r\n\r\n const controllerData = this._controllers[this._currentTeleportationControllerId];\r\n\r\n const quadraticBezierVectors = Curve3.CreateQuadraticBezier(controllerData.xrController.pointer.absolutePosition, pickInfo.ray!.origin, pickInfo.pickedPoint, 25);\r\n const color = controllerData.teleportationState.blocked ? this._blockedRayColor : undefined;\r\n const colorsArray = new Array(26).fill(color || this._cachedColor4White);\r\n if (!this._options.generateRayPathMesh) {\r\n this._quadraticBezierCurve = CreateLines(\r\n \"teleportation path line\",\r\n { points: quadraticBezierVectors.getPoints(), instance: this._quadraticBezierCurve as LinesMesh, updatable: true, colors: colorsArray },\r\n sceneToRenderTo\r\n );\r\n } else {\r\n this._quadraticBezierCurve = this._options.generateRayPathMesh(quadraticBezierVectors.getPoints(), pickInfo);\r\n }\r\n this._quadraticBezierCurve.isPickable = false;\r\n if (this._options.renderingGroupId !== undefined) {\r\n this._quadraticBezierCurve.renderingGroupId = this._options.renderingGroupId;\r\n }\r\n }\r\n\r\n private _teleportForward(controllerId: string) {\r\n const controllerData = this._controllers[controllerId];\r\n if (!controllerData || !controllerData.teleportationState.forward || !this.teleportationEnabled) {\r\n return;\r\n }\r\n controllerData.teleportationState.forward = false;\r\n this._currentTeleportationControllerId = \"\";\r\n if (this.snapPointsOnly && !this._snappedToPoint) {\r\n return;\r\n }\r\n\r\n if (this.skipNextTeleportation) {\r\n this.skipNextTeleportation = false;\r\n return;\r\n }\r\n // do the movement forward here\r\n if (this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.isVisible) {\r\n const height = this._options.xrInput.xrCamera.realWorldHeight;\r\n this._options.xrInput.xrCamera.onBeforeCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);\r\n this._options.xrInput.xrCamera.position.copyFrom(this._options.teleportationTargetMesh.position);\r\n this._options.xrInput.xrCamera.position.y += height;\r\n Quaternion.FromEulerAngles(0, controllerData.teleportationState.currentRotation - (this._xrSessionManager.scene.useRightHandedSystem ? Math.PI : 0), 0).multiplyToRef(\r\n this._options.xrInput.xrCamera.rotationQuaternion,\r\n this._options.xrInput.xrCamera.rotationQuaternion\r\n );\r\n this._options.xrInput.xrCamera.onAfterCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);\r\n }\r\n }\r\n}\r\n\r\nWebXRFeaturesManager.AddWebXRFeature(\r\n WebXRMotionControllerTeleportation.Name,\r\n (xrSessionManager, options) => {\r\n return () => new WebXRMotionControllerTeleportation(xrSessionManager, options);\r\n },\r\n WebXRMotionControllerTeleportation.Version,\r\n true\r\n);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"webXRCamera.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRCamera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,UAAU;IAyCvC;;;;;OAKG;IACH,YACI,IAAY,EACZ,KAAY,EACJ,iBAAsC;QAE9C,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;QAF3B,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AAE,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC5D,YAAY,CAAC,MAAM,EAAE,CAAC;YAEtB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE;gBACnC,YAAY,CAAC,4BAA4B,EAAE,CAAC;aAC/C;YAED,YAAY,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACvF,MAAM,SAAS,GAAG,IAAI,gBAAgB,CAClC;gBACI,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;gBAC7B,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;gBAC7B,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;aAChC,EACD;gBACI,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;aACjC,CACJ,CAAC;YACF,IAAI,CAAC,iBAAiB,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;SACpH;IACL,CAAC;;AAtWc,0BAAc,GAAG,OAAO,CAAC,GAAG,EAAE,AAAhB,CAAiB","sourcesContent":["import { Vector3, Matrix, Quaternion, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport { FreeCamera } from \"../Cameras/freeCamera\";\r\nimport { TargetCamera } from \"../Cameras/targetCamera\";\r\nimport type { WebXRSessionManager } from \"./webXRSessionManager\";\r\nimport { Viewport } from \"../Maths/math.viewport\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { WebXRTrackingState } from \"./webXRTypes\";\r\n\r\n/**\r\n * WebXR Camera which holds the views for the xrSession\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRCamera\r\n */\r\nexport class WebXRCamera extends FreeCamera {\r\n private static _ScaleReadOnly = Vector3.One();\r\n\r\n private _firstFrame = false;\r\n private _referenceQuaternion: Quaternion = Quaternion.Identity();\r\n private _referencedPosition: Vector3 = new Vector3();\r\n private _trackingState: WebXRTrackingState = WebXRTrackingState.NOT_TRACKING;\r\n\r\n /**\r\n * This will be triggered after the first XR Frame initialized the camera,\r\n * including the right number of views and their rendering parameters\r\n */\r\n public onXRCameraInitializedObservable = new Observable<WebXRCamera>();\r\n\r\n /**\r\n * Observable raised before camera teleportation\r\n */\r\n public onBeforeCameraTeleport = new Observable<Vector3>();\r\n\r\n /**\r\n * Observable raised after camera teleportation\r\n */\r\n public onAfterCameraTeleport = new Observable<Vector3>();\r\n\r\n /**\r\n * Notifies when the camera's tracking state has changed.\r\n * Notice - will also be triggered when tracking has started (at the beginning of the session)\r\n */\r\n public onTrackingStateChanged = new Observable<WebXRTrackingState>();\r\n /**\r\n * Should position compensation execute on first frame.\r\n * This is used when copying the position from a native (non XR) camera\r\n */\r\n public compensateOnFirstFrame: boolean = true;\r\n\r\n /**\r\n * The last XRViewerPose from the current XRFrame\r\n * @internal\r\n */\r\n public _lastXRViewerPose?: XRViewerPose;\r\n\r\n /**\r\n * Creates a new webXRCamera, this should only be set at the camera after it has been updated by the xrSessionManager\r\n * @param name the name of the camera\r\n * @param scene the scene to add the camera to\r\n * @param _xrSessionManager a constructed xr session manager\r\n */\r\n constructor(\r\n name: string,\r\n scene: Scene,\r\n private _xrSessionManager: WebXRSessionManager\r\n ) {\r\n super(name, Vector3.Zero(), scene);\r\n\r\n // Initial camera configuration\r\n this.minZ = 0.1;\r\n this.rotationQuaternion = new Quaternion();\r\n this.cameraRigMode = Camera.RIG_MODE_CUSTOM;\r\n this.updateUpVectorFromRotation = true;\r\n this._updateNumberOfRigCameras(1);\r\n // freeze projection matrix, which will be copied later\r\n this.freezeProjectionMatrix();\r\n this._deferOnly = true;\r\n\r\n this._xrSessionManager.onXRSessionInit.add(() => {\r\n this._referencedPosition.copyFromFloats(0, 0, 0);\r\n this._referenceQuaternion.copyFromFloats(0, 0, 0, 1);\r\n // first frame - camera's y position should be 0 for the correct offset\r\n this._firstFrame = this.compensateOnFirstFrame;\r\n });\r\n\r\n // Check transformation changes on each frame. Callback is added to be first so that the transformation will be\r\n // applied to the rest of the elements using the referenceSpace object\r\n this._xrSessionManager.onXRFrameObservable.add(\r\n () => {\r\n if (this._firstFrame) {\r\n this._updateFromXRSession();\r\n }\r\n if (this.onXRCameraInitializedObservable.hasObservers()) {\r\n this.onXRCameraInitializedObservable.notifyObservers(this);\r\n this.onXRCameraInitializedObservable.clear();\r\n }\r\n\r\n if (this._deferredUpdated) {\r\n this.position.copyFrom(this._deferredPositionUpdate);\r\n this.rotationQuaternion.copyFrom(this._deferredRotationQuaternionUpdate);\r\n }\r\n\r\n this._updateReferenceSpace();\r\n this._updateFromXRSession();\r\n },\r\n undefined,\r\n true\r\n );\r\n }\r\n\r\n /**\r\n * Get the current XR tracking state of the camera\r\n */\r\n public get trackingState(): WebXRTrackingState {\r\n return this._trackingState;\r\n }\r\n\r\n private _setTrackingState(newState: WebXRTrackingState) {\r\n if (this._trackingState !== newState) {\r\n this._trackingState = newState;\r\n this.onTrackingStateChanged.notifyObservers(newState);\r\n }\r\n }\r\n\r\n /**\r\n * Return the user's height, unrelated to the current ground.\r\n * This will be the y position of this camera, when ground level is 0.\r\n */\r\n public get realWorldHeight(): number {\r\n const basePose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.baseReferenceSpace);\r\n if (basePose && basePose.transform) {\r\n return basePose.transform.position.y;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _updateForDualEyeDebugging(/*pupilDistance = 0.01*/) {\r\n // Create initial camera rigs\r\n this._updateNumberOfRigCameras(2);\r\n this.rigCameras[0].viewport = new Viewport(0, 0, 0.5, 1.0);\r\n // this.rigCameras[0].position.x = -pupilDistance / 2;\r\n this.rigCameras[0].outputRenderTarget = null;\r\n this.rigCameras[1].viewport = new Viewport(0.5, 0, 0.5, 1.0);\r\n // this.rigCameras[1].position.x = pupilDistance / 2;\r\n this.rigCameras[1].outputRenderTarget = null;\r\n }\r\n\r\n /**\r\n * Sets this camera's transformation based on a non-vr camera\r\n * @param otherCamera the non-vr camera to copy the transformation from\r\n * @param resetToBaseReferenceSpace should XR reset to the base reference space\r\n */\r\n public setTransformationFromNonVRCamera(otherCamera: Camera = this.getScene().activeCamera!, resetToBaseReferenceSpace: boolean = true) {\r\n if (!otherCamera || otherCamera === this) {\r\n return;\r\n }\r\n const mat = otherCamera.computeWorldMatrix();\r\n mat.decompose(undefined, this.rotationQuaternion, this.position);\r\n // set the ground level\r\n this.position.y = 0;\r\n Quaternion.FromEulerAnglesToRef(0, this.rotationQuaternion.toEulerAngles().y, 0, this.rotationQuaternion);\r\n this._firstFrame = true;\r\n if (resetToBaseReferenceSpace) {\r\n this._xrSessionManager.resetReferenceSpace();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current instance class name (\"WebXRCamera\").\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"WebXRCamera\";\r\n }\r\n\r\n /**\r\n * Set the target for the camera to look at.\r\n * Note that this only rotates around the Y axis, as opposed to the default behavior of other cameras\r\n * @param target the target to set the camera to look at\r\n */\r\n public setTarget(target: Vector3): void {\r\n // only rotate around the y axis!\r\n const tmpVector = TmpVectors.Vector3[1];\r\n target.subtractToRef(this.position, tmpVector);\r\n tmpVector.y = 0;\r\n tmpVector.normalize();\r\n const yRotation = Math.atan2(tmpVector.x, tmpVector.z);\r\n this.rotationQuaternion.toEulerAnglesToRef(tmpVector);\r\n Quaternion.FromEulerAnglesToRef(tmpVector.x, yRotation, tmpVector.z, this.rotationQuaternion);\r\n }\r\n\r\n public dispose() {\r\n super.dispose();\r\n this._lastXRViewerPose = undefined;\r\n }\r\n\r\n private _rotate180 = new Quaternion(0, 1, 0, 0);\r\n\r\n private _updateFromXRSession() {\r\n const pose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);\r\n this._lastXRViewerPose = pose || undefined;\r\n if (!pose) {\r\n this._setTrackingState(WebXRTrackingState.NOT_TRACKING);\r\n return;\r\n }\r\n\r\n // Set the tracking state. if it didn't change it is a no-op\r\n const trackingState = pose.emulatedPosition ? WebXRTrackingState.TRACKING_LOST : WebXRTrackingState.TRACKING;\r\n this._setTrackingState(trackingState);\r\n\r\n // check min/max Z and update if not the same as in cache\r\n if (this.minZ !== this._cache.minZ || this.maxZ !== this._cache.maxZ) {\r\n const xrRenderState: XRRenderStateInit = {\r\n // if maxZ is 0 it should be \"Infinity\", but it doesn't work with the WebXR API. Setting to a large number.\r\n depthFar: this.maxZ || 10000,\r\n depthNear: this.minZ,\r\n };\r\n\r\n this._xrSessionManager.updateRenderState(xrRenderState);\r\n this._cache.minZ = this.minZ;\r\n this._cache.maxZ = this.maxZ;\r\n }\r\n\r\n if (pose.transform) {\r\n const orientation = pose.transform.orientation;\r\n if (pose.transform.orientation.x === undefined) {\r\n // Babylon native polyfill can return an undefined orientation value\r\n // When not initialized\r\n return;\r\n }\r\n const pos = pose.transform.position;\r\n this._referencedPosition.set(pos.x, pos.y, pos.z);\r\n\r\n this._referenceQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this._referencedPosition.z *= -1;\r\n this._referenceQuaternion.z *= -1;\r\n this._referenceQuaternion.w *= -1;\r\n }\r\n\r\n if (this._firstFrame) {\r\n this._firstFrame = false;\r\n // we have the XR reference, now use this to find the offset to get the camera to be\r\n // in the right position\r\n\r\n // set the height to correlate to the current height\r\n this.position.y += this._referencedPosition.y;\r\n // avoid using the head rotation on the first frame.\r\n this._referenceQuaternion.copyFromFloats(0, 0, 0, 1);\r\n } else {\r\n // update position and rotation as reference\r\n this.rotationQuaternion.copyFrom(this._referenceQuaternion);\r\n this.position.copyFrom(this._referencedPosition);\r\n }\r\n }\r\n\r\n // Update camera rigs\r\n if (this.rigCameras.length !== pose.views.length) {\r\n this._updateNumberOfRigCameras(pose.views.length);\r\n }\r\n\r\n pose.views.forEach((view: XRView, i: number) => {\r\n const currentRig = <TargetCamera>this.rigCameras[i];\r\n // update right and left, where applicable\r\n if (!currentRig.isLeftCamera && !currentRig.isRightCamera) {\r\n if (view.eye === \"right\") {\r\n currentRig._isRightCamera = true;\r\n } else if (view.eye === \"left\") {\r\n currentRig._isLeftCamera = true;\r\n }\r\n }\r\n // Update view/projection matrix\r\n const pos = view.transform.position;\r\n const orientation = view.transform.orientation;\r\n\r\n currentRig.parent = this.parent;\r\n\r\n currentRig.position.set(pos.x, pos.y, pos.z);\r\n currentRig.rotationQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n currentRig.position.z *= -1;\r\n currentRig.rotationQuaternion.z *= -1;\r\n currentRig.rotationQuaternion.w *= -1;\r\n } else {\r\n currentRig.rotationQuaternion.multiplyInPlace(this._rotate180);\r\n }\r\n Matrix.FromFloat32ArrayToRefScaled(view.projectionMatrix, 0, 1, currentRig._projectionMatrix);\r\n\r\n if (!this._scene.useRightHandedSystem) {\r\n currentRig._projectionMatrix.toggleProjectionMatrixHandInPlace();\r\n }\r\n\r\n // first camera?\r\n if (i === 0) {\r\n this._projectionMatrix.copyFrom(currentRig._projectionMatrix);\r\n }\r\n\r\n const renderTargetTexture = this._xrSessionManager.getRenderTargetTextureForView(view);\r\n this._renderingMultiview = renderTargetTexture?._texture?.isMultiview || false;\r\n if (this._renderingMultiview) {\r\n // For multiview, the render target texture is the same per-view (just the slice index is different),\r\n // so we only need to set the output render target once for the rig parent.\r\n if (i == 0) {\r\n this._xrSessionManager.trySetViewportForView(this.viewport, view);\r\n this.outputRenderTarget = renderTargetTexture;\r\n }\r\n } else {\r\n // Update viewport\r\n this._xrSessionManager.trySetViewportForView(currentRig.viewport, view);\r\n\r\n // Set cameras to render to the session's render target\r\n currentRig.outputRenderTarget = renderTargetTexture || this._xrSessionManager.getRenderTargetTextureForView(view);\r\n }\r\n\r\n // Replicate parent rig camera behavior\r\n currentRig.layerMask = this.layerMask;\r\n });\r\n }\r\n\r\n private _updateNumberOfRigCameras(viewCount = 1) {\r\n while (this.rigCameras.length < viewCount) {\r\n const newCamera = new TargetCamera(\"XR-RigCamera: \" + this.rigCameras.length, Vector3.Zero(), this.getScene());\r\n newCamera.minZ = 0.1;\r\n newCamera.rotationQuaternion = new Quaternion();\r\n newCamera.updateUpVectorFromRotation = true;\r\n newCamera.isRigCamera = true;\r\n newCamera.rigParent = this;\r\n // do not compute projection matrix, provided by XR\r\n newCamera.freezeProjectionMatrix();\r\n this.rigCameras.push(newCamera);\r\n }\r\n while (this.rigCameras.length > viewCount) {\r\n const removedCamera = this.rigCameras.pop();\r\n if (removedCamera) {\r\n removedCamera.dispose();\r\n }\r\n }\r\n }\r\n\r\n private _updateReferenceSpace() {\r\n // were position & rotation updated OUTSIDE of the xr update loop\r\n if (!this.position.equals(this._referencedPosition) || !this.rotationQuaternion.equals(this._referenceQuaternion)) {\r\n const referencedMat = TmpVectors.Matrix[0];\r\n const poseMat = TmpVectors.Matrix[1];\r\n const transformMat = TmpVectors.Matrix[2];\r\n\r\n Matrix.ComposeToRef(WebXRCamera._ScaleReadOnly, this._referenceQuaternion, this._referencedPosition, referencedMat);\r\n Matrix.ComposeToRef(WebXRCamera._ScaleReadOnly, this.rotationQuaternion, this.position, poseMat);\r\n referencedMat.invert().multiplyToRef(poseMat, transformMat);\r\n transformMat.invert();\r\n\r\n if (!this._scene.useRightHandedSystem) {\r\n transformMat.toggleModelMatrixHandInPlace();\r\n }\r\n\r\n transformMat.decompose(undefined, this._referenceQuaternion, this._referencedPosition);\r\n const transform = new XRRigidTransform(\r\n {\r\n x: this._referencedPosition.x,\r\n y: this._referencedPosition.y,\r\n z: this._referencedPosition.z,\r\n },\r\n {\r\n x: this._referenceQuaternion.x,\r\n y: this._referenceQuaternion.y,\r\n z: this._referenceQuaternion.z,\r\n w: this._referenceQuaternion.w,\r\n }\r\n );\r\n this._xrSessionManager.referenceSpace = this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(transform);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"webXRCamera.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRCamera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,UAAU;IA0CvC;;;;;OAKG;IACH,YACI,IAAY,EACZ,KAAY,EACJ,iBAAsC;QAE9C,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;QAF3B,sBAAiB,GAAjB,iBAAiB,CAAqB;QAhD1C,gBAAW,GAAG,KAAK,CAAC;QACpB,yBAAoB,GAAe,UAAU,CAAC,QAAQ,EAAE,CAAC;QACzD,wBAAmB,GAAY,IAAI,OAAO,EAAE,CAAC;QAC7C,mBAAc,GAAuB,kBAAkB,CAAC,YAAY,CAAC;QAE7E;;;WAGG;QACI,oCAA+B,GAAG,IAAI,UAAU,EAAe,CAAC;QAEv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,mBAAmB,CAAC,CAAC;YACvF,MAAM,SAAS,GAAG,IAAI,gBAAgB,CAClC;gBACI,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;gBAC7B,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;gBAC7B,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;aAChC,EACD;gBACI,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;aACjC,CACJ,CAAC;YACF,IAAI,CAAC,iBAAiB,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;SACpH;IACL,CAAC;;AAvWc,0BAAc,GAAG,OAAO,CAAC,GAAG,EAAE,AAAhB,CAAiB","sourcesContent":["import { Vector3, Matrix, Quaternion, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport { FreeCamera } from \"../Cameras/freeCamera\";\r\nimport { TargetCamera } from \"../Cameras/targetCamera\";\r\nimport type { WebXRSessionManager } from \"./webXRSessionManager\";\r\nimport { Viewport } from \"../Maths/math.viewport\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { WebXRTrackingState } from \"./webXRTypes\";\r\n\r\n/**\r\n * WebXR Camera which holds the views for the xrSession\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRCamera\r\n */\r\nexport class WebXRCamera extends FreeCamera {\r\n private static _ScaleReadOnly = Vector3.One();\r\n\r\n private _firstFrame = false;\r\n private _referenceQuaternion: Quaternion = Quaternion.Identity();\r\n private _referencedPosition: Vector3 = new Vector3();\r\n private _trackingState: WebXRTrackingState = WebXRTrackingState.NOT_TRACKING;\r\n\r\n /**\r\n * This will be triggered after the first XR Frame initialized the camera,\r\n * including the right number of views and their rendering parameters\r\n */\r\n public onXRCameraInitializedObservable = new Observable<WebXRCamera>();\r\n\r\n /**\r\n * Observable raised before camera teleportation\r\n */\r\n public onBeforeCameraTeleport = new Observable<Vector3>();\r\n\r\n /**\r\n * Observable raised after camera teleportation\r\n */\r\n public onAfterCameraTeleport = new Observable<Vector3>();\r\n\r\n /**\r\n * Notifies when the camera's tracking state has changed.\r\n * Notice - will also be triggered when tracking has started (at the beginning of the session)\r\n */\r\n public onTrackingStateChanged = new Observable<WebXRTrackingState>();\r\n\r\n /**\r\n * Should position compensation execute on first frame.\r\n * This is used when copying the position from a native (non XR) camera\r\n */\r\n public compensateOnFirstFrame: boolean = true;\r\n\r\n /**\r\n * The last XRViewerPose from the current XRFrame\r\n * @internal\r\n */\r\n public _lastXRViewerPose?: XRViewerPose;\r\n\r\n /**\r\n * Creates a new webXRCamera, this should only be set at the camera after it has been updated by the xrSessionManager\r\n * @param name the name of the camera\r\n * @param scene the scene to add the camera to\r\n * @param _xrSessionManager a constructed xr session manager\r\n */\r\n constructor(\r\n name: string,\r\n scene: Scene,\r\n private _xrSessionManager: WebXRSessionManager\r\n ) {\r\n super(name, Vector3.Zero(), scene);\r\n\r\n // Initial camera configuration\r\n this.minZ = 0.1;\r\n this.rotationQuaternion = new Quaternion();\r\n this.cameraRigMode = Camera.RIG_MODE_CUSTOM;\r\n this.updateUpVectorFromRotation = true;\r\n this._updateNumberOfRigCameras(1);\r\n // freeze projection matrix, which will be copied later\r\n this.freezeProjectionMatrix();\r\n this._deferOnly = true;\r\n\r\n this._xrSessionManager.onXRSessionInit.add(() => {\r\n this._referencedPosition.copyFromFloats(0, 0, 0);\r\n this._referenceQuaternion.copyFromFloats(0, 0, 0, 1);\r\n // first frame - camera's y position should be 0 for the correct offset\r\n this._firstFrame = this.compensateOnFirstFrame;\r\n });\r\n\r\n // Check transformation changes on each frame. Callback is added to be first so that the transformation will be\r\n // applied to the rest of the elements using the referenceSpace object\r\n this._xrSessionManager.onXRFrameObservable.add(\r\n () => {\r\n if (this._firstFrame) {\r\n this._updateFromXRSession();\r\n }\r\n if (this.onXRCameraInitializedObservable.hasObservers()) {\r\n this.onXRCameraInitializedObservable.notifyObservers(this);\r\n this.onXRCameraInitializedObservable.clear();\r\n }\r\n\r\n if (this._deferredUpdated) {\r\n this.position.copyFrom(this._deferredPositionUpdate);\r\n this.rotationQuaternion.copyFrom(this._deferredRotationQuaternionUpdate);\r\n }\r\n\r\n this._updateReferenceSpace();\r\n this._updateFromXRSession();\r\n },\r\n undefined,\r\n true\r\n );\r\n }\r\n\r\n /**\r\n * Get the current XR tracking state of the camera\r\n */\r\n public get trackingState(): WebXRTrackingState {\r\n return this._trackingState;\r\n }\r\n\r\n private _setTrackingState(newState: WebXRTrackingState) {\r\n if (this._trackingState !== newState) {\r\n this._trackingState = newState;\r\n this.onTrackingStateChanged.notifyObservers(newState);\r\n }\r\n }\r\n\r\n /**\r\n * Return the user's height, unrelated to the current ground.\r\n * This will be the y position of this camera, when ground level is 0.\r\n */\r\n public get realWorldHeight(): number {\r\n const basePose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.baseReferenceSpace);\r\n if (basePose && basePose.transform) {\r\n return basePose.transform.position.y;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _updateForDualEyeDebugging(/*pupilDistance = 0.01*/) {\r\n // Create initial camera rigs\r\n this._updateNumberOfRigCameras(2);\r\n this.rigCameras[0].viewport = new Viewport(0, 0, 0.5, 1.0);\r\n // this.rigCameras[0].position.x = -pupilDistance / 2;\r\n this.rigCameras[0].outputRenderTarget = null;\r\n this.rigCameras[1].viewport = new Viewport(0.5, 0, 0.5, 1.0);\r\n // this.rigCameras[1].position.x = pupilDistance / 2;\r\n this.rigCameras[1].outputRenderTarget = null;\r\n }\r\n\r\n /**\r\n * Sets this camera's transformation based on a non-vr camera\r\n * @param otherCamera the non-vr camera to copy the transformation from\r\n * @param resetToBaseReferenceSpace should XR reset to the base reference space\r\n */\r\n public setTransformationFromNonVRCamera(otherCamera: Camera = this.getScene().activeCamera!, resetToBaseReferenceSpace: boolean = true) {\r\n if (!otherCamera || otherCamera === this) {\r\n return;\r\n }\r\n const mat = otherCamera.computeWorldMatrix();\r\n mat.decompose(undefined, this.rotationQuaternion, this.position);\r\n // set the ground level\r\n this.position.y = 0;\r\n Quaternion.FromEulerAnglesToRef(0, this.rotationQuaternion.toEulerAngles().y, 0, this.rotationQuaternion);\r\n this._firstFrame = true;\r\n if (resetToBaseReferenceSpace) {\r\n this._xrSessionManager.resetReferenceSpace();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current instance class name (\"WebXRCamera\").\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"WebXRCamera\";\r\n }\r\n\r\n /**\r\n * Set the target for the camera to look at.\r\n * Note that this only rotates around the Y axis, as opposed to the default behavior of other cameras\r\n * @param target the target to set the camera to look at\r\n */\r\n public setTarget(target: Vector3): void {\r\n // only rotate around the y axis!\r\n const tmpVector = TmpVectors.Vector3[1];\r\n target.subtractToRef(this.position, tmpVector);\r\n tmpVector.y = 0;\r\n tmpVector.normalize();\r\n const yRotation = Math.atan2(tmpVector.x, tmpVector.z);\r\n this.rotationQuaternion.toEulerAnglesToRef(tmpVector);\r\n Quaternion.FromEulerAnglesToRef(tmpVector.x, yRotation, tmpVector.z, this.rotationQuaternion);\r\n }\r\n\r\n public dispose() {\r\n super.dispose();\r\n this._lastXRViewerPose = undefined;\r\n }\r\n\r\n private _rotate180 = new Quaternion(0, 1, 0, 0);\r\n\r\n private _updateFromXRSession() {\r\n const pose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);\r\n this._lastXRViewerPose = pose || undefined;\r\n if (!pose) {\r\n this._setTrackingState(WebXRTrackingState.NOT_TRACKING);\r\n return;\r\n }\r\n\r\n // Set the tracking state. if it didn't change it is a no-op\r\n const trackingState = pose.emulatedPosition ? WebXRTrackingState.TRACKING_LOST : WebXRTrackingState.TRACKING;\r\n this._setTrackingState(trackingState);\r\n\r\n // check min/max Z and update if not the same as in cache\r\n if (this.minZ !== this._cache.minZ || this.maxZ !== this._cache.maxZ) {\r\n const xrRenderState: XRRenderStateInit = {\r\n // if maxZ is 0 it should be \"Infinity\", but it doesn't work with the WebXR API. Setting to a large number.\r\n depthFar: this.maxZ || 10000,\r\n depthNear: this.minZ,\r\n };\r\n\r\n this._xrSessionManager.updateRenderState(xrRenderState);\r\n this._cache.minZ = this.minZ;\r\n this._cache.maxZ = this.maxZ;\r\n }\r\n\r\n if (pose.transform) {\r\n const orientation = pose.transform.orientation;\r\n if (pose.transform.orientation.x === undefined) {\r\n // Babylon native polyfill can return an undefined orientation value\r\n // When not initialized\r\n return;\r\n }\r\n const pos = pose.transform.position;\r\n this._referencedPosition.set(pos.x, pos.y, pos.z);\r\n\r\n this._referenceQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this._referencedPosition.z *= -1;\r\n this._referenceQuaternion.z *= -1;\r\n this._referenceQuaternion.w *= -1;\r\n }\r\n\r\n if (this._firstFrame) {\r\n this._firstFrame = false;\r\n // we have the XR reference, now use this to find the offset to get the camera to be\r\n // in the right position\r\n\r\n // set the height to correlate to the current height\r\n this.position.y += this._referencedPosition.y;\r\n // avoid using the head rotation on the first frame.\r\n this._referenceQuaternion.copyFromFloats(0, 0, 0, 1);\r\n } else {\r\n // update position and rotation as reference\r\n this.rotationQuaternion.copyFrom(this._referenceQuaternion);\r\n this.position.copyFrom(this._referencedPosition);\r\n }\r\n }\r\n\r\n // Update camera rigs\r\n if (this.rigCameras.length !== pose.views.length) {\r\n this._updateNumberOfRigCameras(pose.views.length);\r\n }\r\n\r\n pose.views.forEach((view: XRView, i: number) => {\r\n const currentRig = <TargetCamera>this.rigCameras[i];\r\n // update right and left, where applicable\r\n if (!currentRig.isLeftCamera && !currentRig.isRightCamera) {\r\n if (view.eye === \"right\") {\r\n currentRig._isRightCamera = true;\r\n } else if (view.eye === \"left\") {\r\n currentRig._isLeftCamera = true;\r\n }\r\n }\r\n // Update view/projection matrix\r\n const pos = view.transform.position;\r\n const orientation = view.transform.orientation;\r\n\r\n currentRig.parent = this.parent;\r\n\r\n currentRig.position.set(pos.x, pos.y, pos.z);\r\n currentRig.rotationQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n currentRig.position.z *= -1;\r\n currentRig.rotationQuaternion.z *= -1;\r\n currentRig.rotationQuaternion.w *= -1;\r\n } else {\r\n currentRig.rotationQuaternion.multiplyInPlace(this._rotate180);\r\n }\r\n Matrix.FromFloat32ArrayToRefScaled(view.projectionMatrix, 0, 1, currentRig._projectionMatrix);\r\n\r\n if (!this._scene.useRightHandedSystem) {\r\n currentRig._projectionMatrix.toggleProjectionMatrixHandInPlace();\r\n }\r\n\r\n // first camera?\r\n if (i === 0) {\r\n this._projectionMatrix.copyFrom(currentRig._projectionMatrix);\r\n }\r\n\r\n const renderTargetTexture = this._xrSessionManager.getRenderTargetTextureForView(view);\r\n this._renderingMultiview = renderTargetTexture?._texture?.isMultiview || false;\r\n if (this._renderingMultiview) {\r\n // For multiview, the render target texture is the same per-view (just the slice index is different),\r\n // so we only need to set the output render target once for the rig parent.\r\n if (i == 0) {\r\n this._xrSessionManager.trySetViewportForView(this.viewport, view);\r\n this.outputRenderTarget = renderTargetTexture;\r\n }\r\n } else {\r\n // Update viewport\r\n this._xrSessionManager.trySetViewportForView(currentRig.viewport, view);\r\n\r\n // Set cameras to render to the session's render target\r\n currentRig.outputRenderTarget = renderTargetTexture || this._xrSessionManager.getRenderTargetTextureForView(view);\r\n }\r\n\r\n // Replicate parent rig camera behavior\r\n currentRig.layerMask = this.layerMask;\r\n });\r\n }\r\n\r\n private _updateNumberOfRigCameras(viewCount = 1) {\r\n while (this.rigCameras.length < viewCount) {\r\n const newCamera = new TargetCamera(\"XR-RigCamera: \" + this.rigCameras.length, Vector3.Zero(), this.getScene());\r\n newCamera.minZ = 0.1;\r\n newCamera.rotationQuaternion = new Quaternion();\r\n newCamera.updateUpVectorFromRotation = true;\r\n newCamera.isRigCamera = true;\r\n newCamera.rigParent = this;\r\n // do not compute projection matrix, provided by XR\r\n newCamera.freezeProjectionMatrix();\r\n this.rigCameras.push(newCamera);\r\n }\r\n while (this.rigCameras.length > viewCount) {\r\n const removedCamera = this.rigCameras.pop();\r\n if (removedCamera) {\r\n removedCamera.dispose();\r\n }\r\n }\r\n }\r\n\r\n private _updateReferenceSpace() {\r\n // were position & rotation updated OUTSIDE of the xr update loop\r\n if (!this.position.equals(this._referencedPosition) || !this.rotationQuaternion.equals(this._referenceQuaternion)) {\r\n const referencedMat = TmpVectors.Matrix[0];\r\n const poseMat = TmpVectors.Matrix[1];\r\n const transformMat = TmpVectors.Matrix[2];\r\n\r\n Matrix.ComposeToRef(WebXRCamera._ScaleReadOnly, this._referenceQuaternion, this._referencedPosition, referencedMat);\r\n Matrix.ComposeToRef(WebXRCamera._ScaleReadOnly, this.rotationQuaternion, this.position, poseMat);\r\n referencedMat.invert().multiplyToRef(poseMat, transformMat);\r\n transformMat.invert();\r\n\r\n if (!this._scene.useRightHandedSystem) {\r\n transformMat.toggleModelMatrixHandInPlace();\r\n }\r\n\r\n transformMat.decompose(undefined, this._referenceQuaternion, this._referencedPosition);\r\n const transform = new XRRigidTransform(\r\n {\r\n x: this._referencedPosition.x,\r\n y: this._referencedPosition.y,\r\n z: this._referencedPosition.z,\r\n },\r\n {\r\n x: this._referenceQuaternion.x,\r\n y: this._referenceQuaternion.y,\r\n z: this._referenceQuaternion.z,\r\n w: this._referenceQuaternion.w,\r\n }\r\n );\r\n this._xrSessionManager.referenceSpace = this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(transform);\r\n }\r\n }\r\n}\r\n"]}
package/index.d.ts CHANGED
@@ -44,3 +44,4 @@ export * from "./XR/index";
44
44
  export * from "./types";
45
45
  export * from "./Compat/index";
46
46
  export * from "./FlowGraph/index";
47
+ export * from "./ObjectModel/index";
package/index.js CHANGED
@@ -45,4 +45,5 @@ export * from "./XR/index.js";
45
45
  export * from "./types.js";
46
46
  export * from "./Compat/index.js";
47
47
  export * from "./FlowGraph/index.js";
48
+ export * from "./ObjectModel/index.js";
48
49
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../dev/core/src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./abstractScene\";\r\nexport * from \"./Actions/index\";\r\nexport * from \"./Animations/index\";\r\nexport * from \"./assetContainer\";\r\nexport * from \"./Audio/index\";\r\nexport * from \"./BakedVertexAnimation/index\";\r\nexport * from \"./Behaviors/index\";\r\nexport * from \"./Bones/index\";\r\nexport * from \"./Buffers/index\";\r\nexport * from \"./Cameras/index\";\r\nexport * from \"./Collisions/index\";\r\nexport * from \"./Compute/index\";\r\nexport * from \"./Culling/index\";\r\nexport * from \"./Debug/index\";\r\nexport * from \"./DeviceInput/index\";\r\nexport * from \"./Engines/index\";\r\nexport * from \"./Events/index\";\r\nexport * from \"./Gamepads/index\";\r\nexport * from \"./Gizmos/index\";\r\nexport * from \"./Helpers/index\";\r\nexport * from \"./Instrumentation/index\";\r\nexport * from \"./Layers/index\";\r\nexport * from \"./LensFlares/index\";\r\nexport * from \"./Lights/index\";\r\nexport * from \"./Loading/index\";\r\nexport * from \"./Materials/index\";\r\nexport * from \"./Maths/index\";\r\nexport * from \"./Meshes/index\";\r\nexport * from \"./Morph/index\";\r\nexport * from \"./Navigation/index\";\r\nexport * from \"./node\";\r\nexport * from \"./Offline/index\";\r\nexport * from \"./Particles/index\";\r\nexport * from \"./Physics/index\";\r\nexport * from \"./PostProcesses/index\";\r\nexport * from \"./Probes/index\";\r\nexport * from \"./Rendering/index\";\r\nexport * from \"./scene\";\r\nexport * from \"./sceneComponent\";\r\nexport * from \"./Sprites/index\";\r\nexport * from \"./States/index\";\r\nexport * from \"./Misc/index\";\r\nexport * from \"./XR/index\";\r\nexport * from \"./types\";\r\nexport * from \"./Compat/index\";\r\nexport * from \"./FlowGraph/index\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../dev/core/src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./abstractScene\";\r\nexport * from \"./Actions/index\";\r\nexport * from \"./Animations/index\";\r\nexport * from \"./assetContainer\";\r\nexport * from \"./Audio/index\";\r\nexport * from \"./BakedVertexAnimation/index\";\r\nexport * from \"./Behaviors/index\";\r\nexport * from \"./Bones/index\";\r\nexport * from \"./Buffers/index\";\r\nexport * from \"./Cameras/index\";\r\nexport * from \"./Collisions/index\";\r\nexport * from \"./Compute/index\";\r\nexport * from \"./Culling/index\";\r\nexport * from \"./Debug/index\";\r\nexport * from \"./DeviceInput/index\";\r\nexport * from \"./Engines/index\";\r\nexport * from \"./Events/index\";\r\nexport * from \"./Gamepads/index\";\r\nexport * from \"./Gizmos/index\";\r\nexport * from \"./Helpers/index\";\r\nexport * from \"./Instrumentation/index\";\r\nexport * from \"./Layers/index\";\r\nexport * from \"./LensFlares/index\";\r\nexport * from \"./Lights/index\";\r\nexport * from \"./Loading/index\";\r\nexport * from \"./Materials/index\";\r\nexport * from \"./Maths/index\";\r\nexport * from \"./Meshes/index\";\r\nexport * from \"./Morph/index\";\r\nexport * from \"./Navigation/index\";\r\nexport * from \"./node\";\r\nexport * from \"./Offline/index\";\r\nexport * from \"./Particles/index\";\r\nexport * from \"./Physics/index\";\r\nexport * from \"./PostProcesses/index\";\r\nexport * from \"./Probes/index\";\r\nexport * from \"./Rendering/index\";\r\nexport * from \"./scene\";\r\nexport * from \"./sceneComponent\";\r\nexport * from \"./Sprites/index\";\r\nexport * from \"./States/index\";\r\nexport * from \"./Misc/index\";\r\nexport * from \"./XR/index\";\r\nexport * from \"./types\";\r\nexport * from \"./Compat/index\";\r\nexport * from \"./FlowGraph/index\";\r\nexport * from \"./ObjectModel/index\";\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs/core",
3
- "version": "6.36.0",
3
+ "version": "6.37.0",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",
package/types.d.ts CHANGED
@@ -45,5 +45,9 @@ export type DeepImmutableObject<T> = {
45
45
  /** @internal */
46
46
  interface DeepImmutableArray<T> extends ReadonlyArray<DeepImmutable<T>> {
47
47
  }
48
- export {};
49
48
  /** @internal */
49
+ /**
50
+ * Alias type for image sources
51
+ */
52
+ export type ImageSource = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas;
53
+ export {};
package/types.js CHANGED
@@ -1,4 +1,2 @@
1
1
  export {};
2
- /** @internal */
3
- /* interface DeepImmutableMap<K, V> extends ReadonlyMap<DeepImmutable<K>, DeepImmutable<V>> {} // es2015+ only */
4
2
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../dev/core/src/types.ts"],"names":[],"mappings":";AA8DA,gBAAgB;AAChB,iHAAiH","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n/** Alias type for value that can be null */\r\nexport type Nullable<T> = T | null;\r\n/**\r\n * Alias type for number that are floats\r\n * @ignorenaming\r\n */\r\nexport type float = number;\r\n/**\r\n * Alias type for number that are doubles.\r\n * @ignorenaming\r\n */\r\nexport type double = number;\r\n/**\r\n * Alias type for number that are integer\r\n * @ignorenaming\r\n */\r\nexport type int = number;\r\n\r\n/** Alias type for number array or Float32Array */\r\nexport type FloatArray = number[] | Float32Array;\r\n/** Alias type for number array or Float32Array or Int32Array or Uint32Array or Uint16Array */\r\nexport type IndicesArray = number[] | Int32Array | Uint32Array | Uint16Array;\r\n\r\n/**\r\n * Alias for types that can be used by a Buffer or VertexBuffer.\r\n */\r\nexport type DataArray = number[] | ArrayBuffer | ArrayBufferView;\r\n\r\n/**\r\n * Alias type for primitive types\r\n * @ignorenaming\r\n */\r\ntype Primitive = undefined | null | boolean | string | number | Function | Element;\r\n\r\n/**\r\n * Type modifier to make all the properties of an object Readonly\r\n */\r\nexport type Immutable<T> = T extends Primitive\r\n ? T\r\n : T extends Array<infer U>\r\n ? ReadonlyArray<U>\r\n : /* T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : // es2015+ only */\r\n DeepImmutable<T>;\r\n\r\n/**\r\n * Type modifier to make all the properties of an object Readonly recursively\r\n */\r\nexport type DeepImmutable<T> = T extends Primitive\r\n ? T\r\n : T extends Array<infer U>\r\n ? DeepImmutableArray<U>\r\n : /* T extends Map<infer K, infer V> ? DeepImmutableMap<K, V> : // es2015+ only */\r\n DeepImmutableObject<T>;\r\n\r\n/**\r\n * Type modifier to make object properties readonly.\r\n */\r\nexport type DeepImmutableObject<T> = { readonly [K in keyof T]: DeepImmutable<T[K]> };\r\n\r\n/** @internal */\r\ninterface DeepImmutableArray<T> extends ReadonlyArray<DeepImmutable<T>> {}\r\n/** @internal */\r\n/* interface DeepImmutableMap<K, V> extends ReadonlyMap<DeepImmutable<K>, DeepImmutable<V>> {} // es2015+ only */\r\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../dev/core/src/types.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n/** Alias type for value that can be null */\r\nexport type Nullable<T> = T | null;\r\n/**\r\n * Alias type for number that are floats\r\n * @ignorenaming\r\n */\r\nexport type float = number;\r\n/**\r\n * Alias type for number that are doubles.\r\n * @ignorenaming\r\n */\r\nexport type double = number;\r\n/**\r\n * Alias type for number that are integer\r\n * @ignorenaming\r\n */\r\nexport type int = number;\r\n\r\n/** Alias type for number array or Float32Array */\r\nexport type FloatArray = number[] | Float32Array;\r\n/** Alias type for number array or Float32Array or Int32Array or Uint32Array or Uint16Array */\r\nexport type IndicesArray = number[] | Int32Array | Uint32Array | Uint16Array;\r\n\r\n/**\r\n * Alias for types that can be used by a Buffer or VertexBuffer.\r\n */\r\nexport type DataArray = number[] | ArrayBuffer | ArrayBufferView;\r\n\r\n/**\r\n * Alias type for primitive types\r\n * @ignorenaming\r\n */\r\ntype Primitive = undefined | null | boolean | string | number | Function | Element;\r\n\r\n/**\r\n * Type modifier to make all the properties of an object Readonly\r\n */\r\nexport type Immutable<T> = T extends Primitive\r\n ? T\r\n : T extends Array<infer U>\r\n ? ReadonlyArray<U>\r\n : /* T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : // es2015+ only */\r\n DeepImmutable<T>;\r\n\r\n/**\r\n * Type modifier to make all the properties of an object Readonly recursively\r\n */\r\nexport type DeepImmutable<T> = T extends Primitive\r\n ? T\r\n : T extends Array<infer U>\r\n ? DeepImmutableArray<U>\r\n : /* T extends Map<infer K, infer V> ? DeepImmutableMap<K, V> : // es2015+ only */\r\n DeepImmutableObject<T>;\r\n\r\n/**\r\n * Type modifier to make object properties readonly.\r\n */\r\nexport type DeepImmutableObject<T> = { readonly [K in keyof T]: DeepImmutable<T[K]> };\r\n\r\n/** @internal */\r\ninterface DeepImmutableArray<T> extends ReadonlyArray<DeepImmutable<T>> {}\r\n/** @internal */\r\n/* interface DeepImmutableMap<K, V> extends ReadonlyMap<DeepImmutable<K>, DeepImmutable<V>> {} // es2015+ only */\r\n\r\n/**\r\n * Alias type for image sources\r\n */\r\nexport type ImageSource = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas;\r\n"]}