@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
package/Lights/light.js CHANGED
@@ -255,7 +255,6 @@ export class Light extends Node {
255
255
  * @param receiveShadows Defines if the effect (mesh) we bind the light for receives shadows
256
256
  */
257
257
  _bindLight(lightIndex, scene, effect, useSpecular, receiveShadows = true) {
258
- var _a;
259
258
  const iAsString = lightIndex.toString();
260
259
  let needUpdate = false;
261
260
  this._uniformBuffer.bindToEffect(effect, "Light" + iAsString);
@@ -276,7 +275,7 @@ export class Light extends Node {
276
275
  this.transferTexturesToEffect(effect, iAsString);
277
276
  // Shadows
278
277
  if (scene.shadowsEnabled && this.shadowEnabled && receiveShadows) {
279
- const shadowGenerator = (_a = this.getShadowGenerator(scene.activeCamera)) !== null && _a !== void 0 ? _a : this.getShadowGenerator();
278
+ const shadowGenerator = this.getShadowGenerator(scene.activeCamera) ?? this.getShadowGenerator();
280
279
  if (shadowGenerator) {
281
280
  shadowGenerator.bindShadowLight(iAsString, effect);
282
281
  needUpdate = true;
@@ -332,11 +331,10 @@ export class Light extends Node {
332
331
  * @returns the associated shadow generator.
333
332
  */
334
333
  getShadowGenerator(camera = null) {
335
- var _a;
336
334
  if (this._shadowGenerators === null) {
337
335
  return null;
338
336
  }
339
- return (_a = this._shadowGenerators.get(camera)) !== null && _a !== void 0 ? _a : null;
337
+ return this._shadowGenerators.get(camera) ?? null;
340
338
  }
341
339
  /**
342
340
  * Returns all the shadow generators associated to this light
@@ -1 +1 @@
1
- {"version":3,"file":"light.js","sourceRoot":"","sources":["../../../../dev/core/src/Lights/light.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAIzG,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,qBAAqB,C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;wCACW;AAUvB;IADC,SAAS,EAAE;kCAGX;AAsBD;IADC,SAAS,EAAE;0CAGX;AAeD;IADC,SAAS,EAAE;mCAGX;AAUO;IADP,SAAS,EAAE;8CACoB;AAMzB;IADN,gBAAgB,CAAC,uBAAuB,CAAC;6CACR;AAG1B;IADP,SAAS,CAAC,eAAe,CAAC;6CACY;AAoD/B;IADP,SAAS,CAAC,sBAAsB,CAAC;oDACA;AAkB1B;IADP,SAAS,CAAC,0BAA0B,CAAC;wDACA;AAkB9B;IADP,SAAS,CAAC,cAAc,CAAC;4CACA","sourcesContent":["import { serialize, SerializationHelper, serializeAsColor3, expandToProperty } from \"../Misc/decorators\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Matrix } from \"../Maths/math.vector\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3, TmpColors } from \"../Maths/math.color\";\r\nimport { Node } from \"../node\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { UniformBuffer } from \"../Materials/uniformBuffer\";\r\nimport type { IShadowGenerator } from \"./Shadows/shadowGenerator\";\r\nimport { GetClass } from \"../Misc/typeStore\";\r\nimport type { ISortableLight } from \"./lightConstants\";\r\nimport { LightConstants } from \"./lightConstants\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\n\r\n/**\r\n * Base class of all the lights in Babylon. It groups all the generic information about lights.\r\n * Lights are used, as you would expect, to affect how meshes are seen, in terms of both illumination and colour.\r\n * All meshes allow light to pass through them unless shadow generation is activated. The default number of lights allowed is four but this can be increased.\r\n */\r\nexport abstract class Light extends Node implements ISortableLight {\r\n /**\r\n * Falloff Default: light is falling off following the material specification:\r\n * standard material is using standard falloff whereas pbr material can request special falloff per materials.\r\n */\r\n public static readonly FALLOFF_DEFAULT = LightConstants.FALLOFF_DEFAULT;\r\n\r\n /**\r\n * Falloff Physical: light is falling off following the inverse squared distance law.\r\n */\r\n public static readonly FALLOFF_PHYSICAL = LightConstants.FALLOFF_PHYSICAL;\r\n\r\n /**\r\n * Falloff gltf: light is falling off as described in the gltf moving to PBR document\r\n * to enhance interoperability with other engines.\r\n */\r\n public static readonly FALLOFF_GLTF = LightConstants.FALLOFF_GLTF;\r\n\r\n /**\r\n * Falloff Standard: light is falling off like in the standard material\r\n * to enhance interoperability with other materials.\r\n */\r\n public static readonly FALLOFF_STANDARD = LightConstants.FALLOFF_STANDARD;\r\n\r\n //lightmapMode Consts\r\n /**\r\n * If every light affecting the material is in this lightmapMode,\r\n * material.lightmapTexture adds or multiplies\r\n * (depends on material.useLightmapAsShadowmap)\r\n * after every other light calculations.\r\n */\r\n public static readonly LIGHTMAP_DEFAULT = LightConstants.LIGHTMAP_DEFAULT;\r\n /**\r\n * material.lightmapTexture as only diffuse lighting from this light\r\n * adds only specular lighting from this light\r\n * adds dynamic shadows\r\n */\r\n public static readonly LIGHTMAP_SPECULAR = LightConstants.LIGHTMAP_SPECULAR;\r\n /**\r\n * material.lightmapTexture as only lighting\r\n * no light calculation from this light\r\n * only adds dynamic shadows from this light\r\n */\r\n public static readonly LIGHTMAP_SHADOWSONLY = LightConstants.LIGHTMAP_SHADOWSONLY;\r\n\r\n // Intensity Mode Consts\r\n /**\r\n * Each light type uses the default quantity according to its type:\r\n * point/spot lights use luminous intensity\r\n * directional lights use illuminance\r\n */\r\n public static readonly INTENSITYMODE_AUTOMATIC = LightConstants.INTENSITYMODE_AUTOMATIC;\r\n /**\r\n * lumen (lm)\r\n */\r\n public static readonly INTENSITYMODE_LUMINOUSPOWER = LightConstants.INTENSITYMODE_LUMINOUSPOWER;\r\n /**\r\n * candela (lm/sr)\r\n */\r\n public static readonly INTENSITYMODE_LUMINOUSINTENSITY = LightConstants.INTENSITYMODE_LUMINOUSINTENSITY;\r\n /**\r\n * lux (lm/m^2)\r\n */\r\n public static readonly INTENSITYMODE_ILLUMINANCE = LightConstants.INTENSITYMODE_ILLUMINANCE;\r\n /**\r\n * nit (cd/m^2)\r\n */\r\n public static readonly INTENSITYMODE_LUMINANCE = LightConstants.INTENSITYMODE_LUMINANCE;\r\n\r\n // Light types ids const.\r\n /**\r\n * Light type const id of the point light.\r\n */\r\n public static readonly LIGHTTYPEID_POINTLIGHT = LightConstants.LIGHTTYPEID_POINTLIGHT;\r\n /**\r\n * Light type const id of the directional light.\r\n */\r\n public static readonly LIGHTTYPEID_DIRECTIONALLIGHT = LightConstants.LIGHTTYPEID_DIRECTIONALLIGHT;\r\n /**\r\n * Light type const id of the spot light.\r\n */\r\n public static readonly LIGHTTYPEID_SPOTLIGHT = LightConstants.LIGHTTYPEID_SPOTLIGHT;\r\n /**\r\n * Light type const id of the hemispheric light.\r\n */\r\n public static readonly LIGHTTYPEID_HEMISPHERICLIGHT = LightConstants.LIGHTTYPEID_HEMISPHERICLIGHT;\r\n\r\n /**\r\n * Diffuse gives the basic color to an object.\r\n */\r\n @serializeAsColor3()\r\n public diffuse = new Color3(1.0, 1.0, 1.0);\r\n\r\n /**\r\n * Specular produces a highlight color on an object.\r\n * Note: This is not affecting PBR materials.\r\n */\r\n @serializeAsColor3()\r\n public specular = new Color3(1.0, 1.0, 1.0);\r\n\r\n /**\r\n * Defines the falloff type for this light. This lets overriding how punctual light are\r\n * falling off base on range or angle.\r\n * This can be set to any values in Light.FALLOFF_x.\r\n *\r\n * Note: This is only useful for PBR Materials at the moment. This could be extended if required to\r\n * other types of materials.\r\n */\r\n @serialize()\r\n public falloffType = Light.FALLOFF_DEFAULT;\r\n\r\n /**\r\n * Strength of the light.\r\n * Note: By default it is define in the framework own unit.\r\n * Note: In PBR materials the intensityMode can be use to chose what unit the intensity is defined in.\r\n */\r\n @serialize()\r\n public intensity = 1.0;\r\n\r\n private _range = Number.MAX_VALUE;\r\n protected _inverseSquaredRange = 0;\r\n\r\n /**\r\n * Defines how far from the source the light is impacting in scene units.\r\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\r\n */\r\n @serialize()\r\n public get range(): number {\r\n return this._range;\r\n }\r\n /**\r\n * Defines how far from the source the light is impacting in scene units.\r\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\r\n */\r\n public set range(value: number) {\r\n this._range = value;\r\n this._inverseSquaredRange = 1.0 / (this.range * this.range);\r\n }\r\n\r\n /**\r\n * Cached photometric scale default to 1.0 as the automatic intensity mode defaults to 1.0 for every type\r\n * of light.\r\n */\r\n private _photometricScale = 1.0;\r\n\r\n private _intensityMode: number = Light.INTENSITYMODE_AUTOMATIC;\r\n /**\r\n * Gets the photometric scale used to interpret the intensity.\r\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\r\n */\r\n @serialize()\r\n public get intensityMode(): number {\r\n return this._intensityMode;\r\n }\r\n /**\r\n * Sets the photometric scale used to interpret the intensity.\r\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\r\n */\r\n public set intensityMode(value: number) {\r\n this._intensityMode = value;\r\n this._computePhotometricScale();\r\n }\r\n\r\n private _radius = 0.00001;\r\n /**\r\n * Gets the light radius used by PBR Materials to simulate soft area lights.\r\n */\r\n @serialize()\r\n public get radius(): number {\r\n return this._radius;\r\n }\r\n /**\r\n * sets the light radius used by PBR Materials to simulate soft area lights.\r\n */\r\n public set radius(value: number) {\r\n this._radius = value;\r\n this._computePhotometricScale();\r\n }\r\n\r\n @serialize()\r\n private _renderPriority: number;\r\n /**\r\n * Defines the rendering priority of the lights. It can help in case of fallback or number of lights\r\n * exceeding the number allowed of the materials.\r\n */\r\n @expandToProperty(\"_reorderLightsInScene\")\r\n public renderPriority: number = 0;\r\n\r\n @serialize(\"shadowEnabled\")\r\n private _shadowEnabled: boolean = true;\r\n /**\r\n * Gets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\r\n * the current shadow generator.\r\n */\r\n public get shadowEnabled(): boolean {\r\n return this._shadowEnabled;\r\n }\r\n /**\r\n * Sets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\r\n * the current shadow generator.\r\n */\r\n public set shadowEnabled(value: boolean) {\r\n if (this._shadowEnabled === value) {\r\n return;\r\n }\r\n\r\n this._shadowEnabled = value;\r\n this._markMeshesAsLightDirty();\r\n }\r\n\r\n private _includedOnlyMeshes: AbstractMesh[];\r\n /**\r\n * Gets the only meshes impacted by this light.\r\n */\r\n public get includedOnlyMeshes(): AbstractMesh[] {\r\n return this._includedOnlyMeshes;\r\n }\r\n /**\r\n * Sets the only meshes impacted by this light.\r\n */\r\n public set includedOnlyMeshes(value: AbstractMesh[]) {\r\n this._includedOnlyMeshes = value;\r\n this._hookArrayForIncludedOnly(value);\r\n }\r\n\r\n private _excludedMeshes: AbstractMesh[];\r\n /**\r\n * Gets the meshes not impacted by this light.\r\n */\r\n public get excludedMeshes(): AbstractMesh[] {\r\n return this._excludedMeshes;\r\n }\r\n /**\r\n * Sets the meshes not impacted by this light.\r\n */\r\n public set excludedMeshes(value: AbstractMesh[]) {\r\n this._excludedMeshes = value;\r\n this._hookArrayForExcluded(value);\r\n }\r\n\r\n @serialize(\"excludeWithLayerMask\")\r\n private _excludeWithLayerMask = 0;\r\n /**\r\n * Gets the layer id use to find what meshes are not impacted by the light.\r\n * Inactive if 0\r\n */\r\n public get excludeWithLayerMask(): number {\r\n return this._excludeWithLayerMask;\r\n }\r\n /**\r\n * Sets the layer id use to find what meshes are not impacted by the light.\r\n * Inactive if 0\r\n */\r\n public set excludeWithLayerMask(value: number) {\r\n this._excludeWithLayerMask = value;\r\n this._resyncMeshes();\r\n }\r\n\r\n @serialize(\"includeOnlyWithLayerMask\")\r\n private _includeOnlyWithLayerMask = 0;\r\n /**\r\n * Gets the layer id use to find what meshes are impacted by the light.\r\n * Inactive if 0\r\n */\r\n public get includeOnlyWithLayerMask(): number {\r\n return this._includeOnlyWithLayerMask;\r\n }\r\n /**\r\n * Sets the layer id use to find what meshes are impacted by the light.\r\n * Inactive if 0\r\n */\r\n public set includeOnlyWithLayerMask(value: number) {\r\n this._includeOnlyWithLayerMask = value;\r\n this._resyncMeshes();\r\n }\r\n\r\n @serialize(\"lightmapMode\")\r\n private _lightmapMode = 0;\r\n /**\r\n * Gets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\r\n */\r\n public get lightmapMode(): number {\r\n return this._lightmapMode;\r\n }\r\n /**\r\n * Sets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\r\n */\r\n public set lightmapMode(value: number) {\r\n if (this._lightmapMode === value) {\r\n return;\r\n }\r\n\r\n this._lightmapMode = value;\r\n this._markMeshesAsLightDirty();\r\n }\r\n\r\n /**\r\n * Returns the view matrix.\r\n * @param _faceIndex The index of the face for which we want to extract the view matrix. Only used for point light types.\r\n * @returns The view matrix. Can be null, if a view matrix cannot be defined for the type of light considered (as for a hemispherical light, for example).\r\n */\r\n public getViewMatrix(_faceIndex?: number): Nullable<Matrix> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Returns the projection matrix.\r\n * Note that viewMatrix and renderList are optional and are only used by lights that calculate the projection matrix from a list of meshes (e.g. directional lights with automatic extents calculation).\r\n * @param _viewMatrix The view transform matrix of the light (optional).\r\n * @param _renderList The list of meshes to take into account when calculating the projection matrix (optional).\r\n * @returns The projection matrix. Can be null, if a projection matrix cannot be defined for the type of light considered (as for a hemispherical light, for example).\r\n */\r\n public getProjectionMatrix(_viewMatrix?: Matrix, _renderList?: Array<AbstractMesh>): Nullable<Matrix> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Shadow generators associated to the light.\r\n * @internal Internal use only.\r\n */\r\n public _shadowGenerators: Nullable<Map<Nullable<Camera>, IShadowGenerator>> = null;\r\n\r\n /**\r\n * @internal Internal use only.\r\n */\r\n public _excludedMeshesIds = new Array<string>();\r\n\r\n /**\r\n * @internal Internal use only.\r\n */\r\n public _includedOnlyMeshesIds = new Array<string>();\r\n\r\n /**\r\n * The current light uniform buffer.\r\n * @internal Internal use only.\r\n */\r\n public _uniformBuffer: UniformBuffer;\r\n\r\n /** @internal */\r\n public _renderId: number;\r\n\r\n private _lastUseSpecular: boolean;\r\n\r\n /**\r\n * Creates a Light object in the scene.\r\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n * @param name The friendly name of the light\r\n * @param scene The scene the light belongs too\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this.getScene().addLight(this);\r\n this._uniformBuffer = new UniformBuffer(this.getScene().getEngine(), undefined, undefined, name);\r\n this._buildUniformLayout();\r\n\r\n this.includedOnlyMeshes = [] as AbstractMesh[];\r\n this.excludedMeshes = [] as AbstractMesh[];\r\n\r\n this._resyncMeshes();\r\n }\r\n\r\n protected abstract _buildUniformLayout(): void;\r\n\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light information.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The light\r\n */\r\n public abstract transferToEffect(effect: Effect, lightIndex: string): Light;\r\n\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light textures.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The light\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public transferTexturesToEffect(effect: Effect, lightIndex: string): Light {\r\n // Do nothing by default.\r\n return this;\r\n }\r\n\r\n /**\r\n * Binds the lights information from the scene to the effect for the given mesh.\r\n * @param lightIndex Light index\r\n * @param scene The scene where the light belongs to\r\n * @param effect The effect we are binding the data to\r\n * @param useSpecular Defines if specular is supported\r\n * @param receiveShadows Defines if the effect (mesh) we bind the light for receives shadows\r\n */\r\n public _bindLight(lightIndex: number, scene: Scene, effect: Effect, useSpecular: boolean, receiveShadows = true): void {\r\n const iAsString = lightIndex.toString();\r\n let needUpdate = false;\r\n\r\n this._uniformBuffer.bindToEffect(effect, \"Light\" + iAsString);\r\n\r\n if (this._renderId !== scene.getRenderId() || this._lastUseSpecular !== useSpecular || !this._uniformBuffer.useUbo) {\r\n this._renderId = scene.getRenderId();\r\n this._lastUseSpecular = useSpecular;\r\n\r\n const scaledIntensity = this.getScaledIntensity();\r\n\r\n this.transferToEffect(effect, iAsString);\r\n\r\n this.diffuse.scaleToRef(scaledIntensity, TmpColors.Color3[0]);\r\n this._uniformBuffer.updateColor4(\"vLightDiffuse\", TmpColors.Color3[0], this.range, iAsString);\r\n if (useSpecular) {\r\n this.specular.scaleToRef(scaledIntensity, TmpColors.Color3[1]);\r\n this._uniformBuffer.updateColor4(\"vLightSpecular\", TmpColors.Color3[1], this.radius, iAsString);\r\n }\r\n needUpdate = true;\r\n }\r\n\r\n // Textures might still need to be rebound.\r\n this.transferTexturesToEffect(effect, iAsString);\r\n\r\n // Shadows\r\n if (scene.shadowsEnabled && this.shadowEnabled && receiveShadows) {\r\n const shadowGenerator = this.getShadowGenerator(scene.activeCamera) ?? this.getShadowGenerator();\r\n if (shadowGenerator) {\r\n shadowGenerator.bindShadowLight(iAsString, effect);\r\n needUpdate = true;\r\n }\r\n }\r\n\r\n if (needUpdate) {\r\n this._uniformBuffer.update();\r\n } else {\r\n this._uniformBuffer.bindUniformBuffer();\r\n }\r\n }\r\n\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light information.\r\n * @param effect The effect to update\r\n * @param lightDataUniformName The uniform used to store light data (position or direction)\r\n * @returns The light\r\n */\r\n public abstract transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string): Light;\r\n\r\n /**\r\n * Returns the string \"Light\".\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"Light\";\r\n }\r\n\r\n /** @internal */\r\n public readonly _isLight = true;\r\n\r\n /**\r\n * Converts the light information to a readable string for debug purpose.\r\n * @param fullDetails Supports for multiple levels of logging within scene loading\r\n * @returns the human readable light info\r\n */\r\n public toString(fullDetails?: boolean): string {\r\n let ret = \"Name: \" + this.name;\r\n ret += \", type: \" + [\"Point\", \"Directional\", \"Spot\", \"Hemispheric\"][this.getTypeID()];\r\n if (this.animations) {\r\n for (let i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n return ret;\r\n }\r\n\r\n /** @internal */\r\n protected _syncParentEnabledState() {\r\n super._syncParentEnabledState();\r\n if (!this.isDisposed()) {\r\n this._resyncMeshes();\r\n }\r\n }\r\n\r\n /**\r\n * Set the enabled state of this node.\r\n * @param value - the new enabled state\r\n */\r\n public setEnabled(value: boolean): void {\r\n super.setEnabled(value);\r\n\r\n this._resyncMeshes();\r\n }\r\n\r\n /**\r\n * Returns the Light associated shadow generator if any.\r\n * @param camera Camera for which the shadow generator should be retrieved (default: null). If null, retrieves the default shadow generator\r\n * @returns the associated shadow generator.\r\n */\r\n public getShadowGenerator(camera: Nullable<Camera> = null): Nullable<IShadowGenerator> {\r\n if (this._shadowGenerators === null) {\r\n return null;\r\n }\r\n\r\n return this._shadowGenerators.get(camera) ?? null;\r\n }\r\n\r\n /**\r\n * Returns all the shadow generators associated to this light\r\n * @returns\r\n */\r\n public getShadowGenerators(): Nullable<Map<Nullable<Camera>, IShadowGenerator>> {\r\n return this._shadowGenerators;\r\n }\r\n\r\n /**\r\n * Returns a Vector3, the absolute light position in the World.\r\n * @returns the world space position of the light\r\n */\r\n public getAbsolutePosition(): Vector3 {\r\n return Vector3.Zero();\r\n }\r\n\r\n /**\r\n * Specifies if the light will affect the passed mesh.\r\n * @param mesh The mesh to test against the light\r\n * @returns true the mesh is affected otherwise, false.\r\n */\r\n public canAffectMesh(mesh: AbstractMesh): boolean {\r\n if (!mesh) {\r\n return true;\r\n }\r\n\r\n if (this.includedOnlyMeshes && this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {\r\n return false;\r\n }\r\n\r\n if (this.excludedMeshes && this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {\r\n return false;\r\n }\r\n\r\n if (this.includeOnlyWithLayerMask !== 0 && (this.includeOnlyWithLayerMask & mesh.layerMask) === 0) {\r\n return false;\r\n }\r\n\r\n if (this.excludeWithLayerMask !== 0 && this.excludeWithLayerMask & mesh.layerMask) {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n public dispose(doNotRecurse?: boolean, disposeMaterialAndTextures = false): void {\r\n if (this._shadowGenerators) {\r\n const iterator = this._shadowGenerators.values();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const shadowGenerator = key.value;\r\n shadowGenerator.dispose();\r\n }\r\n this._shadowGenerators = null;\r\n }\r\n\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.lights.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.lights.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n // Remove from meshes\r\n for (const mesh of this.getScene().meshes) {\r\n mesh._removeLightSource(this, true);\r\n }\r\n\r\n this._uniformBuffer.dispose();\r\n\r\n // Remove from scene\r\n this.getScene().removeLight(this);\r\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\r\n }\r\n\r\n /**\r\n * Returns the light type ID (integer).\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n public getTypeID(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode.\r\n * @returns the scaled intensity in intensity mode unit\r\n */\r\n public getScaledIntensity() {\r\n return this._photometricScale * this.intensity;\r\n }\r\n\r\n /**\r\n * Returns a new Light object, named \"name\", from the current one.\r\n * @param name The name of the cloned light\r\n * @param newParent The parent of this light, if it has one\r\n * @returns the new created light\r\n */\r\n public clone(name: string, newParent: Nullable<Node> = null): Nullable<Light> {\r\n const constructor = Light.GetConstructorFromName(this.getTypeID(), name, this.getScene());\r\n\r\n if (!constructor) {\r\n return null;\r\n }\r\n const clonedLight = SerializationHelper.Clone(constructor, this);\r\n if (name) {\r\n clonedLight.name = name;\r\n }\r\n if (newParent) {\r\n clonedLight.parent = newParent;\r\n }\r\n clonedLight.setEnabled(this.isEnabled());\r\n\r\n this.onClonedObservable.notifyObservers(clonedLight);\r\n\r\n return clonedLight;\r\n }\r\n\r\n /**\r\n * Serializes the current light into a Serialization object.\r\n * @returns the serialized object.\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.uniqueId = this.uniqueId;\r\n\r\n // Type\r\n serializationObject.type = this.getTypeID();\r\n\r\n // Parent\r\n if (this.parent) {\r\n this.parent._serializeAsParent(serializationObject);\r\n }\r\n\r\n // Inclusion / exclusions\r\n if (this.excludedMeshes.length > 0) {\r\n serializationObject.excludedMeshesIds = [];\r\n this.excludedMeshes.forEach((mesh: AbstractMesh) => {\r\n serializationObject.excludedMeshesIds.push(mesh.id);\r\n });\r\n }\r\n\r\n if (this.includedOnlyMeshes.length > 0) {\r\n serializationObject.includedOnlyMeshesIds = [];\r\n this.includedOnlyMeshes.forEach((mesh: AbstractMesh) => {\r\n serializationObject.includedOnlyMeshesIds.push(mesh.id);\r\n });\r\n }\r\n\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n\r\n serializationObject.isEnabled = this.isEnabled();\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3.\r\n * This new light is named \"name\" and added to the passed scene.\r\n * @param type Type according to the types available in Light.LIGHTTYPEID_x\r\n * @param name The friendly name of the light\r\n * @param scene The scene the new light will belong to\r\n * @returns the constructor function\r\n */\r\n static GetConstructorFromName(type: number, name: string, scene: Scene): Nullable<() => Light> {\r\n const constructorFunc = Node.Construct(\"Light_Type_\" + type, name, scene);\r\n\r\n if (constructorFunc) {\r\n return <() => Light>constructorFunc;\r\n }\r\n\r\n // Default to no light for none present once.\r\n return null;\r\n }\r\n\r\n /**\r\n * Parses the passed \"parsedLight\" and returns a new instanced Light from this parsing.\r\n * @param parsedLight The JSON representation of the light\r\n * @param scene The scene to create the parsed light in\r\n * @returns the created light after parsing\r\n */\r\n public static Parse(parsedLight: any, scene: Scene): Nullable<Light> {\r\n const constructor = Light.GetConstructorFromName(parsedLight.type, parsedLight.name, scene);\r\n\r\n if (!constructor) {\r\n return null;\r\n }\r\n\r\n const light = SerializationHelper.Parse(constructor, parsedLight, scene);\r\n\r\n // Inclusion / exclusions\r\n if (parsedLight.excludedMeshesIds) {\r\n light._excludedMeshesIds = parsedLight.excludedMeshesIds;\r\n }\r\n\r\n if (parsedLight.includedOnlyMeshesIds) {\r\n light._includedOnlyMeshesIds = parsedLight.includedOnlyMeshesIds;\r\n }\r\n\r\n // Parent\r\n if (parsedLight.parentId !== undefined) {\r\n light._waitingParentId = parsedLight.parentId;\r\n }\r\n\r\n if (parsedLight.parentInstanceIndex !== undefined) {\r\n light._waitingParentInstanceIndex = parsedLight.parentInstanceIndex;\r\n }\r\n\r\n // Falloff\r\n if (parsedLight.falloffType !== undefined) {\r\n light.falloffType = parsedLight.falloffType;\r\n }\r\n\r\n // Lightmaps\r\n if (parsedLight.lightmapMode !== undefined) {\r\n light.lightmapMode = parsedLight.lightmapMode;\r\n }\r\n\r\n // Animations\r\n if (parsedLight.animations) {\r\n for (let animationIndex = 0; animationIndex < parsedLight.animations.length; animationIndex++) {\r\n const parsedAnimation = parsedLight.animations[animationIndex];\r\n const internalClass = GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n light.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n Node.ParseAnimationRanges(light, parsedLight, scene);\r\n }\r\n\r\n if (parsedLight.autoAnimate) {\r\n scene.beginAnimation(light, parsedLight.autoAnimateFrom, parsedLight.autoAnimateTo, parsedLight.autoAnimateLoop, parsedLight.autoAnimateSpeed || 1.0);\r\n }\r\n\r\n // Check if isEnabled is defined to be back compatible with prior serialized versions.\r\n if (parsedLight.isEnabled !== undefined) {\r\n light.setEnabled(parsedLight.isEnabled);\r\n }\r\n\r\n return light;\r\n }\r\n\r\n private _hookArrayForExcluded(array: AbstractMesh[]): void {\r\n const oldPush = array.push;\r\n array.push = (...items: AbstractMesh[]) => {\r\n const result = oldPush.apply(array, items);\r\n\r\n for (const item of items) {\r\n item._resyncLightSource(this);\r\n }\r\n\r\n return result;\r\n };\r\n\r\n const oldSplice = array.splice;\r\n array.splice = (index: number, deleteCount?: number) => {\r\n const deleted = oldSplice.apply(array, [index, deleteCount]);\r\n\r\n for (const item of deleted) {\r\n item._resyncLightSource(this);\r\n }\r\n\r\n return deleted;\r\n };\r\n\r\n for (const item of array) {\r\n item._resyncLightSource(this);\r\n }\r\n }\r\n\r\n private _hookArrayForIncludedOnly(array: AbstractMesh[]): void {\r\n const oldPush = array.push;\r\n array.push = (...items: AbstractMesh[]) => {\r\n const result = oldPush.apply(array, items);\r\n\r\n this._resyncMeshes();\r\n\r\n return result;\r\n };\r\n\r\n const oldSplice = array.splice;\r\n array.splice = (index: number, deleteCount?: number) => {\r\n const deleted = oldSplice.apply(array, [index, deleteCount]);\r\n\r\n this._resyncMeshes();\r\n\r\n return deleted;\r\n };\r\n\r\n this._resyncMeshes();\r\n }\r\n\r\n private _resyncMeshes() {\r\n for (const mesh of this.getScene().meshes) {\r\n mesh._resyncLightSource(this);\r\n }\r\n }\r\n\r\n /**\r\n * Forces the meshes to update their light related information in their rendering used effects\r\n * @internal Internal Use Only\r\n */\r\n public _markMeshesAsLightDirty() {\r\n for (const mesh of this.getScene().meshes) {\r\n if (mesh.lightSources.indexOf(this) !== -1) {\r\n mesh._markSubMeshesAsLightDirty();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Recomputes the cached photometric scale if needed.\r\n */\r\n private _computePhotometricScale(): void {\r\n this._photometricScale = this._getPhotometricScale();\r\n this.getScene().resetCachedMaterial();\r\n }\r\n\r\n /**\r\n * @returns the Photometric Scale according to the light type and intensity mode.\r\n */\r\n private _getPhotometricScale() {\r\n let photometricScale = 0.0;\r\n const lightTypeID = this.getTypeID();\r\n\r\n //get photometric mode\r\n let photometricMode = this.intensityMode;\r\n if (photometricMode === Light.INTENSITYMODE_AUTOMATIC) {\r\n if (lightTypeID === Light.LIGHTTYPEID_DIRECTIONALLIGHT) {\r\n photometricMode = Light.INTENSITYMODE_ILLUMINANCE;\r\n } else {\r\n photometricMode = Light.INTENSITYMODE_LUMINOUSINTENSITY;\r\n }\r\n }\r\n\r\n //compute photometric scale\r\n switch (lightTypeID) {\r\n case Light.LIGHTTYPEID_POINTLIGHT:\r\n case Light.LIGHTTYPEID_SPOTLIGHT:\r\n switch (photometricMode) {\r\n case Light.INTENSITYMODE_LUMINOUSPOWER:\r\n photometricScale = 1.0 / (4.0 * Math.PI);\r\n break;\r\n case Light.INTENSITYMODE_LUMINOUSINTENSITY:\r\n photometricScale = 1.0;\r\n break;\r\n case Light.INTENSITYMODE_LUMINANCE:\r\n photometricScale = this.radius * this.radius;\r\n break;\r\n }\r\n break;\r\n\r\n case Light.LIGHTTYPEID_DIRECTIONALLIGHT:\r\n switch (photometricMode) {\r\n case Light.INTENSITYMODE_ILLUMINANCE:\r\n photometricScale = 1.0;\r\n break;\r\n case Light.INTENSITYMODE_LUMINANCE: {\r\n // When radius (and therefore solid angle) is non-zero a directional lights brightness can be specified via central (peak) luminance.\r\n // For a directional light the 'radius' defines the angular radius (in radians) rather than world-space radius (e.g. in metres).\r\n let apexAngleRadians = this.radius;\r\n // Impose a minimum light angular size to avoid the light becoming an infinitely small angular light source (i.e. a dirac delta function).\r\n apexAngleRadians = Math.max(apexAngleRadians, 0.001);\r\n const solidAngle = 2.0 * Math.PI * (1.0 - Math.cos(apexAngleRadians));\r\n photometricScale = solidAngle;\r\n break;\r\n }\r\n }\r\n break;\r\n\r\n case Light.LIGHTTYPEID_HEMISPHERICLIGHT:\r\n // No fall off in hemispheric light.\r\n photometricScale = 1.0;\r\n break;\r\n }\r\n return photometricScale;\r\n }\r\n\r\n /**\r\n * Reorder the light in the scene according to their defined priority.\r\n * @internal Internal Use Only\r\n */\r\n public _reorderLightsInScene(): void {\r\n const scene = this.getScene();\r\n if (this._renderPriority != 0) {\r\n scene.requireLightSorting = true;\r\n }\r\n this.getScene().sortLightsByPriority();\r\n }\r\n\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n public abstract prepareLightSpecificDefines(defines: any, lightIndex: number): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"light.js","sourceRoot":"","sources":["../../../../dev/core/src/Lights/light.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAIzG,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;GAIG;AACH,MAAM,OAAgB,KAAM,SAAQ,IAAI;IA0HpC;;;OAGG;IAEH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACD;;;OAGG;IACH,IAAW,KAAK,CAAC,KAAa;QAC1B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,oBAAoB,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IASD;;;OAGG;IAEH,IAAW,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2BAA2B,AAA7C,CAA8C;AAChG;;GAEG;AACoB,qCAA+B,GAAG,cAAc,CAAC,+BAA+B,AAAjD,CAAkD;AACxG;;GAEG;AACoB,+BAAyB,GAAG,cAAc,CAAC,yBAAyB,AAA3C,CAA4C;AAC5F;;GAEG;AACoB,6BAAuB,GAAG,cAAc,CAAC,uBAAuB,AAAzC,CAA0C;AAExF,yBAAyB;AACzB;;GAEG;AACoB,4BAAsB,GAAG,cAAc,CAAC,sBAAsB,AAAxC,CAAyC;AACtF;;GAEG;AACoB,kCAA4B,GAAG,cAAc,CAAC,4BAA4B,AAA9C,CAA+C;AAClG;;GAEG;AACoB,2BAAqB,GAAG,cAAc,CAAC,qBAAqB,AAAvC,CAAwC;AACpF;;GAEG;AACoB,kCAA4B,GAAG,cAAc,CAAC,4BAA4B,AAA9C,CAA+C;AAM3F;IADN,iBAAiB,EAAE;sCACuB;AAOpC;IADN,iBAAiB,EAAE;uCACwB;AAWrC;IADN,SAAS,EAAE;0CAC+B;AAQpC;IADN,SAAS,EAAE;wCACW;AAUvB;IADC,SAAS,EAAE;kCAGX;AAsBD;IADC,SAAS,EAAE;0CAGX;AAeD;IADC,SAAS,EAAE;mCAGX;AAUO;IADP,SAAS,EAAE;8CACoB;AAMzB;IADN,gBAAgB,CAAC,uBAAuB,CAAC;6CACR;AAG1B;IADP,SAAS,CAAC,eAAe,CAAC;6CACY;AAoD/B;IADP,SAAS,CAAC,sBAAsB,CAAC;oDACA;AAkB1B;IADP,SAAS,CAAC,0BAA0B,CAAC;wDACA;AAkB9B;IADP,SAAS,CAAC,cAAc,CAAC;4CACA","sourcesContent":["import { serialize, SerializationHelper, serializeAsColor3, expandToProperty } from \"../Misc/decorators\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Matrix } from \"../Maths/math.vector\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3, TmpColors } from \"../Maths/math.color\";\r\nimport { Node } from \"../node\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { UniformBuffer } from \"../Materials/uniformBuffer\";\r\nimport type { IShadowGenerator } from \"./Shadows/shadowGenerator\";\r\nimport { GetClass } from \"../Misc/typeStore\";\r\nimport type { ISortableLight } from \"./lightConstants\";\r\nimport { LightConstants } from \"./lightConstants\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\n\r\n/**\r\n * Base class of all the lights in Babylon. It groups all the generic information about lights.\r\n * Lights are used, as you would expect, to affect how meshes are seen, in terms of both illumination and colour.\r\n * All meshes allow light to pass through them unless shadow generation is activated. The default number of lights allowed is four but this can be increased.\r\n */\r\nexport abstract class Light extends Node implements ISortableLight {\r\n /**\r\n * Falloff Default: light is falling off following the material specification:\r\n * standard material is using standard falloff whereas pbr material can request special falloff per materials.\r\n */\r\n public static readonly FALLOFF_DEFAULT = LightConstants.FALLOFF_DEFAULT;\r\n\r\n /**\r\n * Falloff Physical: light is falling off following the inverse squared distance law.\r\n */\r\n public static readonly FALLOFF_PHYSICAL = LightConstants.FALLOFF_PHYSICAL;\r\n\r\n /**\r\n * Falloff gltf: light is falling off as described in the gltf moving to PBR document\r\n * to enhance interoperability with other engines.\r\n */\r\n public static readonly FALLOFF_GLTF = LightConstants.FALLOFF_GLTF;\r\n\r\n /**\r\n * Falloff Standard: light is falling off like in the standard material\r\n * to enhance interoperability with other materials.\r\n */\r\n public static readonly FALLOFF_STANDARD = LightConstants.FALLOFF_STANDARD;\r\n\r\n //lightmapMode Consts\r\n /**\r\n * If every light affecting the material is in this lightmapMode,\r\n * material.lightmapTexture adds or multiplies\r\n * (depends on material.useLightmapAsShadowmap)\r\n * after every other light calculations.\r\n */\r\n public static readonly LIGHTMAP_DEFAULT = LightConstants.LIGHTMAP_DEFAULT;\r\n /**\r\n * material.lightmapTexture as only diffuse lighting from this light\r\n * adds only specular lighting from this light\r\n * adds dynamic shadows\r\n */\r\n public static readonly LIGHTMAP_SPECULAR = LightConstants.LIGHTMAP_SPECULAR;\r\n /**\r\n * material.lightmapTexture as only lighting\r\n * no light calculation from this light\r\n * only adds dynamic shadows from this light\r\n */\r\n public static readonly LIGHTMAP_SHADOWSONLY = LightConstants.LIGHTMAP_SHADOWSONLY;\r\n\r\n // Intensity Mode Consts\r\n /**\r\n * Each light type uses the default quantity according to its type:\r\n * point/spot lights use luminous intensity\r\n * directional lights use illuminance\r\n */\r\n public static readonly INTENSITYMODE_AUTOMATIC = LightConstants.INTENSITYMODE_AUTOMATIC;\r\n /**\r\n * lumen (lm)\r\n */\r\n public static readonly INTENSITYMODE_LUMINOUSPOWER = LightConstants.INTENSITYMODE_LUMINOUSPOWER;\r\n /**\r\n * candela (lm/sr)\r\n */\r\n public static readonly INTENSITYMODE_LUMINOUSINTENSITY = LightConstants.INTENSITYMODE_LUMINOUSINTENSITY;\r\n /**\r\n * lux (lm/m^2)\r\n */\r\n public static readonly INTENSITYMODE_ILLUMINANCE = LightConstants.INTENSITYMODE_ILLUMINANCE;\r\n /**\r\n * nit (cd/m^2)\r\n */\r\n public static readonly INTENSITYMODE_LUMINANCE = LightConstants.INTENSITYMODE_LUMINANCE;\r\n\r\n // Light types ids const.\r\n /**\r\n * Light type const id of the point light.\r\n */\r\n public static readonly LIGHTTYPEID_POINTLIGHT = LightConstants.LIGHTTYPEID_POINTLIGHT;\r\n /**\r\n * Light type const id of the directional light.\r\n */\r\n public static readonly LIGHTTYPEID_DIRECTIONALLIGHT = LightConstants.LIGHTTYPEID_DIRECTIONALLIGHT;\r\n /**\r\n * Light type const id of the spot light.\r\n */\r\n public static readonly LIGHTTYPEID_SPOTLIGHT = LightConstants.LIGHTTYPEID_SPOTLIGHT;\r\n /**\r\n * Light type const id of the hemispheric light.\r\n */\r\n public static readonly LIGHTTYPEID_HEMISPHERICLIGHT = LightConstants.LIGHTTYPEID_HEMISPHERICLIGHT;\r\n\r\n /**\r\n * Diffuse gives the basic color to an object.\r\n */\r\n @serializeAsColor3()\r\n public diffuse = new Color3(1.0, 1.0, 1.0);\r\n\r\n /**\r\n * Specular produces a highlight color on an object.\r\n * Note: This is not affecting PBR materials.\r\n */\r\n @serializeAsColor3()\r\n public specular = new Color3(1.0, 1.0, 1.0);\r\n\r\n /**\r\n * Defines the falloff type for this light. This lets overriding how punctual light are\r\n * falling off base on range or angle.\r\n * This can be set to any values in Light.FALLOFF_x.\r\n *\r\n * Note: This is only useful for PBR Materials at the moment. This could be extended if required to\r\n * other types of materials.\r\n */\r\n @serialize()\r\n public falloffType = Light.FALLOFF_DEFAULT;\r\n\r\n /**\r\n * Strength of the light.\r\n * Note: By default it is define in the framework own unit.\r\n * Note: In PBR materials the intensityMode can be use to chose what unit the intensity is defined in.\r\n */\r\n @serialize()\r\n public intensity = 1.0;\r\n\r\n private _range = Number.MAX_VALUE;\r\n protected _inverseSquaredRange = 0;\r\n\r\n /**\r\n * Defines how far from the source the light is impacting in scene units.\r\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\r\n */\r\n @serialize()\r\n public get range(): number {\r\n return this._range;\r\n }\r\n /**\r\n * Defines how far from the source the light is impacting in scene units.\r\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\r\n */\r\n public set range(value: number) {\r\n this._range = value;\r\n this._inverseSquaredRange = 1.0 / (this.range * this.range);\r\n }\r\n\r\n /**\r\n * Cached photometric scale default to 1.0 as the automatic intensity mode defaults to 1.0 for every type\r\n * of light.\r\n */\r\n private _photometricScale = 1.0;\r\n\r\n private _intensityMode: number = Light.INTENSITYMODE_AUTOMATIC;\r\n /**\r\n * Gets the photometric scale used to interpret the intensity.\r\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\r\n */\r\n @serialize()\r\n public get intensityMode(): number {\r\n return this._intensityMode;\r\n }\r\n /**\r\n * Sets the photometric scale used to interpret the intensity.\r\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\r\n */\r\n public set intensityMode(value: number) {\r\n this._intensityMode = value;\r\n this._computePhotometricScale();\r\n }\r\n\r\n private _radius = 0.00001;\r\n /**\r\n * Gets the light radius used by PBR Materials to simulate soft area lights.\r\n */\r\n @serialize()\r\n public get radius(): number {\r\n return this._radius;\r\n }\r\n /**\r\n * sets the light radius used by PBR Materials to simulate soft area lights.\r\n */\r\n public set radius(value: number) {\r\n this._radius = value;\r\n this._computePhotometricScale();\r\n }\r\n\r\n @serialize()\r\n private _renderPriority: number;\r\n /**\r\n * Defines the rendering priority of the lights. It can help in case of fallback or number of lights\r\n * exceeding the number allowed of the materials.\r\n */\r\n @expandToProperty(\"_reorderLightsInScene\")\r\n public renderPriority: number = 0;\r\n\r\n @serialize(\"shadowEnabled\")\r\n private _shadowEnabled: boolean = true;\r\n /**\r\n * Gets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\r\n * the current shadow generator.\r\n */\r\n public get shadowEnabled(): boolean {\r\n return this._shadowEnabled;\r\n }\r\n /**\r\n * Sets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\r\n * the current shadow generator.\r\n */\r\n public set shadowEnabled(value: boolean) {\r\n if (this._shadowEnabled === value) {\r\n return;\r\n }\r\n\r\n this._shadowEnabled = value;\r\n this._markMeshesAsLightDirty();\r\n }\r\n\r\n private _includedOnlyMeshes: AbstractMesh[];\r\n /**\r\n * Gets the only meshes impacted by this light.\r\n */\r\n public get includedOnlyMeshes(): AbstractMesh[] {\r\n return this._includedOnlyMeshes;\r\n }\r\n /**\r\n * Sets the only meshes impacted by this light.\r\n */\r\n public set includedOnlyMeshes(value: AbstractMesh[]) {\r\n this._includedOnlyMeshes = value;\r\n this._hookArrayForIncludedOnly(value);\r\n }\r\n\r\n private _excludedMeshes: AbstractMesh[];\r\n /**\r\n * Gets the meshes not impacted by this light.\r\n */\r\n public get excludedMeshes(): AbstractMesh[] {\r\n return this._excludedMeshes;\r\n }\r\n /**\r\n * Sets the meshes not impacted by this light.\r\n */\r\n public set excludedMeshes(value: AbstractMesh[]) {\r\n this._excludedMeshes = value;\r\n this._hookArrayForExcluded(value);\r\n }\r\n\r\n @serialize(\"excludeWithLayerMask\")\r\n private _excludeWithLayerMask = 0;\r\n /**\r\n * Gets the layer id use to find what meshes are not impacted by the light.\r\n * Inactive if 0\r\n */\r\n public get excludeWithLayerMask(): number {\r\n return this._excludeWithLayerMask;\r\n }\r\n /**\r\n * Sets the layer id use to find what meshes are not impacted by the light.\r\n * Inactive if 0\r\n */\r\n public set excludeWithLayerMask(value: number) {\r\n this._excludeWithLayerMask = value;\r\n this._resyncMeshes();\r\n }\r\n\r\n @serialize(\"includeOnlyWithLayerMask\")\r\n private _includeOnlyWithLayerMask = 0;\r\n /**\r\n * Gets the layer id use to find what meshes are impacted by the light.\r\n * Inactive if 0\r\n */\r\n public get includeOnlyWithLayerMask(): number {\r\n return this._includeOnlyWithLayerMask;\r\n }\r\n /**\r\n * Sets the layer id use to find what meshes are impacted by the light.\r\n * Inactive if 0\r\n */\r\n public set includeOnlyWithLayerMask(value: number) {\r\n this._includeOnlyWithLayerMask = value;\r\n this._resyncMeshes();\r\n }\r\n\r\n @serialize(\"lightmapMode\")\r\n private _lightmapMode = 0;\r\n /**\r\n * Gets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\r\n */\r\n public get lightmapMode(): number {\r\n return this._lightmapMode;\r\n }\r\n /**\r\n * Sets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\r\n */\r\n public set lightmapMode(value: number) {\r\n if (this._lightmapMode === value) {\r\n return;\r\n }\r\n\r\n this._lightmapMode = value;\r\n this._markMeshesAsLightDirty();\r\n }\r\n\r\n /**\r\n * Returns the view matrix.\r\n * @param _faceIndex The index of the face for which we want to extract the view matrix. Only used for point light types.\r\n * @returns The view matrix. Can be null, if a view matrix cannot be defined for the type of light considered (as for a hemispherical light, for example).\r\n */\r\n public getViewMatrix(_faceIndex?: number): Nullable<Matrix> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Returns the projection matrix.\r\n * Note that viewMatrix and renderList are optional and are only used by lights that calculate the projection matrix from a list of meshes (e.g. directional lights with automatic extents calculation).\r\n * @param _viewMatrix The view transform matrix of the light (optional).\r\n * @param _renderList The list of meshes to take into account when calculating the projection matrix (optional).\r\n * @returns The projection matrix. Can be null, if a projection matrix cannot be defined for the type of light considered (as for a hemispherical light, for example).\r\n */\r\n public getProjectionMatrix(_viewMatrix?: Matrix, _renderList?: Array<AbstractMesh>): Nullable<Matrix> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Shadow generators associated to the light.\r\n * @internal Internal use only.\r\n */\r\n public _shadowGenerators: Nullable<Map<Nullable<Camera>, IShadowGenerator>> = null;\r\n\r\n /**\r\n * @internal Internal use only.\r\n */\r\n public _excludedMeshesIds = new Array<string>();\r\n\r\n /**\r\n * @internal Internal use only.\r\n */\r\n public _includedOnlyMeshesIds = new Array<string>();\r\n\r\n /**\r\n * The current light uniform buffer.\r\n * @internal Internal use only.\r\n */\r\n public _uniformBuffer: UniformBuffer;\r\n\r\n /** @internal */\r\n public _renderId: number;\r\n\r\n private _lastUseSpecular: boolean;\r\n\r\n /**\r\n * Creates a Light object in the scene.\r\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n * @param name The friendly name of the light\r\n * @param scene The scene the light belongs too\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this.getScene().addLight(this);\r\n this._uniformBuffer = new UniformBuffer(this.getScene().getEngine(), undefined, undefined, name);\r\n this._buildUniformLayout();\r\n\r\n this.includedOnlyMeshes = [] as AbstractMesh[];\r\n this.excludedMeshes = [] as AbstractMesh[];\r\n\r\n this._resyncMeshes();\r\n }\r\n\r\n protected abstract _buildUniformLayout(): void;\r\n\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light information.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The light\r\n */\r\n public abstract transferToEffect(effect: Effect, lightIndex: string): Light;\r\n\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light textures.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The light\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public transferTexturesToEffect(effect: Effect, lightIndex: string): Light {\r\n // Do nothing by default.\r\n return this;\r\n }\r\n\r\n /**\r\n * Binds the lights information from the scene to the effect for the given mesh.\r\n * @param lightIndex Light index\r\n * @param scene The scene where the light belongs to\r\n * @param effect The effect we are binding the data to\r\n * @param useSpecular Defines if specular is supported\r\n * @param receiveShadows Defines if the effect (mesh) we bind the light for receives shadows\r\n */\r\n public _bindLight(lightIndex: number, scene: Scene, effect: Effect, useSpecular: boolean, receiveShadows = true): void {\r\n const iAsString = lightIndex.toString();\r\n let needUpdate = false;\r\n\r\n this._uniformBuffer.bindToEffect(effect, \"Light\" + iAsString);\r\n\r\n if (this._renderId !== scene.getRenderId() || this._lastUseSpecular !== useSpecular || !this._uniformBuffer.useUbo) {\r\n this._renderId = scene.getRenderId();\r\n this._lastUseSpecular = useSpecular;\r\n\r\n const scaledIntensity = this.getScaledIntensity();\r\n\r\n this.transferToEffect(effect, iAsString);\r\n\r\n this.diffuse.scaleToRef(scaledIntensity, TmpColors.Color3[0]);\r\n this._uniformBuffer.updateColor4(\"vLightDiffuse\", TmpColors.Color3[0], this.range, iAsString);\r\n if (useSpecular) {\r\n this.specular.scaleToRef(scaledIntensity, TmpColors.Color3[1]);\r\n this._uniformBuffer.updateColor4(\"vLightSpecular\", TmpColors.Color3[1], this.radius, iAsString);\r\n }\r\n needUpdate = true;\r\n }\r\n\r\n // Textures might still need to be rebound.\r\n this.transferTexturesToEffect(effect, iAsString);\r\n\r\n // Shadows\r\n if (scene.shadowsEnabled && this.shadowEnabled && receiveShadows) {\r\n const shadowGenerator = this.getShadowGenerator(scene.activeCamera) ?? this.getShadowGenerator();\r\n if (shadowGenerator) {\r\n shadowGenerator.bindShadowLight(iAsString, effect);\r\n needUpdate = true;\r\n }\r\n }\r\n\r\n if (needUpdate) {\r\n this._uniformBuffer.update();\r\n } else {\r\n this._uniformBuffer.bindUniformBuffer();\r\n }\r\n }\r\n\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light information.\r\n * @param effect The effect to update\r\n * @param lightDataUniformName The uniform used to store light data (position or direction)\r\n * @returns The light\r\n */\r\n public abstract transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string): Light;\r\n\r\n /**\r\n * Returns the string \"Light\".\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"Light\";\r\n }\r\n\r\n /** @internal */\r\n public readonly _isLight = true;\r\n\r\n /**\r\n * Converts the light information to a readable string for debug purpose.\r\n * @param fullDetails Supports for multiple levels of logging within scene loading\r\n * @returns the human readable light info\r\n */\r\n public toString(fullDetails?: boolean): string {\r\n let ret = \"Name: \" + this.name;\r\n ret += \", type: \" + [\"Point\", \"Directional\", \"Spot\", \"Hemispheric\"][this.getTypeID()];\r\n if (this.animations) {\r\n for (let i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n return ret;\r\n }\r\n\r\n /** @internal */\r\n protected _syncParentEnabledState() {\r\n super._syncParentEnabledState();\r\n if (!this.isDisposed()) {\r\n this._resyncMeshes();\r\n }\r\n }\r\n\r\n /**\r\n * Set the enabled state of this node.\r\n * @param value - the new enabled state\r\n */\r\n public setEnabled(value: boolean): void {\r\n super.setEnabled(value);\r\n\r\n this._resyncMeshes();\r\n }\r\n\r\n /**\r\n * Returns the Light associated shadow generator if any.\r\n * @param camera Camera for which the shadow generator should be retrieved (default: null). If null, retrieves the default shadow generator\r\n * @returns the associated shadow generator.\r\n */\r\n public getShadowGenerator(camera: Nullable<Camera> = null): Nullable<IShadowGenerator> {\r\n if (this._shadowGenerators === null) {\r\n return null;\r\n }\r\n\r\n return this._shadowGenerators.get(camera) ?? null;\r\n }\r\n\r\n /**\r\n * Returns all the shadow generators associated to this light\r\n * @returns\r\n */\r\n public getShadowGenerators(): Nullable<Map<Nullable<Camera>, IShadowGenerator>> {\r\n return this._shadowGenerators;\r\n }\r\n\r\n /**\r\n * Returns a Vector3, the absolute light position in the World.\r\n * @returns the world space position of the light\r\n */\r\n public getAbsolutePosition(): Vector3 {\r\n return Vector3.Zero();\r\n }\r\n\r\n /**\r\n * Specifies if the light will affect the passed mesh.\r\n * @param mesh The mesh to test against the light\r\n * @returns true the mesh is affected otherwise, false.\r\n */\r\n public canAffectMesh(mesh: AbstractMesh): boolean {\r\n if (!mesh) {\r\n return true;\r\n }\r\n\r\n if (this.includedOnlyMeshes && this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {\r\n return false;\r\n }\r\n\r\n if (this.excludedMeshes && this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {\r\n return false;\r\n }\r\n\r\n if (this.includeOnlyWithLayerMask !== 0 && (this.includeOnlyWithLayerMask & mesh.layerMask) === 0) {\r\n return false;\r\n }\r\n\r\n if (this.excludeWithLayerMask !== 0 && this.excludeWithLayerMask & mesh.layerMask) {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n public dispose(doNotRecurse?: boolean, disposeMaterialAndTextures = false): void {\r\n if (this._shadowGenerators) {\r\n const iterator = this._shadowGenerators.values();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const shadowGenerator = key.value;\r\n shadowGenerator.dispose();\r\n }\r\n this._shadowGenerators = null;\r\n }\r\n\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.lights.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.lights.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n // Remove from meshes\r\n for (const mesh of this.getScene().meshes) {\r\n mesh._removeLightSource(this, true);\r\n }\r\n\r\n this._uniformBuffer.dispose();\r\n\r\n // Remove from scene\r\n this.getScene().removeLight(this);\r\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\r\n }\r\n\r\n /**\r\n * Returns the light type ID (integer).\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n public getTypeID(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode.\r\n * @returns the scaled intensity in intensity mode unit\r\n */\r\n public getScaledIntensity() {\r\n return this._photometricScale * this.intensity;\r\n }\r\n\r\n /**\r\n * Returns a new Light object, named \"name\", from the current one.\r\n * @param name The name of the cloned light\r\n * @param newParent The parent of this light, if it has one\r\n * @returns the new created light\r\n */\r\n public clone(name: string, newParent: Nullable<Node> = null): Nullable<Light> {\r\n const constructor = Light.GetConstructorFromName(this.getTypeID(), name, this.getScene());\r\n\r\n if (!constructor) {\r\n return null;\r\n }\r\n const clonedLight = SerializationHelper.Clone(constructor, this);\r\n if (name) {\r\n clonedLight.name = name;\r\n }\r\n if (newParent) {\r\n clonedLight.parent = newParent;\r\n }\r\n clonedLight.setEnabled(this.isEnabled());\r\n\r\n this.onClonedObservable.notifyObservers(clonedLight);\r\n\r\n return clonedLight;\r\n }\r\n\r\n /**\r\n * Serializes the current light into a Serialization object.\r\n * @returns the serialized object.\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.uniqueId = this.uniqueId;\r\n\r\n // Type\r\n serializationObject.type = this.getTypeID();\r\n\r\n // Parent\r\n if (this.parent) {\r\n this.parent._serializeAsParent(serializationObject);\r\n }\r\n\r\n // Inclusion / exclusions\r\n if (this.excludedMeshes.length > 0) {\r\n serializationObject.excludedMeshesIds = [];\r\n this.excludedMeshes.forEach((mesh: AbstractMesh) => {\r\n serializationObject.excludedMeshesIds.push(mesh.id);\r\n });\r\n }\r\n\r\n if (this.includedOnlyMeshes.length > 0) {\r\n serializationObject.includedOnlyMeshesIds = [];\r\n this.includedOnlyMeshes.forEach((mesh: AbstractMesh) => {\r\n serializationObject.includedOnlyMeshesIds.push(mesh.id);\r\n });\r\n }\r\n\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n\r\n serializationObject.isEnabled = this.isEnabled();\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3.\r\n * This new light is named \"name\" and added to the passed scene.\r\n * @param type Type according to the types available in Light.LIGHTTYPEID_x\r\n * @param name The friendly name of the light\r\n * @param scene The scene the new light will belong to\r\n * @returns the constructor function\r\n */\r\n static GetConstructorFromName(type: number, name: string, scene: Scene): Nullable<() => Light> {\r\n const constructorFunc = Node.Construct(\"Light_Type_\" + type, name, scene);\r\n\r\n if (constructorFunc) {\r\n return <() => Light>constructorFunc;\r\n }\r\n\r\n // Default to no light for none present once.\r\n return null;\r\n }\r\n\r\n /**\r\n * Parses the passed \"parsedLight\" and returns a new instanced Light from this parsing.\r\n * @param parsedLight The JSON representation of the light\r\n * @param scene The scene to create the parsed light in\r\n * @returns the created light after parsing\r\n */\r\n public static Parse(parsedLight: any, scene: Scene): Nullable<Light> {\r\n const constructor = Light.GetConstructorFromName(parsedLight.type, parsedLight.name, scene);\r\n\r\n if (!constructor) {\r\n return null;\r\n }\r\n\r\n const light = SerializationHelper.Parse(constructor, parsedLight, scene);\r\n\r\n // Inclusion / exclusions\r\n if (parsedLight.excludedMeshesIds) {\r\n light._excludedMeshesIds = parsedLight.excludedMeshesIds;\r\n }\r\n\r\n if (parsedLight.includedOnlyMeshesIds) {\r\n light._includedOnlyMeshesIds = parsedLight.includedOnlyMeshesIds;\r\n }\r\n\r\n // Parent\r\n if (parsedLight.parentId !== undefined) {\r\n light._waitingParentId = parsedLight.parentId;\r\n }\r\n\r\n if (parsedLight.parentInstanceIndex !== undefined) {\r\n light._waitingParentInstanceIndex = parsedLight.parentInstanceIndex;\r\n }\r\n\r\n // Falloff\r\n if (parsedLight.falloffType !== undefined) {\r\n light.falloffType = parsedLight.falloffType;\r\n }\r\n\r\n // Lightmaps\r\n if (parsedLight.lightmapMode !== undefined) {\r\n light.lightmapMode = parsedLight.lightmapMode;\r\n }\r\n\r\n // Animations\r\n if (parsedLight.animations) {\r\n for (let animationIndex = 0; animationIndex < parsedLight.animations.length; animationIndex++) {\r\n const parsedAnimation = parsedLight.animations[animationIndex];\r\n const internalClass = GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n light.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n Node.ParseAnimationRanges(light, parsedLight, scene);\r\n }\r\n\r\n if (parsedLight.autoAnimate) {\r\n scene.beginAnimation(light, parsedLight.autoAnimateFrom, parsedLight.autoAnimateTo, parsedLight.autoAnimateLoop, parsedLight.autoAnimateSpeed || 1.0);\r\n }\r\n\r\n // Check if isEnabled is defined to be back compatible with prior serialized versions.\r\n if (parsedLight.isEnabled !== undefined) {\r\n light.setEnabled(parsedLight.isEnabled);\r\n }\r\n\r\n return light;\r\n }\r\n\r\n private _hookArrayForExcluded(array: AbstractMesh[]): void {\r\n const oldPush = array.push;\r\n array.push = (...items: AbstractMesh[]) => {\r\n const result = oldPush.apply(array, items);\r\n\r\n for (const item of items) {\r\n item._resyncLightSource(this);\r\n }\r\n\r\n return result;\r\n };\r\n\r\n const oldSplice = array.splice;\r\n array.splice = (index: number, deleteCount?: number) => {\r\n const deleted = oldSplice.apply(array, [index, deleteCount]);\r\n\r\n for (const item of deleted) {\r\n item._resyncLightSource(this);\r\n }\r\n\r\n return deleted;\r\n };\r\n\r\n for (const item of array) {\r\n item._resyncLightSource(this);\r\n }\r\n }\r\n\r\n private _hookArrayForIncludedOnly(array: AbstractMesh[]): void {\r\n const oldPush = array.push;\r\n array.push = (...items: AbstractMesh[]) => {\r\n const result = oldPush.apply(array, items);\r\n\r\n this._resyncMeshes();\r\n\r\n return result;\r\n };\r\n\r\n const oldSplice = array.splice;\r\n array.splice = (index: number, deleteCount?: number) => {\r\n const deleted = oldSplice.apply(array, [index, deleteCount]);\r\n\r\n this._resyncMeshes();\r\n\r\n return deleted;\r\n };\r\n\r\n this._resyncMeshes();\r\n }\r\n\r\n private _resyncMeshes() {\r\n for (const mesh of this.getScene().meshes) {\r\n mesh._resyncLightSource(this);\r\n }\r\n }\r\n\r\n /**\r\n * Forces the meshes to update their light related information in their rendering used effects\r\n * @internal Internal Use Only\r\n */\r\n public _markMeshesAsLightDirty() {\r\n for (const mesh of this.getScene().meshes) {\r\n if (mesh.lightSources.indexOf(this) !== -1) {\r\n mesh._markSubMeshesAsLightDirty();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Recomputes the cached photometric scale if needed.\r\n */\r\n private _computePhotometricScale(): void {\r\n this._photometricScale = this._getPhotometricScale();\r\n this.getScene().resetCachedMaterial();\r\n }\r\n\r\n /**\r\n * @returns the Photometric Scale according to the light type and intensity mode.\r\n */\r\n private _getPhotometricScale() {\r\n let photometricScale = 0.0;\r\n const lightTypeID = this.getTypeID();\r\n\r\n //get photometric mode\r\n let photometricMode = this.intensityMode;\r\n if (photometricMode === Light.INTENSITYMODE_AUTOMATIC) {\r\n if (lightTypeID === Light.LIGHTTYPEID_DIRECTIONALLIGHT) {\r\n photometricMode = Light.INTENSITYMODE_ILLUMINANCE;\r\n } else {\r\n photometricMode = Light.INTENSITYMODE_LUMINOUSINTENSITY;\r\n }\r\n }\r\n\r\n //compute photometric scale\r\n switch (lightTypeID) {\r\n case Light.LIGHTTYPEID_POINTLIGHT:\r\n case Light.LIGHTTYPEID_SPOTLIGHT:\r\n switch (photometricMode) {\r\n case Light.INTENSITYMODE_LUMINOUSPOWER:\r\n photometricScale = 1.0 / (4.0 * Math.PI);\r\n break;\r\n case Light.INTENSITYMODE_LUMINOUSINTENSITY:\r\n photometricScale = 1.0;\r\n break;\r\n case Light.INTENSITYMODE_LUMINANCE:\r\n photometricScale = this.radius * this.radius;\r\n break;\r\n }\r\n break;\r\n\r\n case Light.LIGHTTYPEID_DIRECTIONALLIGHT:\r\n switch (photometricMode) {\r\n case Light.INTENSITYMODE_ILLUMINANCE:\r\n photometricScale = 1.0;\r\n break;\r\n case Light.INTENSITYMODE_LUMINANCE: {\r\n // When radius (and therefore solid angle) is non-zero a directional lights brightness can be specified via central (peak) luminance.\r\n // For a directional light the 'radius' defines the angular radius (in radians) rather than world-space radius (e.g. in metres).\r\n let apexAngleRadians = this.radius;\r\n // Impose a minimum light angular size to avoid the light becoming an infinitely small angular light source (i.e. a dirac delta function).\r\n apexAngleRadians = Math.max(apexAngleRadians, 0.001);\r\n const solidAngle = 2.0 * Math.PI * (1.0 - Math.cos(apexAngleRadians));\r\n photometricScale = solidAngle;\r\n break;\r\n }\r\n }\r\n break;\r\n\r\n case Light.LIGHTTYPEID_HEMISPHERICLIGHT:\r\n // No fall off in hemispheric light.\r\n photometricScale = 1.0;\r\n break;\r\n }\r\n return photometricScale;\r\n }\r\n\r\n /**\r\n * Reorder the light in the scene according to their defined priority.\r\n * @internal Internal Use Only\r\n */\r\n public _reorderLightsInScene(): void {\r\n const scene = this.getScene();\r\n if (this._renderPriority != 0) {\r\n scene.requireLightSorting = true;\r\n }\r\n this.getScene().sortLightsByPriority();\r\n }\r\n\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n public abstract prepareLightSpecificDefines(defines: any, lightIndex: number): void;\r\n}\r\n"]}
@@ -261,7 +261,7 @@ export class ShadowLight extends Light {
261
261
  * @returns The projection matrix. Can be null, if a projection matrix cannot be defined for the type of light considered (as for a hemispherical light, for example).
262
262
  */
263
263
  getProjectionMatrix(viewMatrix, renderList) {
264
- this.setShadowProjectionMatrix(this._projectionMatrix, viewMatrix !== null && viewMatrix !== void 0 ? viewMatrix : this._viewMatrix, renderList !== null && renderList !== void 0 ? renderList : []);
264
+ this.setShadowProjectionMatrix(this._projectionMatrix, viewMatrix ?? this._viewMatrix, renderList ?? []);
265
265
  return this._projectionMatrix;
266
266
  }
267
267
  }
@@ -1 +1 @@
1
- {"version":3,"file":"shadowLight.js","sourceRoot":"","sources":["../../../../dev/core/src/Lights/shadowLight.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAiH1C;;;GAGG;AACH,MAAM,OAAgB,WAAY,SAAQ,KAAK;IAA/C;;QA2FY,iCAA4B,GAAY,IAAI,CAAC;QA0L3C,gBAAW,GAAW,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxC,sBAAiB,GAAW,MAAM,CAAC,QAAQ,EAAE,CAAC;IAwC5D,CAAC;IA1Ta,YAAY,CAAC,KAAc;QACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IAC3B,CAAC;IACD;;;OAGG;IAEH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IACD;;;OAGG;IACH,IAAW,QAAQ,CAAC,KAAc;QAC9B,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAGS,aAAa,CAAC,KAAc;QAClC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC5B,CAAC;IACD;;;OAGG;IAEH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IACD;;;OAGG;IACH,IAAW,SAAS,CAAC,KAAc;QAC/B,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9B,C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,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,EAAE;YAC7D,cAAc,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,kDAAkD;SACzF;QAED,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC1C,aAAa,CAAC,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QAEpD,MAAM,CAAC,aAAa,CAAC,aAAa,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAEjF,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACI,mBAAmB,CAAC,UAAmB,EAAE,UAAgC;QAC5E,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,IAAI,CAAC,WAAW,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,CAAC,CAAC;QAEzG,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;CACJ;AAlTG;IADC,kBAAkB,EAAE;2CAGpB;AAkBD;IADC,kBAAkB,EAAE;4CAGpB;AAcD;IADC,SAAS,EAAE;6CAGX;AAcD;IADC,SAAS,EAAE;6CAGX","sourcesContent":["import { serialize, serializeAsVector3 } from \"../Misc/decorators\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Light } from \"./light\";\r\nimport { Axis } from \"../Maths/math.axis\";\r\nimport type { Nullable } from \"core/types\";\r\n/**\r\n * Interface describing all the common properties and methods a shadow light needs to implement.\r\n * This helps both the shadow generator and materials to generate the corresponding shadow maps\r\n * as well as binding the different shadow properties to the effects.\r\n */\r\nexport interface IShadowLight extends Light {\r\n /**\r\n * The light id in the scene (used in scene.getLightById for instance)\r\n */\r\n id: string;\r\n /**\r\n * The position the shadow will be casted from.\r\n */\r\n position: Vector3;\r\n /**\r\n * In 2d mode (needCube being false), the direction used to cast the shadow.\r\n */\r\n direction: Vector3;\r\n /**\r\n * The transformed position. Position of the light in world space taking parenting in account.\r\n */\r\n transformedPosition: Vector3;\r\n /**\r\n * The transformed direction. Direction of the light in world space taking parenting in account.\r\n */\r\n transformedDirection: Vector3;\r\n /**\r\n * The friendly name of the light in the scene.\r\n */\r\n name: string;\r\n /**\r\n * Defines the shadow projection clipping minimum z value.\r\n */\r\n shadowMinZ: number;\r\n /**\r\n * Defines the shadow projection clipping maximum z value.\r\n */\r\n shadowMaxZ: number;\r\n\r\n /**\r\n * Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light\r\n * @returns true if the information has been computed, false if it does not need to (no parenting)\r\n */\r\n computeTransformedInformation(): boolean;\r\n\r\n /**\r\n * Gets the scene the light belongs to.\r\n * @returns The scene\r\n */\r\n getScene(): Scene;\r\n\r\n /**\r\n * Callback defining a custom Projection Matrix Builder.\r\n * This can be used to override the default projection matrix computation.\r\n */\r\n customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;\r\n\r\n /**\r\n * Sets the shadow projection matrix in parameter to the generated projection matrix.\r\n * @param matrix The matrix to update with the projection information\r\n * @param viewMatrix The transform matrix of the light\r\n * @param renderList The list of mesh to render in the map\r\n * @returns The current light\r\n */\r\n setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): IShadowLight;\r\n\r\n /**\r\n * Gets the current depth scale used in ESM.\r\n * @returns The scale\r\n */\r\n getDepthScale(): number;\r\n\r\n /**\r\n * Returns whether or not the shadow generation require a cube texture or a 2d texture.\r\n * @returns true if a cube texture needs to be use\r\n */\r\n needCube(): boolean;\r\n\r\n /**\r\n * Detects if the projection matrix requires to be recomputed this frame.\r\n * @returns true if it requires to be recomputed otherwise, false.\r\n */\r\n needProjectionMatrixCompute(): boolean;\r\n\r\n /**\r\n * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.\r\n */\r\n forceProjectionMatrixCompute(): void;\r\n\r\n /**\r\n * Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed.\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n getShadowDirection(faceIndex?: number): Vector3;\r\n\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n getDepthMinZ(activeCamera: Camera): number;\r\n\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n getDepthMaxZ(activeCamera: Camera): number;\r\n}\r\n\r\n/**\r\n * Base implementation IShadowLight\r\n * It groups all the common behaviour in order to reduce duplication and better follow the DRY pattern.\r\n */\r\nexport abstract class ShadowLight extends Light implements IShadowLight {\r\n protected abstract _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;\r\n\r\n protected _position: Vector3;\r\n protected _setPosition(value: Vector3) {\r\n this._position = value;\r\n }\r\n /**\r\n * Sets the position the shadow will be casted from. Also use as the light position for both\r\n * point and spot lights.\r\n */\r\n @serializeAsVector3()\r\n public get position(): Vector3 {\r\n return this._position;\r\n }\r\n /**\r\n * Sets the position the shadow will be casted from. Also use as the light position for both\r\n * point and spot lights.\r\n */\r\n public set position(value: Vector3) {\r\n this._setPosition(value);\r\n }\r\n\r\n protected _direction: Vector3;\r\n protected _setDirection(value: Vector3) {\r\n this._direction = value;\r\n }\r\n /**\r\n * In 2d mode (needCube being false), gets the direction used to cast the shadow.\r\n * Also use as the light direction on spot and directional lights.\r\n */\r\n @serializeAsVector3()\r\n public get direction(): Vector3 {\r\n return this._direction;\r\n }\r\n /**\r\n * In 2d mode (needCube being false), sets the direction used to cast the shadow.\r\n * Also use as the light direction on spot and directional lights.\r\n */\r\n public set direction(value: Vector3) {\r\n this._setDirection(value);\r\n }\r\n\r\n protected _shadowMinZ: number;\r\n /**\r\n * Gets the shadow projection clipping minimum z value.\r\n */\r\n @serialize()\r\n public get shadowMinZ(): number {\r\n return this._shadowMinZ;\r\n }\r\n /**\r\n * Sets the shadow projection clipping minimum z value.\r\n */\r\n public set shadowMinZ(value: number) {\r\n this._shadowMinZ = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n protected _shadowMaxZ: number;\r\n /**\r\n * Sets the shadow projection clipping maximum z value.\r\n */\r\n @serialize()\r\n public get shadowMaxZ(): number {\r\n return this._shadowMaxZ;\r\n }\r\n /**\r\n * Gets the shadow projection clipping maximum z value.\r\n */\r\n public set shadowMaxZ(value: number) {\r\n this._shadowMaxZ = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n /**\r\n * Callback defining a custom Projection Matrix Builder.\r\n * This can be used to override the default projection matrix computation.\r\n */\r\n public customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;\r\n\r\n /**\r\n * The transformed position. Position of the light in world space taking parenting in account. Needs to be computed by calling computeTransformedInformation.\r\n */\r\n public transformedPosition: Vector3;\r\n\r\n /**\r\n * The transformed direction. Direction of the light in world space taking parenting in account.\r\n */\r\n public transformedDirection: Vector3;\r\n\r\n private _needProjectionMatrixCompute: boolean = true;\r\n\r\n /**\r\n * Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light\r\n * @returns true if the information has been computed, false if it does not need to (no parenting)\r\n */\r\n public computeTransformedInformation(): boolean {\r\n if (this.parent && this.parent.getWorldMatrix) {\r\n if (!this.transformedPosition) {\r\n this.transformedPosition = Vector3.Zero();\r\n }\r\n Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);\r\n\r\n // In case the direction is present.\r\n if (this.direction) {\r\n if (!this.transformedDirection) {\r\n this.transformedDirection = Vector3.Zero();\r\n }\r\n Vector3.TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), this.transformedDirection);\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Return the depth scale used for the shadow map.\r\n * @returns the depth scale.\r\n */\r\n public getDepthScale(): number {\r\n return 50.0;\r\n }\r\n\r\n /**\r\n * Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed.\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public getShadowDirection(faceIndex?: number): Vector3 {\r\n return this.transformedDirection ? this.transformedDirection : this.direction;\r\n }\r\n\r\n /**\r\n * If computeTransformedInformation has been called, returns the ShadowLight absolute position in the world. Otherwise, returns the local position.\r\n * @returns the position vector in world space\r\n */\r\n public getAbsolutePosition(): Vector3 {\r\n return this.transformedPosition ? this.transformedPosition : this.position;\r\n }\r\n\r\n /**\r\n * Sets the ShadowLight direction toward the passed target.\r\n * @param target The point to target in local space\r\n * @returns the updated ShadowLight direction\r\n */\r\n public setDirectionToTarget(target: Vector3): Vector3 {\r\n this.direction = Vector3.Normalize(target.subtract(this.position));\r\n return this.direction;\r\n }\r\n\r\n /**\r\n * Returns the light rotation in euler definition.\r\n * @returns the x y z rotation in local space.\r\n */\r\n public getRotation(): Vector3 {\r\n this.direction.normalize();\r\n const xaxis = Vector3.Cross(this.direction, Axis.Y);\r\n const yaxis = Vector3.Cross(xaxis, this.direction);\r\n return Vector3.RotationFromAxis(xaxis, yaxis, this.direction);\r\n }\r\n\r\n /**\r\n * Returns whether or not the shadow generation require a cube texture or a 2d texture.\r\n * @returns true if a cube texture needs to be use\r\n */\r\n public needCube(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Detects if the projection matrix requires to be recomputed this frame.\r\n * @returns true if it requires to be recomputed otherwise, false.\r\n */\r\n public needProjectionMatrixCompute(): boolean {\r\n return this._needProjectionMatrixCompute;\r\n }\r\n\r\n /**\r\n * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.\r\n */\r\n public forceProjectionMatrixCompute(): void {\r\n this._needProjectionMatrixCompute = true;\r\n }\r\n\r\n /** @internal */\r\n public _initCache() {\r\n super._initCache();\r\n\r\n this._cache.position = Vector3.Zero();\r\n }\r\n\r\n /** @internal */\r\n public _isSynchronized(): boolean {\r\n if (!this._cache.position.equals(this.position)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n public computeWorldMatrix(force?: boolean): Matrix {\r\n if (!force && this.isSynchronized()) {\r\n this._currentRenderId = this.getScene().getRenderId();\r\n return this._worldMatrix;\r\n }\r\n\r\n this._updateCache();\r\n this._cache.position.copyFrom(this.position);\r\n\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = Matrix.Identity();\r\n }\r\n\r\n Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);\r\n\r\n if (this.parent && this.parent.getWorldMatrix) {\r\n this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);\r\n\r\n this._markSyncedWithParent();\r\n }\r\n\r\n // Cache the determinant\r\n this._worldMatrixDeterminantIsDirty = true;\r\n\r\n return this._worldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n public getDepthMinZ(activeCamera: Camera): number {\r\n return this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n }\r\n\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n public getDepthMaxZ(activeCamera: Camera): number {\r\n return this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n }\r\n\r\n /**\r\n * Sets the shadow projection matrix in parameter to the generated projection matrix.\r\n * @param matrix The matrix to updated with the projection information\r\n * @param viewMatrix The transform matrix of the light\r\n * @param renderList The list of mesh to render in the map\r\n * @returns The current light\r\n */\r\n public setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): IShadowLight {\r\n if (this.customProjectionMatrixBuilder) {\r\n this.customProjectionMatrixBuilder(viewMatrix, renderList, matrix);\r\n } else {\r\n this._setDefaultShadowProjectionMatrix(matrix, viewMatrix, renderList);\r\n }\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n protected _syncParentEnabledState() {\r\n super._syncParentEnabledState();\r\n if (!this.parent || !this.parent.getWorldMatrix) {\r\n (this.transformedPosition as any) = null;\r\n (this.transformedDirection as any) = null;\r\n }\r\n }\r\n\r\n protected _viewMatrix: Matrix = Matrix.Identity();\r\n protected _projectionMatrix: Matrix = Matrix.Identity();\r\n\r\n /**\r\n * Returns the view matrix.\r\n * @param faceIndex The index of the face for which we want to extract the view matrix. Only used for point light types.\r\n * @returns The view matrix. Can be null, if a view matrix cannot be defined for the type of light considered (as for a hemispherical light, for example).\r\n */\r\n public getViewMatrix(faceIndex?: number): Nullable<Matrix> {\r\n const lightDirection = TmpVectors.Vector3[0];\r\n\r\n let lightPosition = this.position;\r\n if (this.computeTransformedInformation()) {\r\n lightPosition = this.transformedPosition;\r\n }\r\n\r\n Vector3.NormalizeToRef(this.getShadowDirection(faceIndex), lightDirection);\r\n if (Math.abs(Vector3.Dot(lightDirection, Vector3.Up())) === 1.0) {\r\n lightDirection.z = 0.0000000000001; // Required to avoid perfectly perpendicular light\r\n }\r\n\r\n const lightTarget = TmpVectors.Vector3[1];\r\n lightPosition.addToRef(lightDirection, lightTarget);\r\n\r\n Matrix.LookAtLHToRef(lightPosition, lightTarget, Vector3.Up(), this._viewMatrix);\r\n\r\n return this._viewMatrix;\r\n }\r\n\r\n /**\r\n * Returns the projection matrix.\r\n * Note that viewMatrix and renderList are optional and are only used by lights that calculate the projection matrix from a list of meshes (e.g. directional lights with automatic extents calculation).\r\n * @param viewMatrix The view transform matrix of the light (optional).\r\n * @param renderList The list of meshes to take into account when calculating the projection matrix (optional).\r\n * @returns The projection matrix. Can be null, if a projection matrix cannot be defined for the type of light considered (as for a hemispherical light, for example).\r\n */\r\n public getProjectionMatrix(viewMatrix?: Matrix, renderList?: Array<AbstractMesh>): Nullable<Matrix> {\r\n this.setShadowProjectionMatrix(this._projectionMatrix, viewMatrix ?? this._viewMatrix, renderList ?? []);\r\n\r\n return this._projectionMatrix;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"shadowLight.js","sourceRoot":"","sources":["../../../../dev/core/src/Lights/shadowLight.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAiH1C;;;GAGG;AACH,MAAM,OAAgB,WAAY,SAAQ,KAAK;IAA/C;;QA2FY,iCAA4B,GAAY,IAAI,CAAC;QA0L3C,gBAAW,GAAW,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxC,sBAAiB,GAAW,MAAM,CAAC,QAAQ,EAAE,CAAC;IAwC5D,CAAC;IA1Ta,YAAY,CAAC,KAAc;QACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IAC3B,CAAC;IACD;;;OAGG;IAEH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IACD;;;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\"../Misc/decorators\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Light } from \"./light\";\r\nimport { Axis } from \"../Maths/math.axis\";\r\nimport type { Nullable } from \"core/types\";\r\n/**\r\n * Interface describing all the common properties and methods a shadow light needs to implement.\r\n * This helps both the shadow generator and materials to generate the corresponding shadow maps\r\n * as well as binding the different shadow properties to the effects.\r\n */\r\nexport interface IShadowLight extends Light {\r\n /**\r\n * The light id in the scene (used in scene.getLightById for instance)\r\n */\r\n id: string;\r\n /**\r\n * The position the shadow will be casted from.\r\n */\r\n position: Vector3;\r\n /**\r\n * In 2d mode (needCube being false), the direction used to cast the shadow.\r\n */\r\n direction: Vector3;\r\n /**\r\n * The transformed position. Position of the light in world space taking parenting in account.\r\n */\r\n transformedPosition: Vector3;\r\n /**\r\n * The transformed direction. Direction of the light in world space taking parenting in account.\r\n */\r\n transformedDirection: Vector3;\r\n /**\r\n * The friendly name of the light in the scene.\r\n */\r\n name: string;\r\n /**\r\n * Defines the shadow projection clipping minimum z value.\r\n */\r\n shadowMinZ: number;\r\n /**\r\n * Defines the shadow projection clipping maximum z value.\r\n */\r\n shadowMaxZ: number;\r\n\r\n /**\r\n * Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light\r\n * @returns true if the information has been computed, false if it does not need to (no parenting)\r\n */\r\n computeTransformedInformation(): boolean;\r\n\r\n /**\r\n * Gets the scene the light belongs to.\r\n * @returns The scene\r\n */\r\n getScene(): Scene;\r\n\r\n /**\r\n * Callback defining a custom Projection Matrix Builder.\r\n * This can be used to override the default projection matrix computation.\r\n */\r\n customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;\r\n\r\n /**\r\n * Sets the shadow projection matrix in parameter to the generated projection matrix.\r\n * @param matrix The matrix to update with the projection information\r\n * @param viewMatrix The transform matrix of the light\r\n * @param renderList The list of mesh to render in the map\r\n * @returns The current light\r\n */\r\n setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): IShadowLight;\r\n\r\n /**\r\n * Gets the current depth scale used in ESM.\r\n * @returns The scale\r\n */\r\n getDepthScale(): number;\r\n\r\n /**\r\n * Returns whether or not the shadow generation require a cube texture or a 2d texture.\r\n * @returns true if a cube texture needs to be use\r\n */\r\n needCube(): boolean;\r\n\r\n /**\r\n * Detects if the projection matrix requires to be recomputed this frame.\r\n * @returns true if it requires to be recomputed otherwise, false.\r\n */\r\n needProjectionMatrixCompute(): boolean;\r\n\r\n /**\r\n * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.\r\n */\r\n forceProjectionMatrixCompute(): void;\r\n\r\n /**\r\n * Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed.\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n getShadowDirection(faceIndex?: number): Vector3;\r\n\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n getDepthMinZ(activeCamera: Camera): number;\r\n\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n getDepthMaxZ(activeCamera: Camera): number;\r\n}\r\n\r\n/**\r\n * Base implementation IShadowLight\r\n * It groups all the common behaviour in order to reduce duplication and better follow the DRY pattern.\r\n */\r\nexport abstract class ShadowLight extends Light implements IShadowLight {\r\n protected abstract _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;\r\n\r\n protected _position: Vector3;\r\n protected _setPosition(value: Vector3) {\r\n this._position = value;\r\n }\r\n /**\r\n * Sets the position the shadow will be casted from. Also use as the light position for both\r\n * point and spot lights.\r\n */\r\n @serializeAsVector3()\r\n public get position(): Vector3 {\r\n return this._position;\r\n }\r\n /**\r\n * Sets the position the shadow will be casted from. Also use as the light position for both\r\n * point and spot lights.\r\n */\r\n public set position(value: Vector3) {\r\n this._setPosition(value);\r\n }\r\n\r\n protected _direction: Vector3;\r\n protected _setDirection(value: Vector3) {\r\n this._direction = value;\r\n }\r\n /**\r\n * In 2d mode (needCube being false), gets the direction used to cast the shadow.\r\n * Also use as the light direction on spot and directional lights.\r\n */\r\n @serializeAsVector3()\r\n public get direction(): Vector3 {\r\n return this._direction;\r\n }\r\n /**\r\n * In 2d mode (needCube being false), sets the direction used to cast the shadow.\r\n * Also use as the light direction on spot and directional lights.\r\n */\r\n public set direction(value: Vector3) {\r\n this._setDirection(value);\r\n }\r\n\r\n protected _shadowMinZ: number;\r\n /**\r\n * Gets the shadow projection clipping minimum z value.\r\n */\r\n @serialize()\r\n public get shadowMinZ(): number {\r\n return this._shadowMinZ;\r\n }\r\n /**\r\n * Sets the shadow projection clipping minimum z value.\r\n */\r\n public set shadowMinZ(value: number) {\r\n this._shadowMinZ = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n protected _shadowMaxZ: number;\r\n /**\r\n * Sets the shadow projection clipping maximum z value.\r\n */\r\n @serialize()\r\n public get shadowMaxZ(): number {\r\n return this._shadowMaxZ;\r\n }\r\n /**\r\n * Gets the shadow projection clipping maximum z value.\r\n */\r\n public set shadowMaxZ(value: number) {\r\n this._shadowMaxZ = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n /**\r\n * Callback defining a custom Projection Matrix Builder.\r\n * This can be used to override the default projection matrix computation.\r\n */\r\n public customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;\r\n\r\n /**\r\n * The transformed position. Position of the light in world space taking parenting in account. Needs to be computed by calling computeTransformedInformation.\r\n */\r\n public transformedPosition: Vector3;\r\n\r\n /**\r\n * The transformed direction. Direction of the light in world space taking parenting in account.\r\n */\r\n public transformedDirection: Vector3;\r\n\r\n private _needProjectionMatrixCompute: boolean = true;\r\n\r\n /**\r\n * Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light\r\n * @returns true if the information has been computed, false if it does not need to (no parenting)\r\n */\r\n public computeTransformedInformation(): boolean {\r\n if (this.parent && this.parent.getWorldMatrix) {\r\n if (!this.transformedPosition) {\r\n this.transformedPosition = Vector3.Zero();\r\n }\r\n Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);\r\n\r\n // In case the direction is present.\r\n if (this.direction) {\r\n if (!this.transformedDirection) {\r\n this.transformedDirection = Vector3.Zero();\r\n }\r\n Vector3.TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), this.transformedDirection);\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Return the depth scale used for the shadow map.\r\n * @returns the depth scale.\r\n */\r\n public getDepthScale(): number {\r\n return 50.0;\r\n }\r\n\r\n /**\r\n * Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed.\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public getShadowDirection(faceIndex?: number): Vector3 {\r\n return this.transformedDirection ? this.transformedDirection : this.direction;\r\n }\r\n\r\n /**\r\n * If computeTransformedInformation has been called, returns the ShadowLight absolute position in the world. Otherwise, returns the local position.\r\n * @returns the position vector in world space\r\n */\r\n public getAbsolutePosition(): Vector3 {\r\n return this.transformedPosition ? this.transformedPosition : this.position;\r\n }\r\n\r\n /**\r\n * Sets the ShadowLight direction toward the passed target.\r\n * @param target The point to target in local space\r\n * @returns the updated ShadowLight direction\r\n */\r\n public setDirectionToTarget(target: Vector3): Vector3 {\r\n this.direction = Vector3.Normalize(target.subtract(this.position));\r\n return this.direction;\r\n }\r\n\r\n /**\r\n * Returns the light rotation in euler definition.\r\n * @returns the x y z rotation in local space.\r\n */\r\n public getRotation(): Vector3 {\r\n this.direction.normalize();\r\n const xaxis = Vector3.Cross(this.direction, Axis.Y);\r\n const yaxis = Vector3.Cross(xaxis, this.direction);\r\n return Vector3.RotationFromAxis(xaxis, yaxis, this.direction);\r\n }\r\n\r\n /**\r\n * Returns whether or not the shadow generation require a cube texture or a 2d texture.\r\n * @returns true if a cube texture needs to be use\r\n */\r\n public needCube(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Detects if the projection matrix requires to be recomputed this frame.\r\n * @returns true if it requires to be recomputed otherwise, false.\r\n */\r\n public needProjectionMatrixCompute(): boolean {\r\n return this._needProjectionMatrixCompute;\r\n }\r\n\r\n /**\r\n * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.\r\n */\r\n public forceProjectionMatrixCompute(): void {\r\n this._needProjectionMatrixCompute = true;\r\n }\r\n\r\n /** @internal */\r\n public _initCache() {\r\n super._initCache();\r\n\r\n this._cache.position = Vector3.Zero();\r\n }\r\n\r\n /** @internal */\r\n public _isSynchronized(): boolean {\r\n if (!this._cache.position.equals(this.position)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n public computeWorldMatrix(force?: boolean): Matrix {\r\n if (!force && this.isSynchronized()) {\r\n this._currentRenderId = this.getScene().getRenderId();\r\n return this._worldMatrix;\r\n }\r\n\r\n this._updateCache();\r\n this._cache.position.copyFrom(this.position);\r\n\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = Matrix.Identity();\r\n }\r\n\r\n Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);\r\n\r\n if (this.parent && this.parent.getWorldMatrix) {\r\n this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);\r\n\r\n this._markSyncedWithParent();\r\n }\r\n\r\n // Cache the determinant\r\n this._worldMatrixDeterminantIsDirty = true;\r\n\r\n return this._worldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n public getDepthMinZ(activeCamera: Camera): number {\r\n return this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n }\r\n\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n public getDepthMaxZ(activeCamera: Camera): number {\r\n return this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n }\r\n\r\n /**\r\n * Sets the shadow projection matrix in parameter to the generated projection matrix.\r\n * @param matrix The matrix to updated with the projection information\r\n * @param viewMatrix The transform matrix of the light\r\n * @param renderList The list of mesh to render in the map\r\n * @returns The current light\r\n */\r\n public setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): IShadowLight {\r\n if (this.customProjectionMatrixBuilder) {\r\n this.customProjectionMatrixBuilder(viewMatrix, renderList, matrix);\r\n } else {\r\n this._setDefaultShadowProjectionMatrix(matrix, viewMatrix, renderList);\r\n }\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n protected _syncParentEnabledState() {\r\n super._syncParentEnabledState();\r\n if (!this.parent || !this.parent.getWorldMatrix) {\r\n (this.transformedPosition as any) = null;\r\n (this.transformedDirection as any) = null;\r\n }\r\n }\r\n\r\n protected _viewMatrix: Matrix = Matrix.Identity();\r\n protected _projectionMatrix: Matrix = Matrix.Identity();\r\n\r\n /**\r\n * Returns the view matrix.\r\n * @param faceIndex The index of the face for which we want to extract the view matrix. Only used for point light types.\r\n * @returns The view matrix. Can be null, if a view matrix cannot be defined for the type of light considered (as for a hemispherical light, for example).\r\n */\r\n public getViewMatrix(faceIndex?: number): Nullable<Matrix> {\r\n const lightDirection = TmpVectors.Vector3[0];\r\n\r\n let lightPosition = this.position;\r\n if (this.computeTransformedInformation()) {\r\n lightPosition = this.transformedPosition;\r\n }\r\n\r\n Vector3.NormalizeToRef(this.getShadowDirection(faceIndex), lightDirection);\r\n if (Math.abs(Vector3.Dot(lightDirection, Vector3.Up())) === 1.0) {\r\n lightDirection.z = 0.0000000000001; // Required to avoid perfectly perpendicular light\r\n }\r\n\r\n const lightTarget = TmpVectors.Vector3[1];\r\n lightPosition.addToRef(lightDirection, lightTarget);\r\n\r\n Matrix.LookAtLHToRef(lightPosition, lightTarget, Vector3.Up(), this._viewMatrix);\r\n\r\n return this._viewMatrix;\r\n }\r\n\r\n /**\r\n * Returns the projection matrix.\r\n * Note that viewMatrix and renderList are optional and are only used by lights that calculate the projection matrix from a list of meshes (e.g. directional lights with automatic extents calculation).\r\n * @param viewMatrix The view transform matrix of the light (optional).\r\n * @param renderList The list of meshes to take into account when calculating the projection matrix (optional).\r\n * @returns The projection matrix. Can be null, if a projection matrix cannot be defined for the type of light considered (as for a hemispherical light, for example).\r\n */\r\n public getProjectionMatrix(viewMatrix?: Matrix, renderList?: Array<AbstractMesh>): Nullable<Matrix> {\r\n this.setShadowProjectionMatrix(this._projectionMatrix, viewMatrix ?? this._viewMatrix, renderList ?? []);\r\n\r\n return this._projectionMatrix;\r\n }\r\n}\r\n"]}
@@ -523,7 +523,6 @@ SceneLoader.RegisterPlugin({
523
523
  return false;
524
524
  },
525
525
  importMesh: (meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons, onError) => {
526
- var _a;
527
526
  // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details
528
527
  // when SceneLoader.debugLogging = true (default), or exception encountered.
529
528
  // Everything stored in var log instead of writing separate lines to support only writing in exception,
@@ -728,7 +727,7 @@ SceneLoader.RegisterPlugin({
728
727
  currentMesh._waitingParentInstanceIndex = null;
729
728
  }
730
729
  currentMesh.parent = parentNode;
731
- if (((_a = currentMesh.parent) === null || _a === void 0 ? void 0 : _a.getClassName()) === "TransformNode") {
730
+ if (currentMesh.parent?.getClassName() === "TransformNode") {
732
731
  const loadedTransformNodeIndex = loadedTransformNodes.indexOf(currentMesh.parent);
733
732
  if (loadedTransformNodeIndex > -1) {
734
733
  loadedTransformNodes.splice(loadedTransformNodeIndex, 1);