@babylonjs/core 6.41.0 → 6.41.2

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 (650) hide show
  1. package/Animations/animatable.js +1 -2
  2. package/Animations/animatable.js.map +1 -1
  3. package/Animations/animation.js +4 -6
  4. package/Animations/animation.js.map +1 -1
  5. package/Animations/animationGroup.js +3 -3
  6. package/Animations/animationGroup.js.map +1 -1
  7. package/Animations/runtimeAnimation.js +1 -1
  8. package/Animations/runtimeAnimation.js.map +1 -1
  9. package/Audio/audioEngine.js +3 -5
  10. package/Audio/audioEngine.js.map +1 -1
  11. package/Audio/audioSceneComponent.js +1 -2
  12. package/Audio/audioSceneComponent.js.map +1 -1
  13. package/Audio/sound.js +48 -74
  14. package/Audio/sound.js.map +1 -1
  15. package/Audio/soundTrack.js +6 -12
  16. package/Audio/soundTrack.js.map +1 -1
  17. package/BakedVertexAnimation/bakedVertexAnimationManager.js +1 -2
  18. package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
  19. package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
  20. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  21. package/Behaviors/Meshes/fadeInOutBehavior.js +2 -4
  22. package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
  23. package/Behaviors/Meshes/followBehavior.js +1 -2
  24. package/Behaviors/Meshes/followBehavior.js.map +1 -1
  25. package/Behaviors/Meshes/handConstraintBehavior.js +2 -2
  26. package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
  27. package/Bones/bone.js +4 -6
  28. package/Bones/bone.js.map +1 -1
  29. package/Bones/skeleton.js +2 -3
  30. package/Bones/skeleton.js.map +1 -1
  31. package/Buffers/buffer.align.js +5 -8
  32. package/Buffers/buffer.align.js.map +1 -1
  33. package/Buffers/buffer.js +6 -8
  34. package/Buffers/buffer.js.map +1 -1
  35. package/Cameras/Inputs/BaseCameraPointersInput.js +3 -4
  36. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  37. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +3 -5
  38. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
  39. package/Cameras/Inputs/flyCameraMouseInput.js +2 -2
  40. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  41. package/Cameras/Inputs/freeCameraMouseInput.js +2 -2
  42. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  43. package/Cameras/arcRotateCamera.js +1 -2
  44. package/Cameras/arcRotateCamera.js.map +1 -1
  45. package/Cameras/camera.d.ts +5 -0
  46. package/Cameras/camera.js +18 -11
  47. package/Cameras/camera.js.map +1 -1
  48. package/Collisions/pickingInfo.js +1 -1
  49. package/Collisions/pickingInfo.js.map +1 -1
  50. package/Compute/computeEffect.js +5 -8
  51. package/Compute/computeEffect.js.map +1 -1
  52. package/Compute/computeShader.js +12 -9
  53. package/Compute/computeShader.js.map +1 -1
  54. package/Culling/Octrees/octreeSceneComponent.js +1 -2
  55. package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
  56. package/Culling/boundingBox.js +2 -3
  57. package/Culling/boundingBox.js.map +1 -1
  58. package/Culling/ray.d.ts +6 -1
  59. package/Culling/ray.js +9 -4
  60. package/Culling/ray.js.map +1 -1
  61. package/Debug/debugLayer.js +4 -1
  62. package/Debug/debugLayer.js.map +1 -1
  63. package/Debug/directionalLightFrustumViewer.js +7 -9
  64. package/Debug/directionalLightFrustumViewer.js.map +1 -1
  65. package/Debug/physicsViewer.js +5 -7
  66. package/Debug/physicsViewer.js.map +1 -1
  67. package/Debug/rayHelper.js +1 -2
  68. package/Debug/rayHelper.js.map +1 -1
  69. package/Debug/skeletonViewer.js +26 -31
  70. package/Debug/skeletonViewer.js.map +1 -1
  71. package/Decorators/nodeDecorator.js +1 -1
  72. package/Decorators/nodeDecorator.js.map +1 -1
  73. package/DeviceInput/InputDevices/deviceSourceManager.js +3 -5
  74. package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
  75. package/DeviceInput/eventFactory.js +1 -1
  76. package/DeviceInput/eventFactory.js.map +1 -1
  77. package/DeviceInput/internalDeviceSourceManager.js +1 -2
  78. package/DeviceInput/internalDeviceSourceManager.js.map +1 -1
  79. package/DeviceInput/webDeviceInputSystem.js +9 -12
  80. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  81. package/Engines/Extensions/engine.cubeTexture.js +6 -1
  82. package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
  83. package/Engines/Extensions/engine.multiRender.js +3 -4
  84. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  85. package/Engines/Extensions/engine.rawTexture.js +4 -4
  86. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  87. package/Engines/Extensions/engine.readTexture.js +2 -3
  88. package/Engines/Extensions/engine.readTexture.js.map +1 -1
  89. package/Engines/Extensions/engine.renderTarget.js +9 -5
  90. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  91. package/Engines/Extensions/engine.renderTargetCube.js +9 -1
  92. package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
  93. package/Engines/Extensions/engine.views.js +1 -2
  94. package/Engines/Extensions/engine.views.js.map +1 -1
  95. package/Engines/Processors/shaderCodeNode.js +6 -7
  96. package/Engines/Processors/shaderCodeNode.js.map +1 -1
  97. package/Engines/Processors/shaderProcessor.js +6 -11
  98. package/Engines/Processors/shaderProcessor.js.map +1 -1
  99. package/Engines/WebGL/webGLHardwareTexture.js +1 -2
  100. package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
  101. package/Engines/WebGL/webGLRenderTargetWrapper.js +3 -5
  102. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  103. package/Engines/WebGPU/Extensions/engine.cubeTexture.js +9 -2
  104. package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
  105. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +1 -2
  106. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
  107. package/Engines/WebGPU/Extensions/engine.multiRender.js +5 -6
  108. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  109. package/Engines/WebGPU/Extensions/engine.query.js +2 -4
  110. package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
  111. package/Engines/WebGPU/Extensions/engine.rawTexture.js +4 -4
  112. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  113. package/Engines/WebGPU/Extensions/engine.renderTarget.js +11 -5
  114. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  115. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js +11 -3
  116. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
  117. package/Engines/WebGPU/Extensions/engine.storageBuffer.js +2 -3
  118. package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
  119. package/Engines/WebGPU/Extensions/engine.textureSampler.js +1 -2
  120. package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +1 -1
  121. package/Engines/WebGPU/Extensions/engine.videoTexture.js +1 -2
  122. package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
  123. package/Engines/WebGPU/webgpuBufferManager.js +1 -1
  124. package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
  125. package/Engines/WebGPU/webgpuCacheBindGroups.js +6 -7
  126. package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
  127. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +15 -20
  128. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  129. package/Engines/WebGPU/webgpuCacheSampler.js +10 -5
  130. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  131. package/Engines/WebGPU/webgpuClearQuad.js +2 -3
  132. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  133. package/Engines/WebGPU/webgpuComputePipelineContext.js +1 -2
  134. package/Engines/WebGPU/webgpuComputePipelineContext.js.map +1 -1
  135. package/Engines/WebGPU/webgpuDepthCullingState.js +2 -2
  136. package/Engines/WebGPU/webgpuDepthCullingState.js.map +1 -1
  137. package/Engines/WebGPU/webgpuDrawContext.js +1 -2
  138. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  139. package/Engines/WebGPU/webgpuHardwareTexture.js +4 -6
  140. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  141. package/Engines/WebGPU/webgpuMaterialContext.js +2 -3
  142. package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
  143. package/Engines/WebGPU/webgpuOcclusionQuery.js +3 -5
  144. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  145. package/Engines/WebGPU/webgpuPipelineContext.js +2 -4
  146. package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
  147. package/Engines/WebGPU/webgpuQuerySet.js +1 -1
  148. package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
  149. package/Engines/WebGPU/webgpuShaderProcessingContext.js +2 -4
  150. package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
  151. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +2 -4
  152. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  153. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +5 -4
  154. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  155. package/Engines/WebGPU/webgpuStencilStateComposer.js +1 -2
  156. package/Engines/WebGPU/webgpuStencilStateComposer.js.map +1 -1
  157. package/Engines/WebGPU/webgpuTextureManager.js +40 -43
  158. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  159. package/Engines/WebGPU/webgpuTimestampQuery.js +12 -7
  160. package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
  161. package/Engines/WebGPU/webgpuTintWASM.js +4 -1
  162. package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
  163. package/Engines/engine.js +4 -7
  164. package/Engines/engine.js.map +1 -1
  165. package/Engines/nativeEngine.js +16 -22
  166. package/Engines/nativeEngine.js.map +1 -1
  167. package/Engines/nullEngine.js +9 -1
  168. package/Engines/nullEngine.js.map +1 -1
  169. package/Engines/renderTargetWrapper.js +11 -16
  170. package/Engines/renderTargetWrapper.js.map +1 -1
  171. package/Engines/thinEngine.js +32 -44
  172. package/Engines/thinEngine.js.map +1 -1
  173. package/Engines/webgpuEngine.js +77 -95
  174. package/Engines/webgpuEngine.js.map +1 -1
  175. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +2 -3
  176. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  177. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +3 -6
  178. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  179. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +1 -2
  180. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  181. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +1 -2
  182. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  183. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +2 -4
  184. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  185. package/FlowGraph/flowGraph.js +1 -2
  186. package/FlowGraph/flowGraph.js.map +1 -1
  187. package/FlowGraph/flowGraphBlock.js +2 -4
  188. package/FlowGraph/flowGraphBlock.js.map +1 -1
  189. package/FlowGraph/flowGraphContext.js +1 -2
  190. package/FlowGraph/flowGraphContext.js.map +1 -1
  191. package/FlowGraph/flowGraphCoordinator.js +4 -7
  192. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  193. package/FlowGraph/flowGraphSignalConnection.js +1 -2
  194. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  195. package/FlowGraph/serialization.js +2 -3
  196. package/FlowGraph/serialization.js.map +1 -1
  197. package/Gamepads/gamepadManager.js +1 -1
  198. package/Gamepads/gamepadManager.js.map +1 -1
  199. package/Gizmos/axisDragGizmo.js +2 -4
  200. package/Gizmos/axisDragGizmo.js.map +1 -1
  201. package/Gizmos/axisScaleGizmo.js +5 -8
  202. package/Gizmos/axisScaleGizmo.js.map +1 -1
  203. package/Gizmos/boundingBoxGizmo.js +1 -1
  204. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  205. package/Gizmos/cameraGizmo.js +2 -3
  206. package/Gizmos/cameraGizmo.js.map +1 -1
  207. package/Gizmos/gizmo.js +4 -7
  208. package/Gizmos/gizmo.js.map +1 -1
  209. package/Gizmos/gizmoManager.js +3 -4
  210. package/Gizmos/gizmoManager.js.map +1 -1
  211. package/Gizmos/planeDragGizmo.js +2 -4
  212. package/Gizmos/planeDragGizmo.js.map +1 -1
  213. package/Gizmos/planeRotationGizmo.js +2 -4
  214. package/Gizmos/planeRotationGizmo.js.map +1 -1
  215. package/Helpers/environmentHelper.js +8 -2
  216. package/Helpers/environmentHelper.js.map +1 -1
  217. package/Helpers/videoDome.js +1 -2
  218. package/Helpers/videoDome.js.map +1 -1
  219. package/Inputs/scene.inputManager.js +8 -10
  220. package/Inputs/scene.inputManager.js.map +1 -1
  221. package/Layers/effectLayer.js +16 -10
  222. package/Layers/effectLayer.js.map +1 -1
  223. package/Layers/glowLayer.js +16 -6
  224. package/Layers/glowLayer.js.map +1 -1
  225. package/Layers/highlightLayer.js +12 -3
  226. package/Layers/highlightLayer.js.map +1 -1
  227. package/Layers/layer.js +1 -2
  228. package/Layers/layer.js.map +1 -1
  229. package/LensFlares/lensFlareSystem.js +1 -2
  230. package/LensFlares/lensFlareSystem.js.map +1 -1
  231. package/Lights/Shadows/cascadedShadowGenerator.js +21 -25
  232. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  233. package/Lights/Shadows/shadowGenerator.js +18 -21
  234. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  235. package/Lights/light.js +2 -4
  236. package/Lights/light.js.map +1 -1
  237. package/Lights/shadowLight.js +1 -1
  238. package/Lights/shadowLight.js.map +1 -1
  239. package/Loading/Plugins/babylonFileLoader.js +1 -2
  240. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  241. package/Loading/sceneLoader.js +1 -1
  242. package/Loading/sceneLoader.js.map +1 -1
  243. package/Materials/GreasedLine/greasedLinePluginMaterial.js +26 -32
  244. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  245. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +22 -27
  246. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  247. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +6 -7
  248. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  249. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +1 -2
  250. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  251. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +1 -2
  252. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  253. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +1 -1
  254. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  255. package/Materials/Node/Blocks/Dual/textureBlock.js +10 -16
  256. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  257. package/Materials/Node/Blocks/Fragment/TBNBlock.js +2 -3
  258. package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
  259. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +1 -2
  260. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  261. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +2 -4
  262. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  263. package/Materials/Node/Blocks/Input/inputBlock.js +1 -2
  264. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  265. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +24 -26
  266. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  267. package/Materials/Node/Blocks/PBR/iridescenceBlock.js +3 -3
  268. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  269. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +45 -49
  270. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  271. package/Materials/Node/Blocks/PBR/reflectionBlock.js +1 -2
  272. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  273. package/Materials/Node/Blocks/PBR/refractionBlock.js +1 -2
  274. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  275. package/Materials/Node/Blocks/PBR/sheenBlock.js +13 -13
  276. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  277. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +27 -28
  278. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  279. package/Materials/Node/Blocks/Teleport/teleportOutBlock.js +1 -2
  280. package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  281. package/Materials/Node/Blocks/Vertex/instancesBlock.js +2 -2
  282. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  283. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +43 -33
  284. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  285. package/Materials/Node/Blocks/biPlanarBlock.js +1 -2
  286. package/Materials/Node/Blocks/biPlanarBlock.js.map +1 -1
  287. package/Materials/Node/Blocks/cloudBlock.js +2 -3
  288. package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
  289. package/Materials/Node/Blocks/colorMergerBlock.js +4 -5
  290. package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
  291. package/Materials/Node/Blocks/customBlock.js +4 -6
  292. package/Materials/Node/Blocks/customBlock.js.map +1 -1
  293. package/Materials/Node/Blocks/meshAttributeExistsBlock.js +2 -4
  294. package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
  295. package/Materials/Node/Blocks/triPlanarBlock.js +14 -23
  296. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  297. package/Materials/Node/Blocks/vectorMergerBlock.js +4 -5
  298. package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
  299. package/Materials/Node/nodeMaterial.js +16 -11
  300. package/Materials/Node/nodeMaterial.js.map +1 -1
  301. package/Materials/Node/nodeMaterialBlock.js +3 -4
  302. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  303. package/Materials/Node/nodeMaterialBuildState.js +1 -1
  304. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  305. package/Materials/PBR/pbrBaseMaterial.js +25 -28
  306. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  307. package/Materials/PBR/pbrClearCoatConfiguration.js +6 -9
  308. package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
  309. package/Materials/PBR/pbrIridescenceConfiguration.js +4 -7
  310. package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
  311. package/Materials/PBR/pbrSheenConfiguration.js +4 -7
  312. package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
  313. package/Materials/Textures/Loaders/envTextureLoader.js +2 -2
  314. package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
  315. package/Materials/Textures/Packer/packer.js +13 -14
  316. package/Materials/Textures/Packer/packer.js.map +1 -1
  317. package/Materials/Textures/Procedurals/noiseProceduralTexture.js +1 -2
  318. package/Materials/Textures/Procedurals/noiseProceduralTexture.js.map +1 -1
  319. package/Materials/Textures/Procedurals/proceduralTexture.js +19 -11
  320. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  321. package/Materials/Textures/baseTexture.js +2 -4
  322. package/Materials/Textures/baseTexture.js.map +1 -1
  323. package/Materials/Textures/cubeTexture.js +7 -13
  324. package/Materials/Textures/cubeTexture.js.map +1 -1
  325. package/Materials/Textures/dynamicTexture.js +1 -2
  326. package/Materials/Textures/dynamicTexture.js.map +1 -1
  327. package/Materials/Textures/hdrCubeTexture.js +2 -4
  328. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  329. package/Materials/Textures/htmlElementTexture.js +5 -3
  330. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  331. package/Materials/Textures/internalTexture.js +3 -5
  332. package/Materials/Textures/internalTexture.js.map +1 -1
  333. package/Materials/Textures/mirrorTexture.js +3 -6
  334. package/Materials/Textures/mirrorTexture.js.map +1 -1
  335. package/Materials/Textures/multiRenderTarget.js +5 -8
  336. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  337. package/Materials/Textures/rawTexture.js +1 -1
  338. package/Materials/Textures/rawTexture.js.map +1 -1
  339. package/Materials/Textures/renderTargetTexture.js +22 -34
  340. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  341. package/Materials/Textures/texture.js +16 -21
  342. package/Materials/Textures/texture.js.map +1 -1
  343. package/Materials/Textures/thinRenderTargetTexture.js +2 -4
  344. package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
  345. package/Materials/Textures/thinTexture.js +1 -1
  346. package/Materials/Textures/thinTexture.js.map +1 -1
  347. package/Materials/Textures/videoTexture.js +12 -10
  348. package/Materials/Textures/videoTexture.js.map +1 -1
  349. package/Materials/clipPlaneMaterialHelper.js +18 -21
  350. package/Materials/clipPlaneMaterialHelper.js.map +1 -1
  351. package/Materials/drawWrapper.js +2 -4
  352. package/Materials/drawWrapper.js.map +1 -1
  353. package/Materials/effect.d.ts +4 -0
  354. package/Materials/effect.js +18 -18
  355. package/Materials/effect.js.map +1 -1
  356. package/Materials/effectRenderer.js +2 -3
  357. package/Materials/effectRenderer.js.map +1 -1
  358. package/Materials/material.decalMapConfiguration.js +3 -3
  359. package/Materials/material.decalMapConfiguration.js.map +1 -1
  360. package/Materials/material.detailMapConfiguration.js +1 -2
  361. package/Materials/material.detailMapConfiguration.js.map +1 -1
  362. package/Materials/material.js +7 -4
  363. package/Materials/material.js.map +1 -1
  364. package/Materials/materialDefines.js +5 -6
  365. package/Materials/materialDefines.js.map +1 -1
  366. package/Materials/materialHelper.d.ts +1 -1
  367. package/Materials/materialHelper.js +3 -4
  368. package/Materials/materialHelper.js.map +1 -1
  369. package/Materials/materialPluginManager.js +3 -5
  370. package/Materials/materialPluginManager.js.map +1 -1
  371. package/Materials/meshDebugPluginMaterial.js +13 -14
  372. package/Materials/meshDebugPluginMaterial.js.map +1 -1
  373. package/Materials/multiMaterial.js +1 -2
  374. package/Materials/multiMaterial.js.map +1 -1
  375. package/Materials/shaderMaterial.d.ts +1 -1
  376. package/Materials/shaderMaterial.js +64 -32
  377. package/Materials/shaderMaterial.js.map +1 -1
  378. package/Materials/shadowDepthWrapper.js +24 -23
  379. package/Materials/shadowDepthWrapper.js.map +1 -1
  380. package/Materials/standardMaterial.js +10 -12
  381. package/Materials/standardMaterial.js.map +1 -1
  382. package/Materials/uniformBuffer.js +1 -1
  383. package/Materials/uniformBuffer.js.map +1 -1
  384. package/Maths/math.vector.js +1 -2
  385. package/Maths/math.vector.js.map +1 -1
  386. package/Meshes/Builders/decalBuilder.js +26 -29
  387. package/Meshes/Builders/decalBuilder.js.map +1 -1
  388. package/Meshes/Builders/greasedLineBuilder.js +16 -16
  389. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  390. package/Meshes/Builders/groundBuilder.d.ts +5 -1
  391. package/Meshes/Builders/groundBuilder.js +13 -2
  392. package/Meshes/Builders/groundBuilder.js.map +1 -1
  393. package/Meshes/Builders/textBuilder.js +2 -3
  394. package/Meshes/Builders/textBuilder.js.map +1 -1
  395. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +9 -1
  396. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +141 -12
  397. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  398. package/Meshes/GreasedLine/greasedLineBaseMesh.js +8 -11
  399. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  400. package/Meshes/GreasedLine/greasedLineMesh.js +3 -5
  401. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  402. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +13 -18
  403. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  404. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js +1 -2
  405. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  406. package/Meshes/Node/Blocks/geometryTrigonometryBlock.d.ts +18 -18
  407. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +18 -18
  408. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
  409. package/Meshes/Node/nodeGeometry.js +6 -3
  410. package/Meshes/Node/nodeGeometry.js.map +1 -1
  411. package/Meshes/Node/nodeGeometryBlock.js +1 -1
  412. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  413. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +1 -2
  414. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  415. package/Meshes/Node/nodeGeometryBuildState.js +1 -2
  416. package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
  417. package/Meshes/abstractMesh.js +6 -10
  418. package/Meshes/abstractMesh.js.map +1 -1
  419. package/Meshes/csg.js +1 -2
  420. package/Meshes/csg.js.map +1 -1
  421. package/Meshes/geometry.js +1 -1
  422. package/Meshes/geometry.js.map +1 -1
  423. package/Meshes/instancedMesh.js +5 -10
  424. package/Meshes/instancedMesh.js.map +1 -1
  425. package/Meshes/mesh.js +13 -22
  426. package/Meshes/mesh.js.map +1 -1
  427. package/Meshes/mesh.vertexData.js +3 -4
  428. package/Meshes/mesh.vertexData.js.map +1 -1
  429. package/Meshes/meshUVSpaceRenderer.js +18 -15
  430. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  431. package/Meshes/subMesh.js +8 -14
  432. package/Meshes/subMesh.js.map +1 -1
  433. package/Meshes/thinInstanceMesh.js +12 -18
  434. package/Meshes/thinInstanceMesh.js.map +1 -1
  435. package/Meshes/trailMesh.js +2 -3
  436. package/Meshes/trailMesh.js.map +1 -1
  437. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +1 -2
  438. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  439. package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js +9 -14
  440. package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js.map +1 -1
  441. package/Misc/PerformanceViewer/performanceViewerCollector.js +2 -3
  442. package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
  443. package/Misc/arrayTools.js +1 -1
  444. package/Misc/arrayTools.js.map +1 -1
  445. package/Misc/basis.js +2 -3
  446. package/Misc/basis.js.map +1 -1
  447. package/Misc/dataStorage.js +1 -1
  448. package/Misc/dataStorage.js.map +1 -1
  449. package/Misc/deepCopier.js +1 -1
  450. package/Misc/deepCopier.js.map +1 -1
  451. package/Misc/environmentTextureTools.js +3 -4
  452. package/Misc/environmentTextureTools.js.map +1 -1
  453. package/Misc/equirectangularCapture.js +2 -3
  454. package/Misc/equirectangularCapture.js.map +1 -1
  455. package/Misc/fileTools.js +4 -4
  456. package/Misc/fileTools.js.map +1 -1
  457. package/Misc/greasedLineTools.js +3 -5
  458. package/Misc/greasedLineTools.js.map +1 -1
  459. package/Misc/logger.js +1 -2
  460. package/Misc/logger.js.map +1 -1
  461. package/Misc/minMaxReducer.js +2 -3
  462. package/Misc/minMaxReducer.js.map +1 -1
  463. package/Misc/pressureObserverWrapper.js +5 -8
  464. package/Misc/pressureObserverWrapper.js.map +1 -1
  465. package/Misc/sceneRecorder.js +1 -1
  466. package/Misc/sceneRecorder.js.map +1 -1
  467. package/Misc/screenshotTools.js +1 -1
  468. package/Misc/screenshotTools.js.map +1 -1
  469. package/Misc/textureTools.js +5 -5
  470. package/Misc/textureTools.js.map +1 -1
  471. package/Misc/timer.js +3 -5
  472. package/Misc/timer.js.map +1 -1
  473. package/Misc/tools.d.ts +3 -2
  474. package/Misc/tools.js +6 -5
  475. package/Misc/tools.js.map +1 -1
  476. package/Misc/trajectoryClassifier.js +3 -3
  477. package/Misc/trajectoryClassifier.js.map +1 -1
  478. package/Misc/videoRecorder.js +6 -4
  479. package/Misc/videoRecorder.js.map +1 -1
  480. package/Misc/virtualJoystick.js +4 -1
  481. package/Misc/virtualJoystick.js.map +1 -1
  482. package/Morph/morphTargetManager.js +1 -2
  483. package/Morph/morphTargetManager.js.map +1 -1
  484. package/Particles/EmitterTypes/meshParticleEmitter.js +1 -2
  485. package/Particles/EmitterTypes/meshParticleEmitter.js.map +1 -1
  486. package/Particles/baseParticleSystem.d.ts +4 -0
  487. package/Particles/baseParticleSystem.js +4 -0
  488. package/Particles/baseParticleSystem.js.map +1 -1
  489. package/Particles/computeShaderParticleSystem.js +3 -6
  490. package/Particles/computeShaderParticleSystem.js.map +1 -1
  491. package/Particles/gpuParticleSystem.d.ts +2 -2
  492. package/Particles/gpuParticleSystem.js +30 -20
  493. package/Particles/gpuParticleSystem.js.map +1 -1
  494. package/Particles/particleSystem.d.ts +3 -2
  495. package/Particles/particleSystem.js +33 -30
  496. package/Particles/particleSystem.js.map +1 -1
  497. package/Particles/particleSystemComponent.js +2 -3
  498. package/Particles/particleSystemComponent.js.map +1 -1
  499. package/Particles/pointsCloudSystem.js +5 -8
  500. package/Particles/pointsCloudSystem.js.map +1 -1
  501. package/Particles/solidParticleSystem.js +5 -7
  502. package/Particles/solidParticleSystem.js.map +1 -1
  503. package/Particles/webgl2ParticleSystem.js +1 -2
  504. package/Particles/webgl2ParticleSystem.js.map +1 -1
  505. package/Physics/castingResult.js +1 -1
  506. package/Physics/castingResult.js.map +1 -1
  507. package/Physics/joinedPhysicsEngineComponent.js +2 -2
  508. package/Physics/joinedPhysicsEngineComponent.js.map +1 -1
  509. package/Physics/physicsHelper.js +19 -21
  510. package/Physics/physicsHelper.js.map +1 -1
  511. package/Physics/v2/IPhysicsEnginePlugin.d.ts +20 -0
  512. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  513. package/Physics/v2/Plugins/havokPlugin.js +48 -35
  514. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  515. package/Physics/v2/physicsAggregate.js +10 -12
  516. package/Physics/v2/physicsAggregate.js.map +1 -1
  517. package/Physics/v2/physicsBody.js +2 -4
  518. package/Physics/v2/physicsBody.js.map +1 -1
  519. package/Physics/v2/physicsShape.js +1 -2
  520. package/Physics/v2/physicsShape.js.map +1 -1
  521. package/Physics/v2/ragdoll.js +6 -8
  522. package/Physics/v2/ragdoll.js.map +1 -1
  523. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +6 -8
  524. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  525. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +14 -22
  526. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  527. package/PostProcesses/colorCorrectionPostProcess.js +1 -1
  528. package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
  529. package/PostProcesses/postProcess.js +28 -34
  530. package/PostProcesses/postProcess.js.map +1 -1
  531. package/PostProcesses/postProcessManager.js +4 -6
  532. package/PostProcesses/postProcessManager.js.map +1 -1
  533. package/PostProcesses/screenSpaceReflectionPostProcess.js +2 -2
  534. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  535. package/PostProcesses/volumetricLightScatteringPostProcess.js +4 -7
  536. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  537. package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +1 -1
  538. package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
  539. package/Probes/reflectionProbe.js +2 -4
  540. package/Probes/reflectionProbe.js.map +1 -1
  541. package/Rendering/GlobalIllumination/giRSMManager.js +22 -19
  542. package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
  543. package/Rendering/boundingBoxRenderer.js +2 -3
  544. package/Rendering/boundingBoxRenderer.js.map +1 -1
  545. package/Rendering/depthPeelingRenderer.js +2 -4
  546. package/Rendering/depthPeelingRenderer.js.map +1 -1
  547. package/Rendering/depthPeelingSceneComponent.js +2 -4
  548. package/Rendering/depthPeelingSceneComponent.js.map +1 -1
  549. package/Rendering/depthRenderer.js +10 -13
  550. package/Rendering/depthRenderer.js.map +1 -1
  551. package/Rendering/edgesRenderer.js +8 -11
  552. package/Rendering/edgesRenderer.js.map +1 -1
  553. package/Rendering/fluidRenderer/fluidRenderer.js +6 -11
  554. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  555. package/Rendering/fluidRenderer/fluidRenderingObject.js +3 -5
  556. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  557. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +2 -4
  558. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  559. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +30 -36
  560. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  561. package/Rendering/fluidRenderer/fluidRenderingTextures.js +5 -7
  562. package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
  563. package/Rendering/geometryBufferRenderer.js +3 -2
  564. package/Rendering/geometryBufferRenderer.js.map +1 -1
  565. package/Rendering/outlineRenderer.js +5 -4
  566. package/Rendering/outlineRenderer.js.map +1 -1
  567. package/Rendering/prePassRenderer.js +3 -6
  568. package/Rendering/prePassRenderer.js.map +1 -1
  569. package/Rendering/reflectiveShadowMap.d.ts +1 -0
  570. package/Rendering/reflectiveShadowMap.js +5 -5
  571. package/Rendering/reflectiveShadowMap.js.map +1 -1
  572. package/Shaders/color.fragment.d.ts +2 -0
  573. package/Shaders/color.fragment.js +4 -0
  574. package/Shaders/color.fragment.js.map +1 -1
  575. package/Shaders/color.vertex.d.ts +2 -0
  576. package/Shaders/color.vertex.js +7 -0
  577. package/Shaders/color.vertex.js.map +1 -1
  578. package/Shaders/gpuRenderParticles.fragment.d.ts +2 -0
  579. package/Shaders/gpuRenderParticles.fragment.js +4 -0
  580. package/Shaders/gpuRenderParticles.fragment.js.map +1 -1
  581. package/Shaders/gpuRenderParticles.vertex.d.ts +2 -0
  582. package/Shaders/gpuRenderParticles.vertex.js +5 -1
  583. package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
  584. package/Shaders/particles.fragment.d.ts +2 -0
  585. package/Shaders/particles.fragment.js +4 -0
  586. package/Shaders/particles.fragment.js.map +1 -1
  587. package/Shaders/particles.vertex.d.ts +2 -0
  588. package/Shaders/particles.vertex.js +5 -1
  589. package/Shaders/particles.vertex.js.map +1 -1
  590. package/Sprites/spriteManager.js +1 -2
  591. package/Sprites/spriteManager.js.map +1 -1
  592. package/Sprites/spriteRenderer.js +5 -7
  593. package/Sprites/spriteRenderer.js.map +1 -1
  594. package/States/stencilStateComposer.js +2 -4
  595. package/States/stencilStateComposer.js.map +1 -1
  596. package/XR/features/WebXRAbstractFeature.js +6 -2
  597. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  598. package/XR/features/WebXRAnchorSystem.js +1 -2
  599. package/XR/features/WebXRAnchorSystem.js.map +1 -1
  600. package/XR/features/WebXRControllerMovement.js +6 -7
  601. package/XR/features/WebXRControllerMovement.js.map +1 -1
  602. package/XR/features/WebXRControllerPhysics.js +17 -10
  603. package/XR/features/WebXRControllerPhysics.js.map +1 -1
  604. package/XR/features/WebXRControllerPointerSelection.js +1 -2
  605. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  606. package/XR/features/WebXRControllerTeleportation.d.ts +1 -0
  607. package/XR/features/WebXRControllerTeleportation.js +6 -3
  608. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  609. package/XR/features/WebXRDepthSensing.js +3 -5
  610. package/XR/features/WebXRDepthSensing.js.map +1 -1
  611. package/XR/features/WebXRHandTracking.d.ts +1 -0
  612. package/XR/features/WebXRHandTracking.js +31 -28
  613. package/XR/features/WebXRHandTracking.js.map +1 -1
  614. package/XR/features/WebXRLayers.js +9 -11
  615. package/XR/features/WebXRLayers.js.map +1 -1
  616. package/XR/features/WebXRLightEstimation.js +3 -6
  617. package/XR/features/WebXRLightEstimation.js.map +1 -1
  618. package/XR/features/WebXRMeshDetector.js +2 -4
  619. package/XR/features/WebXRMeshDetector.js.map +1 -1
  620. package/XR/features/WebXRNearInteraction.js +21 -18
  621. package/XR/features/WebXRNearInteraction.js.map +1 -1
  622. package/XR/features/WebXRPlaneDetector.js +1 -2
  623. package/XR/features/WebXRPlaneDetector.js.map +1 -1
  624. package/XR/features/WebXRRawCameraAccess.js +2 -3
  625. package/XR/features/WebXRRawCameraAccess.js.map +1 -1
  626. package/XR/features/WebXRSpaceWarp.js +1 -1
  627. package/XR/features/WebXRSpaceWarp.js.map +1 -1
  628. package/XR/motionController/webXRAbstractMotionController.js +4 -1
  629. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  630. package/XR/native/nativeXRFrame.js +1 -2
  631. package/XR/native/nativeXRFrame.js.map +1 -1
  632. package/XR/webXRCamera.js +1 -2
  633. package/XR/webXRCamera.js.map +1 -1
  634. package/XR/webXRDefaultExperience.js +28 -6
  635. package/XR/webXRDefaultExperience.js.map +1 -1
  636. package/XR/webXRExperienceHelper.js +5 -7
  637. package/XR/webXRExperienceHelper.js.map +1 -1
  638. package/XR/webXRFeaturesManager.js +4 -1
  639. package/XR/webXRFeaturesManager.js.map +1 -1
  640. package/XR/webXRInput.js +6 -1
  641. package/XR/webXRInput.js.map +1 -1
  642. package/XR/webXRInputSource.js +1 -2
  643. package/XR/webXRInputSource.js.map +1 -1
  644. package/XR/webXRSessionManager.js +16 -29
  645. package/XR/webXRSessionManager.js.map +1 -1
  646. package/assetContainer.js +4 -1
  647. package/assetContainer.js.map +1 -1
  648. package/package.json +1 -1
  649. package/scene.js +18 -17
  650. package/scene.js.map +1 -1
