@babylonjs/core 6.24.0 → 6.25.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 (344) hide show
  1. package/Buffers/buffer.align.d.ts +25 -0
  2. package/Buffers/buffer.align.js +120 -0
  3. package/Buffers/buffer.align.js.map +1 -0
  4. package/Buffers/buffer.d.ts +15 -3
  5. package/Buffers/buffer.js +27 -7
  6. package/Buffers/buffer.js.map +1 -1
  7. package/Buffers/index.d.ts +1 -0
  8. package/Buffers/index.js +1 -0
  9. package/Buffers/index.js.map +1 -1
  10. package/Cameras/Inputs/BaseCameraPointersInput.js +0 -3
  11. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  12. package/Cameras/Inputs/flyCameraMouseInput.js +1 -4
  13. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  14. package/Cameras/Inputs/freeCameraMouseInput.js +0 -6
  15. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  16. package/Cameras/RigModes/index.d.ts +0 -1
  17. package/Cameras/RigModes/index.js +0 -1
  18. package/Cameras/RigModes/index.js.map +1 -1
  19. package/Cameras/RigModes/vrRigMode.js +1 -1
  20. package/Cameras/RigModes/vrRigMode.js.map +1 -1
  21. package/Cameras/VR/index.d.ts +0 -1
  22. package/Cameras/VR/index.js +0 -1
  23. package/Cameras/VR/index.js.map +1 -1
  24. package/Cameras/VR/vrExperienceHelper.d.ts +7 -66
  25. package/Cameras/VR/vrExperienceHelper.js +17 -702
  26. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  27. package/Cameras/camera.d.ts +15 -20
  28. package/Cameras/camera.js +41 -36
  29. package/Cameras/camera.js.map +1 -1
  30. package/Cameras/targetCamera.js +1 -1
  31. package/Cameras/targetCamera.js.map +1 -1
  32. package/Engines/Extensions/index.d.ts +0 -1
  33. package/Engines/Extensions/index.js +0 -1
  34. package/Engines/Extensions/index.js.map +1 -1
  35. package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +4 -0
  36. package/Engines/WebGL/webGLRenderTargetWrapper.js +4 -0
  37. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  38. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +8 -7
  39. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  40. package/Engines/WebGPU/webgpuCacheSampler.js +1 -1
  41. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  42. package/Engines/constants.d.ts +0 -4
  43. package/Engines/constants.js +0 -4
  44. package/Engines/constants.js.map +1 -1
  45. package/Engines/engine.d.ts +38 -258
  46. package/Engines/engine.js +0 -65
  47. package/Engines/engine.js.map +1 -1
  48. package/Engines/engineFactory.js +9 -14
  49. package/Engines/engineFactory.js.map +1 -1
  50. package/Engines/engineFeatures.d.ts +2 -0
  51. package/Engines/engineFeatures.js.map +1 -1
  52. package/Engines/nativeEngine.js +1 -0
  53. package/Engines/nativeEngine.js.map +1 -1
  54. package/Engines/nullEngine.js +1 -0
  55. package/Engines/nullEngine.js.map +1 -1
  56. package/Engines/thinEngine.d.ts +22 -5
  57. package/Engines/thinEngine.js +55 -22
  58. package/Engines/thinEngine.js.map +1 -1
  59. package/Engines/webgpuEngine.d.ts +1 -0
  60. package/Engines/webgpuEngine.js +4 -2
  61. package/Engines/webgpuEngine.js.map +1 -1
  62. package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.d.ts +9 -8
  63. package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js +34 -16
  64. package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js.map +1 -1
  65. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.d.ts +4 -3
  66. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js +14 -6
  67. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js.map +1 -1
  68. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.d.ts +19 -14
  69. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js +64 -27
  70. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js.map +1 -1
  71. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.d.ts +39 -41
  72. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js +152 -74
  73. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js.map +1 -1
  74. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.d.ts +12 -12
  75. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js +42 -21
  76. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js.map +1 -1
  77. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.d.ts +17 -14
  78. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js +62 -26
  79. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js.map +1 -1
  80. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.d.ts +13 -10
  81. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js +46 -18
  82. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js.map +1 -1
  83. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +4 -1
  84. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +6 -2
  85. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  86. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +3 -1
  87. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +7 -2
  88. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  89. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +5 -3
  90. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +10 -5
  91. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  92. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +4 -1
  93. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +6 -2
  94. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
  95. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.d.ts +3 -1
  96. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js +7 -2
  97. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +1 -1
  98. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +3 -1
  99. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +7 -2
  100. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  101. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +4 -1
  102. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +6 -2
  103. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  104. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +6 -2
  105. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +12 -3
  106. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  107. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +5 -3
  108. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +11 -6
  109. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  110. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +1 -0
  111. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +7 -2
  112. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  113. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +1 -0
  114. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +7 -2
  115. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  116. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +3 -1
  117. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +7 -2
  118. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  119. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +3 -1
  120. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +8 -3
  121. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  122. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +3 -1
  123. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +7 -2
  124. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  125. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +3 -1
  126. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +7 -2
  127. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +1 -1
  128. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.d.ts +3 -1
  129. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +7 -2
  130. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +1 -1
  131. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +3 -1
  132. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +7 -2
  133. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  134. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +3 -1
  135. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +7 -2
  136. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  137. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +3 -1
  138. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +7 -2
  139. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  140. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +3 -1
  141. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +7 -2
  142. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  143. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +3 -1
  144. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +7 -2
  145. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  146. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +3 -1
  147. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +7 -2
  148. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  149. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +6 -3
  150. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +22 -16
  151. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  152. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +7 -4
  153. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +15 -10
  154. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  155. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -1
  156. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +7 -2
  157. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  158. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +3 -1
  159. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +8 -3
  160. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
  161. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +7 -4
  162. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +14 -7
  163. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  164. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +5 -3
  165. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +9 -4
  166. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  167. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.d.ts +3 -1
  168. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js +7 -2
  169. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js.map +1 -1
  170. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +3 -1
  171. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +8 -3
  172. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
  173. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +3 -1
  174. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +7 -2
  175. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  176. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +3 -1
  177. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +7 -2
  178. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  179. package/FlowGraph/flowGraph.d.ts +41 -3
  180. package/FlowGraph/flowGraph.js +135 -0
  181. package/FlowGraph/flowGraph.js.map +1 -1
  182. package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +2 -1
  183. package/FlowGraph/flowGraphAsyncExecutionBlock.js +2 -2
  184. package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
  185. package/FlowGraph/flowGraphBlock.d.ts +15 -3
  186. package/FlowGraph/flowGraphBlock.js +50 -7
  187. package/FlowGraph/flowGraphBlock.js.map +1 -1
  188. package/FlowGraph/flowGraphConnection.d.ts +34 -4
  189. package/FlowGraph/flowGraphConnection.js +49 -3
  190. package/FlowGraph/flowGraphConnection.js.map +1 -1
  191. package/FlowGraph/flowGraphContext.d.ts +25 -5
  192. package/FlowGraph/flowGraphContext.js +86 -4
  193. package/FlowGraph/flowGraphContext.js.map +1 -1
  194. package/FlowGraph/flowGraphCoordinator.d.ts +7 -1
  195. package/FlowGraph/flowGraphCoordinator.js +18 -2
  196. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  197. package/FlowGraph/flowGraphDataConnection.d.ts +4 -11
  198. package/FlowGraph/flowGraphDataConnection.js +16 -14
  199. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  200. package/FlowGraph/flowGraphExecutionBlock.d.ts +8 -3
  201. package/FlowGraph/flowGraphExecutionBlock.js +37 -6
  202. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  203. package/FlowGraph/flowGraphRichTypes.d.ts +5 -9
  204. package/FlowGraph/flowGraphRichTypes.js +29 -44
  205. package/FlowGraph/flowGraphRichTypes.js.map +1 -1
  206. package/FlowGraph/flowGraphSignalConnection.js +2 -0
  207. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  208. package/FlowGraph/flowGraphVariableDefinitions.d.ts +22 -2
  209. package/FlowGraph/flowGraphVariableDefinitions.js +29 -0
  210. package/FlowGraph/flowGraphVariableDefinitions.js.map +1 -1
  211. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.d.ts +2 -1
  212. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js +2 -2
  213. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js.map +1 -1
  214. package/Gamepads/gamepadManager.js +0 -5
  215. package/Gamepads/gamepadManager.js.map +1 -1
  216. package/Gamepads/index.d.ts +0 -1
  217. package/Gamepads/index.js +0 -2
  218. package/Gamepads/index.js.map +1 -1
  219. package/Gizmos/gizmo.js +1 -4
  220. package/Gizmos/gizmo.js.map +1 -1
  221. package/Materials/GreasedLine/greasedLineMaterialDefaults.d.ts +24 -0
  222. package/Materials/GreasedLine/greasedLineMaterialDefaults.js +19 -0
  223. package/Materials/GreasedLine/greasedLineMaterialDefaults.js.map +1 -0
  224. package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +243 -0
  225. package/Materials/GreasedLine/greasedLineMaterialInterfaces.js +55 -0
  226. package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -0
  227. package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +253 -0
  228. package/Materials/{greasedLinePluginMaterial.js → GreasedLine/greasedLinePluginMaterial.js} +148 -205
  229. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -0
  230. package/Materials/{greasedLineSimpleMaterial.d.ts → GreasedLine/greasedLineSimpleMaterial.d.ts} +20 -48
  231. package/Materials/{greasedLineSimpleMaterial.js → GreasedLine/greasedLineSimpleMaterial.js} +74 -91
  232. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -0
  233. package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +1 -1
  234. package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
  235. package/Materials/Textures/texture.js +1 -0
  236. package/Materials/Textures/texture.js.map +1 -1
  237. package/Materials/index.d.ts +4 -1
  238. package/Materials/index.js +4 -1
  239. package/Materials/index.js.map +1 -1
  240. package/Maths/math.vector.d.ts +32 -22
  241. package/Maths/math.vector.js +54 -43
  242. package/Maths/math.vector.js.map +1 -1
  243. package/Meshes/Builders/greasedLineBuilder.d.ts +7 -6
  244. package/Meshes/Builders/greasedLineBuilder.js +65 -31
  245. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  246. package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +216 -0
  247. package/Meshes/GreasedLine/greasedLineBaseMesh.js +247 -0
  248. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -0
  249. package/Meshes/GreasedLine/greasedLineMesh.d.ts +92 -0
  250. package/Meshes/{greasedLineMesh.js → GreasedLine/greasedLineMesh.js} +29 -223
  251. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -0
  252. package/Meshes/GreasedLine/greasedLineRibbonMesh.d.ts +107 -0
  253. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +462 -0
  254. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -0
  255. package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +9 -2
  256. package/Meshes/Node/Blocks/Sources/meshBlock.js +17 -5
  257. package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
  258. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +15 -0
  259. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +50 -1
  260. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  261. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +5 -5
  262. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  263. package/Meshes/Node/nodeGeometry.d.ts +1 -2
  264. package/Meshes/Node/nodeGeometry.js +3 -4
  265. package/Meshes/Node/nodeGeometry.js.map +1 -1
  266. package/Meshes/Node/nodeGeometryBlock.d.ts +1 -2
  267. package/Meshes/Node/nodeGeometryBlock.js +1 -2
  268. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  269. package/Meshes/geometry.js +6 -12
  270. package/Meshes/geometry.js.map +1 -1
  271. package/Meshes/index.d.ts +3 -1
  272. package/Meshes/index.js +3 -1
  273. package/Meshes/index.js.map +1 -1
  274. package/Meshes/mesh.d.ts +4 -0
  275. package/Meshes/mesh.js +7 -0
  276. package/Meshes/mesh.js.map +1 -1
  277. package/Misc/deepCopier.js +3 -0
  278. package/Misc/deepCopier.js.map +1 -1
  279. package/Misc/greasedLineTools.d.ts +52 -5
  280. package/Misc/greasedLineTools.js +180 -10
  281. package/Misc/greasedLineTools.js.map +1 -1
  282. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +9 -2
  283. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  284. package/PostProcesses/motionBlurPostProcess.js +4 -1
  285. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  286. package/PostProcesses/postProcess.js +1 -6
  287. package/PostProcesses/postProcess.js.map +1 -1
  288. package/Rendering/geometryBufferRenderer.js +4 -0
  289. package/Rendering/geometryBufferRenderer.js.map +1 -1
  290. package/Shaders/greasedLine.fragment.js +2 -5
  291. package/Shaders/greasedLine.fragment.js.map +1 -1
  292. package/Shaders/greasedLine.vertex.js +15 -4
  293. package/Shaders/greasedLine.vertex.js.map +1 -1
  294. package/XR/webXRDefaultExperience.d.ts +1 -1
  295. package/XR/webXRDefaultExperience.js +1 -1
  296. package/XR/webXRDefaultExperience.js.map +1 -1
  297. package/package.json +1 -1
  298. package/scene.d.ts +17 -10
  299. package/scene.js +25 -30
  300. package/scene.js.map +1 -1
  301. package/Cameras/RigModes/webVRRigMode.d.ts +0 -5
  302. package/Cameras/RigModes/webVRRigMode.js +0 -34
  303. package/Cameras/RigModes/webVRRigMode.js.map +0 -1
  304. package/Cameras/VR/webVRCamera.d.ts +0 -316
  305. package/Cameras/VR/webVRCamera.js +0 -618
  306. package/Cameras/VR/webVRCamera.js.map +0 -1
  307. package/Engines/Extensions/engine.webVR.d.ts +0 -91
  308. package/Engines/Extensions/engine.webVR.js +0 -195
  309. package/Engines/Extensions/engine.webVR.js.map +0 -1
  310. package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.d.ts +0 -23
  311. package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.js +0 -18
  312. package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.js.map +0 -1
  313. package/Gamepads/Controllers/daydreamController.d.ts +0 -38
  314. package/Gamepads/Controllers/daydreamController.js +0 -70
  315. package/Gamepads/Controllers/daydreamController.js.map +0 -1
  316. package/Gamepads/Controllers/gearVRController.d.ts +0 -39
  317. package/Gamepads/Controllers/gearVRController.js +0 -79
  318. package/Gamepads/Controllers/gearVRController.js.map +0 -1
  319. package/Gamepads/Controllers/genericController.d.ts +0 -34
  320. package/Gamepads/Controllers/genericController.js +0 -48
  321. package/Gamepads/Controllers/genericController.js.map +0 -1
  322. package/Gamepads/Controllers/index.d.ts +0 -8
  323. package/Gamepads/Controllers/index.js +0 -9
  324. package/Gamepads/Controllers/index.js.map +0 -1
  325. package/Gamepads/Controllers/oculusTouchController.d.ts +0 -78
  326. package/Gamepads/Controllers/oculusTouchController.js +0 -196
  327. package/Gamepads/Controllers/oculusTouchController.js.map +0 -1
  328. package/Gamepads/Controllers/poseEnabledController.d.ts +0 -219
  329. package/Gamepads/Controllers/poseEnabledController.js +0 -293
  330. package/Gamepads/Controllers/poseEnabledController.js.map +0 -1
  331. package/Gamepads/Controllers/viveController.d.ts +0 -52
  332. package/Gamepads/Controllers/viveController.js +0 -115
  333. package/Gamepads/Controllers/viveController.js.map +0 -1
  334. package/Gamepads/Controllers/webVRController.d.ts +0 -85
  335. package/Gamepads/Controllers/webVRController.js +0 -122
  336. package/Gamepads/Controllers/webVRController.js.map +0 -1
  337. package/Gamepads/Controllers/windowsMotionController.d.ts +0 -212
  338. package/Gamepads/Controllers/windowsMotionController.js +0 -519
  339. package/Gamepads/Controllers/windowsMotionController.js.map +0 -1
  340. package/Materials/greasedLinePluginMaterial.d.ts +0 -496
  341. package/Materials/greasedLinePluginMaterial.js.map +0 -1
  342. package/Materials/greasedLineSimpleMaterial.js.map +0 -1
  343. package/Meshes/greasedLineMesh.d.ts +0 -204
  344. package/Meshes/greasedLineMesh.js.map +0 -1
