@onerjs/core 9.0.2 → 9.0.4

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 (476) hide show
  1. package/Buffers/buffer.pure.js +4 -0
  2. package/Buffers/buffer.pure.js.map +1 -1
  3. package/Cameras/camera.pure.d.ts +14 -0
  4. package/Cameras/camera.pure.js +15 -0
  5. package/Cameras/camera.pure.js.map +1 -1
  6. package/Compute/computeShader.pure.d.ts +2 -1
  7. package/Compute/computeShader.pure.js +29 -10
  8. package/Compute/computeShader.pure.js.map +1 -1
  9. package/Culling/ray.core.js +22 -9
  10. package/Culling/ray.core.js.map +1 -1
  11. package/Engines/IDrawContext.d.ts +2 -0
  12. package/Engines/IDrawContext.js.map +1 -1
  13. package/Engines/Native/nativeInterfaces.d.ts +55 -4
  14. package/Engines/Native/nativeInterfaces.js.map +1 -1
  15. package/Engines/Native/nativeRenderTargetWrapper.d.ts +1 -0
  16. package/Engines/Native/nativeRenderTargetWrapper.js +5 -1
  17. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
  18. package/Engines/Processors/shaderCodeInliner.d.ts +2 -0
  19. package/Engines/Processors/shaderCodeInliner.js +251 -6
  20. package/Engines/Processors/shaderCodeInliner.js.map +1 -1
  21. package/Engines/Processors/shaderProcessor.js +10 -1
  22. package/Engines/Processors/shaderProcessor.js.map +1 -1
  23. package/Engines/WebGPU/Extensions/engine.debugging.pure.js +12 -0
  24. package/Engines/WebGPU/Extensions/engine.debugging.pure.js.map +1 -1
  25. package/Engines/WebGPU/Extensions/engine.multiRender.pure.js +0 -1
  26. package/Engines/WebGPU/Extensions/engine.multiRender.pure.js.map +1 -1
  27. package/Engines/WebGPU/Extensions/engine.query.pure.js +5 -0
  28. package/Engines/WebGPU/Extensions/engine.query.pure.js.map +1 -1
  29. package/Engines/WebGPU/webgpuBufferManager.js +7 -0
  30. package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
  31. package/Engines/WebGPU/webgpuCacheTextureView.d.ts +1 -1
  32. package/Engines/WebGPU/webgpuCacheTextureView.js +20 -8
  33. package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -1
  34. package/Engines/WebGPU/webgpuDrawContext.d.ts +2 -0
  35. package/Engines/WebGPU/webgpuDrawContext.js +6 -0
  36. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  37. package/Engines/WebGPU/webgpuQuerySet.d.ts +3 -3
  38. package/Engines/WebGPU/webgpuQuerySet.js +23 -9
  39. package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
  40. package/Engines/WebGPU/webgpuRenderPassCommandStream.d.ts +156 -0
  41. package/Engines/WebGPU/webgpuRenderPassCommandStream.js +323 -0
  42. package/Engines/WebGPU/webgpuRenderPassCommandStream.js.map +1 -0
  43. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
  44. package/Engines/WebGPU/webgpuTextureManager.js +4 -3
  45. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  46. package/Engines/WebGPU/webgpuTimestampQuery.d.ts +3 -1
  47. package/Engines/WebGPU/webgpuTimestampQuery.js +9 -6
  48. package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
  49. package/Engines/abstractEngine.pure.d.ts +2 -0
  50. package/Engines/abstractEngine.pure.js +14 -5
  51. package/Engines/abstractEngine.pure.js.map +1 -1
  52. package/Engines/constants.d.ts +6 -0
  53. package/Engines/constants.js +6 -0
  54. package/Engines/constants.js.map +1 -1
  55. package/Engines/engine.d.ts +198 -24
  56. package/Engines/pure.d.ts +1 -0
  57. package/Engines/pure.js +1 -0
  58. package/Engines/pure.js.map +1 -1
  59. package/Engines/renderCommandBatcher.pure.d.ts +16 -0
  60. package/Engines/renderCommandBatcher.pure.js +24 -0
  61. package/Engines/renderCommandBatcher.pure.js.map +1 -0
  62. package/Engines/thinEngine.functions.js +3 -2
  63. package/Engines/thinEngine.functions.js.map +1 -1
  64. package/Engines/thinEngine.pure.js +18 -2
  65. package/Engines/thinEngine.pure.js.map +1 -1
  66. package/Engines/thinNativeEngine.pure.d.ts +10 -7
  67. package/Engines/thinNativeEngine.pure.js +117 -46
  68. package/Engines/thinNativeEngine.pure.js.map +1 -1
  69. package/Engines/thinWebGPUEngine.d.ts +8 -0
  70. package/Engines/thinWebGPUEngine.js +11 -0
  71. package/Engines/thinWebGPUEngine.js.map +1 -1
  72. package/Engines/webgpuEngine.pure.d.ts +60 -1
  73. package/Engines/webgpuEngine.pure.js +238 -42
  74. package/Engines/webgpuEngine.pure.js.map +1 -1
  75. package/FlowGraph/Blocks/Data/Audio/flowGraphGetSoundVolumeBlock.pure.d.ts +3 -3
  76. package/FlowGraph/Blocks/Data/Audio/flowGraphGetSoundVolumeBlock.pure.js +2 -1
  77. package/FlowGraph/Blocks/Data/Audio/flowGraphGetSoundVolumeBlock.pure.js.map +1 -1
  78. package/FlowGraph/Blocks/Data/Audio/flowGraphIsSoundPlayingBlock.pure.d.ts +3 -3
  79. package/FlowGraph/Blocks/Data/Audio/flowGraphIsSoundPlayingBlock.pure.js +2 -1
  80. package/FlowGraph/Blocks/Data/Audio/flowGraphIsSoundPlayingBlock.pure.js.map +1 -1
  81. package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.d.ts +5 -0
  82. package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.js +8 -0
  83. package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.js.map +1 -0
  84. package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.pure.d.ts +77 -0
  85. package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.pure.js +141 -0
  86. package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.pure.js.map +1 -0
  87. package/FlowGraph/Blocks/Event/flowGraphSoundEndedEventBlock.pure.d.ts +5 -3
  88. package/FlowGraph/Blocks/Event/flowGraphSoundEndedEventBlock.pure.js +38 -7
  89. package/FlowGraph/Blocks/Event/flowGraphSoundEndedEventBlock.pure.js.map +1 -1
  90. package/FlowGraph/Blocks/Event/index.d.ts +1 -0
  91. package/FlowGraph/Blocks/Event/index.js +1 -0
  92. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  93. package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
  94. package/FlowGraph/Blocks/Event/pure.js +1 -0
  95. package/FlowGraph/Blocks/Event/pure.js.map +1 -1
  96. package/FlowGraph/Blocks/Execution/Audio/flowGraphPauseSoundBlock.pure.d.ts +3 -3
  97. package/FlowGraph/Blocks/Execution/Audio/flowGraphPauseSoundBlock.pure.js +2 -1
  98. package/FlowGraph/Blocks/Execution/Audio/flowGraphPauseSoundBlock.pure.js.map +1 -1
  99. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlaySoundBlock.pure.d.ts +3 -3
  100. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlaySoundBlock.pure.js +2 -1
  101. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlaySoundBlock.pure.js.map +1 -1
  102. package/FlowGraph/Blocks/Execution/Audio/flowGraphSetSoundVolumeBlock.pure.d.ts +3 -3
  103. package/FlowGraph/Blocks/Execution/Audio/flowGraphSetSoundVolumeBlock.pure.js +2 -1
  104. package/FlowGraph/Blocks/Execution/Audio/flowGraphSetSoundVolumeBlock.pure.js.map +1 -1
  105. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopSoundBlock.pure.d.ts +3 -3
  106. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopSoundBlock.pure.js +2 -1
  107. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopSoundBlock.pure.js.map +1 -1
  108. package/FlowGraph/Blocks/allBlocks.pure.js +2 -0
  109. package/FlowGraph/Blocks/allBlocks.pure.js.map +1 -1
  110. package/FlowGraph/Blocks/flowGraphBlockFactory.js +2 -0
  111. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  112. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +1 -0
  113. package/FlowGraph/Blocks/flowGraphBlockNames.js +1 -0
  114. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  115. package/FlowGraph/flowGraph.d.ts +12 -1
  116. package/FlowGraph/flowGraph.js +38 -0
  117. package/FlowGraph/flowGraph.js.map +1 -1
  118. package/FlowGraph/flowGraphCoordinator.d.ts +44 -0
  119. package/FlowGraph/flowGraphCoordinator.js +141 -0
  120. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  121. package/FlowGraph/flowGraphDataConnection.pure.js +41 -14
  122. package/FlowGraph/flowGraphDataConnection.pure.js.map +1 -1
  123. package/FlowGraph/flowGraphParser.js +105 -5
  124. package/FlowGraph/flowGraphParser.js.map +1 -1
  125. package/FlowGraph/flowGraphSoundAssets.d.ts +40 -0
  126. package/FlowGraph/flowGraphSoundAssets.js +33 -0
  127. package/FlowGraph/flowGraphSoundAssets.js.map +1 -0
  128. package/FlowGraph/index.d.ts +1 -0
  129. package/FlowGraph/index.js +1 -0
  130. package/FlowGraph/index.js.map +1 -1
  131. package/FlowGraph/pure.d.ts +1 -0
  132. package/FlowGraph/pure.js +1 -0
  133. package/FlowGraph/pure.js.map +1 -1
  134. package/FlowGraph/serialization.d.ts +8 -0
  135. package/FlowGraph/serialization.js +31 -12
  136. package/FlowGraph/serialization.js.map +1 -1
  137. package/FlowGraph/typeDefinitions.d.ts +25 -0
  138. package/FlowGraph/typeDefinitions.js.map +1 -1
  139. package/FrameGraph/Tasks/PostProcesses/taaTask.js +2 -0
  140. package/FrameGraph/Tasks/PostProcesses/taaTask.js.map +1 -1
  141. package/Instrumentation/engineInstrumentation.d.ts +1 -0
  142. package/Instrumentation/engineInstrumentation.js +25 -6
  143. package/Instrumentation/engineInstrumentation.js.map +1 -1
  144. package/Lights/Clustered/clusteredLightContainer.pure.js +2 -0
  145. package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
  146. package/Lights/Shadows/cascadedShadowGenerator.pure.d.ts +36 -1
  147. package/Lights/Shadows/cascadedShadowGenerator.pure.js +202 -27
  148. package/Lights/Shadows/cascadedShadowGenerator.pure.js.map +1 -1
  149. package/Lights/directionalLight.pure.d.ts +24 -10
  150. package/Lights/directionalLight.pure.js +29 -11
  151. package/Lights/directionalLight.pure.js.map +1 -1
  152. package/Loading/sceneLoader.d.ts +1 -1
  153. package/Loading/sceneLoader.js +1 -1
  154. package/Loading/sceneLoader.js.map +1 -1
  155. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +4 -4
  156. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
  157. package/Materials/Node/Blocks/Dual/lightBlock.pure.js +1 -1
  158. package/Materials/Node/Blocks/Dual/lightBlock.pure.js.map +1 -1
  159. package/Materials/Node/Blocks/Input/inputBlock.pure.js +4 -0
  160. package/Materials/Node/Blocks/Input/inputBlock.pure.js.map +1 -1
  161. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.d.ts +9 -0
  162. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +23 -3
  163. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
  164. package/Materials/PBR/openpbrMaterial.pure.js +1 -1
  165. package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
  166. package/Materials/PBR/pbrBaseMaterial.pure.d.ts +9 -0
  167. package/Materials/PBR/pbrBaseMaterial.pure.js +60 -1
  168. package/Materials/PBR/pbrBaseMaterial.pure.js.map +1 -1
  169. package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +11 -0
  170. package/Materials/PBR/pbrBaseSimpleMaterial.js +21 -2
  171. package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
  172. package/Materials/PBR/pbrMaterial.pure.d.ts +12 -0
  173. package/Materials/PBR/pbrMaterial.pure.js +23 -3
  174. package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
  175. package/Materials/Textures/Filtering/hdrIrradianceFiltering.d.ts +1 -0
  176. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js +10 -0
  177. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js.map +1 -1
  178. package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +5 -0
  179. package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +7 -0
  180. package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -1
  181. package/Materials/Textures/HTML/htmlInteractionManager.d.ts +9 -3
  182. package/Materials/Textures/HTML/htmlInteractionManager.js +64 -5
  183. package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -1
  184. package/Materials/Textures/HTML/htmlTexture.d.ts +11 -11
  185. package/Materials/Textures/HTML/htmlTexture.js +106 -65
  186. package/Materials/Textures/HTML/htmlTexture.js.map +1 -1
  187. package/Materials/Textures/Loaders/internalTextureLoader.d.ts +2 -1
  188. package/Materials/Textures/Loaders/internalTextureLoader.js.map +1 -1
  189. package/Materials/Textures/Loaders/ktxTextureLoader.d.ts +2 -1
  190. package/Materials/Textures/Loaders/ktxTextureLoader.js +4 -50
  191. package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
  192. package/Materials/Textures/Procedurals/proceduralTexture.pure.js +10 -0
  193. package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
  194. package/Materials/Textures/dynamicTexture.pure.js +6 -0
  195. package/Materials/Textures/dynamicTexture.pure.js.map +1 -1
  196. package/Materials/Textures/ktx2encoderTypes.d.ts +51 -0
  197. package/Materials/Textures/ktx2encoderTypes.js +2 -0
  198. package/Materials/Textures/ktx2encoderTypes.js.map +1 -0
  199. package/Materials/Textures/renderTargetTexture.pure.js +10 -2
  200. package/Materials/Textures/renderTargetTexture.pure.js.map +1 -1
  201. package/Materials/Textures/textureMerger.d.ts +11 -0
  202. package/Materials/Textures/textureMerger.js +34 -19
  203. package/Materials/Textures/textureMerger.js.map +1 -1
  204. package/Materials/Textures/textureProcessor.d.ts +145 -0
  205. package/Materials/Textures/textureProcessor.js +445 -45
  206. package/Materials/Textures/textureProcessor.js.map +1 -1
  207. package/Materials/Textures/textureSampling.functions.d.ts +41 -0
  208. package/Materials/Textures/textureSampling.functions.js +82 -0
  209. package/Materials/Textures/textureSampling.functions.js.map +1 -0
  210. package/Materials/drawWrapper.d.ts +8 -0
  211. package/Materials/drawWrapper.js +19 -0
  212. package/Materials/drawWrapper.js.map +1 -1
  213. package/Materials/effect.pure.d.ts +6 -0
  214. package/Materials/effect.pure.js +28 -6
  215. package/Materials/effect.pure.js.map +1 -1
  216. package/Materials/effect.webgl.functions.pure.js +1 -1
  217. package/Materials/effect.webgl.functions.pure.js.map +1 -1
  218. package/Materials/material.pure.d.ts +5 -0
  219. package/Materials/material.pure.js +9 -2
  220. package/Materials/material.pure.js.map +1 -1
  221. package/Materials/materialFlags.d.ts +6 -0
  222. package/Materials/materialFlags.js +14 -0
  223. package/Materials/materialFlags.js.map +1 -1
  224. package/Materials/materialHelper.functions.d.ts +2 -1
  225. package/Materials/materialHelper.functions.js +36 -2
  226. package/Materials/materialHelper.functions.js.map +1 -1
  227. package/Materials/materialHelper.geometryrendering.js +19 -16
  228. package/Materials/materialHelper.geometryrendering.js.map +1 -1
  229. package/Materials/materialPluginManager.pure.js +12 -8
  230. package/Materials/materialPluginManager.pure.js.map +1 -1
  231. package/Materials/prePassConfiguration.js +19 -16
  232. package/Materials/prePassConfiguration.js.map +1 -1
  233. package/Materials/shaderMaterial.pure.js +19 -6
  234. package/Materials/shaderMaterial.pure.js.map +1 -1
  235. package/Materials/shadowDepthWrapper.d.ts +6 -0
  236. package/Materials/shadowDepthWrapper.js +17 -0
  237. package/Materials/shadowDepthWrapper.js.map +1 -1
  238. package/Meshes/Compression/dracoCodec.d.ts +14 -0
  239. package/Meshes/Compression/dracoCodec.js +22 -0
  240. package/Meshes/Compression/dracoCodec.js.map +1 -1
  241. package/Meshes/Compression/dracoDecoder.d.ts +1 -0
  242. package/Meshes/Compression/dracoDecoder.js +27 -0
  243. package/Meshes/Compression/dracoDecoder.js.map +1 -1
  244. package/Meshes/Compression/dracoEncoder.d.ts +1 -0
  245. package/Meshes/Compression/dracoEncoder.js +8 -0
  246. package/Meshes/Compression/dracoEncoder.js.map +1 -1
  247. package/Meshes/Compression/meshoptCompression.d.ts +1 -0
  248. package/Meshes/Compression/meshoptCompression.js +9 -0
  249. package/Meshes/Compression/meshoptCompression.js.map +1 -1
  250. package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.d.ts +415 -0
  251. package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.js +912 -0
  252. package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.js.map +1 -0
  253. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +3 -0
  254. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +40 -9
  255. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  256. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +112 -8
  257. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +696 -74
  258. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  259. package/Meshes/abstractMesh.pure.js +12 -4
  260. package/Meshes/abstractMesh.pure.js.map +1 -1
  261. package/Meshes/geometry.d.ts +5 -0
  262. package/Meshes/geometry.js +25 -0
  263. package/Meshes/geometry.js.map +1 -1
  264. package/Meshes/index.d.ts +1 -0
  265. package/Meshes/index.js +1 -0
  266. package/Meshes/index.js.map +1 -1
  267. package/Meshes/mesh.pure.d.ts +7 -0
  268. package/Meshes/mesh.pure.js +18 -13
  269. package/Meshes/mesh.pure.js.map +1 -1
  270. package/Meshes/pure.d.ts +1 -0
  271. package/Meshes/pure.js +1 -0
  272. package/Meshes/pure.js.map +1 -1
  273. package/Meshes/subMesh.pure.d.ts +3 -0
  274. package/Meshes/subMesh.pure.js +26 -0
  275. package/Meshes/subMesh.pure.js.map +1 -1
  276. package/Meshes/thinInstanceMesh.pure.js +5 -3
  277. package/Meshes/thinInstanceMesh.pure.js.map +1 -1
  278. package/Misc/index.d.ts +1 -0
  279. package/Misc/index.js +1 -0
  280. package/Misc/index.js.map +1 -1
  281. package/Misc/khronosTextureContainer2.d.ts +3 -2
  282. package/Misc/khronosTextureContainer2.js +24 -6
  283. package/Misc/khronosTextureContainer2.js.map +1 -1
  284. package/Misc/khronosTextureContainer2Encoder.d.ts +166 -0
  285. package/Misc/khronosTextureContainer2Encoder.js +556 -0
  286. package/Misc/khronosTextureContainer2Encoder.js.map +1 -0
  287. package/Misc/khronosTextureContainer2EncoderWorker.d.ts +61 -0
  288. package/Misc/khronosTextureContainer2EncoderWorker.js +55 -0
  289. package/Misc/khronosTextureContainer2EncoderWorker.js.map +1 -0
  290. package/Misc/pure.d.ts +1 -0
  291. package/Misc/pure.js +1 -0
  292. package/Misc/pure.js.map +1 -1
  293. package/Misc/textureFormat.functions.d.ts +6 -0
  294. package/Misc/textureFormat.functions.js +54 -0
  295. package/Misc/textureFormat.functions.js.map +1 -0
  296. package/Misc/textureTools.d.ts +6 -2
  297. package/Misc/textureTools.js +100 -42
  298. package/Misc/textureTools.js.map +1 -1
  299. package/Misc/tools.pure.js +1 -1
  300. package/Misc/tools.pure.js.map +1 -1
  301. package/Particles/Node/Blocks/systemBlock.pure.d.ts +1 -1
  302. package/Particles/Node/Blocks/systemBlock.pure.js +6 -3
  303. package/Particles/Node/Blocks/systemBlock.pure.js.map +1 -1
  304. package/Particles/computeShaderParticleSystem.pure.js +5 -0
  305. package/Particles/computeShaderParticleSystem.pure.js.map +1 -1
  306. package/Particles/gpuParticleSystem.pure.d.ts +2 -0
  307. package/Particles/gpuParticleSystem.pure.js +25 -1
  308. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  309. package/Particles/solidParticle.d.ts +5 -0
  310. package/Particles/solidParticle.js +5 -0
  311. package/Particles/solidParticle.js.map +1 -1
  312. package/Particles/solidParticleSystem.d.ts +10 -0
  313. package/Particles/solidParticleSystem.js +72 -13
  314. package/Particles/solidParticleSystem.js.map +1 -1
  315. package/Particles/thinParticleSystem.pure.js +4 -0
  316. package/Particles/thinParticleSystem.pure.js.map +1 -1
  317. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.d.ts +27 -6
  318. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.js +60 -5
  319. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.js.map +1 -1
  320. package/PostProcesses/thinTAAPostProcess.d.ts +1 -0
  321. package/PostProcesses/thinTAAPostProcess.js +17 -1
  322. package/PostProcesses/thinTAAPostProcess.js.map +1 -1
  323. package/PostProcesses/volumetricLightScatteringPostProcess.pure.d.ts +2 -1
  324. package/PostProcesses/volumetricLightScatteringPostProcess.pure.js +6 -5
  325. package/PostProcesses/volumetricLightScatteringPostProcess.pure.js.map +1 -1
  326. package/Rendering/boundingBoxRenderer.pure.js +2 -3
  327. package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
  328. package/Rendering/geometryBufferRenderer.pure.js +8 -2
  329. package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
  330. package/Rendering/objectRenderer.d.ts +1 -0
  331. package/Rendering/objectRenderer.js +14 -0
  332. package/Rendering/objectRenderer.js.map +1 -1
  333. package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js +2 -2
  334. package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
  335. package/Shaders/ShadersInclude/bumpVertex.js +1 -1
  336. package/Shaders/ShadersInclude/bumpVertex.js.map +1 -1
  337. package/Shaders/ShadersInclude/bumpVertexDeclaration.js +1 -1
  338. package/Shaders/ShadersInclude/bumpVertexDeclaration.js.map +1 -1
  339. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +5 -1
  340. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  341. package/Shaders/ShadersInclude/helperFunctions.js +2 -2
  342. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  343. package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
  344. package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
  345. package/Shaders/ShadersInclude/openpbrVertexDeclaration.js +6 -0
  346. package/Shaders/ShadersInclude/openpbrVertexDeclaration.js.map +1 -1
  347. package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js +11 -1
  348. package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
  349. package/Shaders/ShadersInclude/pbrBlockNormalFinal.js +9 -0
  350. package/Shaders/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
  351. package/Shaders/ShadersInclude/pbrBlockReflectance.js +1 -1
  352. package/Shaders/ShadersInclude/pbrBlockReflectance.js.map +1 -1
  353. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
  354. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
  355. package/Shaders/ShadersInclude/pbrFragmentDeclaration.js +7 -1
  356. package/Shaders/ShadersInclude/pbrFragmentDeclaration.js.map +1 -1
  357. package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +1 -0
  358. package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
  359. package/Shaders/ShadersInclude/pbrIBLFunctions.js +12 -0
  360. package/Shaders/ShadersInclude/pbrIBLFunctions.js.map +1 -1
  361. package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
  362. package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  363. package/Shaders/ShadersInclude/pbrVertexDeclaration.js +3 -0
  364. package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
  365. package/Shaders/geometry.vertex.js +6 -6
  366. package/Shaders/geometry.vertex.js.map +1 -1
  367. package/Shaders/gpuUpdateParticles.vertex.js +1 -1
  368. package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
  369. package/Shaders/lod.fragment.js +15 -2
  370. package/Shaders/lod.fragment.js.map +1 -1
  371. package/Shaders/lod3D.fragment.js +15 -2
  372. package/Shaders/lod3D.fragment.js.map +1 -1
  373. package/Shaders/lodCube.fragment.js +15 -2
  374. package/Shaders/lodCube.fragment.js.map +1 -1
  375. package/Shaders/openpbr.vertex.js +2 -0
  376. package/Shaders/openpbr.vertex.js.map +1 -1
  377. package/Shaders/pbr.fragment.js +12 -1
  378. package/Shaders/pbr.fragment.js.map +1 -1
  379. package/Shaders/pbr.vertex.js +2 -0
  380. package/Shaders/pbr.vertex.js.map +1 -1
  381. package/Shaders/textureMerger.fragment.js +28 -0
  382. package/Shaders/textureMerger.fragment.js.map +1 -1
  383. package/Shaders/textureProcessor.fragment.js +26 -4
  384. package/Shaders/textureProcessor.fragment.js.map +1 -1
  385. package/Shaders/volumetricLightScattering.fragment.js +1 -1
  386. package/Shaders/volumetricLightScattering.fragment.js.map +1 -1
  387. package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js +2 -2
  388. package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
  389. package/ShadersWGSL/ShadersInclude/bumpVertex.js +1 -1
  390. package/ShadersWGSL/ShadersInclude/bumpVertex.js.map +1 -1
  391. package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.js +1 -1
  392. package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.js.map +1 -1
  393. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +1 -1
  394. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  395. package/ShadersWGSL/ShadersInclude/helperFunctions.js +2 -2
  396. package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
  397. package/ShadersWGSL/ShadersInclude/lightFragment.js +44 -2
  398. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  399. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +17 -3
  400. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
  401. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js +12 -1
  402. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
  403. package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
  404. package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
  405. package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js +11 -1
  406. package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
  407. package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js +9 -0
  408. package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
  409. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js +1 -1
  410. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js.map +1 -1
  411. package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
  412. package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
  413. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js +1 -1
  414. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
  415. package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +1 -0
  416. package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
  417. package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js +8 -0
  418. package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js.map +1 -1
  419. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
  420. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  421. package/ShadersWGSL/ShadersInclude/prePassVertex.js +2 -2
  422. package/ShadersWGSL/ShadersInclude/prePassVertex.js.map +1 -1
  423. package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js +1 -1
  424. package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js.map +1 -1
  425. package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js +3 -1
  426. package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js.map +1 -1
  427. package/ShadersWGSL/ShadersInclude/shadowsVertex.js +16 -0
  428. package/ShadersWGSL/ShadersInclude/shadowsVertex.js.map +1 -1
  429. package/ShadersWGSL/default.fragment.js +4 -4
  430. package/ShadersWGSL/default.fragment.js.map +1 -1
  431. package/ShadersWGSL/default.vertex.js +1 -1
  432. package/ShadersWGSL/default.vertex.js.map +1 -1
  433. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
  434. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  435. package/ShadersWGSL/gpuUpdateParticles.compute.js +1 -1
  436. package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
  437. package/ShadersWGSL/gsSortCount.compute.d.ts +5 -0
  438. package/ShadersWGSL/gsSortCount.compute.js +19 -0
  439. package/ShadersWGSL/gsSortCount.compute.js.map +1 -0
  440. package/ShadersWGSL/gsSortKeys.compute.d.ts +5 -0
  441. package/ShadersWGSL/gsSortKeys.compute.js +49 -0
  442. package/ShadersWGSL/gsSortKeys.compute.js.map +1 -0
  443. package/ShadersWGSL/gsSortOutput.compute.d.ts +5 -0
  444. package/ShadersWGSL/gsSortOutput.compute.js +28 -0
  445. package/ShadersWGSL/gsSortOutput.compute.js.map +1 -0
  446. package/ShadersWGSL/gsSortScanLocal.compute.d.ts +5 -0
  447. package/ShadersWGSL/gsSortScanLocal.compute.js +23 -0
  448. package/ShadersWGSL/gsSortScanLocal.compute.js.map +1 -0
  449. package/ShadersWGSL/gsSortScanSums.compute.d.ts +5 -0
  450. package/ShadersWGSL/gsSortScanSums.compute.js +19 -0
  451. package/ShadersWGSL/gsSortScanSums.compute.js.map +1 -0
  452. package/ShadersWGSL/gsSortScatter.compute.d.ts +5 -0
  453. package/ShadersWGSL/gsSortScatter.compute.js +33 -0
  454. package/ShadersWGSL/gsSortScatter.compute.js.map +1 -0
  455. package/ShadersWGSL/lod.fragment.js +14 -2
  456. package/ShadersWGSL/lod.fragment.js.map +1 -1
  457. package/ShadersWGSL/lod3D.fragment.js +14 -2
  458. package/ShadersWGSL/lod3D.fragment.js.map +1 -1
  459. package/ShadersWGSL/lodCube.fragment.js +14 -2
  460. package/ShadersWGSL/lodCube.fragment.js.map +1 -1
  461. package/ShadersWGSL/openpbr.vertex.js +3 -1
  462. package/ShadersWGSL/openpbr.vertex.js.map +1 -1
  463. package/ShadersWGSL/pbr.fragment.js +11 -0
  464. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  465. package/ShadersWGSL/pbr.vertex.js +3 -1
  466. package/ShadersWGSL/pbr.vertex.js.map +1 -1
  467. package/ShadersWGSL/textureMerger.fragment.js +40 -4
  468. package/ShadersWGSL/textureMerger.fragment.js.map +1 -1
  469. package/ShadersWGSL/textureProcessor.fragment.js +26 -4
  470. package/ShadersWGSL/textureProcessor.fragment.js.map +1 -1
  471. package/Sprites/spriteRenderer.js +15 -5
  472. package/Sprites/spriteRenderer.js.map +1 -1
  473. package/package.json +1 -1
  474. package/scene.pure.d.ts +23 -1
  475. package/scene.pure.js +83 -1
  476. package/scene.pure.js.map +1 -1