@@ -39,16 +39,16 @@ export class VideoTexture extends Texture {
39
39
  _processError(reason) {
40
40
  this._errorFound = true;
41
41
  if (this._onError) {
42
- this._onError(reason === null || reason === void 0 ? void 0 : reason.message);
42
+ this._onError(reason?.message);
43
43
  }
44
44
  else {
45
- Logger.Error(reason === null || reason === void 0 ? void 0 : reason.message);
45
+ Logger.Error(reason?.message);
46
46
  }
47
47
  }
48
48
  _handlePlay() {
49
49
  this._errorFound = false;
50
50
  this.video.play().catch((reason) => {
51
- if ((reason === null || reason === void 0 ? void 0 : reason.name) === "NotAllowedError") {
51
+ if (reason?.name === "NotAllowedError") {
52
52
  if (this._onUserActionRequestedObservable && this._onUserActionRequestedObservable.hasObservers()) {
53
53
  this._onUserActionRequestedObservable.notifyObservers(this);
54
54
  return;
@@ -82,7 +82,6 @@ export class VideoTexture extends Texture {
82
82
  * @param format defines the texture format to use (Engine.TEXTUREFORMAT_RGBA by default)
83
83
  */
84
84
  constructor(name, src, scene, generateMipMaps = false, invertY = false, samplingMode = Texture.TRILINEAR_SAMPLINGMODE, settings = {}, onError, format = 5) {
85
- var _a;
86
85
  super(null, scene, !generateMipMaps, invertY);
87
86
  this._externalTexture = null;
88
87
  this._onUserActionRequestedObservable = null;
@@ -96,7 +95,6 @@ export class VideoTexture extends Texture {
96
95
  */
97
96
  this.isVideo = true;
98
97
  this._resizeInternalTexture = () => {
99
- var _a;
100
98
  // Cleanup the old texture before replacing it
101
99
  if (this._texture != null) {
102
100
  this._texture.dispose();
@@ -111,7 +109,7 @@ export class VideoTexture extends Texture {
111
109
  this._generateMipMaps = false;
112
110
  }
113
111
  this._texture = this._getEngine().createDynamicTexture(this.video.videoWidth, this.video.videoHeight, this._generateMipMaps, this.samplingMode);
114
- this._texture.format = (_a = this._format) !== null && _a !== void 0 ? _a : 5;
112
+ this._texture.format = this._format ?? 5;
115
113
  // Reset the frame ID and update the new texture to ensure it pulls in the current video frame
116
114
  this._frameId = -1;
117
115
  this._updateInternalTexture();
@@ -177,7 +175,12 @@ export class VideoTexture extends Texture {
177
175
  this._frameId = frameId;
178
176
  this._getEngine().updateVideoTexture(this._texture, this._externalTexture ? this._externalTexture : this.video, this._invertY);
179
177
  };
180
- this._settings = Object.assign({ autoPlay: true, loop: true, autoUpdateTexture: true }, settings);
178
+ this._settings = {
179
+ autoPlay: true,
180
+ loop: true,
181
+ autoUpdateTexture: true,
182
+ ...settings,
183
+ };
181
184
  this._onError = onError;
182
185
  this._generateMipMaps = generateMipMaps;
183
186
  this._initialSamplingMode = samplingMode;
@@ -185,7 +188,7 @@ export class VideoTexture extends Texture {
185
188
  this._currentSrc = src;
186
189
  this.name = name || this._getName(src);
187
190
  this.video = this._getVideo(src);
188
- if ((_a = this._engine) === null || _a === void 0 ? void 0 : _a.createExternalTexture) {
191
+ if (this._engine?.createExternalTexture) {
189
192
  this._externalTexture = this._engine.createExternalTexture(this.video);
190
193
  }
191
194
  if (!this._settings.independentVideoSource) {
@@ -319,7 +322,6 @@ export class VideoTexture extends Texture {
319
322
  * Dispose the texture and release its associated resources.
320
323
  */
321
324
  dispose() {
322
- var _a;
323
325
  super.dispose();
324
326
  this._currentSrc = null;
325
327
  if (this._onUserActionRequestedObservable) {
@@ -335,7 +337,7 @@ export class VideoTexture extends Texture {
335
337
  this.video.removeEventListener("resize", this._resizeInternalTexture);
336
338
  this.video.pause();
337
339
  }
338
- (_a = this._externalTexture) === null || _a === void 0 ? void 0 : _a.dispose();
340
+ this._externalTexture?.dispose();
339
341
  }
340
342
  /**
341
343
  * Creates a video texture straight from a stream.
@@ -1 +1 @@
1
- {"version":3,"file":"videoTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/videoTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,k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,GAAG,IAAI;QAEd,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,CAAC;aACnE,IAAI,CAAC,UAAU,YAAY;YACxB,IAAI,OAAO,EAAE;gBACT,OAAO,CAAC,YAAY,CAAC,CAAC;aACzB;QACL,CAAC,CAAC;aACD,KAAK,CAAC,UAAU,GAAG;YAChB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACX,CAAC;CACJ;AAreW;IADP,SAAS,CAAC,UAAU,CAAC;+CACkB;AAIhC;IADP,SAAS,CAAC,KAAK,CAAC;iDAC0D;AAQ3D;IADf,SAAS,EAAE;6CACmB;AA2dnC,OAAO,CAAC,mBAAmB,GAAG,CAC1B,IAAsB,EACtB,GAAyC,EACzC,KAAsB,EACtB,eAAe,GAAG,KAAK,EACvB,OAAO,GAAG,KAAK,EACf,eAAuB,OAAO,CAAC,sBAAsB,EACrD,WAA0C,EAAE,EAC5C,OAA+D,EAC/D,SAAiB,SAAS,CAAC,kBAAkB,EAC/C,EAAE;IACA,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACjH,CAAC,CAAC;AACF,6CAA6C;AAC7C,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { ExternalTexture } from \"./externalTexture\";\r\n\r\nimport \"../../Engines/Extensions/engine.videoTexture\";\r\nimport \"../../Engines/Extensions/engine.dynamicTexture\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\n\r\nfunction removeSource(video: HTMLVideoElement): void {\r\n // Remove any <source> elements, etc.\r\n while (video.firstChild) {\r\n video.removeChild(video.firstChild);\r\n }\r\n\r\n // detach srcObject\r\n video.srcObject = null;\r\n\r\n // Set a blank src (https://html.spec.whatwg.org/multipage/media.html#best-practices-for-authors-using-media-elements)\r\n video.src = \"\";\r\n\r\n // Prevent non-important errors maybe (https://twitter.com/beraliv/status/1205214277956775936)\r\n video.removeAttribute(\"src\");\r\n}\r\n\r\n/**\r\n * Settings for finer control over video usage\r\n */\r\nexport interface VideoTextureSettings {\r\n /**\r\n * Applies `autoplay` to video, if specified\r\n */\r\n autoPlay?: boolean;\r\n\r\n /**\r\n * Applies `muted` to video, if specified\r\n */\r\n muted?: boolean;\r\n\r\n /**\r\n * Applies `loop` to video, if specified\r\n */\r\n loop?: boolean;\r\n\r\n /**\r\n * Automatically updates internal texture from video at every frame in the render loop\r\n */\r\n autoUpdateTexture: boolean;\r\n\r\n /**\r\n * Image src displayed during the video loading or until the user interacts with the video.\r\n */\r\n poster?: string;\r\n\r\n /**\r\n * Defines the associated texture format.\r\n */\r\n format?: number;\r\n\r\n /**\r\n * Notify babylon to not modify any video settings and not control the video's playback.\r\n * Set this to true if you are controlling the way the video is being played, stopped and paused.\r\n */\r\n independentVideoSource?: boolean;\r\n}\r\n\r\n/**\r\n * If you want to display a video in your scene, this is the special texture for that.\r\n * This special texture works similar to other textures, with the exception of a few parameters.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/videoTexture\r\n */\r\nexport class VideoTexture extends Texture {\r\n /**\r\n * Tells whether textures will be updated automatically or user is required to call `updateTexture` manually\r\n */\r\n public readonly autoUpdateTexture: boolean;\r\n\r\n /**\r\n * The video instance used by the texture internally\r\n */\r\n public readonly video: HTMLVideoElement;\r\n\r\n private _externalTexture: Nullable<ExternalTexture> = null;\r\n private _onUserActionRequestedObservable: Nullable<Observable<Texture>> = null;\r\n\r\n /**\r\n * Event triggered when a dom action is required by the user to play the video.\r\n * This happens due to recent changes in browser policies preventing video to auto start.\r\n */\r\n public get onUserActionRequestedObservable(): Observable<Texture> {\r\n if (!this._onUserActionRequestedObservable) {\r\n this._onUserActionRequestedObservable = new Observable<Texture>();\r\n }\r\n return this._onUserActionRequestedObservable;\r\n }\r\n\r\n private _generateMipMaps: boolean;\r\n private _stillImageCaptured = false;\r\n private _displayingPosterTexture = false;\r\n @serialize(\"settings\")\r\n private _settings: VideoTextureSettings;\r\n private _createInternalTextureOnEvent: string;\r\n private _frameId = -1;\r\n @serialize(\"src\")\r\n private _currentSrc: Nullable<string | string[] | HTMLVideoElement> = null;\r\n private _onError?: Nullable<(message?: string, exception?: any) => void>;\r\n private _errorFound = false;\r\n\r\n /**\r\n * Serialize the flag to define this texture as a video texture\r\n */\r\n @serialize()\r\n public readonly isVideo = true;\r\n\r\n private _processError(reason: any) {\r\n this._errorFound = true;\r\n if (this._onError) {\r\n this._onError(reason?.message);\r\n } else {\r\n Logger.Error(reason?.message);\r\n }\r\n }\r\n\r\n private _handlePlay() {\r\n this._errorFound = false;\r\n this.video.play().catch((reason) => {\r\n if (reason?.name === \"NotAllowedError\") {\r\n if (this._onUserActionRequestedObservable && this._onUserActionRequestedObservable.hasObservers()) {\r\n this._onUserActionRequestedObservable.notifyObservers(this);\r\n return;\r\n } else if (!this.video.muted) {\r\n Logger.Warn(\"Unable to autoplay a video with sound. Trying again with muted turned true\");\r\n this.video.muted = true;\r\n this._errorFound = false;\r\n this.video.play().catch((otherReason) => {\r\n this._processError(otherReason);\r\n });\r\n return;\r\n }\r\n }\r\n\r\n this._processError(reason);\r\n });\r\n }\r\n\r\n /**\r\n * Creates a video texture.\r\n * If you want to display a video in your scene, this is the special texture for that.\r\n * This special texture works similar to other textures, with the exception of a few parameters.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/videoTexture\r\n * @param name optional name, will detect from video source, if not defined\r\n * @param src can be used to provide an url, array of urls or an already setup HTML video element.\r\n * @param scene is obviously the current scene.\r\n * @param generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).\r\n * @param invertY is false by default but can be used to invert video on Y axis\r\n * @param samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default\r\n * @param settings allows finer control over video usage\r\n * @param onError defines a callback triggered when an error occurred during the loading session\r\n * @param format defines the texture format to use (Engine.TEXTUREFORMAT_RGBA by default)\r\n */\r\n constructor(\r\n name: Nullable<string>,\r\n src: string | string[] | HTMLVideoElement,\r\n scene: Nullable<Scene>,\r\n generateMipMaps = false,\r\n invertY = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n settings: Partial<VideoTextureSettings> = {},\r\n onError?: Nullable<(message?: string, exception?: any) => void>,\r\n format: number = Constants.TEXTUREFORMAT_RGBA\r\n ) {\r\n super(null, scene, !generateMipMaps, invertY);\r\n\r\n this._settings = {\r\n autoPlay: true,\r\n loop: true,\r\n autoUpdateTexture: true,\r\n ...settings,\r\n };\r\n\r\n this._onError = onError;\r\n\r\n this._generateMipMaps = generateMipMaps;\r\n this._initialSamplingMode = samplingMode;\r\n this.autoUpdateTexture = this._settings.autoUpdateTexture;\r\n\r\n this._currentSrc = src;\r\n this.name = name || this._getName(src);\r\n this.video = this._getVideo(src);\r\n if (this._engine?.createExternalTexture) {\r\n this._externalTexture = this._engine.createExternalTexture(this.video);\r\n }\r\n\r\n if (!this._settings.independentVideoSource) {\r\n if (this._settings.poster) {\r\n this.video.poster = this._settings.poster;\r\n }\r\n if (this._settings.autoPlay !== undefined) {\r\n this.video.autoplay = this._settings.autoPlay;\r\n }\r\n if (this._settings.loop !== undefined) {\r\n this.video.loop = this._settings.loop;\r\n }\r\n if (this._settings.muted !== undefined) {\r\n this.video.muted = this._settings.muted;\r\n }\r\n\r\n this.video.setAttribute(\"playsinline\", \"\");\r\n this.video.addEventListener(\"paused\", this._updateInternalTexture);\r\n this.video.addEventListener(\"seeked\", this._updateInternalTexture);\r\n this.video.addEventListener(\"loadeddata\", this._updateInternalTexture);\r\n this.video.addEventListener(\"emptied\", this._reset);\r\n\r\n if (this._settings.autoPlay) {\r\n this._handlePlay();\r\n }\r\n }\r\n\r\n this._createInternalTextureOnEvent = this._settings.poster && !this._settings.autoPlay ? \"play\" : \"canplay\";\r\n this.video.addEventListener(this._createInternalTextureOnEvent, this._createInternalTexture);\r\n this._format = format;\r\n\r\n const videoHasEnoughData = this.video.readyState >= this.video.HAVE_CURRENT_DATA;\r\n if (this._settings.poster && (!this._settings.autoPlay || !videoHasEnoughData)) {\r\n this._texture = this._getEngine()!.createTexture(this._settings.poster!, false, !this.invertY, scene);\r\n this._displayingPosterTexture = true;\r\n } else if (videoHasEnoughData) {\r\n this._createInternalTexture();\r\n }\r\n }\r\n\r\n /**\r\n * Get the current class name of the video texture useful for serialization or dynamic coding.\r\n * @returns \"VideoTexture\"\r\n */\r\n public getClassName(): string {\r\n return \"VideoTexture\";\r\n }\r\n\r\n private _getName(src: string | string[] | HTMLVideoElement): string {\r\n if (src instanceof HTMLVideoElement) {\r\n return src.currentSrc;\r\n }\r\n\r\n if (typeof src === \"object\") {\r\n return src.toString();\r\n }\r\n\r\n return src;\r\n }\r\n\r\n private _getVideo(src: string | string[] | HTMLVideoElement): HTMLVideoElement {\r\n if ((<any>src).isNative) {\r\n return <HTMLVideoElement>src;\r\n }\r\n if (src instanceof HTMLVideoElement) {\r\n Tools.SetCorsBehavior(src.currentSrc, src);\r\n return src;\r\n }\r\n const video: HTMLVideoElement = document.createElement(\"video\");\r\n if (typeof src === \"string\") {\r\n Tools.SetCorsBehavior(src, video);\r\n video.src = src;\r\n } else {\r\n Tools.SetCorsBehavior(src[0], video);\r\n src.forEach((url) => {\r\n const source = document.createElement(\"source\");\r\n source.src = url;\r\n video.appendChild(source);\r\n });\r\n }\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n removeSource(video);\r\n });\r\n\r\n return video;\r\n }\r\n\r\n private _resizeInternalTexture = (): void => {\r\n // Cleanup the old texture before replacing it\r\n if (this._texture != null) {\r\n this._texture.dispose();\r\n }\r\n\r\n if (!this._getEngine()!.needPOTTextures || (Tools.IsExponentOfTwo(this.video.videoWidth) && Tools.IsExponentOfTwo(this.video.videoHeight))) {\r\n this.wrapU = Texture.WRAP_ADDRESSMODE;\r\n this.wrapV = Texture.WRAP_ADDRESSMODE;\r\n } else {\r\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._generateMipMaps = false;\r\n }\r\n\r\n this._texture = this._getEngine()!.createDynamicTexture(this.video.videoWidth, this.video.videoHeight, this._generateMipMaps, this.samplingMode);\r\n this._texture.format = this._format ?? Constants.TEXTUREFORMAT_RGBA;\r\n\r\n // Reset the frame ID and update the new texture to ensure it pulls in the current video frame\r\n this._frameId = -1;\r\n this._updateInternalTexture();\r\n };\r\n\r\n private _createInternalTexture = (): void => {\r\n if (this._texture != null) {\r\n if (this._displayingPosterTexture) {\r\n this._displayingPosterTexture = false;\r\n } else {\r\n return;\r\n }\r\n }\r\n\r\n this.video.addEventListener(\"resize\", this._resizeInternalTexture);\r\n this._resizeInternalTexture();\r\n\r\n if (!this.video.autoplay && !this._settings.poster && !this._settings.independentVideoSource) {\r\n const oldHandler = this.video.onplaying;\r\n const oldMuted = this.video.muted;\r\n this.video.muted = true;\r\n this.video.onplaying = () => {\r\n this.video.muted = oldMuted;\r\n this.video.onplaying = oldHandler;\r\n this._updateInternalTexture();\r\n if (!this._errorFound) {\r\n this.video.pause();\r\n }\r\n if (this.onLoadObservable.hasObservers()) {\r\n this.onLoadObservable.notifyObservers(this);\r\n }\r\n };\r\n this._handlePlay();\r\n } else {\r\n this._updateInternalTexture();\r\n if (this.onLoadObservable.hasObservers()) {\r\n this.onLoadObservable.notifyObservers(this);\r\n }\r\n }\r\n };\r\n\r\n private _reset = (): void => {\r\n if (this._texture == null) {\r\n return;\r\n }\r\n\r\n if (!this._displayingPosterTexture) {\r\n this._texture.dispose();\r\n this._texture = null;\r\n }\r\n };\r\n\r\n /**\r\n * @internal Internal method to initiate `update`.\r\n */\r\n public _rebuild(): void {\r\n this.update();\r\n }\r\n\r\n /**\r\n * Update Texture in the `auto` mode. Does not do anything if `settings.autoUpdateTexture` is false.\r\n */\r\n public update(): void {\r\n if (!this.autoUpdateTexture) {\r\n // Expecting user to call `updateTexture` manually\r\n return;\r\n }\r\n\r\n this.updateTexture(true);\r\n }\r\n\r\n /**\r\n * Update Texture in `manual` mode. Does not do anything if not visible or paused.\r\n * @param isVisible Visibility state, detected by user using `scene.getActiveMeshes()` or otherwise.\r\n */\r\n public updateTexture(isVisible: boolean): void {\r\n if (!isVisible) {\r\n return;\r\n }\r\n if (this.video.paused && this._stillImageCaptured) {\r\n return;\r\n }\r\n this._stillImageCaptured = true;\r\n this._updateInternalTexture();\r\n }\r\n\r\n protected _updateInternalTexture = (): void => {\r\n if (this._texture == null) {\r\n return;\r\n }\r\n if (this.video.readyState < this.video.HAVE_CURRENT_DATA) {\r\n return;\r\n }\r\n if (this._displayingPosterTexture) {\r\n return;\r\n }\r\n\r\n const frameId = this.getScene()!.getFrameId();\r\n if (this._frameId === frameId) {\r\n return;\r\n }\r\n\r\n this._frameId = frameId;\r\n\r\n this._getEngine()!.updateVideoTexture(this._texture, this._externalTexture ? this._externalTexture : this.video, this._invertY);\r\n };\r\n\r\n /**\r\n * Get the underlying external texture (if supported by the current engine, else null)\r\n */\r\n public get externalTexture(): Nullable<ExternalTexture> {\r\n return this._externalTexture;\r\n }\r\n\r\n /**\r\n * Change video content. Changing video instance or setting multiple urls (as in constructor) is not supported.\r\n * @param url New url.\r\n */\r\n public updateURL(url: string): void {\r\n this.video.src = url;\r\n this._currentSrc = url;\r\n }\r\n\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n public clone(): VideoTexture {\r\n return new VideoTexture(this.name, this._currentSrc!, this.getScene(), this._generateMipMaps, this.invertY, this.samplingMode, this._settings);\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public dispose(): void {\r\n super.dispose();\r\n\r\n this._currentSrc = null;\r\n\r\n if (this._onUserActionRequestedObservable) {\r\n this._onUserActionRequestedObservable.clear();\r\n this._onUserActionRequestedObservable = null;\r\n }\r\n\r\n this.video.removeEventListener(this._createInternalTextureOnEvent, this._createInternalTexture);\r\n if (!this._settings.independentVideoSource) {\r\n this.video.removeEventListener(\"paused\", this._updateInternalTexture);\r\n this.video.removeEventListener(\"seeked\", this._updateInternalTexture);\r\n this.video.removeEventListener(\"loadeddata\", this._updateInternalTexture);\r\n this.video.removeEventListener(\"emptied\", this._reset);\r\n this.video.removeEventListener(\"resize\", this._resizeInternalTexture);\r\n this.video.pause();\r\n }\r\n\r\n this._externalTexture?.dispose();\r\n }\r\n\r\n /**\r\n * Creates a video texture straight from a stream.\r\n * @param scene Define the scene the texture should be created in\r\n * @param stream Define the stream the texture should be created from\r\n * @param constraints video constraints\r\n * @param invertY Defines if the video should be stored with invert Y set to true (true by default)\r\n * @returns The created video texture as a promise\r\n */\r\n public static CreateFromStreamAsync(scene: Scene, stream: MediaStream, constraints: any, invertY = true): Promise<VideoTexture> {\r\n const video = scene.getEngine().createVideoElement(constraints);\r\n\r\n if (scene.getEngine()._badOS) {\r\n // Yes... I know and I hope to remove it soon...\r\n document.body.appendChild(video);\r\n video.style.transform = \"scale(0.0001, 0.0001)\";\r\n video.style.opacity = \"0\";\r\n video.style.position = \"fixed\";\r\n video.style.bottom = \"0px\";\r\n video.style.right = \"0px\";\r\n }\r\n\r\n video.setAttribute(\"autoplay\", \"\");\r\n video.setAttribute(\"muted\", \"true\");\r\n video.setAttribute(\"playsinline\", \"\");\r\n video.muted = true;\r\n\r\n if (video.isNative) {\r\n // No additional configuration needed for native\r\n } else if (video.mozSrcObject !== undefined) {\r\n // hack for Firefox < 19\r\n video.mozSrcObject = stream;\r\n } else {\r\n if (typeof video.srcObject == \"object\") {\r\n video.srcObject = stream;\r\n } else {\r\n // older API. See https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL#using_object_urls_for_media_streams\r\n video.src = window.URL && window.URL.createObjectURL(stream as any);\r\n }\r\n }\r\n\r\n return new Promise<VideoTexture>((resolve) => {\r\n const onPlaying = () => {\r\n const videoTexture = new VideoTexture(\"video\", video, scene, true, invertY, undefined, undefined, undefined, Constants.TEXTUREFORMAT_RGB);\r\n if (scene.getEngine()._badOS) {\r\n videoTexture.onDisposeObservable.addOnce(() => {\r\n video.remove();\r\n });\r\n }\r\n videoTexture.onDisposeObservable.addOnce(() => {\r\n removeSource(video);\r\n });\r\n\r\n resolve(videoTexture);\r\n video.removeEventListener(\"playing\", onPlaying);\r\n };\r\n\r\n video.addEventListener(\"playing\", onPlaying);\r\n video.play();\r\n });\r\n }\r\n\r\n /**\r\n * Creates a video texture straight from your WebCam video feed.\r\n * @param scene Define the scene the texture should be created in\r\n * @param constraints Define the constraints to use to create the web cam feed from WebRTC\r\n * @param audioConstaints Define the audio constraints to use to create the web cam feed from WebRTC\r\n * @param invertY Defines if the video should be stored with invert Y set to true (true by default)\r\n * @returns The created video texture as a promise\r\n */\r\n public static async CreateFromWebCamAsync(\r\n scene: Scene,\r\n constraints: {\r\n minWidth: number;\r\n maxWidth: number;\r\n minHeight: number;\r\n maxHeight: number;\r\n deviceId: string;\r\n } & MediaTrackConstraints,\r\n audioConstaints: boolean | MediaTrackConstraints = false,\r\n invertY = true\r\n ): Promise<VideoTexture> {\r\n if (navigator.mediaDevices) {\r\n const stream = await navigator.mediaDevices.getUserMedia({\r\n video: constraints,\r\n audio: audioConstaints,\r\n });\r\n\r\n const videoTexture = await this.CreateFromStreamAsync(scene, stream, constraints, invertY);\r\n videoTexture.onDisposeObservable.addOnce(() => {\r\n stream.getTracks().forEach((track) => {\r\n track.stop();\r\n });\r\n });\r\n\r\n return videoTexture;\r\n }\r\n\r\n return Promise.reject(\"No support for userMedia on this device\");\r\n }\r\n\r\n /**\r\n * Creates a video texture straight from your WebCam video feed.\r\n * @param scene Defines the scene the texture should be created in\r\n * @param onReady Defines a callback to triggered once the texture will be ready\r\n * @param constraints Defines the constraints to use to create the web cam feed from WebRTC\r\n * @param audioConstaints Defines the audio constraints to use to create the web cam feed from WebRTC\r\n * @param invertY Defines if the video should be stored with invert Y set to true (true by default)\r\n */\r\n public static CreateFromWebCam(\r\n scene: Scene,\r\n onReady: (videoTexture: VideoTexture) => void,\r\n constraints: {\r\n minWidth: number;\r\n maxWidth: number;\r\n minHeight: number;\r\n maxHeight: number;\r\n deviceId: string;\r\n } & MediaTrackConstraints,\r\n audioConstaints: boolean | MediaTrackConstraints = false,\r\n invertY = true\r\n ): void {\r\n this.CreateFromWebCamAsync(scene, constraints, audioConstaints, invertY)\r\n .then(function (videoTexture) {\r\n if (onReady) {\r\n onReady(videoTexture);\r\n }\r\n })\r\n .catch(function (err) {\r\n Logger.Error(err.name);\r\n });\r\n }\r\n}\r\n\r\nTexture._CreateVideoTexture = (\r\n name: Nullable<string>,\r\n src: string | string[] | HTMLVideoElement,\r\n scene: Nullable<Scene>,\r\n generateMipMaps = false,\r\n invertY = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n settings: Partial<VideoTextureSettings> = {},\r\n onError?: Nullable<(message?: string, exception?: any) => void>,\r\n format: number = Constants.TEXTUREFORMAT_RGBA\r\n) => {\r\n return new VideoTexture(name, src, scene, generateMipMaps, invertY, samplingMode, settings, onError, format);\r\n};\r\n// Some exporters relies on Tools.Instantiate\r\nRegisterClass(\"BABYLON.VideoTexture\", VideoTexture);\r\n"]}
1
+ {"version":3,"file":"videoTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/videoTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OA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YAAY;YACxB,IAAI,OAAO,EAAE;gBACT,OAAO,CAAC,YAAY,CAAC,CAAC;aACzB;QACL,CAAC,CAAC;aACD,KAAK,CAAC,UAAU,GAAG;YAChB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACX,CAAC;CACJ;AAreW;IADP,SAAS,CAAC,UAAU,CAAC;+CACkB;AAIhC;IADP,SAAS,CAAC,KAAK,CAAC;iDAC0D;AAQ3D;IADf,SAAS,EAAE;6CACmB;AA2dnC,OAAO,CAAC,mBAAmB,GAAG,CAC1B,IAAsB,EACtB,GAAyC,EACzC,KAAsB,EACtB,eAAe,GAAG,KAAK,EACvB,OAAO,GAAG,KAAK,EACf,eAAuB,OAAO,CAAC,sBAAsB,EACrD,WAA0C,EAAE,EAC5C,OAA+D,EAC/D,SAAiB,SAAS,CAAC,kBAAkB,EAC/C,EAAE;IACA,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACjH,CAAC,CAAC;AACF,6CAA6C;AAC7C,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { ExternalTexture } from \"./externalTexture\";\r\n\r\nimport \"../../Engines/Extensions/engine.videoTexture\";\r\nimport \"../../Engines/Extensions/engine.dynamicTexture\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\n\r\nfunction removeSource(video: HTMLVideoElement): void {\r\n // Remove any <source> elements, etc.\r\n while (video.firstChild) {\r\n video.removeChild(video.firstChild);\r\n }\r\n\r\n // detach srcObject\r\n video.srcObject = null;\r\n\r\n // Set a blank src (https://html.spec.whatwg.org/multipage/media.html#best-practices-for-authors-using-media-elements)\r\n video.src = \"\";\r\n\r\n // Prevent non-important errors maybe (https://twitter.com/beraliv/status/1205214277956775936)\r\n video.removeAttribute(\"src\");\r\n}\r\n\r\n/**\r\n * Settings for finer control over video usage\r\n */\r\nexport interface VideoTextureSettings {\r\n /**\r\n * Applies `autoplay` to video, if specified\r\n */\r\n autoPlay?: boolean;\r\n\r\n /**\r\n * Applies `muted` to video, if specified\r\n */\r\n muted?: boolean;\r\n\r\n /**\r\n * Applies `loop` to video, if specified\r\n */\r\n loop?: boolean;\r\n\r\n /**\r\n * Automatically updates internal texture from video at every frame in the render loop\r\n */\r\n autoUpdateTexture: boolean;\r\n\r\n /**\r\n * Image src displayed during the video loading or until the user interacts with the video.\r\n */\r\n poster?: string;\r\n\r\n /**\r\n * Defines the associated texture format.\r\n */\r\n format?: number;\r\n\r\n /**\r\n * Notify babylon to not modify any video settings and not control the video's playback.\r\n * Set this to true if you are controlling the way the video is being played, stopped and paused.\r\n */\r\n independentVideoSource?: boolean;\r\n}\r\n\r\n/**\r\n * If you want to display a video in your scene, this is the special texture for that.\r\n * This special texture works similar to other textures, with the exception of a few parameters.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/videoTexture\r\n */\r\nexport class VideoTexture extends Texture {\r\n /**\r\n * Tells whether textures will be updated automatically or user is required to call `updateTexture` manually\r\n */\r\n public readonly autoUpdateTexture: boolean;\r\n\r\n /**\r\n * The video instance used by the texture internally\r\n */\r\n public readonly video: HTMLVideoElement;\r\n\r\n private _externalTexture: Nullable<ExternalTexture> = null;\r\n private _onUserActionRequestedObservable: Nullable<Observable<Texture>> = null;\r\n\r\n /**\r\n * Event triggered when a dom action is required by the user to play the video.\r\n * This happens due to recent changes in browser policies preventing video to auto start.\r\n */\r\n public get onUserActionRequestedObservable(): Observable<Texture> {\r\n if (!this._onUserActionRequestedObservable) {\r\n this._onUserActionRequestedObservable = new Observable<Texture>();\r\n }\r\n return this._onUserActionRequestedObservable;\r\n }\r\n\r\n private _generateMipMaps: boolean;\r\n private _stillImageCaptured = false;\r\n private _displayingPosterTexture = false;\r\n @serialize(\"settings\")\r\n private _settings: VideoTextureSettings;\r\n private _createInternalTextureOnEvent: string;\r\n private _frameId = -1;\r\n @serialize(\"src\")\r\n private _currentSrc: Nullable<string | string[] | HTMLVideoElement> = null;\r\n private _onError?: Nullable<(message?: string, exception?: any) => void>;\r\n private _errorFound = false;\r\n\r\n /**\r\n * Serialize the flag to define this texture as a video texture\r\n */\r\n @serialize()\r\n public readonly isVideo = true;\r\n\r\n private _processError(reason: any) {\r\n this._errorFound = true;\r\n if (this._onError) {\r\n this._onError(reason?.message);\r\n } else {\r\n Logger.Error(reason?.message);\r\n }\r\n }\r\n\r\n private _handlePlay() {\r\n this._errorFound = false;\r\n this.video.play().catch((reason) => {\r\n if (reason?.name === \"NotAllowedError\") {\r\n if (this._onUserActionRequestedObservable && this._onUserActionRequestedObservable.hasObservers()) {\r\n this._onUserActionRequestedObservable.notifyObservers(this);\r\n return;\r\n } else if (!this.video.muted) {\r\n Logger.Warn(\"Unable to autoplay a video with sound. Trying again with muted turned true\");\r\n this.video.muted = true;\r\n this._errorFound = false;\r\n this.video.play().catch((otherReason) => {\r\n this._processError(otherReason);\r\n });\r\n return;\r\n }\r\n }\r\n\r\n this._processError(reason);\r\n });\r\n }\r\n\r\n /**\r\n * Creates a video texture.\r\n * If you want to display a video in your scene, this is the special texture for that.\r\n * This special texture works similar to other textures, with the exception of a few parameters.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/videoTexture\r\n * @param name optional name, will detect from video source, if not defined\r\n * @param src can be used to provide an url, array of urls or an already setup HTML video element.\r\n * @param scene is obviously the current scene.\r\n * @param generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).\r\n * @param invertY is false by default but can be used to invert video on Y axis\r\n * @param samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default\r\n * @param settings allows finer control over video usage\r\n * @param onError defines a callback triggered when an error occurred during the loading session\r\n * @param format defines the texture format to use (Engine.TEXTUREFORMAT_RGBA by default)\r\n */\r\n constructor(\r\n name: Nullable<string>,\r\n src: string | string[] | HTMLVideoElement,\r\n scene: Nullable<Scene>,\r\n generateMipMaps = false,\r\n invertY = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n settings: Partial<VideoTextureSettings> = {},\r\n onError?: Nullable<(message?: string, exception?: any) => void>,\r\n format: number = Constants.TEXTUREFORMAT_RGBA\r\n ) {\r\n super(null, scene, !generateMipMaps, invertY);\r\n\r\n this._settings = {\r\n autoPlay: true,\r\n loop: true,\r\n autoUpdateTexture: true,\r\n ...settings,\r\n };\r\n\r\n this._onError = onError;\r\n\r\n this._generateMipMaps = generateMipMaps;\r\n this._initialSamplingMode = samplingMode;\r\n this.autoUpdateTexture = this._settings.autoUpdateTexture;\r\n\r\n this._currentSrc = src;\r\n this.name = name || this._getName(src);\r\n this.video = this._getVideo(src);\r\n if (this._engine?.createExternalTexture) {\r\n this._externalTexture = this._engine.createExternalTexture(this.video);\r\n }\r\n\r\n if (!this._settings.independentVideoSource) {\r\n if (this._settings.poster) {\r\n this.video.poster = this._settings.poster;\r\n }\r\n if (this._settings.autoPlay !== undefined) {\r\n this.video.autoplay = this._settings.autoPlay;\r\n }\r\n if (this._settings.loop !== undefined) {\r\n this.video.loop = this._settings.loop;\r\n }\r\n if (this._settings.muted !== undefined) {\r\n this.video.muted = this._settings.muted;\r\n }\r\n\r\n this.video.setAttribute(\"playsinline\", \"\");\r\n this.video.addEventListener(\"paused\", this._updateInternalTexture);\r\n this.video.addEventListener(\"seeked\", this._updateInternalTexture);\r\n this.video.addEventListener(\"loadeddata\", this._updateInternalTexture);\r\n this.video.addEventListener(\"emptied\", this._reset);\r\n\r\n if (this._settings.autoPlay) {\r\n this._handlePlay();\r\n }\r\n }\r\n\r\n this._createInternalTextureOnEvent = this._settings.poster && !this._settings.autoPlay ? \"play\" : \"canplay\";\r\n this.video.addEventListener(this._createInternalTextureOnEvent, this._createInternalTexture);\r\n this._format = format;\r\n\r\n const videoHasEnoughData = this.video.readyState >= this.video.HAVE_CURRENT_DATA;\r\n if (this._settings.poster && (!this._settings.autoPlay || !videoHasEnoughData)) {\r\n this._texture = this._getEngine()!.createTexture(this._settings.poster!, false, !this.invertY, scene);\r\n this._displayingPosterTexture = true;\r\n } else if (videoHasEnoughData) {\r\n this._createInternalTexture();\r\n }\r\n }\r\n\r\n /**\r\n * Get the current class name of the video texture useful for serialization or dynamic coding.\r\n * @returns \"VideoTexture\"\r\n */\r\n public getClassName(): string {\r\n return \"VideoTexture\";\r\n }\r\n\r\n private _getName(src: string | string[] | HTMLVideoElement): string {\r\n if (src instanceof HTMLVideoElement) {\r\n return src.currentSrc;\r\n }\r\n\r\n if (typeof src === \"object\") {\r\n return src.toString();\r\n }\r\n\r\n return src;\r\n }\r\n\r\n private _getVideo(src: string | string[] | HTMLVideoElement): HTMLVideoElement {\r\n if ((<any>src).isNative) {\r\n return <HTMLVideoElement>src;\r\n }\r\n if (src instanceof HTMLVideoElement) {\r\n Tools.SetCorsBehavior(src.currentSrc, src);\r\n return src;\r\n }\r\n const video: HTMLVideoElement = document.createElement(\"video\");\r\n if (typeof src === \"string\") {\r\n Tools.SetCorsBehavior(src, video);\r\n video.src = src;\r\n } else {\r\n Tools.SetCorsBehavior(src[0], video);\r\n src.forEach((url) => {\r\n const source = document.createElement(\"source\");\r\n source.src = url;\r\n video.appendChild(source);\r\n });\r\n }\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n removeSource(video);\r\n });\r\n\r\n return video;\r\n }\r\n\r\n private _resizeInternalTexture = (): void => {\r\n // Cleanup the old texture before replacing it\r\n if (this._texture != null) {\r\n this._texture.dispose();\r\n }\r\n\r\n if (!this._getEngine()!.needPOTTextures || (Tools.IsExponentOfTwo(this.video.videoWidth) && Tools.IsExponentOfTwo(this.video.videoHeight))) {\r\n this.wrapU = Texture.WRAP_ADDRESSMODE;\r\n this.wrapV = Texture.WRAP_ADDRESSMODE;\r\n } else {\r\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._generateMipMaps = false;\r\n }\r\n\r\n this._texture = this._getEngine()!.createDynamicTexture(this.video.videoWidth, this.video.videoHeight, this._generateMipMaps, this.samplingMode);\r\n this._texture.format = this._format ?? Constants.TEXTUREFORMAT_RGBA;\r\n\r\n // Reset the frame ID and update the new texture to ensure it pulls in the current video frame\r\n this._frameId = -1;\r\n this._updateInternalTexture();\r\n };\r\n\r\n private _createInternalTexture = (): void => {\r\n if (this._texture != null) {\r\n if (this._displayingPosterTexture) {\r\n this._displayingPosterTexture = false;\r\n } else {\r\n return;\r\n }\r\n }\r\n\r\n this.video.addEventListener(\"resize\", this._resizeInternalTexture);\r\n this._resizeInternalTexture();\r\n\r\n if (!this.video.autoplay && !this._settings.poster && !this._settings.independentVideoSource) {\r\n const oldHandler = this.video.onplaying;\r\n const oldMuted = this.video.muted;\r\n this.video.muted = true;\r\n this.video.onplaying = () => {\r\n this.video.muted = oldMuted;\r\n this.video.onplaying = oldHandler;\r\n this._updateInternalTexture();\r\n if (!this._errorFound) {\r\n this.video.pause();\r\n }\r\n if (this.onLoadObservable.hasObservers()) {\r\n this.onLoadObservable.notifyObservers(this);\r\n }\r\n };\r\n this._handlePlay();\r\n } else {\r\n this._updateInternalTexture();\r\n if (this.onLoadObservable.hasObservers()) {\r\n this.onLoadObservable.notifyObservers(this);\r\n }\r\n }\r\n };\r\n\r\n private _reset = (): void => {\r\n if (this._texture == null) {\r\n return;\r\n }\r\n\r\n if (!this._displayingPosterTexture) {\r\n this._texture.dispose();\r\n this._texture = null;\r\n }\r\n };\r\n\r\n /**\r\n * @internal Internal method to initiate `update`.\r\n */\r\n public _rebuild(): void {\r\n this.update();\r\n }\r\n\r\n /**\r\n * Update Texture in the `auto` mode. Does not do anything if `settings.autoUpdateTexture` is false.\r\n */\r\n public update(): void {\r\n if (!this.autoUpdateTexture) {\r\n // Expecting user to call `updateTexture` manually\r\n return;\r\n }\r\n\r\n this.updateTexture(true);\r\n }\r\n\r\n /**\r\n * Update Texture in `manual` mode. Does not do anything if not visible or paused.\r\n * @param isVisible Visibility state, detected by user using `scene.getActiveMeshes()` or otherwise.\r\n */\r\n public updateTexture(isVisible: boolean): void {\r\n if (!isVisible) {\r\n return;\r\n }\r\n if (this.video.paused && this._stillImageCaptured) {\r\n return;\r\n }\r\n this._stillImageCaptured = true;\r\n this._updateInternalTexture();\r\n }\r\n\r\n protected _updateInternalTexture = (): void => {\r\n if (this._texture == null) {\r\n return;\r\n }\r\n if (this.video.readyState < this.video.HAVE_CURRENT_DATA) {\r\n return;\r\n }\r\n if (this._displayingPosterTexture) {\r\n return;\r\n }\r\n\r\n const frameId = this.getScene()!.getFrameId();\r\n if (this._frameId === frameId) {\r\n return;\r\n }\r\n\r\n this._frameId = frameId;\r\n\r\n this._getEngine()!.updateVideoTexture(this._texture, this._externalTexture ? this._externalTexture : this.video, this._invertY);\r\n };\r\n\r\n /**\r\n * Get the underlying external texture (if supported by the current engine, else null)\r\n */\r\n public get externalTexture(): Nullable<ExternalTexture> {\r\n return this._externalTexture;\r\n }\r\n\r\n /**\r\n * Change video content. Changing video instance or setting multiple urls (as in constructor) is not supported.\r\n * @param url New url.\r\n */\r\n public updateURL(url: string): void {\r\n this.video.src = url;\r\n this._currentSrc = url;\r\n }\r\n\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n public clone(): VideoTexture {\r\n return new VideoTexture(this.name, this._currentSrc!, this.getScene(), this._generateMipMaps, this.invertY, this.samplingMode, this._settings);\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public dispose(): void {\r\n super.dispose();\r\n\r\n this._currentSrc = null;\r\n\r\n if (this._onUserActionRequestedObservable) {\r\n this._onUserActionRequestedObservable.clear();\r\n this._onUserActionRequestedObservable = null;\r\n }\r\n\r\n this.video.removeEventListener(this._createInternalTextureOnEvent, this._createInternalTexture);\r\n if (!this._settings.independentVideoSource) {\r\n this.video.removeEventListener(\"paused\", this._updateInternalTexture);\r\n this.video.removeEventListener(\"seeked\", this._updateInternalTexture);\r\n this.video.removeEventListener(\"loadeddata\", this._updateInternalTexture);\r\n this.video.removeEventListener(\"emptied\", this._reset);\r\n this.video.removeEventListener(\"resize\", this._resizeInternalTexture);\r\n this.video.pause();\r\n }\r\n\r\n this._externalTexture?.dispose();\r\n }\r\n\r\n /**\r\n * Creates a video texture straight from a stream.\r\n * @param scene Define the scene the texture should be created in\r\n * @param stream Define the stream the texture should be created from\r\n * @param constraints video constraints\r\n * @param invertY Defines if the video should be stored with invert Y set to true (true by default)\r\n * @returns The created video texture as a promise\r\n */\r\n public static CreateFromStreamAsync(scene: Scene, stream: MediaStream, constraints: any, invertY = true): Promise<VideoTexture> {\r\n const video = scene.getEngine().createVideoElement(constraints);\r\n\r\n if (scene.getEngine()._badOS) {\r\n // Yes... I know and I hope to remove it soon...\r\n document.body.appendChild(video);\r\n video.style.transform = \"scale(0.0001, 0.0001)\";\r\n video.style.opacity = \"0\";\r\n video.style.position = \"fixed\";\r\n video.style.bottom = \"0px\";\r\n video.style.right = \"0px\";\r\n }\r\n\r\n video.setAttribute(\"autoplay\", \"\");\r\n video.setAttribute(\"muted\", \"true\");\r\n video.setAttribute(\"playsinline\", \"\");\r\n video.muted = true;\r\n\r\n if (video.isNative) {\r\n // No additional configuration needed for native\r\n } else if (video.mozSrcObject !== undefined) {\r\n // hack for Firefox < 19\r\n video.mozSrcObject = stream;\r\n } else {\r\n if (typeof video.srcObject == \"object\") {\r\n video.srcObject = stream;\r\n } else {\r\n // older API. See https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL#using_object_urls_for_media_streams\r\n video.src = window.URL && window.URL.createObjectURL(stream as any);\r\n }\r\n }\r\n\r\n return new Promise<VideoTexture>((resolve) => {\r\n const onPlaying = () => {\r\n const videoTexture = new VideoTexture(\"video\", video, scene, true, invertY, undefined, undefined, undefined, Constants.TEXTUREFORMAT_RGB);\r\n if (scene.getEngine()._badOS) {\r\n videoTexture.onDisposeObservable.addOnce(() => {\r\n video.remove();\r\n });\r\n }\r\n videoTexture.onDisposeObservable.addOnce(() => {\r\n removeSource(video);\r\n });\r\n\r\n resolve(videoTexture);\r\n video.removeEventListener(\"playing\", onPlaying);\r\n };\r\n\r\n video.addEventListener(\"playing\", onPlaying);\r\n video.play();\r\n });\r\n }\r\n\r\n /**\r\n * Creates a video texture straight from your WebCam video feed.\r\n * @param scene Define the scene the texture should be created in\r\n * @param constraints Define the constraints to use to create the web cam feed from WebRTC\r\n * @param audioConstaints Define the audio constraints to use to create the web cam feed from WebRTC\r\n * @param invertY Defines if the video should be stored with invert Y set to true (true by default)\r\n * @returns The created video texture as a promise\r\n */\r\n public static async CreateFromWebCamAsync(\r\n scene: Scene,\r\n constraints: {\r\n minWidth: number;\r\n maxWidth: number;\r\n minHeight: number;\r\n maxHeight: number;\r\n deviceId: string;\r\n } & MediaTrackConstraints,\r\n audioConstaints: boolean | MediaTrackConstraints = false,\r\n invertY = true\r\n ): Promise<VideoTexture> {\r\n if (navigator.mediaDevices) {\r\n const stream = await navigator.mediaDevices.getUserMedia({\r\n video: constraints,\r\n audio: audioConstaints,\r\n });\r\n\r\n const videoTexture = await this.CreateFromStreamAsync(scene, stream, constraints, invertY);\r\n videoTexture.onDisposeObservable.addOnce(() => {\r\n stream.getTracks().forEach((track) => {\r\n track.stop();\r\n });\r\n });\r\n\r\n return videoTexture;\r\n }\r\n\r\n return Promise.reject(\"No support for userMedia on this device\");\r\n }\r\n\r\n /**\r\n * Creates a video texture straight from your WebCam video feed.\r\n * @param scene Defines the scene the texture should be created in\r\n * @param onReady Defines a callback to triggered once the texture will be ready\r\n * @param constraints Defines the constraints to use to create the web cam feed from WebRTC\r\n * @param audioConstaints Defines the audio constraints to use to create the web cam feed from WebRTC\r\n * @param invertY Defines if the video should be stored with invert Y set to true (true by default)\r\n */\r\n public static CreateFromWebCam(\r\n scene: Scene,\r\n onReady: (videoTexture: VideoTexture) => void,\r\n constraints: {\r\n minWidth: number;\r\n maxWidth: number;\r\n minHeight: number;\r\n maxHeight: number;\r\n deviceId: string;\r\n } & MediaTrackConstraints,\r\n audioConstaints: boolean | MediaTrackConstraints = false,\r\n invertY = true\r\n ): void {\r\n this.CreateFromWebCamAsync(scene, constraints, audioConstaints, invertY)\r\n .then(function (videoTexture) {\r\n if (onReady) {\r\n onReady(videoTexture);\r\n }\r\n })\r\n .catch(function (err) {\r\n Logger.Error(err.name);\r\n });\r\n }\r\n}\r\n\r\nTexture._CreateVideoTexture = (\r\n name: Nullable<string>,\r\n src: string | string[] | HTMLVideoElement,\r\n scene: Nullable<Scene>,\r\n generateMipMaps = false,\r\n invertY = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n settings: Partial<VideoTextureSettings> = {},\r\n onError?: Nullable<(message?: string, exception?: any) => void>,\r\n format: number = Constants.TEXTUREFORMAT_RGBA\r\n) => {\r\n return new VideoTexture(name, src, scene, generateMipMaps, invertY, samplingMode, settings, onError, format);\r\n};\r\n// Some exporters relies on Tools.Instantiate\r\nRegisterClass(\"BABYLON.VideoTexture\", VideoTexture);\r\n"]}
@@ -21,13 +21,12 @@ export function addClipPlaneUniforms(uniforms) {
21
21
  }
22
22
  /** @internal */
23
23
  export function prepareStringDefinesForClipPlanes(primaryHolder, secondaryHolder, defines) {
24
- var _a, _b, _c, _d, _e, _f;
25
- const clipPlane = !!((_a = primaryHolder.clipPlane) !== null && _a !== void 0 ? _a : secondaryHolder.clipPlane);
26
- const clipPlane2 = !!((_b = primaryHolder.clipPlane2) !== null && _b !== void 0 ? _b : secondaryHolder.clipPlane2);
27
- const clipPlane3 = !!((_c = primaryHolder.clipPlane3) !== null && _c !== void 0 ? _c : secondaryHolder.clipPlane3);
28
- const clipPlane4 = !!((_d = primaryHolder.clipPlane4) !== null && _d !== void 0 ? _d : secondaryHolder.clipPlane4);
29
- const clipPlane5 = !!((_e = primaryHolder.clipPlane5) !== null && _e !== void 0 ? _e : secondaryHolder.clipPlane5);
30
- const clipPlane6 = !!((_f = primaryHolder.clipPlane6) !== null && _f !== void 0 ? _f : secondaryHolder.clipPlane6);
24
+ const clipPlane = !!(primaryHolder.clipPlane ?? secondaryHolder.clipPlane);
25
+ const clipPlane2 = !!(primaryHolder.clipPlane2 ?? secondaryHolder.clipPlane2);
26
+ const clipPlane3 = !!(primaryHolder.clipPlane3 ?? secondaryHolder.clipPlane3);
27
+ const clipPlane4 = !!(primaryHolder.clipPlane4 ?? secondaryHolder.clipPlane4);
28
+ const clipPlane5 = !!(primaryHolder.clipPlane5 ?? secondaryHolder.clipPlane5);
29
+ const clipPlane6 = !!(primaryHolder.clipPlane6 ?? secondaryHolder.clipPlane6);
31
30
  if (clipPlane)
32
31
  defines.push("#define CLIPPLANE");
33
32
  if (clipPlane2)
@@ -43,14 +42,13 @@ export function prepareStringDefinesForClipPlanes(primaryHolder, secondaryHolder
43
42
  }
44
43
  /** @internal */
45
44
  export function prepareDefinesForClipPlanes(primaryHolder, secondaryHolder, defines) {
46
- var _a, _b, _c, _d, _e, _f;
47
45
  let changed = false;
48
- const clipPlane = !!((_a = primaryHolder.clipPlane) !== null && _a !== void 0 ? _a : secondaryHolder.clipPlane);
49
- const clipPlane2 = !!((_b = primaryHolder.clipPlane2) !== null && _b !== void 0 ? _b : secondaryHolder.clipPlane2);
50
- const clipPlane3 = !!((_c = primaryHolder.clipPlane3) !== null && _c !== void 0 ? _c : secondaryHolder.clipPlane3);
51
- const clipPlane4 = !!((_d = primaryHolder.clipPlane4) !== null && _d !== void 0 ? _d : secondaryHolder.clipPlane4);
52
- const clipPlane5 = !!((_e = primaryHolder.clipPlane5) !== null && _e !== void 0 ? _e : secondaryHolder.clipPlane5);
53
- const clipPlane6 = !!((_f = primaryHolder.clipPlane6) !== null && _f !== void 0 ? _f : secondaryHolder.clipPlane6);
46
+ const clipPlane = !!(primaryHolder.clipPlane ?? secondaryHolder.clipPlane);
47
+ const clipPlane2 = !!(primaryHolder.clipPlane2 ?? secondaryHolder.clipPlane2);
48
+ const clipPlane3 = !!(primaryHolder.clipPlane3 ?? secondaryHolder.clipPlane3);
49
+ const clipPlane4 = !!(primaryHolder.clipPlane4 ?? secondaryHolder.clipPlane4);
50
+ const clipPlane5 = !!(primaryHolder.clipPlane5 ?? secondaryHolder.clipPlane5);
51
+ const clipPlane6 = !!(primaryHolder.clipPlane6 ?? secondaryHolder.clipPlane6);
54
52
  // Do not factorize this code, it breaks browsers optimizations.
55
53
  if (defines["CLIPPLANE"] !== clipPlane) {
56
54
  defines["CLIPPLANE"] = clipPlane;
@@ -80,18 +78,17 @@ export function prepareDefinesForClipPlanes(primaryHolder, secondaryHolder, defi
80
78
  }
81
79
  /** @internal */
82
80
  export function bindClipPlane(effect, primaryHolder, secondaryHolder) {
83
- var _a, _b, _c, _d, _e, _f;
84
- let clipPlane = (_a = primaryHolder.clipPlane) !== null && _a !== void 0 ? _a : secondaryHolder.clipPlane;
81
+ let clipPlane = primaryHolder.clipPlane ?? secondaryHolder.clipPlane;
85
82
  setClipPlane(effect, "vClipPlane", clipPlane);
86
- clipPlane = (_b = primaryHolder.clipPlane2) !== null && _b !== void 0 ? _b : secondaryHolder.clipPlane2;
83
+ clipPlane = primaryHolder.clipPlane2 ?? secondaryHolder.clipPlane2;
87
84
  setClipPlane(effect, "vClipPlane2", clipPlane);
88
- clipPlane = (_c = primaryHolder.clipPlane3) !== null && _c !== void 0 ? _c : secondaryHolder.clipPlane3;
85
+ clipPlane = primaryHolder.clipPlane3 ?? secondaryHolder.clipPlane3;
89
86
  setClipPlane(effect, "vClipPlane3", clipPlane);
90
- clipPlane = (_d = primaryHolder.clipPlane4) !== null && _d !== void 0 ? _d : secondaryHolder.clipPlane4;
87
+ clipPlane = primaryHolder.clipPlane4 ?? secondaryHolder.clipPlane4;
91
88
  setClipPlane(effect, "vClipPlane4", clipPlane);
92
- clipPlane = (_e = primaryHolder.clipPlane5) !== null && _e !== void 0 ? _e : secondaryHolder.clipPlane5;
89
+ clipPlane = primaryHolder.clipPlane5 ?? secondaryHolder.clipPlane5;
93
90
  setClipPlane(effect, "vClipPlane5", clipPlane);
94
- clipPlane = (_f = primaryHolder.clipPlane6) !== null && _f !== void 0 ? _f : secondaryHolder.clipPlane6;
91
+ clipPlane = primaryHolder.clipPlane6 ?? secondaryHolder.clipPlane6;
95
92
  setClipPlane(effect, "vClipPlane6", clipPlane);
96
93
  }
97
94
  function setClipPlane(effect, uniformName, clipPlane) {
@@ -1 +1 @@
1
- {"version":3,"file":"clipPlaneMaterialHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/clipPlaneMaterialHelper.ts"],"names":[],"mappings":"AAKA,gBAAgB;AAChB,MAAM,UAAU,oBAAoB,CAAC,QAAkB;IACnD,IAAI,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE;QACvC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KAC/B;IACD,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QACxC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;KAChC;IACD,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QACxC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;KAChC;IACD,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QACxC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;KAChC;IACD,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,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,SAAS,CAAC,CAAC;IAC/C,SAAS,GAAG,MAAA,aAAa,CAAC,UAAU,mCAAI,eAAe,CAAC,UAAU,CAAC;IACnE,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,YAAY,CAAC,MAAc,EAAE,WAAmB,EAAE,SAA0B;IACjF,IAAI,SAAS,EAAE;QACX,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;KAC1G;AACL,CAAC","sourcesContent":["import type { Effect } from \"./effect\";\r\nimport type { IClipPlanesHolder } from \"../Misc/interfaces/iClipPlanesHolder\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Plane } from \"../Maths/math.plane\";\r\n\r\n/** @internal */\r\nexport function addClipPlaneUniforms(uniforms: string[]): void {\r\n if (uniforms.indexOf(\"vClipPlane\") === -1) {\r\n uniforms.push(\"vClipPlane\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane2\") === -1) {\r\n uniforms.push(\"vClipPlane2\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane3\") === -1) {\r\n uniforms.push(\"vClipPlane3\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane4\") === -1) {\r\n uniforms.push(\"vClipPlane4\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane5\") === -1) {\r\n uniforms.push(\"vClipPlane5\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane6\") === -1) {\r\n uniforms.push(\"vClipPlane6\");\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function prepareStringDefinesForClipPlanes(primaryHolder: IClipPlanesHolder, secondaryHolder: IClipPlanesHolder, defines: string[]): void {\r\n const clipPlane = !!(primaryHolder.clipPlane ?? secondaryHolder.clipPlane);\r\n const clipPlane2 = !!(primaryHolder.clipPlane2 ?? secondaryHolder.clipPlane2);\r\n const clipPlane3 = !!(primaryHolder.clipPlane3 ?? secondaryHolder.clipPlane3);\r\n const clipPlane4 = !!(primaryHolder.clipPlane4 ?? secondaryHolder.clipPlane4);\r\n const clipPlane5 = !!(primaryHolder.clipPlane5 ?? secondaryHolder.clipPlane5);\r\n const clipPlane6 = !!(primaryHolder.clipPlane6 ?? secondaryHolder.clipPlane6);\r\n\r\n if (clipPlane) defines.push(\"#define CLIPPLANE\");\r\n if (clipPlane2) defines.push(\"#define CLIPPLANE2\");\r\n if (clipPlane3) defines.push(\"#define CLIPPLANE3\");\r\n if (clipPlane4) defines.push(\"#define CLIPPLANE4\");\r\n if (clipPlane5) defines.push(\"#define CLIPPLANE5\");\r\n if (clipPlane6) defines.push(\"#define CLIPPLANE6\");\r\n}\r\n\r\n/** @internal */\r\nexport function prepareDefinesForClipPlanes(primaryHolder: IClipPlanesHolder, secondaryHolder: IClipPlanesHolder, defines: Record<string, any>): boolean {\r\n let changed = false;\r\n\r\n const clipPlane = !!(primaryHolder.clipPlane ?? secondaryHolder.clipPlane);\r\n const clipPlane2 = !!(primaryHolder.clipPlane2 ?? secondaryHolder.clipPlane2);\r\n const clipPlane3 = !!(primaryHolder.clipPlane3 ?? secondaryHolder.clipPlane3);\r\n const clipPlane4 = !!(primaryHolder.clipPlane4 ?? secondaryHolder.clipPlane4);\r\n const clipPlane5 = !!(primaryHolder.clipPlane5 ?? secondaryHolder.clipPlane5);\r\n const clipPlane6 = !!(primaryHolder.clipPlane6 ?? secondaryHolder.clipPlane6);\r\n\r\n // Do not factorize this code, it breaks browsers optimizations.\r\n if (defines[\"CLIPPLANE\"] !== clipPlane) {\r\n defines[\"CLIPPLANE\"] = clipPlane;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE2\"] !== clipPlane2) {\r\n defines[\"CLIPPLANE2\"] = clipPlane2;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE3\"] !== clipPlane3) {\r\n defines[\"CLIPPLANE3\"] = clipPlane3;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE4\"] !== clipPlane4) {\r\n defines[\"CLIPPLANE4\"] = clipPlane4;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE5\"] !== clipPlane5) {\r\n defines[\"CLIPPLANE5\"] = clipPlane5;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE6\"] !== clipPlane6) {\r\n defines[\"CLIPPLANE6\"] = clipPlane6;\r\n changed = true;\r\n }\r\n\r\n return changed;\r\n}\r\n\r\n/** @internal */\r\nexport function bindClipPlane(effect: Effect, primaryHolder: IClipPlanesHolder, secondaryHolder: IClipPlanesHolder): void {\r\n let clipPlane = primaryHolder.clipPlane ?? secondaryHolder.clipPlane;\r\n setClipPlane(effect, \"vClipPlane\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane2 ?? secondaryHolder.clipPlane2;\r\n setClipPlane(effect, \"vClipPlane2\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane3 ?? secondaryHolder.clipPlane3;\r\n setClipPlane(effect, \"vClipPlane3\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane4 ?? secondaryHolder.clipPlane4;\r\n setClipPlane(effect, \"vClipPlane4\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane5 ?? secondaryHolder.clipPlane5;\r\n setClipPlane(effect, \"vClipPlane5\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane6 ?? secondaryHolder.clipPlane6;\r\n setClipPlane(effect, \"vClipPlane6\", clipPlane);\r\n}\r\n\r\nfunction setClipPlane(effect: Effect, uniformName: string, clipPlane: Nullable<Plane>): void {\r\n if (clipPlane) {\r\n effect.setFloat4(uniformName, clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"clipPlaneMaterialHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/clipPlaneMaterialHelper.ts"],"names":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,SAAS,CAAC,CAAC;IAC9C,SAAS,GAAG,aAAa,CAAC,UAAU,IAAI,eAAe,CAAC,UAAU,CAAC;IACnE,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC/C,SAAS,GAAG,aAAa,CAAC,UAAU,IAAI,eAAe,CAAC,UAAU,CAAC;IACnE,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC/C,SAAS,GAAG,aAAa,CAAC,UAAU,IAAI,eAAe,CAAC,UAAU,CAAC;IACnE,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC/C,SAAS,GAAG,aAAa,CAAC,UAAU,IAAI,eAAe,CAAC,UAAU,CAAC;IACnE,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC/C,SAAS,GAAG,aAAa,CAAC,UAAU,IAAI,eAAe,CAAC,UAAU,CAAC;IACnE,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,YAAY,CAAC,MAAc,EAAE,WAAmB,EAAE,SAA0B;IACjF,IAAI,SAAS,EAAE;QACX,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;KAC1G;AACL,CAAC","sourcesContent":["import type { Effect } from \"./effect\";\r\nimport type { IClipPlanesHolder } from \"../Misc/interfaces/iClipPlanesHolder\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Plane } from \"../Maths/math.plane\";\r\n\r\n/** @internal */\r\nexport function addClipPlaneUniforms(uniforms: string[]): void {\r\n if (uniforms.indexOf(\"vClipPlane\") === -1) {\r\n uniforms.push(\"vClipPlane\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane2\") === -1) {\r\n uniforms.push(\"vClipPlane2\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane3\") === -1) {\r\n uniforms.push(\"vClipPlane3\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane4\") === -1) {\r\n uniforms.push(\"vClipPlane4\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane5\") === -1) {\r\n uniforms.push(\"vClipPlane5\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane6\") === -1) {\r\n uniforms.push(\"vClipPlane6\");\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function prepareStringDefinesForClipPlanes(primaryHolder: IClipPlanesHolder, secondaryHolder: IClipPlanesHolder, defines: string[]): void {\r\n const clipPlane = !!(primaryHolder.clipPlane ?? secondaryHolder.clipPlane);\r\n const clipPlane2 = !!(primaryHolder.clipPlane2 ?? secondaryHolder.clipPlane2);\r\n const clipPlane3 = !!(primaryHolder.clipPlane3 ?? secondaryHolder.clipPlane3);\r\n const clipPlane4 = !!(primaryHolder.clipPlane4 ?? secondaryHolder.clipPlane4);\r\n const clipPlane5 = !!(primaryHolder.clipPlane5 ?? secondaryHolder.clipPlane5);\r\n const clipPlane6 = !!(primaryHolder.clipPlane6 ?? secondaryHolder.clipPlane6);\r\n\r\n if (clipPlane) defines.push(\"#define CLIPPLANE\");\r\n if (clipPlane2) defines.push(\"#define CLIPPLANE2\");\r\n if (clipPlane3) defines.push(\"#define CLIPPLANE3\");\r\n if (clipPlane4) defines.push(\"#define CLIPPLANE4\");\r\n if (clipPlane5) defines.push(\"#define CLIPPLANE5\");\r\n if (clipPlane6) defines.push(\"#define CLIPPLANE6\");\r\n}\r\n\r\n/** @internal */\r\nexport function prepareDefinesForClipPlanes(primaryHolder: IClipPlanesHolder, secondaryHolder: IClipPlanesHolder, defines: Record<string, any>): boolean {\r\n let changed = false;\r\n\r\n const clipPlane = !!(primaryHolder.clipPlane ?? secondaryHolder.clipPlane);\r\n const clipPlane2 = !!(primaryHolder.clipPlane2 ?? secondaryHolder.clipPlane2);\r\n const clipPlane3 = !!(primaryHolder.clipPlane3 ?? secondaryHolder.clipPlane3);\r\n const clipPlane4 = !!(primaryHolder.clipPlane4 ?? secondaryHolder.clipPlane4);\r\n const clipPlane5 = !!(primaryHolder.clipPlane5 ?? secondaryHolder.clipPlane5);\r\n const clipPlane6 = !!(primaryHolder.clipPlane6 ?? secondaryHolder.clipPlane6);\r\n\r\n // Do not factorize this code, it breaks browsers optimizations.\r\n if (defines[\"CLIPPLANE\"] !== clipPlane) {\r\n defines[\"CLIPPLANE\"] = clipPlane;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE2\"] !== clipPlane2) {\r\n defines[\"CLIPPLANE2\"] = clipPlane2;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE3\"] !== clipPlane3) {\r\n defines[\"CLIPPLANE3\"] = clipPlane3;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE4\"] !== clipPlane4) {\r\n defines[\"CLIPPLANE4\"] = clipPlane4;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE5\"] !== clipPlane5) {\r\n defines[\"CLIPPLANE5\"] = clipPlane5;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE6\"] !== clipPlane6) {\r\n defines[\"CLIPPLANE6\"] = clipPlane6;\r\n changed = true;\r\n }\r\n\r\n return changed;\r\n}\r\n\r\n/** @internal */\r\nexport function bindClipPlane(effect: Effect, primaryHolder: IClipPlanesHolder, secondaryHolder: IClipPlanesHolder): void {\r\n let clipPlane = primaryHolder.clipPlane ?? secondaryHolder.clipPlane;\r\n setClipPlane(effect, \"vClipPlane\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane2 ?? secondaryHolder.clipPlane2;\r\n setClipPlane(effect, \"vClipPlane2\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane3 ?? secondaryHolder.clipPlane3;\r\n setClipPlane(effect, \"vClipPlane3\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane4 ?? secondaryHolder.clipPlane4;\r\n setClipPlane(effect, \"vClipPlane4\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane5 ?? secondaryHolder.clipPlane5;\r\n setClipPlane(effect, \"vClipPlane5\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane6 ?? secondaryHolder.clipPlane6;\r\n setClipPlane(effect, \"vClipPlane6\", clipPlane);\r\n}\r\n\r\nfunction setClipPlane(effect: Effect, uniformName: string, clipPlane: Nullable<Plane>): void {\r\n if (clipPlane) {\r\n effect.setFloat4(uniformName, clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n}\r\n"]}
@@ -30,18 +30,16 @@ export class DrawWrapper {
30
30
  }
31
31
  }
32
32
  setEffect(effect, defines, resetContext = true) {
33
- var _a;
34
33
  this.effect = effect;
35
34
  if (defines !== undefined) {
36
35
  this.defines = defines;
37
36
  }
38
37
  if (resetContext) {
39
- (_a = this.drawContext) === null || _a === void 0 ? void 0 : _a.reset();
38
+ this.drawContext?.reset();
40
39
  }
41
40
  }
42
41
  dispose() {
43
- var _a;
44
- (_a = this.drawContext) === null || _a === void 0 ? void 0 : _a.dispose();
42
+ this.drawContext?.dispose();
45
43
  }
46
44
  }
47
45
  //# sourceMappingURL=drawWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawWrapper.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/drawWrapper.ts"],"names":[],"mappings":"AAQA,gBAAgB;AAChB,MAAM,OAAO,WAAW;IAwBb,MAAM,CAAC,SAAS,CAAC,MAA4B;QAChD,OAAQ,MAAiB,CAAC,kBAAkB,KAAK,SAAS,CAAC;IAC/D,CAAC;IAEM,MAAM,CAAC,SAAS,CAAC,MAA4B;QAChD,OAAQ,MAAiB,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAE,MAAsB,CAAC,MAAM,CAAC,CAAC,CAAE,MAAiB,CAAC;IACrH,CAAC;IAED,YAAY,MAAkB,EAAE,qBAAqB,GAAG,IAAI;QA1B5D;;;WAGG;QACI,wBAAmB,GAAG,KAAK,CAAC;QAEnC;;;WAGG;QACI,2BAAsB,GAAG,IAAI,CAAC;QAErC;;;WAGG;QACI,iCAA4B,GAAsB,IAAI,CAAC;QAW1D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC9C,IAAI,qBAAqB,EAAE;YACvB,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;SACzD;IACL,CAAC;IAEM,SAAS,CAAC,MAAwB,EAAE,OAA4C,EAAE,YAAY,GAAG,IAAI;;QACxG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,OAAO,KAAK,SAAS,EAAE;YACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;SAC1B;QACD,IAAI,YAAY,EAAE;YACd,MAAA,IAAI,CAAC,WAAW,0CAAE,KAAK,EAAE,CAAC;SAC7B;IACL,CAAC;IAEM,OAAO;;QACV,MAAA,IAAI,CAAC,WAAW,0CAAE,OAAO,EAAE,CAAC;IAChC,CAAC;CACJ","sourcesContent":["import type { IDrawContext } from \"../Engines/IDrawContext\";\r\nimport type { IMaterialContext } from \"../Engines/IMaterialContext\";\r\nimport type { Nullable } from \"../types\";\r\n\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport type { Effect } from \"./effect\";\r\nimport type { MaterialDefines } from \"./materialDefines\";\r\n\r\n/** @internal */\r\nexport class DrawWrapper {\r\n public effect: Nullable<Effect>;\r\n public defines: Nullable<string | MaterialDefines>;\r\n public materialContext?: IMaterialContext;\r\n public drawContext?: IDrawContext;\r\n\r\n /**\r\n * @internal\r\n * Specifies if the effect was previously ready\r\n */\r\n public _wasPreviouslyReady = false;\r\n\r\n /**\r\n * @internal\r\n * Forces the code from bindForSubMesh to be fully run the next time it is called\r\n */\r\n public _forceRebindOnNextCall = true;\r\n\r\n /**\r\n * @internal\r\n * Specifies if the effect was previously using instances\r\n */\r\n public _wasPreviouslyUsingInstances: Nullable<boolean> = null;\r\n\r\n public static IsWrapper(effect: Effect | DrawWrapper): effect is DrawWrapper {\r\n return (effect as Effect).getPipelineContext === undefined;\r\n }\r\n\r\n public static GetEffect(effect: Effect | DrawWrapper): Nullable<Effect> {\r\n return (effect as Effect).getPipelineContext === undefined ? (effect as DrawWrapper).effect : (effect as Effect);\r\n }\r\n\r\n constructor(engine: ThinEngine, createMaterialContext = true) {\r\n this.effect = null;\r\n this.defines = null;\r\n this.drawContext = engine.createDrawContext();\r\n if (createMaterialContext) {\r\n this.materialContext = engine.createMaterialContext();\r\n }\r\n }\r\n\r\n public setEffect(effect: Nullable<Effect>, defines?: Nullable<string | MaterialDefines>, resetContext = true): void {\r\n this.effect = effect;\r\n if (defines !== undefined) {\r\n this.defines = defines;\r\n }\r\n if (resetContext) {\r\n this.drawContext?.reset();\r\n }\r\n }\r\n\r\n public dispose(): void {\r\n this.drawContext?.dispose();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"drawWrapper.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/drawWrapper.ts"],"names":[],"mappings":"AAQA,gBAAgB;AAChB,MAAM,OAAO,WAAW;IAwBb,MAAM,CAAC,SAAS,CAAC,MAA4B;QAChD,OAAQ,MAAiB,CAAC,kBAAkB,KAAK,SAAS,CAAC;IAC/D,CAAC;IAEM,MAAM,CAAC,SAAS,CAAC,MAA4B;QAChD,OAAQ,MAAiB,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAE,MAAsB,CAAC,MAAM,CAAC,CAAC,CAAE,MAAiB,CAAC;IACrH,CAAC;IAED,YAAY,MAAkB,EAAE,qBAAqB,GAAG,IAAI;QA1B5D;;;WAGG;QACI,wBAAmB,GAAG,KAAK,CAAC;QAEnC;;;WAGG;QACI,2BAAsB,GAAG,IAAI,CAAC;QAErC;;;WAGG;QACI,iCAA4B,GAAsB,IAAI,CAAC;QAW1D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC9C,IAAI,qBAAqB,EAAE;YACvB,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;SACzD;IACL,CAAC;IAEM,SAAS,CAAC,MAAwB,EAAE,OAA4C,EAAE,YAAY,GAAG,IAAI;QACxG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,OAAO,KAAK,SAAS,EAAE;YACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;SAC1B;QACD,IAAI,YAAY,EAAE;YACd,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC;SAC7B;IACL,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC;IAChC,CAAC;CACJ","sourcesContent":["import type { IDrawContext } from \"../Engines/IDrawContext\";\r\nimport type { IMaterialContext } from \"../Engines/IMaterialContext\";\r\nimport type { Nullable } from \"../types\";\r\n\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport type { Effect } from \"./effect\";\r\nimport type { MaterialDefines } from \"./materialDefines\";\r\n\r\n/** @internal */\r\nexport class DrawWrapper {\r\n public effect: Nullable<Effect>;\r\n public defines: Nullable<string | MaterialDefines>;\r\n public materialContext?: IMaterialContext;\r\n public drawContext?: IDrawContext;\r\n\r\n /**\r\n * @internal\r\n * Specifies if the effect was previously ready\r\n */\r\n public _wasPreviouslyReady = false;\r\n\r\n /**\r\n * @internal\r\n * Forces the code from bindForSubMesh to be fully run the next time it is called\r\n */\r\n public _forceRebindOnNextCall = true;\r\n\r\n /**\r\n * @internal\r\n * Specifies if the effect was previously using instances\r\n */\r\n public _wasPreviouslyUsingInstances: Nullable<boolean> = null;\r\n\r\n public static IsWrapper(effect: Effect | DrawWrapper): effect is DrawWrapper {\r\n return (effect as Effect).getPipelineContext === undefined;\r\n }\r\n\r\n public static GetEffect(effect: Effect | DrawWrapper): Nullable<Effect> {\r\n return (effect as Effect).getPipelineContext === undefined ? (effect as DrawWrapper).effect : (effect as Effect);\r\n }\r\n\r\n constructor(engine: ThinEngine, createMaterialContext = true) {\r\n this.effect = null;\r\n this.defines = null;\r\n this.drawContext = engine.createDrawContext();\r\n if (createMaterialContext) {\r\n this.materialContext = engine.createMaterialContext();\r\n }\r\n }\r\n\r\n public setEffect(effect: Nullable<Effect>, defines?: Nullable<string | MaterialDefines>, resetContext = true): void {\r\n this.effect = effect;\r\n if (defines !== undefined) {\r\n this.defines = defines;\r\n }\r\n if (resetContext) {\r\n this.drawContext?.reset();\r\n }\r\n }\r\n\r\n public dispose(): void {\r\n this.drawContext?.dispose();\r\n }\r\n}\r\n"]}
@@ -187,6 +187,10 @@ export declare class Effect implements IDisposable {
187
187
  private _processingContext;
188
188
  private _processCodeAfterIncludes;
189
189
  private _processFinalCode;
190
+ /**
191
+ * Gets the shader language type used to write vertex and fragment source code.
192
+ */
193
+ get shaderLanguage(): ShaderLanguage;
190
194
  /**
191
195
  * Instantiates an effect.
192
196
  * An effect can be used to create/manage/execute vertex and fragment shaders.
@@ -27,6 +27,12 @@ export class Effect {
27
27
  }
28
28
  return this._onBindObservable;
29
29
  }
30
+ /**
31
+ * Gets the shader language type used to write vertex and fragment source code.
32
+ */
33
+ get shaderLanguage() {
34
+ return this._shaderLanguage;
35
+ }
30
36
  /**
31
37
  * Instantiates an effect.
32
38
  * An effect can be used to create/manage/execute vertex and fragment shaders.
@@ -44,7 +50,6 @@ export class Effect {
44
50
  * @param shaderLanguage the language the shader is written in (default: GLSL)
45
51
  */
46
52
  constructor(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers = null, engine, defines = null, fallbacks = null, onCompiled = null, onError = null, indexParameters, key = "", shaderLanguage = ShaderLanguage.GLSL) {
47
- var _a, _b, _c;
48
53
  /**
49
54
  * Name of the effect.
50
55
  */
@@ -135,15 +140,15 @@ export class Effect {
135
140
  this._indexParameters = options.indexParameters;
136
141
  this._transformFeedbackVaryings = options.transformFeedbackVaryings || null;
137
142
  this._multiTarget = !!options.multiTarget;
138
- this._shaderLanguage = (_a = options.shaderLanguage) !== null && _a !== void 0 ? _a : ShaderLanguage.GLSL;
143
+ this._shaderLanguage = options.shaderLanguage ?? ShaderLanguage.GLSL;
139
144
  if (options.uniformBuffersNames) {
140
145
  this._uniformBuffersNamesList = options.uniformBuffersNames.slice();
141
146
  for (let i = 0; i < options.uniformBuffersNames.length; i++) {
142
147
  this._uniformBuffersNames[options.uniformBuffersNames[i]] = i;
143
148
  }
144
149
  }
145
- this._processFinalCode = (_b = options.processFinalCode) !== null && _b !== void 0 ? _b : null;
146
- this._processCodeAfterIncludes = (_c = options.processCodeAfterIncludes) !== null && _c !== void 0 ? _c : undefined;
150
+ this._processFinalCode = options.processFinalCode ?? null;
151
+ this._processCodeAfterIncludes = options.processCodeAfterIncludes ?? undefined;
147
152
  }
148
153
  else {
149
154
  this._engine = engine;
@@ -198,7 +203,7 @@ export class Effect {
198
203
  indexParameters: this._indexParameters,
199
204
  isFragment: false,
200
205
  shouldUseHighPrecisionShader: this._engine._shouldUseHighPrecisionShader,
201
- processor: shaderProcessor !== null && shaderProcessor !== void 0 ? shaderProcessor : this._engine._getShaderProcessor(this._shaderLanguage),
206
+ processor: shaderProcessor ?? this._engine._getShaderProcessor(this._shaderLanguage),
202
207
  supportsUniformBuffers: this._engine.supportsUniformBuffers,
203
208
  shadersRepository: EngineShaderStore.GetShadersRepository(this._shaderLanguage),
204
209
  includesShadersStore: EngineShaderStore.GetIncludesShadersStore(this._shaderLanguage),
@@ -270,7 +275,7 @@ export class Effect {
270
275
  try {
271
276
  return this._isReadyInternal();
272
277
  }
273
- catch (_a) {
278
+ catch {
274
279
  return false;
275
280
  }
276
281
  }
@@ -465,20 +470,18 @@ export class Effect {
465
470
  * This is the final source code that will be compiled, after all the processing has been done (pre-processing applied, code injection/replacement, etc)
466
471
  */
467
472
  get vertexSourceCode() {
468
- var _a, _b;
469
473
  return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride
470
474
  ? this._vertexSourceCodeOverride
471
- : (_b = (_a = this._pipelineContext) === null || _a === void 0 ? void 0 : _a._getVertexShaderCode()) !== null && _b !== void 0 ? _b : this._vertexSourceCode;
475
+ : this._pipelineContext?._getVertexShaderCode() ?? this._vertexSourceCode;
472
476
  }
473
477
  /**
474
478
  * Gets the fragment shader source code of this effect
475
479
  * This is the final source code that will be compiled, after all the processing has been done (pre-processing applied, code injection/replacement, etc)
476
480
  */
477
481
  get fragmentSourceCode() {
478
- var _a, _b;
479
482
  return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride
480
483
  ? this._fragmentSourceCodeOverride
481
- : (_b = (_a = this._pipelineContext) === null || _a === void 0 ? void 0 : _a._getFragmentShaderCode()) !== null && _b !== void 0 ? _b : this._fragmentSourceCode;
484
+ : this._pipelineContext?._getFragmentShaderCode() ?? this._fragmentSourceCode;
482
485
  }
483
486
  /**
484
487
  * Gets the vertex shader source code before migration.
@@ -526,14 +529,13 @@ export class Effect {
526
529
  }
527
530
  };
528
531
  this.onCompiled = () => {
529
- var _a, _b;
530
532
  const scenes = this.getEngine().scenes;
531
533
  if (scenes) {
532
534
  for (let i = 0; i < scenes.length; i++) {
533
535
  scenes[i].markAllMaterialsAsDirty(63);
534
536
  }
535
537
  }
536
- (_b = (_a = this._pipelineContext)._handlesSpectorRebuildCallback) === null || _b === void 0 ? void 0 : _b.call(_a, onCompiled);
538
+ this._pipelineContext._handlesSpectorRebuildCallback?.(onCompiled);
537
539
  };
538
540
  this._fallbacks = null;
539
541
  this._prepareEffect();
@@ -543,14 +545,13 @@ export class Effect {
543
545
  * @internal
544
546
  */
545
547
  _prepareEffect(keepExistingPipelineContext = false) {
546
- var _a;
547
548
  const attributesNames = this._attributesNames;
548
549
  const defines = this.defines;
549
550
  const previousPipelineContext = this._pipelineContext;
550
551
  this._isReady = false;
551
552
  try {
552
553
  const engine = this._engine;
553
- this._pipelineContext = (_a = (keepExistingPipelineContext ? previousPipelineContext : undefined)) !== null && _a !== void 0 ? _a : engine.createPipelineContext(this._processingContext);
554
+ this._pipelineContext = (keepExistingPipelineContext ? previousPipelineContext : undefined) ?? engine.createPipelineContext(this._processingContext);
554
555
  this._pipelineContext._name = this._key.replace(/\r/g, "").replace(/\n/g, "|");
555
556
  const rebuildRebind = (vertexSourceCode, fragmentSourceCode, onCompiled, onError) => this._rebuildProgram(vertexSourceCode, fragmentSourceCode, onCompiled, onError);
556
557
  if (this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride) {
@@ -609,7 +610,6 @@ export class Effect {
609
610
  return [code, errorLine];
610
611
  }
611
612
  _processCompilationErrors(e, previousPipelineContext = null) {
612
- var _a, _b, _c;
613
613
  this._compilationError = e.message;
614
614
  const attributesNames = this._attributesNames;
615
615
  const fallbacks = this._fallbacks;
@@ -626,15 +626,15 @@ export class Effect {
626
626
  Logger.Error("Defines:\n" + this.defines);
627
627
  if (Effect.LogShaderCodeOnCompilationError) {
628
628
  let lineErrorVertex = null, lineErrorFragment = null, code = null;
629
- if ((_a = this._pipelineContext) === null || _a === void 0 ? void 0 : _a._getVertexShaderCode()) {
629
+ if (this._pipelineContext?._getVertexShaderCode()) {
630
630
  [code, lineErrorVertex] = this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(), this._compilationError, false);
631
631
  if (code) {
632
632
  Logger.Error("Vertex code:");
633
633
  Logger.Error(code);
634
634
  }
635
635
  }
636
- if ((_b = this._pipelineContext) === null || _b === void 0 ? void 0 : _b._getFragmentShaderCode()) {
637
- [code, lineErrorFragment] = this._getShaderCodeAndErrorLine((_c = this._pipelineContext) === null || _c === void 0 ? void 0 : _c._getFragmentShaderCode(), this._compilationError, true);
636
+ if (this._pipelineContext?._getFragmentShaderCode()) {
637
+ [code, lineErrorFragment] = this._getShaderCodeAndErrorLine(this._pipelineContext?._getFragmentShaderCode(), this._compilationError, true);
638
638
  if (code) {
639
639
  Logger.Error("Fragment code:");
640
640
  Logger.Error(code);