@@ -4,31 +4,23 @@ import { FreeCamera } from "../../Cameras/freeCamera.js";
4
4
  import { TargetCamera } from "../../Cameras/targetCamera.js";
5
5
  import { DeviceOrientationCamera } from "../../Cameras/deviceOrientationCamera.js";
6
6
  import { VRDeviceOrientationFreeCamera } from "../../Cameras/VR/vrDeviceOrientationFreeCamera.js";
7
- import { WebVRFreeCamera } from "../../Cameras/VR/webVRCamera.js";
8
7
  import { PointerEventTypes } from "../../Events/pointerEvents.js";
9
8
  import { Quaternion, Matrix, Vector3 } from "../../Maths/math.vector.js";
10
9
  import { Color3, Color4 } from "../../Maths/math.color.js";
11
10
  import { Gamepad } from "../../Gamepads/gamepad.js";
12
- import { PoseEnabledController, PoseEnabledControllerType } from "../../Gamepads/Controllers/poseEnabledController.js";
13
- import { WebVRController } from "../../Gamepads/Controllers/webVRController.js";
14
11
  import { Xbox360Button } from "../../Gamepads/xboxGamepad.js";
15
- import { Mesh } from "../../Meshes/mesh.js";
16
12
  import { Ray } from "../../Culling/ray.js";
17
13
  import { ImageProcessingConfiguration } from "../../Materials/imageProcessingConfiguration.js";