@@ -52,24 +52,32 @@ let DirectionalLight = (() => {
52
52
  this.forceProjectionMatrixCompute();
53
53
  }
54
54
  /**
55
- * Gets the shadow projection scale against the optimal computed one.
56
- * 0.1 by default which means that the projection window is increase by 10% from the optimal size.
57
- * This does not impact in fixed frustum size (shadowFrustumSize being set)
55
+ * Gets the margin added to each side of the shadow projection window, as a fraction of the window's width and height.
56
+ * 0.1 by default: the window is widened by 10% of its width on the left and on the right, and by 10% of its height at the top
57
+ * and at the bottom, so it covers 1.2 times the width and the height of the extents (20% more on each axis).
58
+ * It applies to the extents computed from the shadow casters (autoUpdateExtends) and to the extents set by hand (orthoLeft,
59
+ * orthoRight, orthoBottom and orthoTop), but not to a fixed frustum size (a positive shadowFrustumSize).
60
+ * Set it to 0 for the projection to match the extents exactly.
58
61
  */
59
62
  get shadowOrthoScale() {
60
63
  return this._shadowOrthoScale;
61
64
  }
62
65
  /**
63
- * Sets the shadow projection scale against the optimal computed one.
64
- * 0.1 by default which means that the projection window is increase by 10% from the optimal size.
65
- * This does not impact in fixed frustum size (shadowFrustumSize being set)
66
+ * Sets the margin added to each side of the shadow projection window, as a fraction of the window's width and height.
67
+ * 0.1 by default: the window is widened by 10% of its width on the left and on the right, and by 10% of its height at the top
68
+ * and at the bottom, so it covers 1.2 times the width and the height of the extents (20% more on each axis).
69
+ * It applies to the extents computed from the shadow casters (autoUpdateExtends) and to the extents set by hand (orthoLeft,
70
+ * orthoRight, orthoBottom and orthoTop), but not to a fixed frustum size (a positive shadowFrustumSize).
71
+ * Set it to 0 for the projection to match the extents exactly.
66
72
  */
67
73
  set shadowOrthoScale(value) {
68
74
  this._shadowOrthoScale = value;
69
75
  this.forceProjectionMatrixCompute();
70
76
  }
71
77
  /**
72
- * Gets or sets the orthoLeft property used to build the light frustum
78
+ * Gets or sets the orthoLeft property used to build the light frustum.
79
+ * The shadow projection widens the extents by shadowOrthoScale on each side (0.1 by default: 20% on each axis), also when they
80
+ * are set by hand; set shadowOrthoScale to 0 for the projection to match them exactly.
73
81
  */
74
82
  get orthoLeft() {
75
83
  return this._orthoLeft;
@@ -78,7 +86,9 @@ let DirectionalLight = (() => {
78
86
  this._orthoLeft = left;
79
87
  }
80
88
  /**
81
- * Gets or sets the orthoRight property used to build the light frustum
89
+ * Gets or sets the orthoRight property used to build the light frustum.
90
+ * The shadow projection widens the extents by shadowOrthoScale on each side (0.1 by default: 20% on each axis), also when they
91
+ * are set by hand; set shadowOrthoScale to 0 for the projection to match them exactly.
82
92
  */
83
93
  get orthoRight() {
84
94
  return this._orthoRight;
@@ -87,7 +97,9 @@ let DirectionalLight = (() => {
87
97
  this._orthoRight = right;
88
98
  }
89
99
  /**
90
- * Gets or sets the orthoTop property used to build the light frustum
100
+ * Gets or sets the orthoTop property used to build the light frustum.
101
+ * The shadow projection widens the extents by shadowOrthoScale on each side (0.1 by default: 20% on each axis), also when they
102
+ * are set by hand; set shadowOrthoScale to 0 for the projection to match them exactly.
91
103
  */
92
104
  get orthoTop() {
93
105
  return this._orthoTop;
@@ -96,7 +108,9 @@ let DirectionalLight = (() => {
96
108
  this._orthoTop = top;
97
109
  }
98
110
  /**
99
- * Gets or sets the orthoBottom property used to build the light frustum
111
+ * Gets or sets the orthoBottom property used to build the light frustum.
112
+ * The shadow projection widens the extents by shadowOrthoScale on each side (0.1 by default: 20% on each axis), also when they
113
+ * are set by hand; set shadowOrthoScale to 0 for the projection to match them exactly.
100
114
  */
101
115
  get orthoBottom() {
102
116
  return this._orthoBottom;
@@ -174,7 +188,11 @@ let DirectionalLight = (() => {
174
188
  */
175
189
  _setDefaultFixedFrustumShadowProjectionMatrix(matrix) {
176
190
  const activeCamera = this.getScene().activeCamera;
177
- Matrix.OrthoLHToRef(this.shadowFrustumSize, this.shadowFrustumSize, this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera ? activeCamera.minZ : 0, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera ? activeCamera.maxZ : 10000, matrix, this.getScene().getEngine().isNDCHalfZRange);
191
+ const engine = this.getScene().getEngine();
192
+ const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera ? activeCamera.minZ : 0;
193
+ const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera ? activeCamera.maxZ : 10000;
194
+ const useReverseDepthBuffer = engine.useReverseDepthBuffer;
195
+ Matrix.OrthoLHToRef(this.shadowFrustumSize, this.shadowFrustumSize, useReverseDepthBuffer ? maxZ : minZ, useReverseDepthBuffer ? minZ : maxZ, matrix, engine.isNDCHalfZRange);
178
196
  }
179
197
  /**
180
198
  * Sets the passed matrix "matrix" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.
@@ -1 +1 @@
1
- {"version":3,"file":"directionalLight.pure.js","sourceRoot":"","sources":["../../../../dev/core/src/Lights/directionalLight.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,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YACI,2BAA2B,CAAC,OAAY,EAAE,UAAkB;gBAC/D,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC;YAC5C,CAAC;;;;iDAlUA,SAAS,EAAE;gDAkBX,SAAS,EAAE;6CAkBX,SAAS,EAAE;iDAOX,SAAS,EAAE;sCAIX,SAAS,CAAC,WAAW,CAAC;uCAEtB,SAAS,CAAC,YAAY,CAAC;qCAEvB,SAAS,CAAC,UAAU,CAAC;wCAErB,SAAS,CAAC,aAAa,CAAC;YApDzB,wMAAW,iBAAiB,6DAE3B;YAgBD,qMAAW,gBAAgB,6DAE1B;YAgBD,qMAAO,iBAAiB,6BAAjB,iBAAiB,6GAAQ;YAOhC,iNAAO,qBAAqB,6BAArB,qBAAqB,qHAAS;YAIrC,gLAAQ,UAAU,6BAAV,UAAU,+FAAoB;YAEtC,mLAAQ,WAAW,6BAAX,WAAW,iGAAoB;YAEvC,6KAAQ,SAAS,6BAAT,SAAS,6FAAoB;YAErC,sLAAQ,YAAY,6BAAZ,YAAY,mGAAoB;;;;;SA3D/B,gBAAgB;AA0U7B,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,wBAAwB;IACpC,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACpD,OAAO,GAAG,EAAE,CAAC,IAAI,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,sBAAsB;IACtB,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC;AAChE,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { type Camera } from \"../Cameras/camera.pure\";\r\nimport { type Scene } from \"../scene.pure\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector.pure\";\r\nimport { type AbstractMesh } from \"../Meshes/abstractMesh.pure\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nimport { type Effect } from \"../Materials/effect.pure\";\r\nimport { type Nullable } from \"../types\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { Node } from \"../node\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\n/**\r\n * A directional light is defined by a direction (what a surprise!).\r\n * The light is emitted from everywhere in the specified direction, and has an infinite range.\r\n * An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object.\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\nexport class DirectionalLight extends ShadowLight {\r\n private _shadowFrustumSize = 0;\r\n /**\r\n * Fix frustum size for the shadow generation. This is disabled if the value is 0.\r\n */\r\n @serialize()\r\n public get shadowFrustumSize(): number {\r\n return this._shadowFrustumSize;\r\n }\r\n /**\r\n * Specifies a fix frustum size for the shadow generation.\r\n */\r\n public set shadowFrustumSize(value: number) {\r\n this._shadowFrustumSize = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n private _shadowOrthoScale = 0.1;\r\n /**\r\n * Gets the shadow projection scale against the optimal computed one.\r\n * 0.1 by default which means that the projection window is increase by 10% from the optimal size.\r\n * This does not impact in fixed frustum size (shadowFrustumSize being set)\r\n */\r\n @serialize()\r\n public get shadowOrthoScale(): number {\r\n return this._shadowOrthoScale;\r\n }\r\n /**\r\n * Sets the shadow projection scale against the optimal computed one.\r\n * 0.1 by default which means that the projection window is increase by 10% from the optimal size.\r\n * This does not impact in fixed frustum size (shadowFrustumSize being set)\r\n */\r\n public set shadowOrthoScale(value: number) {\r\n this._shadowOrthoScale = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n /**\r\n * Automatically compute the projection matrix to best fit (including all the casters)\r\n * on each frame.\r\n */\r\n @serialize()\r\n public autoUpdateExtends = true;\r\n\r\n /**\r\n * Automatically compute the shadowMinZ and shadowMaxZ for the projection matrix to best fit (including all the casters)\r\n * on each frame. autoUpdateExtends must be set to true for this to work\r\n */\r\n @serialize()\r\n public autoCalcShadowZBounds = false;\r\n\r\n // Cache\r\n @serialize(\"orthoLeft\")\r\n private _orthoLeft = Number.MAX_VALUE;\r\n @serialize(\"orthoRight\")\r\n private _orthoRight = Number.MIN_VALUE;\r\n @serialize(\"orthoTop\")\r\n private _orthoTop = Number.MIN_VALUE;\r\n @serialize(\"orthoBottom\")\r\n private _orthoBottom = Number.MAX_VALUE;\r\n\r\n /**\r\n * Gets or sets the orthoLeft property used to build the light frustum\r\n */\r\n public get orthoLeft(): number {\r\n return this._orthoLeft;\r\n }\r\n\r\n public set orthoLeft(left: number) {\r\n this._orthoLeft = left;\r\n }\r\n\r\n /**\r\n * Gets or sets the orthoRight property used to build the light frustum\r\n */\r\n public get orthoRight(): number {\r\n return this._orthoRight;\r\n }\r\n\r\n public set orthoRight(right: number) {\r\n this._orthoRight = right;\r\n }\r\n\r\n /**\r\n * Gets or sets the orthoTop property used to build the light frustum\r\n */\r\n public get orthoTop(): number {\r\n return this._orthoTop;\r\n }\r\n\r\n public set orthoTop(top: number) {\r\n this._orthoTop = top;\r\n }\r\n\r\n /**\r\n * Gets or sets the orthoBottom property used to build the light frustum\r\n */\r\n public get orthoBottom(): number {\r\n return this._orthoBottom;\r\n }\r\n\r\n public set orthoBottom(bottom: number) {\r\n this._orthoBottom = bottom;\r\n }\r\n\r\n /**\r\n * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).\r\n * The directional light is emitted from everywhere in the given direction.\r\n * It can cast shadows.\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 direction The direction of the light\r\n * @param scene The scene the light belongs to\r\n * @param dontAddToScene True to not add the light to the scene\r\n */\r\n constructor(name: string, direction: Vector3, scene?: Scene, dontAddToScene?: boolean) {\r\n super(name, scene, dontAddToScene);\r\n this.position = direction.scale(-1.0);\r\n this.direction = direction;\r\n }\r\n\r\n /**\r\n * Returns the string \"DirectionalLight\".\r\n * @returns The class name\r\n */\r\n public override getClassName(): string {\r\n return \"DirectionalLight\";\r\n }\r\n\r\n /**\r\n * Returns the integer 1.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public override getTypeID(): number {\r\n return Light.LIGHTTYPEID_DIRECTIONALLIGHT;\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n * @param matrix\r\n * @param viewMatrix\r\n * @param renderList\r\n */\r\n protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void {\r\n if (this.shadowFrustumSize > 0) {\r\n this._setDefaultFixedFrustumShadowProjectionMatrix(matrix);\r\n } else {\r\n this._setDefaultAutoExtendShadowProjectionMatrix(matrix, viewMatrix, renderList);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n * @param matrix\r\n */\r\n protected _setDefaultFixedFrustumShadowProjectionMatrix(matrix: Matrix): void {\r\n const activeCamera = this.getScene().activeCamera;\r\n\r\n Matrix.OrthoLHToRef(\r\n this.shadowFrustumSize,\r\n this.shadowFrustumSize,\r\n this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera ? activeCamera.minZ : Constants.ShadowMinZ,\r\n this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera ? activeCamera.maxZ : Constants.ShadowMaxZ,\r\n matrix,\r\n this.getScene().getEngine().isNDCHalfZRange\r\n );\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n * @param matrix\r\n * @param viewMatrix\r\n * @param renderList\r\n */\r\n protected _setDefaultAutoExtendShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void {\r\n const activeCamera = this.getScene().activeCamera;\r\n\r\n // Check extends\r\n if (this.autoUpdateExtends || this._orthoLeft === Number.MAX_VALUE) {\r\n const tempVector3 = Vector3.Zero();\r\n\r\n this._orthoLeft = Number.MAX_VALUE;\r\n this._orthoRight = -Number.MAX_VALUE;\r\n this._orthoTop = -Number.MAX_VALUE;\r\n this._orthoBottom = Number.MAX_VALUE;\r\n\r\n let shadowMinZ = Number.MAX_VALUE;\r\n let shadowMaxZ = -Number.MAX_VALUE;\r\n\r\n for (let meshIndex = 0; meshIndex < renderList.length; meshIndex++) {\r\n const mesh = renderList[meshIndex];\r\n\r\n if (!mesh) {\r\n continue;\r\n }\r\n\r\n const boundingInfo = mesh.getBoundingInfo();\r\n const boundingBox = boundingInfo.boundingBox;\r\n\r\n for (let index = 0; index < boundingBox.vectorsWorld.length; index++) {\r\n Vector3.TransformCoordinatesToRef(boundingBox.vectorsWorld[index], viewMatrix, tempVector3);\r\n\r\n if (tempVector3.x < this._orthoLeft) {\r\n this._orthoLeft = tempVector3.x;\r\n }\r\n if (tempVector3.y < this._orthoBottom) {\r\n this._orthoBottom = tempVector3.y;\r\n }\r\n\r\n if (tempVector3.x > this._orthoRight) {\r\n this._orthoRight = tempVector3.x;\r\n }\r\n if (tempVector3.y > this._orthoTop) {\r\n this._orthoTop = tempVector3.y;\r\n }\r\n if (this.autoCalcShadowZBounds) {\r\n if (tempVector3.z < shadowMinZ) {\r\n shadowMinZ = tempVector3.z;\r\n }\r\n if (tempVector3.z > shadowMaxZ) {\r\n shadowMaxZ = tempVector3.z;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (this.autoCalcShadowZBounds) {\r\n this._shadowMinZ = shadowMinZ;\r\n this._shadowMaxZ = shadowMaxZ;\r\n }\r\n }\r\n\r\n const xOffset = this._orthoRight - this._orthoLeft;\r\n const yOffset = this._orthoTop - this._orthoBottom;\r\n\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera?.minZ || Constants.ShadowMinZ;\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera?.maxZ || Constants.ShadowMaxZ;\r\n\r\n const useReverseDepthBuffer = this.getScene().getEngine().useReverseDepthBuffer;\r\n\r\n Matrix.OrthoOffCenterLHToRef(\r\n this._orthoLeft - xOffset * this.shadowOrthoScale,\r\n this._orthoRight + xOffset * this.shadowOrthoScale,\r\n this._orthoBottom - yOffset * this.shadowOrthoScale,\r\n this._orthoTop + yOffset * this.shadowOrthoScale,\r\n useReverseDepthBuffer ? maxZ : minZ,\r\n useReverseDepthBuffer ? minZ : maxZ,\r\n matrix,\r\n this.getScene().getEngine().isNDCHalfZRange\r\n );\r\n }\r\n\r\n protected _buildUniformLayout(): void {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n }\r\n\r\n /**\r\n * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.\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 directional light\r\n */\r\n public transferToEffect(effect: Effect, lightIndex: string): DirectionalLight {\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, lightIndex);\r\n return this;\r\n }\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.direction.x, this.direction.y, this.direction.z, 1, lightIndex);\r\n return this;\r\n }\r\n\r\n public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string): Light {\r\n if (this.computeTransformedInformation()) {\r\n effect.setFloat3(lightDataUniformName, this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z);\r\n return this;\r\n }\r\n\r\n effect.setFloat3(lightDataUniformName, this.direction.x, this.direction.y, this.direction.z);\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n *\r\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\r\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\r\n * (when not using reverse depth buffer / NDC half Z range)\r\n * @param _activeCamera The camera we are returning the min for (not used)\r\n * @returns the depth min z\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public override getDepthMinZ(_activeCamera: Nullable<Camera>): number {\r\n const engine = this._scene.getEngine();\r\n return !engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\r\n }\r\n\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n *\r\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\r\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\r\n * (when not using reverse depth buffer / NDC half Z range)\r\n * @param _activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public override getDepthMaxZ(_activeCamera: Nullable<Camera>): number {\r\n const engine = this._scene.getEngine();\r\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\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 prepareLightSpecificDefines(defines: any, lightIndex: number): void {\r\n defines[\"DIRLIGHT\" + lightIndex] = true;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for directionalLight.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterDirectionalLight(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n Node.AddNodeConstructor(\"Light_Type_1\", (name, scene) => {\r\n return () => new DirectionalLight(name, Vector3.Zero(), scene);\r\n });\r\n\r\n // Register Class Name\r\n RegisterClass(\"BABYLON.DirectionalLight\", DirectionalLight);\r\n}\r\n"]}
1
+ {"version":3,"file":"directionalLight.pure.js","sourceRoot":"","sources":["../../../../dev/core/src/Lights/directionalLight.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;GAKG;IACU,gBAAgB;;sBAAS,WAAW;;;;;;;;;;;;;;;;;;;;;;sBAApC,gBAAiB,SAAQ,WAAW;YAE7C;;eAEG;YAEH,IAAW,iBAAiB;gBACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC;YACnC,CAAC;YACD;;eAEG;YACH,IAAW,iBAAiB,CAAC,KAAa;gBACtC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;gBAChC,IAAI,CAAC,4BAA4B,EAAE,CAAC;YACxC,CAAC;YAGD;;;;;;;eAOG;YAEH,IAAW,gBAAgB;gBACvB,OAAO,IAAI,CAAC,iBAA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,qBAAqB,qHAAS;YAIrC,gLAAQ,UAAU,6BAAV,UAAU,+FAAoB;YAEtC,mLAAQ,WAAW,6BAAX,WAAW,iGAAoB;YAEvC,6KAAQ,SAAS,6BAAT,SAAS,6FAAoB;YAErC,sLAAQ,YAAY,6BAAZ,YAAY,mGAAoB;;;;;SAjE/B,gBAAgB;AA8V7B,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,wBAAwB;IACpC,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACpD,OAAO,GAAG,EAAE,CAAC,IAAI,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,sBAAsB;IACtB,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC;AAChE,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { type Camera } from \"../Cameras/camera.pure\";\r\nimport { type Scene } from \"../scene.pure\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector.pure\";\r\nimport { type AbstractMesh } from \"../Meshes/abstractMesh.pure\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nimport { type Effect } from \"../Materials/effect.pure\";\r\nimport { type Nullable } from \"../types\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { Node } from \"../node\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\n/**\r\n * A directional light is defined by a direction (what a surprise!).\r\n * The light is emitted from everywhere in the specified direction, and has an infinite range.\r\n * An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object.\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\nexport class DirectionalLight extends ShadowLight {\r\n private _shadowFrustumSize = 0;\r\n /**\r\n * Fix frustum size for the shadow generation. This is disabled if the value is 0.\r\n */\r\n @serialize()\r\n public get shadowFrustumSize(): number {\r\n return this._shadowFrustumSize;\r\n }\r\n /**\r\n * Specifies a fix frustum size for the shadow generation.\r\n */\r\n public set shadowFrustumSize(value: number) {\r\n this._shadowFrustumSize = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n private _shadowOrthoScale = 0.1;\r\n /**\r\n * Gets the margin added to each side of the shadow projection window, as a fraction of the window's width and height.\r\n * 0.1 by default: the window is widened by 10% of its width on the left and on the right, and by 10% of its height at the top\r\n * and at the bottom, so it covers 1.2 times the width and the height of the extents (20% more on each axis).\r\n * It applies to the extents computed from the shadow casters (autoUpdateExtends) and to the extents set by hand (orthoLeft,\r\n * orthoRight, orthoBottom and orthoTop), but not to a fixed frustum size (a positive shadowFrustumSize).\r\n * Set it to 0 for the projection to match the extents exactly.\r\n */\r\n @serialize()\r\n public get shadowOrthoScale(): number {\r\n return this._shadowOrthoScale;\r\n }\r\n /**\r\n * Sets the margin added to each side of the shadow projection window, as a fraction of the window's width and height.\r\n * 0.1 by default: the window is widened by 10% of its width on the left and on the right, and by 10% of its height at the top\r\n * and at the bottom, so it covers 1.2 times the width and the height of the extents (20% more on each axis).\r\n * It applies to the extents computed from the shadow casters (autoUpdateExtends) and to the extents set by hand (orthoLeft,\r\n * orthoRight, orthoBottom and orthoTop), but not to a fixed frustum size (a positive shadowFrustumSize).\r\n * Set it to 0 for the projection to match the extents exactly.\r\n */\r\n public set shadowOrthoScale(value: number) {\r\n this._shadowOrthoScale = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n /**\r\n * Automatically compute the projection matrix to best fit (including all the casters)\r\n * on each frame.\r\n */\r\n @serialize()\r\n public autoUpdateExtends = true;\r\n\r\n /**\r\n * Automatically compute the shadowMinZ and shadowMaxZ for the projection matrix to best fit (including all the casters)\r\n * on each frame. autoUpdateExtends must be set to true for this to work\r\n */\r\n @serialize()\r\n public autoCalcShadowZBounds = false;\r\n\r\n // Cache\r\n @serialize(\"orthoLeft\")\r\n private _orthoLeft = Number.MAX_VALUE;\r\n @serialize(\"orthoRight\")\r\n private _orthoRight = Number.MIN_VALUE;\r\n @serialize(\"orthoTop\")\r\n private _orthoTop = Number.MIN_VALUE;\r\n @serialize(\"orthoBottom\")\r\n private _orthoBottom = Number.MAX_VALUE;\r\n\r\n /**\r\n * Gets or sets the orthoLeft property used to build the light frustum.\r\n * The shadow projection widens the extents by shadowOrthoScale on each side (0.1 by default: 20% on each axis), also when they\r\n * are set by hand; set shadowOrthoScale to 0 for the projection to match them exactly.\r\n */\r\n public get orthoLeft(): number {\r\n return this._orthoLeft;\r\n }\r\n\r\n public set orthoLeft(left: number) {\r\n this._orthoLeft = left;\r\n }\r\n\r\n /**\r\n * Gets or sets the orthoRight property used to build the light frustum.\r\n * The shadow projection widens the extents by shadowOrthoScale on each side (0.1 by default: 20% on each axis), also when they\r\n * are set by hand; set shadowOrthoScale to 0 for the projection to match them exactly.\r\n */\r\n public get orthoRight(): number {\r\n return this._orthoRight;\r\n }\r\n\r\n public set orthoRight(right: number) {\r\n this._orthoRight = right;\r\n }\r\n\r\n /**\r\n * Gets or sets the orthoTop property used to build the light frustum.\r\n * The shadow projection widens the extents by shadowOrthoScale on each side (0.1 by default: 20% on each axis), also when they\r\n * are set by hand; set shadowOrthoScale to 0 for the projection to match them exactly.\r\n */\r\n public get orthoTop(): number {\r\n return this._orthoTop;\r\n }\r\n\r\n public set orthoTop(top: number) {\r\n this._orthoTop = top;\r\n }\r\n\r\n /**\r\n * Gets or sets the orthoBottom property used to build the light frustum.\r\n * The shadow projection widens the extents by shadowOrthoScale on each side (0.1 by default: 20% on each axis), also when they\r\n * are set by hand; set shadowOrthoScale to 0 for the projection to match them exactly.\r\n */\r\n public get orthoBottom(): number {\r\n return this._orthoBottom;\r\n }\r\n\r\n public set orthoBottom(bottom: number) {\r\n this._orthoBottom = bottom;\r\n }\r\n\r\n /**\r\n * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).\r\n * The directional light is emitted from everywhere in the given direction.\r\n * It can cast shadows.\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 direction The direction of the light\r\n * @param scene The scene the light belongs to\r\n * @param dontAddToScene True to not add the light to the scene\r\n */\r\n constructor(name: string, direction: Vector3, scene?: Scene, dontAddToScene?: boolean) {\r\n super(name, scene, dontAddToScene);\r\n this.position = direction.scale(-1.0);\r\n this.direction = direction;\r\n }\r\n\r\n /**\r\n * Returns the string \"DirectionalLight\".\r\n * @returns The class name\r\n */\r\n public override getClassName(): string {\r\n return \"DirectionalLight\";\r\n }\r\n\r\n /**\r\n * Returns the integer 1.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public override getTypeID(): number {\r\n return Light.LIGHTTYPEID_DIRECTIONALLIGHT;\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n * @param matrix\r\n * @param viewMatrix\r\n * @param renderList\r\n */\r\n protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void {\r\n if (this.shadowFrustumSize > 0) {\r\n this._setDefaultFixedFrustumShadowProjectionMatrix(matrix);\r\n } else {\r\n this._setDefaultAutoExtendShadowProjectionMatrix(matrix, viewMatrix, renderList);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n * @param matrix\r\n */\r\n protected _setDefaultFixedFrustumShadowProjectionMatrix(matrix: Matrix): void {\r\n const activeCamera = this.getScene().activeCamera;\r\n const engine = this.getScene().getEngine();\r\n\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera ? activeCamera.minZ : Constants.ShadowMinZ;\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera ? activeCamera.maxZ : Constants.ShadowMaxZ;\r\n\r\n const useReverseDepthBuffer = engine.useReverseDepthBuffer;\r\n\r\n Matrix.OrthoLHToRef(\r\n this.shadowFrustumSize,\r\n this.shadowFrustumSize,\r\n useReverseDepthBuffer ? maxZ : minZ,\r\n useReverseDepthBuffer ? minZ : maxZ,\r\n matrix,\r\n engine.isNDCHalfZRange\r\n );\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n * @param matrix\r\n * @param viewMatrix\r\n * @param renderList\r\n */\r\n protected _setDefaultAutoExtendShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void {\r\n const activeCamera = this.getScene().activeCamera;\r\n\r\n // Check extends\r\n if (this.autoUpdateExtends || this._orthoLeft === Number.MAX_VALUE) {\r\n const tempVector3 = Vector3.Zero();\r\n\r\n this._orthoLeft = Number.MAX_VALUE;\r\n this._orthoRight = -Number.MAX_VALUE;\r\n this._orthoTop = -Number.MAX_VALUE;\r\n this._orthoBottom = Number.MAX_VALUE;\r\n\r\n let shadowMinZ = Number.MAX_VALUE;\r\n let shadowMaxZ = -Number.MAX_VALUE;\r\n\r\n for (let meshIndex = 0; meshIndex < renderList.length; meshIndex++) {\r\n const mesh = renderList[meshIndex];\r\n\r\n if (!mesh) {\r\n continue;\r\n }\r\n\r\n const boundingInfo = mesh.getBoundingInfo();\r\n const boundingBox = boundingInfo.boundingBox;\r\n\r\n for (let index = 0; index < boundingBox.vectorsWorld.length; index++) {\r\n Vector3.TransformCoordinatesToRef(boundingBox.vectorsWorld[index], viewMatrix, tempVector3);\r\n\r\n if (tempVector3.x < this._orthoLeft) {\r\n this._orthoLeft = tempVector3.x;\r\n }\r\n if (tempVector3.y < this._orthoBottom) {\r\n this._orthoBottom = tempVector3.y;\r\n }\r\n\r\n if (tempVector3.x > this._orthoRight) {\r\n this._orthoRight = tempVector3.x;\r\n }\r\n if (tempVector3.y > this._orthoTop) {\r\n this._orthoTop = tempVector3.y;\r\n }\r\n if (this.autoCalcShadowZBounds) {\r\n if (tempVector3.z < shadowMinZ) {\r\n shadowMinZ = tempVector3.z;\r\n }\r\n if (tempVector3.z > shadowMaxZ) {\r\n shadowMaxZ = tempVector3.z;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (this.autoCalcShadowZBounds) {\r\n this._shadowMinZ = shadowMinZ;\r\n this._shadowMaxZ = shadowMaxZ;\r\n }\r\n }\r\n\r\n const xOffset = this._orthoRight - this._orthoLeft;\r\n const yOffset = this._orthoTop - this._orthoBottom;\r\n\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera?.minZ || Constants.ShadowMinZ;\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera?.maxZ || Constants.ShadowMaxZ;\r\n\r\n const useReverseDepthBuffer = this.getScene().getEngine().useReverseDepthBuffer;\r\n\r\n Matrix.OrthoOffCenterLHToRef(\r\n this._orthoLeft - xOffset * this.shadowOrthoScale,\r\n this._orthoRight + xOffset * this.shadowOrthoScale,\r\n this._orthoBottom - yOffset * this.shadowOrthoScale,\r\n this._orthoTop + yOffset * this.shadowOrthoScale,\r\n useReverseDepthBuffer ? maxZ : minZ,\r\n useReverseDepthBuffer ? minZ : maxZ,\r\n matrix,\r\n this.getScene().getEngine().isNDCHalfZRange\r\n );\r\n }\r\n\r\n protected _buildUniformLayout(): void {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n }\r\n\r\n /**\r\n * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.\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 directional light\r\n */\r\n public transferToEffect(effect: Effect, lightIndex: string): DirectionalLight {\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, lightIndex);\r\n return this;\r\n }\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.direction.x, this.direction.y, this.direction.z, 1, lightIndex);\r\n return this;\r\n }\r\n\r\n public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string): Light {\r\n if (this.computeTransformedInformation()) {\r\n effect.setFloat3(lightDataUniformName, this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z);\r\n return this;\r\n }\r\n\r\n effect.setFloat3(lightDataUniformName, this.direction.x, this.direction.y, this.direction.z);\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n *\r\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\r\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\r\n * (when not using reverse depth buffer / NDC half Z range)\r\n * @param _activeCamera The camera we are returning the min for (not used)\r\n * @returns the depth min z\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public override getDepthMinZ(_activeCamera: Nullable<Camera>): number {\r\n const engine = this._scene.getEngine();\r\n return !engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\r\n }\r\n\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n *\r\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\r\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\r\n * (when not using reverse depth buffer / NDC half Z range)\r\n * @param _activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public override getDepthMaxZ(_activeCamera: Nullable<Camera>): number {\r\n const engine = this._scene.getEngine();\r\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\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 prepareLightSpecificDefines(defines: any, lightIndex: number): void {\r\n defines[\"DIRLIGHT\" + lightIndex] = true;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for directionalLight.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterDirectionalLight(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n Node.AddNodeConstructor(\"Light_Type_1\", (name, scene) => {\r\n return () => new DirectionalLight(name, Vector3.Zero(), scene);\r\n });\r\n\r\n // Register Class Name\r\n RegisterClass(\"BABYLON.DirectionalLight\", DirectionalLight);\r\n}\r\n"]}
@@ -130,7 +130,7 @@ export interface ISceneLoaderPluginBase extends ISceneLoaderPluginMetadata {
130
130
  * @param name defines the name of the file when loading a binary file
131
131
  * @returns a file request object
132
132
  */
133
- loadFile?(scene: Scene, fileOrUrl: File | string | ArrayBufferView, rootUrl: string, onSuccess: (data: unknown, responseURL?: string) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void, name?: string): Nullable<IFileRequest>;
133
+ loadFile?(scene: Scene, fileOrUrl: File | string | ArrayBufferView | object, rootUrl: string, onSuccess: (data: unknown, responseURL?: string) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void, name?: string): Nullable<IFileRequest>;
134
134
  /**
135
135
  * The callback that returns the data to pass to the plugin if the data can be directly loaded.
136
136
  * @param scene scene loading this data
@@ -303,7 +303,7 @@ async function loadDataAsync(fileInfo, scene, onProgress, pluginExtension, name,
303
303
  }
304
304
  try {
305
305
  request = plugin.loadFile
306
- ? plugin.loadFile(scene, fileInfo.rawData || fileInfo.file || fileInfo.url, fileInfo.rootUrl, dataCallback, onProgress, useArrayBuffer, errorCallback, name)
306
+ ? plugin.loadFile(scene, fileInfo.jsonData || fileInfo.rawData || fileInfo.file || fileInfo.url, fileInfo.rootUrl, dataCallback, onProgress, useArrayBuffer, errorCallback, name)
307
307
  : scene._loadFile(fileInfo.jsonData || fileInfo.file || fileInfo.url, dataCallback, onProgress, true, useArrayBuffer, errorCallback);
308
308
  }
309
309
  catch (error) {