18
14
  import { StandardMaterial } from "../../Materials/standardMaterial.js";
19
15
  import { DynamicTexture } from "../../Materials/Textures/dynamicTexture.js";
20
- import { ImageProcessingPostProcess } from "../../PostProcesses/imageProcessingPostProcess.js";
21
16
  import { SineEase, EasingFunction, CircleEase } from "../../Animations/easing.js";
22
17
  import { Animation } from "../../Animations/animation.js";
23
- import { VRCameraMetrics } from "../../Cameras/VR/vrCameraMetrics.js";
24
18
  import "../../Gamepads/gamepadSceneComponent.js";
25
19
  import "../../Animations/animatable.js";
26
- import { Axis } from "../../Maths/math.axis.js";
27
20
  import { WebXRSessionManager } from "../../XR/webXRSessionManager.js";
28
21
  import { WebXRState } from "../../XR/webXRTypes.js";
29
- import { CreateCylinder } from "../../Meshes/Builders/cylinderBuilder.js";
30
- import { CreateTorus } from "../../Meshes/Builders/torusBuilder.js";
31
22
  import { CreateGround } from "../../Meshes/Builders/groundBuilder.js";
23
+ import { CreateTorus } from "../../Meshes/Builders/torusBuilder.js";
32
24
  class VRExperienceHelperGazer {
33
25
  constructor(scene, gazeTrackerToClone = null) {
34
26
  this.scene = scene;
@@ -112,100 +104,6 @@ class VRExperienceHelperGazer {
112
104
  }
113
105
  }
114
106
  VRExperienceHelperGazer._IdCounter = 0;
115
- class VRExperienceHelperControllerGazer extends VRExperienceHelperGazer {
116
- constructor(webVRController, scene, gazeTrackerToClone) {
117
- super(scene, gazeTrackerToClone);
118
- this.webVRController = webVRController;
119
- // Laser pointer
120
- this._laserPointer = CreateCylinder("laserPointer", {
121
- updatable: false,
122
- height: 1,
123
- diameterTop: 0.004,
124
- diameterBottom: 0.0002,
125
- tessellation: 20,
126
- subdivisions: 1,
127
- }, scene);
128
- const laserPointerMaterial = new StandardMaterial("laserPointerMat", scene);
129
- laserPointerMaterial.emissiveColor = new Color3(0.7, 0.7, 0.7);
130
- laserPointerMaterial.alpha = 0.6;
131
- this._laserPointer.material = laserPointerMaterial;
132
- this._laserPointer.rotation.x = Math.PI / 2;
133
- this._laserPointer.position.z = -0.5;
134
- this._laserPointer.isVisible = false;
135
- this._laserPointer.isPickable = false;
136
- if (!webVRController.mesh) {
137
- // Create an empty mesh that is used prior to loading the high quality model
138
- const preloadMesh = new Mesh("preloadControllerMesh", scene);
139
- const preloadPointerPose = new Mesh(PoseEnabledController.POINTING_POSE, scene);
140
- preloadPointerPose.rotation.x = -0.7;
141
- preloadMesh.addChild(preloadPointerPose);
142
- webVRController.attachToMesh(preloadMesh);
143
- }
144
- this._setLaserPointerParent(webVRController.mesh);
145
- this._meshAttachedObserver = webVRController._meshAttachedObservable.add((mesh) => {
146
- this._setLaserPointerParent(mesh);
147
- });
148
- }
149
- _getForwardRay(length) {
150
- return this.webVRController.getForwardRay(length);
151
- }
152
- /** @internal */
153
- _activatePointer() {
154
- super._activatePointer();
155
- this._laserPointer.isVisible = true;
156
- }
157
- /** @internal */
158
- _deactivatePointer() {
159
- super._deactivatePointer();
160
- this._laserPointer.isVisible = false;
161
- }
162
- /**
163
- * @internal
164
- */
165
- _setLaserPointerColor(color) {
166
- this._laserPointer.material.emissiveColor = color;
167
- }
168
- /**
169
- * @internal
170
- */
171
- _setLaserPointerLightingDisabled(disabled) {
172
- this._laserPointer.material.disableLighting = disabled;
173
- }
174
- /**
175
- * @internal
176
- */
177
- _setLaserPointerParent(mesh) {
178
- const makeNotPick = (root) => {
179
- root.isPickable = false;
180
- root.getChildMeshes().forEach((c) => {
181
- makeNotPick(c);
182
- });
183
- };
184
- makeNotPick(mesh);
185
- const meshChildren = mesh.getChildren(undefined, false);
186
- let laserParent = mesh;
187
- this.webVRController._pointingPoseNode = null;
188
- for (let i = 0; i < meshChildren.length; i++) {
189
- if (meshChildren[i].name && meshChildren[i].name.indexOf(PoseEnabledController.POINTING_POSE) >= 0) {
190
- laserParent = meshChildren[i];
191
- this.webVRController._pointingPoseNode = laserParent;
192
- break;
193
- }
194
- }
195
- this._laserPointer.parent = laserParent;
196
- }
197
- _updatePointerDistance(distance = 100) {
198
- this._laserPointer.scaling.y = distance;
199
- this._laserPointer.position.z = -distance / 2;
200
- }
201
- dispose() {
202
- super.dispose();
203
- this._laserPointer.dispose();
204
- if (this._meshAttachedObserver) {
205
- this.webVRController._meshAttachedObservable.remove(this._meshAttachedObserver);
206
- }
207
- }
208
- }
209
107
  class VRExperienceHelperCameraGazer extends VRExperienceHelperGazer {
210
108
  constructor(_getCamera, scene) {
211
109
  super(scene);
@@ -229,7 +127,7 @@ export class OnAfterEnteringVRObservableEvent {
229
127
  /**
230
128
  * Helps to quickly add VR support to an existing scene.
231
129
  * See https://doc.babylonjs.com/features/featuresDeepDive/cameras/webVRHelper
232
- * @deprecated
130
+ * @deprecated Use WebXR instead!
233
131
  */
234
132
  export class VRExperienceHelper {
235
133
  /** Return this.onEnteringVRObservable
@@ -244,12 +142,6 @@ export class VRExperienceHelper {
244
142
  get onExitingVR() {
245
143
  return this.onExitingVRObservable;
246
144
  }
247
- /** Return this.onControllerMeshLoadedObservable
248
- * Note: This one is for backward compatibility. Please use onControllerMeshLoadedObservable directly
249
- */
250
- get onControllerMeshLoaded() {
251
- return this.onControllerMeshLoadedObservable;
252
- }
253
145
  /**
254
146
  * The mesh used to display where the user is going to teleport.
255
147
  */
@@ -280,44 +172,14 @@ export class VRExperienceHelper {
280
172
  if (this._cameraGazer._gazeTracker) {
281
173
  this._cameraGazer._gazeTracker.dispose();
282
174
  }
283
- if (this._leftController && this._leftController._gazeTracker) {
284
- this._leftController._gazeTracker.dispose();
285
- }
286
- if (this._rightController && this._rightController._gazeTracker) {
287
- this._rightController._gazeTracker.dispose();
288
- }
289
175
  // Set and create gaze trackers on head and controllers
290
176
  this._cameraGazer._gazeTracker = value;
291
177
  this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices();
292
178
  this._cameraGazer._gazeTracker.isPickable = false;
293
179
  this._cameraGazer._gazeTracker.isVisible = false;
294
180
  this._cameraGazer._gazeTracker.name = "gazeTracker";
295
- if (this._leftController) {
296
- this._leftController._gazeTracker = this._cameraGazer._gazeTracker.clone("gazeTracker");
297
- }
298
- if (this._rightController) {
299
- this._rightController._gazeTracker = this._cameraGazer._gazeTracker.clone("gazeTracker");
300
- }
301
181
  }
302
182
  }
303
- /**
304
- * The gaze tracking mesh corresponding to the left controller
305
- */
306
- get leftControllerGazeTrackerMesh() {
307
- if (this._leftController) {
308
- return this._leftController._gazeTracker;
309
- }
310
- return null;
311
- }
312
- /**
313
- * The gaze tracking mesh corresponding to the right controller
314
- */
315
- get rightControllerGazeTrackerMesh() {
316
- if (this._rightController) {
317
- return this._rightController._gazeTracker;
318
- }
319
- return null;
320
- }
321
183
  /**
322
184
  * If the ray of the gaze should be displayed.
323
185
  */
@@ -331,12 +193,6 @@ export class VRExperienceHelper {
331
193
  this._displayGaze = value;
332
194
  if (!value) {
333
195
  this._cameraGazer._gazeTracker.isVisible = false;
334
- if (this._leftController) {
335
- this._leftController._gazeTracker.isVisible = false;
336
- }
337
- if (this._rightController) {
338
- this._rightController._gazeTracker.isVisible = false;
339
- }
340
196
  }
341
197
  }
342
198
  /**
@@ -350,24 +206,6 @@ export class VRExperienceHelper {
350
206
  */
351
207
  set displayLaserPointer(value) {
352
208
  this._displayLaserPointer = value;
353
- if (!value) {
354
- if (this._rightController) {
355
- this._rightController._deactivatePointer();
356
- this._rightController._gazeTracker.isVisible = false;
357
- }
358
- if (this._leftController) {
359
- this._leftController._deactivatePointer();
360
- this._leftController._gazeTracker.isVisible = false;
361
- }
362
- }
363
- else {
364
- if (this._rightController) {
365
- this._rightController._activatePointer();
366
- }
367
- if (this._leftController) {
368
- this._leftController._activatePointer();
369
- }
370
- }
371
209
  }
372
210
  /**
373
211
  * The deviceOrientationCamera used as the camera when not in VR.
@@ -379,18 +217,7 @@ export class VRExperienceHelper {
379
217
  * Based on the current WebVR support, returns the current VR camera used.
380
218
  */
381
219
  get currentVRCamera() {
382
- if (this._webVRready) {
383
- return this._webVRCamera;
384
- }
385
- else {
386
- return this._scene.activeCamera;
387
- }
388
- }
389
- /**
390
- * The webVRCamera which is used when in VR.
391
- */
392
- get webVRCamera() {
393
- return this._webVRCamera;
220
+ return this._scene.activeCamera;
394
221
  }
395
222
  /**
396
223
  * The deviceOrientationCamera that is used as a fallback when vr device is not connected.
@@ -405,10 +232,7 @@ export class VRExperienceHelper {
405
232
  return this._btnVR;
406
233
  }
407
234
  get _teleportationRequestInitiated() {
408
- const result = this._cameraGazer._teleportationRequestInitiated ||
409
- (this._leftController !== null && this._leftController._teleportationRequestInitiated) ||
410
- (this._rightController !== null && this._rightController._teleportationRequestInitiated);
411
- return result;
235
+ return this._cameraGazer._teleportationRequestInitiated;
412
236
  }
413
237
  /**
414
238
  * Instantiates a VRExperienceHelper.
@@ -420,14 +244,6 @@ export class VRExperienceHelper {
420
244
  /** Options to modify the vr experience helper's behavior. */
421
245
  webVROptions = {}) {
422
246
  this.webVROptions = webVROptions;
423
- // Can the system support WebVR, even if a headset isn't plugged in?
424
- this._webVRsupported = false;
425
- // If WebVR is supported, is a headset plugged in and are we ready to present?
426
- this._webVRready = false;
427
- // Are we waiting for the requestPresent callback to complete?
428
- this._webVRrequesting = false;
429
- // Are we presenting to the headset right now? (this is the vrDevice state)
430
- this._webVRpresenting = false;
431
247
  // Are we presenting in the fullscreen fallback?
432
248
  this._fullscreenVRpresenting = false;
433
249
  /**
@@ -450,12 +266,7 @@ export class VRExperienceHelper {
450
266
  * Observable raised when exiting VR.
451
267
  */
452
268
  this.onExitingVRObservable = new Observable();
453
- /**
454
- * Observable raised when controller mesh is loaded.
455
- */
456
- this.onControllerMeshLoadedObservable = new Observable();
457
269
  this._useCustomVRButton = false;
458
- this._teleportationRequested = false;
459
270
  this._teleportActive = false;
460
271
  this._floorMeshesCollection = [];
461
272
  this._teleportationMode = VRExperienceHelper.TELEPORTATIONMODE_CONSTANTTIME;
@@ -470,21 +281,12 @@ export class VRExperienceHelper {
470
281
  this._haloCenter = new Vector3(0, 0, 0);
471
282
  this._padSensibilityUp = 0.65;
472
283
  this._padSensibilityDown = 0.35;
473
- this._leftController = null;
474
- this._rightController = null;
475
- this._gazeColor = new Color3(0.7, 0.7, 0.7);
476
- this._laserColor = new Color3(0.7, 0.7, 0.7);
477
284
  this._pickedLaserColor = new Color3(0.2, 0.2, 1);
478
285
  this._pickedGazeColor = new Color3(0, 0, 1);
479
286
  /**
480
287
  * Observable raised when a new mesh is selected based on meshSelectionPredicate
481
288
  */
482
289
  this.onNewMeshSelected = new Observable();
483
- /**
484
- * Observable raised when a new mesh is selected based on meshSelectionPredicate.
485
- * This observable will provide the mesh and the controller used to select the mesh
486
- */
487
- this.onMeshSelectedWithController = new Observable();
488
290
  /**
489
291
  * Observable raised when a new mesh is picked based on meshSelectionPredicate
490
292
  */
@@ -507,7 +309,6 @@ export class VRExperienceHelper {
507
309
  this.teleportationEnabled = true;
508
310
  this._teleportationInitialized = false;
509
311
  this._interactionsEnabled = false;
510
- this._interactionsRequested = false;
511
312
  this._displayGaze = true;
512
313
  this._displayLaserPointer = true;
513
314
  /**
@@ -534,9 +335,6 @@ export class VRExperienceHelper {
534
335
  this.xrTestDone = false;
535
336
  this._onResize = () => {
536
337
  this._moveButtonToBottomRight();
537
- if (this._fullscreenVRpresenting && this._webVRready) {
538
- this.exitVR();
539
- }
540
338
  };
541
339
  this._onFullscreenChange = () => {
542
340
  this._fullscreenVRpresenting = !!document.fullscreenElement;
@@ -552,14 +350,8 @@ export class VRExperienceHelper {
552
350
  };
553
351
  this._cachedAngularSensibility = { angularSensibilityX: null, angularSensibilityY: null, angularSensibility: null };
554
352
  this._beforeRender = () => {
555
- if (this._leftController && this._leftController._activePointer) {
556
- this._castRayAndSelectObject(this._leftController);
557
- }
558
- if (this._rightController && this._rightController._activePointer) {
559
- this._castRayAndSelectObject(this._rightController);
560
- }
561
- if (this._noControllerIsActive && (this._scene.getEngine().isPointerLock || this.enableGazeEvenWhenNoPointerLock)) {
562
- this._castRayAndSelectObject(this._cameraGazer);
353
+ if (this._scene.getEngine().isPointerLock || this.enableGazeEvenWhenNoPointerLock) {
354
+ // no-op
563
355
  }
564
356
  else {
565
357
  this._cameraGazer._gazeTracker.isVisible = false;
@@ -571,11 +363,8 @@ export class VRExperienceHelper {
571
363
  gamepad.onleftstickchanged((stickValues) => {
572
364
  if (this._teleportationInitialized && this.teleportationEnabled) {
573
365
  // Listening to classic/xbox gamepad only if no VR controller is active
574
- if ((!this._leftController && !this._rightController) ||
575
- (this._leftController && !this._leftController._activePointer && this._rightController && !this._rightController._activePointer)) {
576
- this._checkTeleportWithRay(stickValues, this._cameraGazer);
577
- this._checkTeleportBackwards(stickValues, this._cameraGazer);
578
- }
366
+ this._checkTeleportWithRay(stickValues, this._cameraGazer);
367
+ this._checkTeleportBackwards(stickValues, this._cameraGazer);
579
368
  }
580
369
  });
581
370
  }
@@ -599,38 +388,6 @@ export class VRExperienceHelper {
599
388
  });
600
389
  }
601
390
  }
602
- else {
603
- const webVRController = gamepad;
604
- const controller = new VRExperienceHelperControllerGazer(webVRController, this._scene, this._cameraGazer._gazeTracker);
605
- if (webVRController.hand === "right" || (this._leftController && this._leftController.webVRController != webVRController)) {
606
- this._rightController = controller;
607
- }
608
- else {
609
- this._leftController = controller;
610
- }
611
- this._tryEnableInteractionOnController(controller);
612
- }
613
- };
614
- // This only succeeds if the controller's mesh exists for the controller so this must be called whenever new controller is connected or when mesh is loaded
615
- this._tryEnableInteractionOnController = (controller) => {
616
- if (this._interactionsRequested && !controller._interactionsEnabled) {
617
- this._enableInteractionOnController(controller);
618
- }
619
- if (this._teleportationRequested && !controller._teleportationEnabled) {
620
- this._enableTeleportationOnController(controller);
621
- }
622
- };
623
- this._onNewGamepadDisconnected = (gamepad) => {
624
- if (gamepad instanceof WebVRController) {
625
- if (gamepad.hand === "left" && this._leftController != null) {
626
- this._leftController.dispose();
627
- this._leftController = null;
628
- }
629
- if (gamepad.hand === "right" && this._rightController != null) {
630
- this._rightController.dispose();
631
- this._rightController = null;
632
- }
633
- }
634
391
  };
635
392
  this._workingVector = Vector3.Zero();
636
393
  this._workingQuaternion = Quaternion.Identity();
@@ -654,23 +411,6 @@ export class VRExperienceHelper {
654
411
  if (webVROptions.laserToggle === undefined) {
655
412
  webVROptions.laserToggle = true;
656
413
  }
657
- if (webVROptions.defaultHeight === undefined) {
658
- webVROptions.defaultHeight = 1.7;
659
- }
660
- if (webVROptions.useCustomVRButton) {
661
- this._useCustomVRButton = true;
662
- if (webVROptions.customVRButton) {
663
- this._btnVR = webVROptions.customVRButton;
664
- }
665
- }
666
- if (webVROptions.rayLength) {
667
- this._rayLength = webVROptions.rayLength;
668
- }
669
- this._defaultHeight = webVROptions.defaultHeight;
670
- if (webVROptions.positionScale) {
671
- this._rayLength *= webVROptions.positionScale;
672
- this._defaultHeight *= webVROptions.positionScale;
673
- }
674
414
  this._hasEnteredVR = false;
675
415
  // Set position
676
416
  if (this._scene.activeCamera) {
@@ -763,17 +503,9 @@ export class VRExperienceHelper {
763
503
  this.xrTestDone = true;
764
504
  // Create VR cameras
765
505
  if (webVROptions.createFallbackVRDeviceOrientationFreeCamera) {
766
- if (webVROptions.useMultiview) {
767
- if (!webVROptions.vrDeviceOrientationCameraMetrics) {
768
- webVROptions.vrDeviceOrientationCameraMetrics = VRCameraMetrics.GetDefault();
769
- }
770
- webVROptions.vrDeviceOrientationCameraMetrics.multiviewEnabled = true;
771
- }
772
506
  this._vrDeviceOrientationCamera = new VRDeviceOrientationFreeCamera("VRDeviceOrientationVRHelper", this._position, this._scene, true, webVROptions.vrDeviceOrientationCameraMetrics);
773
507
  this._vrDeviceOrientationCamera.angularSensibility = Number.MAX_VALUE;
774
508
  }
775
- this._webVRCamera = new WebVRFreeCamera("WebVRHelper", this._position, this._scene, webVROptions);
776
- this._webVRCamera.useStandingMatrix();
777
509
  this._cameraGazer = new VRExperienceHelperCameraGazer(() => {
778
510
  return this.currentVRCamera;
779
511
  }, scene);
@@ -805,9 +537,6 @@ export class VRExperienceHelper {
805
537
  if (!this.isInVRMode) {
806
538
  this.enterVR();
807
539
  }
808
- else {
809
- this._scene.getEngine().disableVR();
810
- }
811
540
  });
812
541
  }
813
542
  // Window events
@@ -821,13 +550,6 @@ export class VRExperienceHelper {
821
550
  if (webVROptions.createFallbackVRDeviceOrientationFreeCamera) {
822
551
  this._displayVRButton();
823
552
  }
824
- else {
825
- this._scene.getEngine().onVRDisplayChangedObservable.add((e) => {
826
- if (e.vrDisplay) {
827
- this._displayVRButton();
828
- }
829
- });
830
- }
831
553
  // Exiting VR mode using 'ESC' key on desktop
832
554
  this._onKeyDown = (event) => {
833
555
  if (event.keyCode === 27 && this.isInVRMode) {
@@ -844,28 +566,9 @@ export class VRExperienceHelper {
844
566
  }
845
567
  }
846
568
  }, PointerEventTypes.POINTERDOUBLETAP, false);
847
- // Listen for WebVR display changes
848
- this._onVRDisplayChangedBind = (eventArgs) => this._onVRDisplayChanged(eventArgs);
849
- this._onVrDisplayPresentChangeBind = () => this._onVrDisplayPresentChange();
850
- this._onVRRequestPresentStart = () => {
851
- this._webVRrequesting = true;
852
- this._updateButtonVisibility();
853
- };
854
- this._onVRRequestPresentComplete = () => {
855
- this._webVRrequesting = false;
856
- this._updateButtonVisibility();
857
- };
858
- scene.getEngine().onVRDisplayChangedObservable.add(this._onVRDisplayChangedBind);
859
- scene.getEngine().onVRRequestPresentStart.add(this._onVRRequestPresentStart);
860
- scene.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete);
861
- hostWindow.addEventListener("vrdisplaypresentchange", this._onVrDisplayPresentChangeBind);
862
569
  scene.onDisposeObservable.add(() => {
863
570
  this.dispose();
864
571
  });
865
- // Gamepad connection events
866
- this._webVRCamera.onControllerMeshLoadedObservable.add((webVRController) => this._onDefaultMeshLoaded(webVRController));
867
- this._scene.gamepadManager.onGamepadConnectedObservable.add(this._onNewGamepadConnected);
868
- this._scene.gamepadManager.onGamepadDisconnectedObservable.add(this._onNewGamepadDisconnected);
869
572
  this._updateButtonVisibility();
870
573
  //create easing functions
871
574
  this._circleEase = new CircleEase();
@@ -888,50 +591,11 @@ export class VRExperienceHelper {
888
591
  this.enableTeleportation({ floorMeshes: this.webVROptions.floorMeshes });
889
592
  }
890
593
  }
891
- // Raised when one of the controller has loaded successfully its associated default mesh
892
- _onDefaultMeshLoaded(webVRController) {
893
- if (this._leftController && this._leftController.webVRController == webVRController) {
894
- if (webVRController.mesh) {
895
- this._leftController._setLaserPointerParent(webVRController.mesh);
896
- }
897
- }
898
- if (this._rightController && this._rightController.webVRController == webVRController) {
899
- if (webVRController.mesh) {
900
- this._rightController._setLaserPointerParent(webVRController.mesh);
901
- }
902
- }
903
- try {
904
- this.onControllerMeshLoadedObservable.notifyObservers(webVRController);
905
- }
906
- catch (err) {
907
- Logger.Warn("Error in your custom logic onControllerMeshLoaded: " + err);
908
- }
909
- }
910
594
  /**
911
595
  * Gets a value indicating if we are currently in VR mode.
912
596
  */
913
597
  get isInVRMode() {
914
- return (this.xr && this.webVROptions.useXR && this.xr.baseExperience.state === WebXRState.IN_XR) || this._webVRpresenting || this._fullscreenVRpresenting;
915
- }
916
- _onVrDisplayPresentChange() {
917
- const vrDisplay = this._scene.getEngine().getVRDevice();
918
- if (vrDisplay) {
919
- const wasPresenting = this._webVRpresenting;
920
- this._webVRpresenting = vrDisplay.isPresenting;
921
- if (wasPresenting && !this._webVRpresenting) {
922
- this.exitVR();
923
- }
924
- }
925
- else {
926
- Logger.Warn("Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?");
927
- }
928
- this._updateButtonVisibility();
929
- }
930
- _onVRDisplayChanged(eventArgs) {
931
- this._webVRsupported = eventArgs.vrSupported;
932
- this._webVRready = !!eventArgs.vrDisplay;
933
- this._webVRpresenting = eventArgs.vrDisplay && eventArgs.vrDisplay.isPresenting;
934
- this._updateButtonVisibility();
598
+ return (this.xr && this.webVROptions.useXR && this.xr.baseExperience.state === WebXRState.IN_XR) || this._fullscreenVRpresenting;
935
599
  }
936
600
  _moveButtonToBottomRight() {
937
601
  if (this._inputElement && !this._useCustomVRButton && this._btnVR) {
@@ -954,17 +618,6 @@ export class VRExperienceHelper {
954
618
  if (this.isInVRMode) {
955
619
  this._btnVR.className += " vrdisplaypresenting";
956
620
  }
957
- else {
958
- if (this._webVRready) {
959
- this._btnVR.className += " vrdisplayready";
960
- }
961
- if (this._webVRsupported) {
962
- this._btnVR.className += " vrdisplaysupported";
963
- }
964
- if (this._webVRrequesting) {
965
- this._btnVR.className += " vrdisplayrequesting";
966
- }
967
- }
968
621
  }
969
622
  /**
970
623
  * Attempt to enter VR. If a headset is connected and ready, will request present on that.
@@ -989,13 +642,6 @@ export class VRExperienceHelper {
989
642
  this.vrDeviceOrientationCamera.rotation = Quaternion.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles();
990
643
  this.vrDeviceOrientationCamera.angularSensibility = 2000;
991
644
  }
992
- if (this.webVRCamera) {
993
- const currentYRotation = this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y;
994
- const desiredYRotation = Quaternion.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y;
995
- const delta = desiredYRotation - currentYRotation;
996
- const currentGlobalRotation = this.webVRCamera.rotationQuaternion.toEulerAngles().y;
997
- this.webVRCamera.rotationQuaternion = Quaternion.FromEulerAngles(0, currentGlobalRotation + delta, 0);
998
- }
999
645
  // make sure that we return to the last active camera
1000
646
  this._existingCamera = this._scene.activeCamera;
1001
647
  // Remove and cache angular sensability to avoid camera rotation when in VR
@@ -1012,20 +658,8 @@ export class VRExperienceHelper {
1012
658
  this._existingCamera.angularSensibility = Number.MAX_VALUE;
1013
659
  }
1014
660
  }
1015
- if (this._webVRrequesting) {
1016
- return;
1017
- }
1018
661
  // If WebVR is supported and a headset is connected
1019
- if (this._webVRready) {
1020
- if (!this._webVRpresenting) {
1021
- this._scene.getEngine().onVRRequestPresentComplete.addOnce((result) => {
1022
- this.onAfterEnteringVRObservable.notifyObservers({ success: result });
1023
- });
1024
- this._webVRCamera.position = this._position;
1025
- this._scene.activeCamera = this._webVRCamera;
1026
- }
1027
- }
1028
- else if (this._vrDeviceOrientationCamera) {
662
+ if (this._vrDeviceOrientationCamera) {
1029
663
  this._vrDeviceOrientationCamera.position = this._position;
1030
664
  if (this._scene.activeCamera) {
1031
665
  this._vrDeviceOrientationCamera.minZ = this._scene.activeCamera.minZ;
@@ -1043,13 +677,6 @@ export class VRExperienceHelper {
1043
677
  if (this._interactionsEnabled) {
1044
678
  this._scene.registerBeforeRender(this._beforeRender);
1045
679
  }
1046
- if (this._displayLaserPointer) {
1047
- [this._leftController, this._rightController].forEach((controller) => {
1048
- if (controller) {
1049
- controller._activatePointer();
1050
- }
1051
- });
1052
- }
1053
680
  this._hasEnteredVR = true;
1054
681
  }
1055
682
  /**
@@ -1069,9 +696,6 @@ export class VRExperienceHelper {
1069
696
  Logger.Warn("Error in your custom logic onExitingVR: " + err);
1070
697
  }
1071
698
  }
1072
- if (this._webVRpresenting) {
1073
- this._scene.getEngine().disableVR();
1074
- }
1075
699
  if (this._scene.activeCamera) {
1076
700
  this._position = this._scene.activeCamera.position.clone();
1077
701
  }
@@ -1119,26 +743,10 @@ export class VRExperienceHelper {
1119
743
  if (this._interactionsEnabled) {
1120
744
  this._scene.unregisterBeforeRender(this._beforeRender);
1121
745
  this._cameraGazer._gazeTracker.isVisible = false;
1122
- if (this._leftController) {
1123
- this._leftController._gazeTracker.isVisible = false;
1124
- }
1125
- if (this._rightController) {
1126
- this._rightController._gazeTracker.isVisible = false;
1127
- }
1128
746
  }
1129
747
  // resize to update width and height when exiting vr exits fullscreen
1130
748
  this._scene.getEngine().resize();
1131
- [this._leftController, this._rightController].forEach((controller) => {
1132
- if (controller) {
1133
- controller._deactivatePointer();
1134
- }
1135
- });
1136
749
  this._hasEnteredVR = false;
1137
- // Update engine state to re enable non-vr camera input
1138
- const engine = this._scene.getEngine();
1139
- if (engine._onVrDisplayPresentChange) {
1140
- engine._onVrDisplayPresentChange();
1141
- }
1142
750
  }
1143
751
  }
1144
752
  /**
@@ -1161,7 +769,6 @@ export class VRExperienceHelper {
1161
769
  */
1162
770
  enableInteractions() {
1163
771
  if (!this._interactionsEnabled) {
1164
- this._interactionsRequested = true;
1165
772
  // in XR it is enabled by default, but just to make sure, re-attach
1166
773
  if (this.xr) {
1167
774
  if (this.xr.baseExperience.state === WebXRState.IN_XR) {
@@ -1169,12 +776,6 @@ export class VRExperienceHelper {
1169
776
  }
1170
777
  return;
1171
778
  }
1172
- if (this._leftController) {
1173
- this._enableInteractionOnController(this._leftController);
1174
- }
1175
- if (this._rightController) {
1176
- this._enableInteractionOnController(this._rightController);
1177
- }
1178
779
  this.raySelectionPredicate = (mesh) => {
1179
780
  return mesh.isVisible && (mesh.isPickable || mesh.name === this._floorMeshName);
1180
781
  };
@@ -1191,9 +792,6 @@ export class VRExperienceHelper {
1191
792
  this._interactionsEnabled = true;
1192
793
  }
1193
794
  }
1194
- get _noControllerIsActive() {
1195
- return !(this._leftController && this._leftController._activePointer) && !(this._rightController && this._rightController._activePointer);
1196
- }
1197
795
  _isTeleportationFloor(mesh) {
1198
796
  for (let i = 0; i < this._floorMeshesCollection.length; i++) {
1199
797
  if (this._floorMeshesCollection[i].id === mesh.id) {
@@ -1237,7 +835,6 @@ export class VRExperienceHelper {
1237
835
  */
1238
836
  enableTeleportation(vrTeleportationOptions = {}) {
1239
837
  if (!this._teleportationInitialized) {
1240
- this._teleportationRequested = true;
1241
838
  this.enableInteractions();
1242
839
  if (this.webVROptions.useXR && (vrTeleportationOptions.floorMeshes || vrTeleportationOptions.floorMeshName)) {
1243
840
  const floorMeshes = vrTeleportationOptions.floorMeshes || [];
@@ -1292,66 +889,18 @@ export class VRExperienceHelper {
1292
889
  if (vrTeleportationOptions.easingFunction !== undefined) {
1293
890
  this._teleportationEasing = vrTeleportationOptions.easingFunction;
1294
891
  }
1295
- if (this._leftController != null) {
1296
- this._enableTeleportationOnController(this._leftController);
1297
- }
1298
- if (this._rightController != null) {
1299
- this._enableTeleportationOnController(this._rightController);
1300
- }
1301
892
  // Creates an image processing post process for the vignette not relying
1302
893
  // on the main scene configuration for image processing to reduce setup and spaces
1303
894
  // (gamma/linear) conflicts.
1304
895
  const imageProcessingConfiguration = new ImageProcessingConfiguration();
1305
896
  imageProcessingConfiguration.vignetteColor = new Color4(0, 0, 0, 0);
1306
897
  imageProcessingConfiguration.vignetteEnabled = true;
1307
- this._postProcessMove = new ImageProcessingPostProcess("postProcessMove", 1.0, this._webVRCamera, undefined, undefined, undefined, undefined, imageProcessingConfiguration);
1308
- this._webVRCamera.detachPostProcess(this._postProcessMove);
1309
898
  this._teleportationInitialized = true;
1310
899
  if (this._isDefaultTeleportationTarget) {
1311
900
  this._createTeleportationCircles();
1312
- this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor);
1313
901
  }
1314
902
  }
1315
903
  }
1316
- _enableInteractionOnController(controller) {
1317
- const controllerMesh = controller.webVRController.mesh;
1318
- if (controllerMesh) {
1319
- controller._interactionsEnabled = true;
1320
- if (this.isInVRMode && this._displayLaserPointer) {
1321
- controller._activatePointer();
1322
- }
1323
- if (this.webVROptions.laserToggle) {
1324
- controller.webVRController.onMainButtonStateChangedObservable.add((stateObject) => {
1325
- // Enabling / disabling laserPointer
1326
- if (this._displayLaserPointer && stateObject.value === 1) {
1327
- if (controller._activePointer) {
1328
- controller._deactivatePointer();
1329
- }
1330
- else {
1331
- controller._activatePointer();
1332
- }
1333
- if (this.displayGaze) {
1334
- controller._gazeTracker.isVisible = controller._activePointer;
1335
- }
1336
- }
1337
- });
1338
- }
1339
- controller.webVRController.onTriggerStateChangedObservable.add((stateObject) => {
1340
- let gazer = controller;
1341
- if (this._noControllerIsActive) {
1342
- gazer = this._cameraGazer;
1343
- }
1344
- if (!gazer._pointerDownOnMeshAsked) {
1345
- if (stateObject.value > this._padSensibilityUp) {
1346
- gazer._selectionPointerDown();
1347
- }
1348
- }
1349
- else if (stateObject.value < this._padSensibilityDown) {
1350
- gazer._selectionPointerUp();
1351
- }
1352
- });
1353
- }
1354
- }
1355
904
  _checkTeleportWithRay(stateObject, gazer) {
1356
905
  // Dont teleport if another gaze already requested teleportation
1357
906
  if (this._teleportationRequestInitiated && !gazer._teleportationRequestInitiated) {
@@ -1417,13 +966,8 @@ export class VRExperienceHelper {
1417
966
  return;
1418
967
  }
1419
968
  // Get rotation and position of the current camera
1420
- let rotation = Quaternion.FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix());
1421
- let position = this.currentVRCamera.position;
1422
- // If the camera has device position, use that instead
1423
- if (this.currentVRCamera.devicePosition && this.currentVRCamera.deviceRotationQuaternion) {
1424
- rotation = this.currentVRCamera.deviceRotationQuaternion;
1425
- position = this.currentVRCamera.devicePosition;
1426
- }
969
+ const rotation = Quaternion.FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix());
970
+ const position = this.currentVRCamera.position;
1427
971
  // Get matrix with only the y rotation of the device rotation
1428
972
  rotation.toEulerAnglesToRef(this._workingVector);
1429
973
  this._workingVector.z = 0;
@@ -1445,34 +989,6 @@ export class VRExperienceHelper {
1445
989
  gazer._teleportationBackRequestInitiated = false;
1446
990
  }
1447
991
  }
1448
- _enableTeleportationOnController(controller) {
1449
- const controllerMesh = controller.webVRController.mesh;
1450
- if (controllerMesh) {
1451
- if (!controller._interactionsEnabled) {
1452
- this._enableInteractionOnController(controller);
1453
- }
1454
- controller._interactionsEnabled = true;
1455
- controller._teleportationEnabled = true;
1456
- if (controller.webVRController.controllerType === PoseEnabledControllerType.VIVE) {
1457
- controller._dpadPressed = false;
1458
- controller.webVRController.onPadStateChangedObservable.add((stateObject) => {
1459
- controller._dpadPressed = stateObject.pressed;
1460
- if (!controller._dpadPressed) {
1461
- controller._rotationLeftAsked = false;
1462
- controller._rotationRightAsked = false;
1463
- controller._teleportationBackRequestInitiated = false;
1464
- }
1465
- });
1466
- }
1467
- controller.webVRController.onPadValuesChangedObservable.add((stateObject) => {
1468
- if (this.teleportationEnabled) {
1469
- this._checkTeleportBackwards(stateObject, controller);
1470
- this._checkTeleportWithRay(stateObject, controller);
1471
- }
1472
- this._checkRotate(stateObject, controller);
1473
- });
1474
- }
1475
- }
1476
992
  _createTeleportationCircles() {
1477
993
  this._teleportationTarget = CreateGround("teleportationTarget", { width: 2, height: 2, subdivisions: 2 }, this._scene);
1478
994
  this._teleportationTarget.isPickable = false;
@@ -1526,15 +1042,6 @@ export class VRExperienceHelper {
1526
1042
  this._scene.beginAnimation(torus, 0, 60, true);
1527
1043
  this._hideTeleportationTarget();
1528
1044
  }
1529
- _displayTeleportationTarget() {
1530
- this._teleportActive = true;
1531
- if (this._teleportationInitialized) {
1532
- this._teleportationTarget.isVisible = true;
1533
- if (this._isDefaultTeleportationTarget) {
1534
- this._teleportationTarget.getChildren()[0].isVisible = true;
1535
- }
1536
- }
1537
- }
1538
1045
  _hideTeleportationTarget() {
1539
1046
  this._teleportActive = false;
1540
1047
  if (this._teleportationInitialized) {
@@ -1607,28 +1114,8 @@ export class VRExperienceHelper {
1607
1114
  this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0;
1608
1115
  this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0;
1609
1116
  this._postProcessMove.samples = 4;
1610
- this._webVRCamera.attachPostProcess(this._postProcessMove);
1611
- this._scene.beginAnimation(this._postProcessMove, 0, 6, false, 1, () => {
1612
- this._webVRCamera.detachPostProcess(this._postProcessMove);
1613
- });
1614
1117
  this._scene.beginAnimation(this.currentVRCamera, 0, 6, false, 1);
1615
1118
  }
1616
- _moveTeleportationSelectorTo(hit, gazer, ray) {
1617
- if (hit.pickedPoint) {
1618
- if (gazer._teleportationRequestInitiated) {
1619
- this._displayTeleportationTarget();
1620
- this._haloCenter.copyFrom(hit.pickedPoint);
1621
- this._teleportationTarget.position.copyFrom(hit.pickedPoint);
1622
- }
1623
- const pickNormal = this._convertNormalToDirectionOfRay(hit.getNormal(true, false), ray);
1624
- if (pickNormal) {
1625
- const axis1 = Vector3.Cross(Axis.Y, pickNormal);
1626
- const axis2 = Vector3.Cross(pickNormal, axis1);
1627
- Vector3.RotationFromAxisToRef(axis2, pickNormal, axis1, this._teleportationTarget.rotation);
1628
- }
1629
- this._teleportationTarget.position.y += 0.1;
1630
- }
1631
- }
1632
1119
  /**
1633
1120
  * Teleports the users feet to the desired location
1634
1121
  * @param location The location where the user's feet should be placed
@@ -1639,17 +1126,10 @@ export class VRExperienceHelper {
1639
1126
  }
1640
1127
  // Teleport the hmd to where the user is looking by moving the anchor to where they are looking minus the
1641
1128
  // offset of the headset from the anchor.
1642
- if (this.webVRCamera.leftCamera) {
1643
- this._workingVector.copyFrom(this.webVRCamera.leftCamera.globalPosition);
1644
- this._workingVector.subtractInPlace(this.webVRCamera.position);
1645
- location.subtractToRef(this._workingVector, this._workingVector);
1646
- }
1647
- else {
1648
- this._workingVector.copyFrom(location);
1649
- }
1129
+ this._workingVector.copyFrom(location);
1650
1130
  // Add height to account for user's height offset
1651
1131
  if (this.isInVRMode) {
1652
- this._workingVector.y += this.webVRCamera.deviceDistanceToRoomGround() * this._webVRCamera.deviceScaleFactor;
1132
+ // no-op
1653
1133
  }
1654
1134
  else {
1655
1135
  this._workingVector.y += this._defaultHeight;
@@ -1721,164 +1201,25 @@ export class VRExperienceHelper {
1721
1201
  this._postProcessMove.animations.push(animationPP2);
1722
1202
  this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0;
1723
1203
  this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0;
1724
- this._webVRCamera.attachPostProcess(this._postProcessMove);
1725
- this._scene.beginAnimation(this._postProcessMove, 0, lastFrame, false, speedRatio, () => {
1726
- this._webVRCamera.detachPostProcess(this._postProcessMove);
1727
- });
1728
1204
  this._scene.beginAnimation(this.currentVRCamera, 0, lastFrame, false, speedRatio, () => {
1729
1205
  this.onAfterCameraTeleport.notifyObservers(this._workingVector);
1730
1206
  });
1731
1207
  this._hideTeleportationTarget();
1732
1208
  }
1733
- _convertNormalToDirectionOfRay(normal, ray) {
1734
- if (normal) {
1735
- const angle = Math.acos(Vector3.Dot(normal, ray.direction));
1736
- if (angle < Math.PI / 2) {
1737
- normal.scaleInPlace(-1);
1738
- }
1739
- }
1740
- return normal;
1741
- }
1742
- _castRayAndSelectObject(gazer) {
1743
- if (!(this.currentVRCamera instanceof FreeCamera)) {
1744
- return;
1745
- }
1746
- const ray = gazer._getForwardRay(this._rayLength);
1747
- const hit = this._scene.pickWithRay(ray, this._raySelectionPredicate);
1748
- if (hit) {
1749
- this._scene.simulatePointerMove(hit, { pointerId: gazer._id });
1750
- }
1751
- gazer._currentHit = hit;
1752
- // Moving the gazeTracker on the mesh face targetted
1753
- if (hit && hit.pickedPoint) {
1754
- if (this._displayGaze) {
1755
- let multiplier = 1;
1756
- gazer._gazeTracker.isVisible = true;
1757
- if (gazer._isActionableMesh) {
1758
- multiplier = 3;
1759
- }
1760
- if (this.updateGazeTrackerScale) {
1761
- gazer._gazeTracker.scaling.x = hit.distance * multiplier;
1762
- gazer._gazeTracker.scaling.y = hit.distance * multiplier;
1763
- gazer._gazeTracker.scaling.z = hit.distance * multiplier;
1764
- }
1765
- const pickNormal = this._convertNormalToDirectionOfRay(hit.getNormal(), ray);
1766
- // To avoid z-fighting
1767
- const deltaFighting = 0.002;
1768
- if (pickNormal) {
1769
- const axis1 = Vector3.Cross(Axis.Y, pickNormal);
1770
- const axis2 = Vector3.Cross(pickNormal, axis1);
1771
- Vector3.RotationFromAxisToRef(axis2, pickNormal, axis1, gazer._gazeTracker.rotation);
1772
- }
1773
- gazer._gazeTracker.position.copyFrom(hit.pickedPoint);
1774
- if (gazer._gazeTracker.position.x < 0) {
1775
- gazer._gazeTracker.position.x += deltaFighting;
1776
- }
1777
- else {
1778
- gazer._gazeTracker.position.x -= deltaFighting;
1779
- }
1780
- if (gazer._gazeTracker.position.y < 0) {
1781
- gazer._gazeTracker.position.y += deltaFighting;
1782
- }
1783
- else {
1784
- gazer._gazeTracker.position.y -= deltaFighting;
1785
- }
1786
- if (gazer._gazeTracker.position.z < 0) {
1787
- gazer._gazeTracker.position.z += deltaFighting;
1788
- }
1789
- else {
1790
- gazer._gazeTracker.position.z -= deltaFighting;
1791
- }
1792
- }
1793
- // Changing the size of the laser pointer based on the distance from the targetted point
1794
- gazer._updatePointerDistance(hit.distance);
1795
- }
1796
- else {
1797
- gazer._updatePointerDistance();
1798
- gazer._gazeTracker.isVisible = false;
1799
- }
1800
- if (hit && hit.pickedMesh) {
1801
- // The object selected is the floor, we're in a teleportation scenario
1802
- if (this._teleportationInitialized && this._isTeleportationFloor(hit.pickedMesh) && hit.pickedPoint) {
1803
- // Moving the teleportation area to this targetted point
1804
- //Raise onSelectedMeshUnselected observable if ray collided floor mesh/meshes and a non floor mesh was previously selected
1805
- if (gazer._currentMeshSelected && !this._isTeleportationFloor(gazer._currentMeshSelected)) {
1806
- this._notifySelectedMeshUnselected(gazer._currentMeshSelected);
1807
- }
1808
- gazer._currentMeshSelected = null;
1809
- if (gazer._teleportationRequestInitiated) {
1810
- this._moveTeleportationSelectorTo(hit, gazer, ray);
1811
- }
1812
- return;
1813
- }
1814
- // If not, we're in a selection scenario
1815
- //this._teleportationAllowed = false;
1816
- if (hit.pickedMesh !== gazer._currentMeshSelected) {
1817
- if (this.meshSelectionPredicate(hit.pickedMesh)) {
1818
- this.onNewMeshPicked.notifyObservers(hit);
1819
- gazer._currentMeshSelected = hit.pickedMesh;
1820
- if (hit.pickedMesh.isPickable && hit.pickedMesh.actionManager) {
1821
- this.changeGazeColor(this._pickedGazeColor);
1822
- this.changeLaserColor(this._pickedLaserColor);
1823
- gazer._isActionableMesh = true;
1824
- }
1825
- else {
1826
- this.changeGazeColor(this._gazeColor);
1827
- this.changeLaserColor(this._laserColor);
1828
- gazer._isActionableMesh = false;
1829
- }
1830
- try {
1831
- this.onNewMeshSelected.notifyObservers(hit.pickedMesh);
1832
- const gazerAsControllerGazer = gazer;
1833
- if (gazerAsControllerGazer.webVRController) {
1834
- this.onMeshSelectedWithController.notifyObservers({ mesh: hit.pickedMesh, controller: gazerAsControllerGazer.webVRController });
1835
- }
1836
- }
1837
- catch (err) {
1838
- Logger.Warn("Error while raising onNewMeshSelected or onMeshSelectedWithController: " + err);
1839
- }
1840
- }
1841
- else {
1842
- this._notifySelectedMeshUnselected(gazer._currentMeshSelected);
1843
- gazer._currentMeshSelected = null;
1844
- this.changeGazeColor(this._gazeColor);
1845
- this.changeLaserColor(this._laserColor);
1846
- }
1847
- }
1848
- }
1849
- else {
1850
- this._notifySelectedMeshUnselected(gazer._currentMeshSelected);
1851
- gazer._currentMeshSelected = null;
1852
- //this._teleportationAllowed = false;
1853
- this.changeGazeColor(this._gazeColor);
1854
- this.changeLaserColor(this._laserColor);
1855
- }
1856
- }
1857
- _notifySelectedMeshUnselected(mesh) {
1858
- if (mesh) {
1859
- this.onSelectedMeshUnselected.notifyObservers(mesh);
1860
- }
1861
- }
1862
1209
  /**
1863
1210
  * Permanently set new colors for the laser pointer
1864
1211
  * @param color the new laser color
1865
1212
  * @param pickedColor the new laser color when picked mesh detected
1866
1213
  */
1867
1214
  setLaserColor(color, pickedColor = this._pickedLaserColor) {
1868
- this._laserColor = color;
1869
1215
  this._pickedLaserColor = pickedColor;
1870
1216
  }
1871
1217
  /**
1872
1218
  * Set lighting enabled / disabled on the laser pointer of both controllers
1873
1219
  * @param enabled should the lighting be enabled on the laser pointer
1874
1220
  */
1875
- setLaserLightingState(enabled = true) {
1876
- if (this._leftController) {
1877
- this._leftController._setLaserPointerLightingDisabled(!enabled);
1878
- }
1879
- if (this._rightController) {
1880
- this._rightController._setLaserPointerLightingDisabled(!enabled);
1881
- }
1221
+ setLaserLightingState(_enabled = true) {
1222
+ // no-op
1882
1223
  }
1883
1224
  /**
1884
1225
  * Permanently set new colors for the gaze pointer
@@ -1886,23 +1227,16 @@ export class VRExperienceHelper {
1886
1227
  * @param pickedColor the new gaze color when picked mesh detected
1887
1228
  */
1888
1229
  setGazeColor(color, pickedColor = this._pickedGazeColor) {
1889
- this._gazeColor = color;
1890
1230
  this._pickedGazeColor = pickedColor;
1891
1231
  }
1892
1232
  /**
1893
1233
  * Sets the color of the laser ray from the vr controllers.
1894
1234
  * @param color new color for the ray.
1895
1235
  */
1896
- changeLaserColor(color) {
1236
+ changeLaserColor(_color) {
1897
1237
  if (!this.updateControllerLaserColor) {
1898
1238
  return;
1899
1239
  }
1900
- if (this._leftController) {
1901
- this._leftController._setLaserPointerColor(color);
1902
- }
1903
- if (this._rightController) {
1904
- this._rightController._setLaserPointerColor(color);
1905
- }
1906
1240
  }
1907
1241
  /**
1908
1242
  * Sets the color of the ray from the vr headsets gaze.
@@ -1916,12 +1250,6 @@ export class VRExperienceHelper {
1916
1250
  return;
1917
1251
  }
1918
1252
  this._cameraGazer._gazeTracker.material.emissiveColor = color;
1919
- if (this._leftController) {
1920
- this._leftController._gazeTracker.material.emissiveColor = color;
1921
- }
1922
- if (this._rightController) {
1923
- this._rightController._gazeTracker.material.emissiveColor = color;
1924
- }
1925
1253
  }
1926
1254
  /**
1927
1255
  * Exits VR and disposes of the vr experience helper
@@ -1933,9 +1261,6 @@ export class VRExperienceHelper {
1933
1261
  if (this._postProcessMove) {
1934
1262
  this._postProcessMove.dispose();
1935
1263
  }
1936
- if (this._webVRCamera) {
1937
- this._webVRCamera.dispose();
1938
- }
1939
1264
  if (this._vrDeviceOrientationCamera) {
1940
1265
  this._vrDeviceOrientationCamera.dispose();
1941
1266
  }
@@ -1948,12 +1273,6 @@ export class VRExperienceHelper {
1948
1273
  if (this._cameraGazer) {
1949
1274
  this._cameraGazer.dispose();
1950
1275
  }
1951
- if (this._leftController) {
1952
- this._leftController.dispose();
1953
- }
1954
- if (this._rightController) {
1955
- this._rightController.dispose();
1956
- }
1957
1276
  if (this._teleportationTarget) {
1958
1277
  this._teleportationTarget.dispose();
1959
1278
  }
@@ -1965,11 +1284,7 @@ export class VRExperienceHelper {
1965
1284
  window.removeEventListener("vrdisplaypresentchange", this._onVrDisplayPresentChangeBind);
1966
1285
  window.removeEventListener("resize", this._onResize);
1967
1286
  document.removeEventListener("fullscreenchange", this._onFullscreenChange);
1968
- this._scene.getEngine().onVRDisplayChangedObservable.removeCallback(this._onVRDisplayChangedBind);
1969
- this._scene.getEngine().onVRRequestPresentStart.removeCallback(this._onVRRequestPresentStart);
1970
- this._scene.getEngine().onVRRequestPresentComplete.removeCallback(this._onVRRequestPresentComplete);
1971
1287
  this._scene.gamepadManager.onGamepadConnectedObservable.removeCallback(this._onNewGamepadConnected);
1972
- this._scene.gamepadManager.onGamepadDisconnectedObservable.removeCallback(this._onNewGamepadDisconnected);
1973
1288
  this._scene.unregisterBeforeRender(this._beforeRender);
1974
1289
  }
1975
1290
  /**