@onerjs/core 9.0.2 → 9.0.3

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 (473) 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/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +4 -4
  153. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
  154. package/Materials/Node/Blocks/Dual/lightBlock.pure.js +1 -1
  155. package/Materials/Node/Blocks/Dual/lightBlock.pure.js.map +1 -1
  156. package/Materials/Node/Blocks/Input/inputBlock.pure.js +4 -0
  157. package/Materials/Node/Blocks/Input/inputBlock.pure.js.map +1 -1
  158. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.d.ts +9 -0
  159. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +23 -3
  160. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
  161. package/Materials/PBR/openpbrMaterial.pure.js +1 -1
  162. package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
  163. package/Materials/PBR/pbrBaseMaterial.pure.d.ts +9 -0
  164. package/Materials/PBR/pbrBaseMaterial.pure.js +60 -1
  165. package/Materials/PBR/pbrBaseMaterial.pure.js.map +1 -1
  166. package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +11 -0
  167. package/Materials/PBR/pbrBaseSimpleMaterial.js +21 -2
  168. package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
  169. package/Materials/PBR/pbrMaterial.pure.d.ts +12 -0
  170. package/Materials/PBR/pbrMaterial.pure.js +23 -3
  171. package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
  172. package/Materials/Textures/Filtering/hdrIrradianceFiltering.d.ts +1 -0
  173. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js +10 -0
  174. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js.map +1 -1
  175. package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +5 -0
  176. package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +7 -0
  177. package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -1
  178. package/Materials/Textures/HTML/htmlInteractionManager.d.ts +9 -3
  179. package/Materials/Textures/HTML/htmlInteractionManager.js +64 -5
  180. package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -1
  181. package/Materials/Textures/HTML/htmlTexture.d.ts +11 -11
  182. package/Materials/Textures/HTML/htmlTexture.js +106 -65
  183. package/Materials/Textures/HTML/htmlTexture.js.map +1 -1
  184. package/Materials/Textures/Loaders/internalTextureLoader.d.ts +2 -1
  185. package/Materials/Textures/Loaders/internalTextureLoader.js.map +1 -1
  186. package/Materials/Textures/Loaders/ktxTextureLoader.d.ts +2 -1
  187. package/Materials/Textures/Loaders/ktxTextureLoader.js +4 -50
  188. package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
  189. package/Materials/Textures/Procedurals/proceduralTexture.pure.js +10 -0
  190. package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
  191. package/Materials/Textures/dynamicTexture.pure.js +6 -0
  192. package/Materials/Textures/dynamicTexture.pure.js.map +1 -1
  193. package/Materials/Textures/ktx2encoderTypes.d.ts +51 -0
  194. package/Materials/Textures/ktx2encoderTypes.js +2 -0
  195. package/Materials/Textures/ktx2encoderTypes.js.map +1 -0
  196. package/Materials/Textures/renderTargetTexture.pure.js +10 -2
  197. package/Materials/Textures/renderTargetTexture.pure.js.map +1 -1
  198. package/Materials/Textures/textureMerger.d.ts +11 -0
  199. package/Materials/Textures/textureMerger.js +34 -19
  200. package/Materials/Textures/textureMerger.js.map +1 -1
  201. package/Materials/Textures/textureProcessor.d.ts +145 -0
  202. package/Materials/Textures/textureProcessor.js +445 -45
  203. package/Materials/Textures/textureProcessor.js.map +1 -1
  204. package/Materials/Textures/textureSampling.functions.d.ts +41 -0
  205. package/Materials/Textures/textureSampling.functions.js +82 -0
  206. package/Materials/Textures/textureSampling.functions.js.map +1 -0
  207. package/Materials/drawWrapper.d.ts +8 -0
  208. package/Materials/drawWrapper.js +19 -0
  209. package/Materials/drawWrapper.js.map +1 -1
  210. package/Materials/effect.pure.d.ts +6 -0
  211. package/Materials/effect.pure.js +28 -6
  212. package/Materials/effect.pure.js.map +1 -1
  213. package/Materials/effect.webgl.functions.pure.js +1 -1
  214. package/Materials/effect.webgl.functions.pure.js.map +1 -1
  215. package/Materials/material.pure.d.ts +5 -0
  216. package/Materials/material.pure.js +9 -2
  217. package/Materials/material.pure.js.map +1 -1
  218. package/Materials/materialFlags.d.ts +6 -0
  219. package/Materials/materialFlags.js +14 -0
  220. package/Materials/materialFlags.js.map +1 -1
  221. package/Materials/materialHelper.functions.d.ts +2 -1
  222. package/Materials/materialHelper.functions.js +36 -2
  223. package/Materials/materialHelper.functions.js.map +1 -1
  224. package/Materials/materialHelper.geometryrendering.js +19 -16
  225. package/Materials/materialHelper.geometryrendering.js.map +1 -1
  226. package/Materials/materialPluginManager.pure.js +12 -8
  227. package/Materials/materialPluginManager.pure.js.map +1 -1
  228. package/Materials/prePassConfiguration.js +19 -16
  229. package/Materials/prePassConfiguration.js.map +1 -1
  230. package/Materials/shaderMaterial.pure.js +19 -6
  231. package/Materials/shaderMaterial.pure.js.map +1 -1
  232. package/Materials/shadowDepthWrapper.d.ts +6 -0
  233. package/Materials/shadowDepthWrapper.js +17 -0
  234. package/Materials/shadowDepthWrapper.js.map +1 -1
  235. package/Meshes/Compression/dracoCodec.d.ts +14 -0
  236. package/Meshes/Compression/dracoCodec.js +22 -0
  237. package/Meshes/Compression/dracoCodec.js.map +1 -1
  238. package/Meshes/Compression/dracoDecoder.d.ts +1 -0
  239. package/Meshes/Compression/dracoDecoder.js +27 -0
  240. package/Meshes/Compression/dracoDecoder.js.map +1 -1
  241. package/Meshes/Compression/dracoEncoder.d.ts +1 -0
  242. package/Meshes/Compression/dracoEncoder.js +8 -0
  243. package/Meshes/Compression/dracoEncoder.js.map +1 -1
  244. package/Meshes/Compression/meshoptCompression.d.ts +1 -0
  245. package/Meshes/Compression/meshoptCompression.js +9 -0
  246. package/Meshes/Compression/meshoptCompression.js.map +1 -1
  247. package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.d.ts +415 -0
  248. package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.js +912 -0
  249. package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.js.map +1 -0
  250. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +3 -0
  251. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +40 -9
  252. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  253. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +112 -8
  254. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +696 -74
  255. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  256. package/Meshes/abstractMesh.pure.js +12 -4
  257. package/Meshes/abstractMesh.pure.js.map +1 -1
  258. package/Meshes/geometry.d.ts +5 -0
  259. package/Meshes/geometry.js +25 -0
  260. package/Meshes/geometry.js.map +1 -1
  261. package/Meshes/index.d.ts +1 -0
  262. package/Meshes/index.js +1 -0
  263. package/Meshes/index.js.map +1 -1
  264. package/Meshes/mesh.pure.d.ts +7 -0
  265. package/Meshes/mesh.pure.js +18 -13
  266. package/Meshes/mesh.pure.js.map +1 -1
  267. package/Meshes/pure.d.ts +1 -0
  268. package/Meshes/pure.js +1 -0
  269. package/Meshes/pure.js.map +1 -1
  270. package/Meshes/subMesh.pure.d.ts +3 -0
  271. package/Meshes/subMesh.pure.js +26 -0
  272. package/Meshes/subMesh.pure.js.map +1 -1
  273. package/Meshes/thinInstanceMesh.pure.js +5 -3
  274. package/Meshes/thinInstanceMesh.pure.js.map +1 -1
  275. package/Misc/index.d.ts +1 -0
  276. package/Misc/index.js +1 -0
  277. package/Misc/index.js.map +1 -1
  278. package/Misc/khronosTextureContainer2.d.ts +3 -2
  279. package/Misc/khronosTextureContainer2.js +24 -6
  280. package/Misc/khronosTextureContainer2.js.map +1 -1
  281. package/Misc/khronosTextureContainer2Encoder.d.ts +166 -0
  282. package/Misc/khronosTextureContainer2Encoder.js +556 -0
  283. package/Misc/khronosTextureContainer2Encoder.js.map +1 -0
  284. package/Misc/khronosTextureContainer2EncoderWorker.d.ts +61 -0
  285. package/Misc/khronosTextureContainer2EncoderWorker.js +55 -0
  286. package/Misc/khronosTextureContainer2EncoderWorker.js.map +1 -0
  287. package/Misc/pure.d.ts +1 -0
  288. package/Misc/pure.js +1 -0
  289. package/Misc/pure.js.map +1 -1
  290. package/Misc/textureFormat.functions.d.ts +6 -0
  291. package/Misc/textureFormat.functions.js +54 -0
  292. package/Misc/textureFormat.functions.js.map +1 -0
  293. package/Misc/textureTools.d.ts +6 -2
  294. package/Misc/textureTools.js +100 -42
  295. package/Misc/textureTools.js.map +1 -1
  296. package/Misc/tools.pure.js +1 -1
  297. package/Misc/tools.pure.js.map +1 -1
  298. package/Particles/Node/Blocks/systemBlock.pure.d.ts +1 -1
  299. package/Particles/Node/Blocks/systemBlock.pure.js +6 -3
  300. package/Particles/Node/Blocks/systemBlock.pure.js.map +1 -1
  301. package/Particles/computeShaderParticleSystem.pure.js +5 -0
  302. package/Particles/computeShaderParticleSystem.pure.js.map +1 -1
  303. package/Particles/gpuParticleSystem.pure.d.ts +2 -0
  304. package/Particles/gpuParticleSystem.pure.js +25 -1
  305. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  306. package/Particles/solidParticle.d.ts +5 -0
  307. package/Particles/solidParticle.js +5 -0
  308. package/Particles/solidParticle.js.map +1 -1
  309. package/Particles/solidParticleSystem.d.ts +10 -0
  310. package/Particles/solidParticleSystem.js +72 -13
  311. package/Particles/solidParticleSystem.js.map +1 -1
  312. package/Particles/thinParticleSystem.pure.js +4 -0
  313. package/Particles/thinParticleSystem.pure.js.map +1 -1
  314. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.d.ts +27 -6
  315. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.js +60 -5
  316. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.js.map +1 -1
  317. package/PostProcesses/thinTAAPostProcess.d.ts +1 -0
  318. package/PostProcesses/thinTAAPostProcess.js +17 -1
  319. package/PostProcesses/thinTAAPostProcess.js.map +1 -1
  320. package/PostProcesses/volumetricLightScatteringPostProcess.pure.d.ts +2 -1
  321. package/PostProcesses/volumetricLightScatteringPostProcess.pure.js +6 -5
  322. package/PostProcesses/volumetricLightScatteringPostProcess.pure.js.map +1 -1
  323. package/Rendering/boundingBoxRenderer.pure.js +2 -3
  324. package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
  325. package/Rendering/geometryBufferRenderer.pure.js +8 -2
  326. package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
  327. package/Rendering/objectRenderer.d.ts +1 -0
  328. package/Rendering/objectRenderer.js +14 -0
  329. package/Rendering/objectRenderer.js.map +1 -1
  330. package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js +2 -2
  331. package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
  332. package/Shaders/ShadersInclude/bumpVertex.js +1 -1
  333. package/Shaders/ShadersInclude/bumpVertex.js.map +1 -1
  334. package/Shaders/ShadersInclude/bumpVertexDeclaration.js +1 -1
  335. package/Shaders/ShadersInclude/bumpVertexDeclaration.js.map +1 -1
  336. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +5 -1
  337. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  338. package/Shaders/ShadersInclude/helperFunctions.js +2 -2
  339. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  340. package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
  341. package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
  342. package/Shaders/ShadersInclude/openpbrVertexDeclaration.js +6 -0
  343. package/Shaders/ShadersInclude/openpbrVertexDeclaration.js.map +1 -1
  344. package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js +11 -1
  345. package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
  346. package/Shaders/ShadersInclude/pbrBlockNormalFinal.js +9 -0
  347. package/Shaders/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
  348. package/Shaders/ShadersInclude/pbrBlockReflectance.js +1 -1
  349. package/Shaders/ShadersInclude/pbrBlockReflectance.js.map +1 -1
  350. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
  351. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
  352. package/Shaders/ShadersInclude/pbrFragmentDeclaration.js +7 -1
  353. package/Shaders/ShadersInclude/pbrFragmentDeclaration.js.map +1 -1
  354. package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +1 -0
  355. package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
  356. package/Shaders/ShadersInclude/pbrIBLFunctions.js +12 -0
  357. package/Shaders/ShadersInclude/pbrIBLFunctions.js.map +1 -1
  358. package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
  359. package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  360. package/Shaders/ShadersInclude/pbrVertexDeclaration.js +3 -0
  361. package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
  362. package/Shaders/geometry.vertex.js +6 -6
  363. package/Shaders/geometry.vertex.js.map +1 -1
  364. package/Shaders/gpuUpdateParticles.vertex.js +1 -1
  365. package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
  366. package/Shaders/lod.fragment.js +15 -2
  367. package/Shaders/lod.fragment.js.map +1 -1
  368. package/Shaders/lod3D.fragment.js +15 -2
  369. package/Shaders/lod3D.fragment.js.map +1 -1
  370. package/Shaders/lodCube.fragment.js +15 -2
  371. package/Shaders/lodCube.fragment.js.map +1 -1
  372. package/Shaders/openpbr.vertex.js +2 -0
  373. package/Shaders/openpbr.vertex.js.map +1 -1
  374. package/Shaders/pbr.fragment.js +12 -1
  375. package/Shaders/pbr.fragment.js.map +1 -1
  376. package/Shaders/pbr.vertex.js +2 -0
  377. package/Shaders/pbr.vertex.js.map +1 -1
  378. package/Shaders/textureMerger.fragment.js +28 -0
  379. package/Shaders/textureMerger.fragment.js.map +1 -1
  380. package/Shaders/textureProcessor.fragment.js +26 -4
  381. package/Shaders/textureProcessor.fragment.js.map +1 -1
  382. package/Shaders/volumetricLightScattering.fragment.js +1 -1
  383. package/Shaders/volumetricLightScattering.fragment.js.map +1 -1
  384. package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js +2 -2
  385. package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
  386. package/ShadersWGSL/ShadersInclude/bumpVertex.js +1 -1
  387. package/ShadersWGSL/ShadersInclude/bumpVertex.js.map +1 -1
  388. package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.js +1 -1
  389. package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.js.map +1 -1
  390. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +1 -1
  391. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  392. package/ShadersWGSL/ShadersInclude/helperFunctions.js +2 -2
  393. package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
  394. package/ShadersWGSL/ShadersInclude/lightFragment.js +44 -2
  395. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  396. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +17 -3
  397. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
  398. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js +12 -1
  399. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
  400. package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
  401. package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
  402. package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js +11 -1
  403. package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
  404. package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js +9 -0
  405. package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
  406. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js +1 -1
  407. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js.map +1 -1
  408. package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
  409. package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
  410. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js +1 -1
  411. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
  412. package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +1 -0
  413. package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
  414. package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js +8 -0
  415. package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js.map +1 -1
  416. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
  417. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  418. package/ShadersWGSL/ShadersInclude/prePassVertex.js +2 -2
  419. package/ShadersWGSL/ShadersInclude/prePassVertex.js.map +1 -1
  420. package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js +1 -1
  421. package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js.map +1 -1
  422. package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js +3 -1
  423. package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js.map +1 -1
  424. package/ShadersWGSL/ShadersInclude/shadowsVertex.js +16 -0
  425. package/ShadersWGSL/ShadersInclude/shadowsVertex.js.map +1 -1
  426. package/ShadersWGSL/default.fragment.js +4 -4
  427. package/ShadersWGSL/default.fragment.js.map +1 -1
  428. package/ShadersWGSL/default.vertex.js +1 -1
  429. package/ShadersWGSL/default.vertex.js.map +1 -1
  430. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
  431. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  432. package/ShadersWGSL/gpuUpdateParticles.compute.js +1 -1
  433. package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
  434. package/ShadersWGSL/gsSortCount.compute.d.ts +5 -0
  435. package/ShadersWGSL/gsSortCount.compute.js +19 -0
  436. package/ShadersWGSL/gsSortCount.compute.js.map +1 -0
  437. package/ShadersWGSL/gsSortKeys.compute.d.ts +5 -0
  438. package/ShadersWGSL/gsSortKeys.compute.js +49 -0
  439. package/ShadersWGSL/gsSortKeys.compute.js.map +1 -0
  440. package/ShadersWGSL/gsSortOutput.compute.d.ts +5 -0
  441. package/ShadersWGSL/gsSortOutput.compute.js +28 -0
  442. package/ShadersWGSL/gsSortOutput.compute.js.map +1 -0
  443. package/ShadersWGSL/gsSortScanLocal.compute.d.ts +5 -0
  444. package/ShadersWGSL/gsSortScanLocal.compute.js +23 -0
  445. package/ShadersWGSL/gsSortScanLocal.compute.js.map +1 -0
  446. package/ShadersWGSL/gsSortScanSums.compute.d.ts +5 -0
  447. package/ShadersWGSL/gsSortScanSums.compute.js +19 -0
  448. package/ShadersWGSL/gsSortScanSums.compute.js.map +1 -0
  449. package/ShadersWGSL/gsSortScatter.compute.d.ts +5 -0
  450. package/ShadersWGSL/gsSortScatter.compute.js +33 -0
  451. package/ShadersWGSL/gsSortScatter.compute.js.map +1 -0
  452. package/ShadersWGSL/lod.fragment.js +14 -2
  453. package/ShadersWGSL/lod.fragment.js.map +1 -1
  454. package/ShadersWGSL/lod3D.fragment.js +14 -2
  455. package/ShadersWGSL/lod3D.fragment.js.map +1 -1
  456. package/ShadersWGSL/lodCube.fragment.js +14 -2
  457. package/ShadersWGSL/lodCube.fragment.js.map +1 -1
  458. package/ShadersWGSL/openpbr.vertex.js +3 -1
  459. package/ShadersWGSL/openpbr.vertex.js.map +1 -1
  460. package/ShadersWGSL/pbr.fragment.js +11 -0
  461. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  462. package/ShadersWGSL/pbr.vertex.js +3 -1
  463. package/ShadersWGSL/pbr.vertex.js.map +1 -1
  464. package/ShadersWGSL/textureMerger.fragment.js +40 -4
  465. package/ShadersWGSL/textureMerger.fragment.js.map +1 -1
  466. package/ShadersWGSL/textureProcessor.fragment.js +26 -4
  467. package/ShadersWGSL/textureProcessor.fragment.js.map +1 -1
  468. package/Sprites/spriteRenderer.js +15 -5
  469. package/Sprites/spriteRenderer.js.map +1 -1
  470. package/package.json +1 -1
  471. package/scene.pure.d.ts +23 -1
  472. package/scene.pure.js +83 -1
  473. package/scene.pure.js.map +1 -1
@@ -241,6 +241,11 @@ export declare class ModelShape {
241
241
  * @internal
242
242
  */
243
243
  _indices: number[];
244
+ /**
245
+ * The winding convention of the stored indices, independent of scene handedness.
246
+ * @internal
247
+ */
248
+ _indicesSideOrientation: Nullable<number>;
244
249
  /**
245
250
  * normals array of the model
246
251
  * @internal
@@ -291,6 +291,11 @@ export class ModelShape {
291
291
  * @internal
292
292
  */
293
293
  constructor(id, shape, indices, normals, colors, shapeUV, posFunction, vtxFunction, material) {
294
+ /**
295
+ * The winding convention of the stored indices, independent of scene handedness.
296
+ * @internal
297
+ */
298
+ this._indicesSideOrientation = null;
294
299
  /**
295
300
  * length of the shape in the model indices array (internal use)
296
301
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"solidParticle.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/solidParticle.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AA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AC,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC7B,CAAC;IACD,6CAA6C;IAC7C,0BAA0B;IAC1B,IAAW,CAAC;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAW,CAAC,CAAC,GAAW;QACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1B,CAAC;IACD,0BAA0B;IAC1B,IAAW,CAAC;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAW,CAAC,CAAC,GAAW;QACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1B,CAAC;IACD,0BAA0B;IAC1B,IAAW,CAAC;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAW,CAAC,CAAC,GAAW;QACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["import { type Nullable } from \"../types\";\r\nimport { type Matrix, Vector3, TmpVectors, Quaternion, Vector4, Vector2 } from \"../Maths/math.vector.pure\";\r\nimport { Color4 } from \"../Maths/math.color.pure\";\r\nimport { type Mesh } from \"../Meshes/mesh\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { BoundingSphere } from \"../Culling/boundingSphere\";\r\nimport { type SolidParticleSystem } from \"./solidParticleSystem\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh.pure\";\r\nimport { type Plane } from \"../Maths/math.plane\";\r\nimport { type Material } from \"../Materials/material\";\r\n/**\r\n * Represents one particle of a solid particle system.\r\n */\r\nexport class SolidParticle {\r\n /**\r\n * particle global index\r\n */\r\n public idx: number = 0;\r\n /**\r\n * particle identifier\r\n */\r\n public id: number = 0;\r\n /**\r\n * The color of the particle\r\n */\r\n public color: Nullable<Color4> = new Color4(1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * The world space position of the particle.\r\n */\r\n public position: Vector3 = Vector3.Zero();\r\n /**\r\n * The world space rotation of the particle. (Not use if rotationQuaternion is set)\r\n */\r\n public rotation: Vector3 = Vector3.Zero();\r\n /**\r\n * The world space rotation quaternion of the particle.\r\n */\r\n public rotationQuaternion: Nullable<Quaternion>;\r\n /**\r\n * The scaling of the particle.\r\n */\r\n public scaling: Vector3 = Vector3.One();\r\n /**\r\n * The uvs of the particle.\r\n */\r\n public uvs: Vector4 = new Vector4(0.0, 0.0, 1.0, 1.0);\r\n /**\r\n * The current speed of the particle.\r\n */\r\n public velocity: Vector3 = Vector3.Zero();\r\n /**\r\n * The pivot point in the particle local space.\r\n */\r\n public pivot: Vector3 = Vector3.Zero();\r\n /**\r\n * Must the particle be translated from its pivot point in its local space ?\r\n * In this case, the pivot point is set at the origin of the particle local space and the particle is translated.\r\n * Default : false\r\n */\r\n public translateFromPivot: boolean = false;\r\n /**\r\n * Is the particle active or not ?\r\n */\r\n public alive: boolean = true;\r\n /**\r\n * Is the particle visible or not ?\r\n */\r\n public isVisible: boolean = true;\r\n /**\r\n * Defines how long will the life of the particle be.\r\n * Set to Infinity for particles that should never die (default behavior for SolidParticleSystem).\r\n */\r\n public lifeTime = Infinity;\r\n /**\r\n * The current age of the particle.\r\n */\r\n public age = 0;\r\n /**\r\n * Index of this particle in the global \"positions\" array (Internal use)\r\n * @internal\r\n */\r\n public _pos: number = 0;\r\n /**\r\n * @internal Index of this particle in the global \"indices\" array (Internal use)\r\n */\r\n public _ind: number = 0;\r\n /**\r\n * @internal ModelShape of this particle (Internal use)\r\n */\r\n public _model: ModelShape;\r\n /**\r\n * ModelShape id of this particle\r\n */\r\n public shapeId: number = 0;\r\n /**\r\n * Index of the particle in its shape id\r\n */\r\n public idxInShape: number = 0;\r\n /**\r\n * @internal Reference to the shape model BoundingInfo object (Internal use)\r\n */\r\n public _modelBoundingInfo: BoundingInfo;\r\n private _boundingInfo: BoundingInfo;\r\n /**\r\n * @internal Reference to the SPS what the particle belongs to (Internal use)\r\n */\r\n public _sps: SolidParticleSystem;\r\n /**\r\n * @internal Still set as invisible in order to skip useless computations (Internal use)\r\n */\r\n public _stillInvisible: boolean = false;\r\n /**\r\n * @internal Last computed particle rotation matrix\r\n */\r\n public _rotationMatrix: number[] = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0];\r\n /**\r\n * Parent particle Id, if any.\r\n * Default null.\r\n */\r\n public parentId: Nullable<number> = null;\r\n /**\r\n * The particle material identifier (integer) when MultiMaterials are enabled in the SPS.\r\n */\r\n public materialIndex: Nullable<number> = null;\r\n /**\r\n * Custom object or properties.\r\n */\r\n public props: Nullable<any> = null;\r\n /**\r\n * The culling strategy to use to check whether the solid particle must be culled or not when using isInFrustum().\r\n * The possible values are :\r\n * - AbstractMesh.CULLINGSTRATEGY_STANDARD\r\n * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY\r\n * The default value for solid particles is AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * Please read each static variable documentation in the class AbstractMesh to get details about the culling process.\r\n * */\r\n public cullingStrategy = AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY;\r\n\r\n /**\r\n * @internal Internal global position in the SPS.\r\n */\r\n public _globalPosition: Vector3 = Vector3.Zero();\r\n\r\n /**\r\n * Particle BoundingInfo object\r\n * @returns a BoundingInfo\r\n */\r\n public getBoundingInfo(): BoundingInfo {\r\n return this._boundingInfo;\r\n }\r\n\r\n /**\r\n * Returns true if there is already a bounding info\r\n */\r\n public get hasBoundingInfo(): boolean {\r\n return this._boundingInfo !== null;\r\n }\r\n\r\n /**\r\n * Creates a Solid Particle object.\r\n * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()\r\n * @param particleIndex (integer) is the particle index in the Solid Particle System pool.\r\n * @param particleId (integer) is the particle identifier. Unless some particles are removed from the SPS, it's the same value than the particle idx.\r\n * @param positionIndex (integer) is the starting index of the particle vertices in the SPS \"positions\" array.\r\n * @param indiceIndex (integer) is the starting index of the particle indices in the SPS \"indices\" array.\r\n * @param model (ModelShape) is a reference to the model shape on what the particle is designed.\r\n * @param shapeId (integer) is the model shape identifier in the SPS.\r\n * @param idxInShape (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))\r\n * @param sps defines the sps it is associated to\r\n * @param modelBoundingInfo is the reference to the model BoundingInfo used for intersection computations.\r\n * @param materialIndex is the particle material identifier (integer) when the MultiMaterials are enabled in the SPS.\r\n */\r\n constructor(\r\n particleIndex: number,\r\n particleId: number,\r\n positionIndex: number,\r\n indiceIndex: number,\r\n model: Nullable<ModelShape>,\r\n shapeId: number,\r\n idxInShape: number,\r\n sps: SolidParticleSystem,\r\n modelBoundingInfo: Nullable<BoundingInfo> = null,\r\n materialIndex: Nullable<number> = null\r\n ) {\r\n this.idx = particleIndex;\r\n this.id = particleId;\r\n this._pos = positionIndex;\r\n this._ind = indiceIndex;\r\n this._model = <ModelShape>model;\r\n this.shapeId = shapeId;\r\n this.idxInShape = idxInShape;\r\n this._sps = sps;\r\n if (modelBoundingInfo) {\r\n this._modelBoundingInfo = modelBoundingInfo;\r\n this._boundingInfo = new BoundingInfo(modelBoundingInfo.minimum, modelBoundingInfo.maximum);\r\n }\r\n if (materialIndex !== null) {\r\n this.materialIndex = materialIndex;\r\n }\r\n }\r\n /**\r\n * Copies the particle property values into the existing target : position, rotation, scaling, uvs, colors, pivot, parent, visibility, alive\r\n * @param target the particle target\r\n * @returns the current particle\r\n */\r\n public copyToRef(target: SolidParticle): SolidParticle {\r\n target.position.copyFrom(this.position);\r\n target.rotation.copyFrom(this.rotation);\r\n if (this.rotationQuaternion) {\r\n if (target.rotationQuaternion) {\r\n target.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n } else {\r\n target.rotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n }\r\n target.scaling.copyFrom(this.scaling);\r\n if (this.color) {\r\n if (target.color) {\r\n target.color.copyFrom(this.color);\r\n } else {\r\n target.color = this.color.clone();\r\n }\r\n }\r\n target.uvs.copyFrom(this.uvs);\r\n target.velocity.copyFrom(this.velocity);\r\n target.pivot.copyFrom(this.pivot);\r\n target.translateFromPivot = this.translateFromPivot;\r\n target.alive = this.alive;\r\n target.isVisible = this.isVisible;\r\n target.parentId = this.parentId;\r\n target.cullingStrategy = this.cullingStrategy;\r\n target.lifeTime = this.lifeTime;\r\n target.age = this.age;\r\n if (this.materialIndex !== null) {\r\n target.materialIndex = this.materialIndex;\r\n }\r\n return this;\r\n }\r\n /**\r\n * Legacy support, changed scale to scaling\r\n */\r\n public get scale(): Vector3 {\r\n return this.scaling;\r\n }\r\n\r\n /**\r\n * Legacy support, changed scale to scaling\r\n */\r\n public set scale(scale: Vector3) {\r\n this.scaling = scale;\r\n }\r\n\r\n /**\r\n * Legacy support, changed quaternion to rotationQuaternion\r\n */\r\n public get quaternion(): Nullable<Quaternion> {\r\n return this.rotationQuaternion;\r\n }\r\n\r\n /**\r\n * Legacy support, changed quaternion to rotationQuaternion\r\n */\r\n public set quaternion(q: Nullable<Quaternion>) {\r\n this.rotationQuaternion = q;\r\n }\r\n\r\n /**\r\n * Returns a boolean. True if the particle intersects another particle or another mesh, else false.\r\n * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)\r\n * @param target is the object (solid particle or mesh) what the intersection is computed against.\r\n * @returns true if it intersects\r\n */\r\n public intersectsMesh(target: Mesh | SolidParticle): boolean {\r\n if (!this._boundingInfo || !target.hasBoundingInfo) {\r\n return false;\r\n }\r\n if (this._sps._bSphereOnly) {\r\n return BoundingSphere.Intersects(this._boundingInfo.boundingSphere, target.getBoundingInfo().boundingSphere);\r\n }\r\n return this._boundingInfo.intersects(target.getBoundingInfo(), false);\r\n }\r\n\r\n /**\r\n * Returns `true` if the solid particle is within the frustum defined by the passed array of planes.\r\n * A particle is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the particle is in the frustum planes\r\n */\r\n public isInFrustum(frustumPlanes: Plane[]): boolean {\r\n return this._boundingInfo !== null && this._boundingInfo.isInFrustum(frustumPlanes, this.cullingStrategy);\r\n }\r\n\r\n /**\r\n * get the rotation matrix of the particle\r\n * @internal\r\n */\r\n public getRotationMatrix(m: Matrix) {\r\n let quaternion: Quaternion;\r\n if (this.rotationQuaternion) {\r\n quaternion = this.rotationQuaternion;\r\n } else {\r\n quaternion = TmpVectors.Quaternion[0];\r\n const rotation = this.rotation;\r\n Quaternion.RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, quaternion);\r\n }\r\n\r\n quaternion.toRotationMatrix(m);\r\n }\r\n}\r\n\r\n/**\r\n * Represents the shape of the model used by one particle of a solid particle system.\r\n * SPS internal tool, don't use it manually.\r\n */\r\nexport class ModelShape {\r\n /**\r\n * Get or set the shapeId\r\n * @deprecated Please use shapeId instead\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public get shapeID(): number {\r\n return this.shapeId;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public set shapeID(shapeID: number) {\r\n this.shapeId = shapeID;\r\n }\r\n /**\r\n * The shape id\r\n * @internal\r\n */\r\n public shapeId: number;\r\n /**\r\n * flat array of model positions (internal use)\r\n * @internal\r\n */\r\n public _shape: Vector3[];\r\n /**\r\n * flat array of model UVs (internal use)\r\n * @internal\r\n */\r\n public _shapeUV: number[];\r\n /**\r\n * color array of the model\r\n * @internal\r\n */\r\n public _shapeColors: number[];\r\n /**\r\n * indices array of the model\r\n * @internal\r\n */\r\n public _indices: number[];\r\n /**\r\n * normals array of the model\r\n * @internal\r\n */\r\n public _normals: number[];\r\n /**\r\n * length of the shape in the model indices array (internal use)\r\n * @internal\r\n */\r\n public _indicesLength: number = 0;\r\n /**\r\n * Custom position function (internal use)\r\n * @internal\r\n */\r\n public _positionFunction: Nullable<(particle: SolidParticle, i: number, s: number) => void>;\r\n /**\r\n * Custom vertex function (internal use)\r\n * @internal\r\n */\r\n public _vertexFunction: Nullable<(particle: SolidParticle, vertex: Vector3, i: number) => void>;\r\n /**\r\n * Model material (internal use)\r\n * @internal\r\n */\r\n public _material: Nullable<Material>;\r\n\r\n /**\r\n * Creates a ModelShape object. This is an internal simplified reference to a mesh used as for a model to replicate particles from by the SPS.\r\n * SPS internal tool, don't use it manually.\r\n * @internal\r\n */\r\n constructor(\r\n id: number,\r\n shape: Vector3[],\r\n indices: number[],\r\n normals: number[],\r\n colors: number[],\r\n shapeUV: number[],\r\n posFunction: Nullable<(particle: SolidParticle, i: number, s: number) => void>,\r\n vtxFunction: Nullable<(particle: SolidParticle, vertex: Vector3, i: number) => void>,\r\n material: Nullable<Material>\r\n ) {\r\n this.shapeId = id;\r\n this._shape = shape;\r\n this._indices = indices;\r\n this._indicesLength = indices.length;\r\n this._shapeUV = shapeUV;\r\n this._shapeColors = colors;\r\n this._normals = normals;\r\n this._positionFunction = posFunction;\r\n this._vertexFunction = vtxFunction;\r\n this._material = material;\r\n }\r\n}\r\n\r\n/**\r\n * Represents a Depth Sorted Particle in the solid particle system.\r\n * @internal\r\n */\r\nexport class DepthSortedParticle {\r\n /**\r\n * Particle index\r\n */\r\n public idx: number = 0;\r\n /**\r\n * Index of the particle in the \"indices\" array\r\n */\r\n public ind: number = 0;\r\n /**\r\n * Length of the particle shape in the \"indices\" array\r\n */\r\n public indicesLength: number = 0;\r\n /**\r\n * Squared distance from the particle to the camera\r\n */\r\n public sqDistance: number = 0.0;\r\n /**\r\n * Material index when used with MultiMaterials\r\n */\r\n public materialIndex: number = 0;\r\n\r\n /**\r\n * Creates a new sorted particle\r\n * @param idx\r\n * @param ind\r\n * @param indLength\r\n * @param materialIndex\r\n */\r\n constructor(idx: number, ind: number, indLength: number, materialIndex: number) {\r\n this.idx = idx;\r\n this.ind = ind;\r\n this.indicesLength = indLength;\r\n this.materialIndex = materialIndex;\r\n }\r\n}\r\n\r\n/**\r\n * Represents a solid particle vertex\r\n */\r\nexport class SolidParticleVertex {\r\n /**\r\n * Vertex position\r\n */\r\n public position: Vector3;\r\n /**\r\n * Vertex color\r\n */\r\n public color: Color4;\r\n /**\r\n * Vertex UV\r\n */\r\n public uv: Vector2;\r\n /**\r\n * Creates a new solid particle vertex\r\n */\r\n constructor() {\r\n this.position = Vector3.Zero();\r\n this.color = new Color4(1.0, 1.0, 1.0, 1.0);\r\n this.uv = Vector2.Zero();\r\n }\r\n // Getters and Setters for back-compatibility\r\n /** Vertex x coordinate */\r\n public get x(): number {\r\n return this.position.x;\r\n }\r\n public set x(val: number) {\r\n this.position.x = val;\r\n }\r\n /** Vertex y coordinate */\r\n public get y(): number {\r\n return this.position.y;\r\n }\r\n public set y(val: number) {\r\n this.position.y = val;\r\n }\r\n /** Vertex z coordinate */\r\n public get z(): number {\r\n return this.position.z;\r\n }\r\n public set z(val: number) {\r\n this.position.z = val;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"solidParticle.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/solidParticle.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAC3G,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D;;GAEG;AACH,MAAM,OAAO,aAAa;IAoItB;;;OAGG;IACI,eAAe;QAClB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,eAAe;QAC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;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAW,CAAC,CAAC,GAAW;QACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1B,CAAC;IACD,0BAA0B;IAC1B,IAAW,CAAC;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAW,CAAC,CAAC,GAAW;QACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["import { type Nullable } from \"../types\";\r\nimport { type Matrix, Vector3, TmpVectors, Quaternion, Vector4, Vector2 } from \"../Maths/math.vector.pure\";\r\nimport { Color4 } from \"../Maths/math.color.pure\";\r\nimport { type Mesh } from \"../Meshes/mesh\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { BoundingSphere } from \"../Culling/boundingSphere\";\r\nimport { type SolidParticleSystem } from \"./solidParticleSystem\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh.pure\";\r\nimport { type Plane } from \"../Maths/math.plane\";\r\nimport { type Material } from \"../Materials/material\";\r\n/**\r\n * Represents one particle of a solid particle system.\r\n */\r\nexport class SolidParticle {\r\n /**\r\n * particle global index\r\n */\r\n public idx: number = 0;\r\n /**\r\n * particle identifier\r\n */\r\n public id: number = 0;\r\n /**\r\n * The color of the particle\r\n */\r\n public color: Nullable<Color4> = new Color4(1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * The world space position of the particle.\r\n */\r\n public position: Vector3 = Vector3.Zero();\r\n /**\r\n * The world space rotation of the particle. (Not use if rotationQuaternion is set)\r\n */\r\n public rotation: Vector3 = Vector3.Zero();\r\n /**\r\n * The world space rotation quaternion of the particle.\r\n */\r\n public rotationQuaternion: Nullable<Quaternion>;\r\n /**\r\n * The scaling of the particle.\r\n */\r\n public scaling: Vector3 = Vector3.One();\r\n /**\r\n * The uvs of the particle.\r\n */\r\n public uvs: Vector4 = new Vector4(0.0, 0.0, 1.0, 1.0);\r\n /**\r\n * The current speed of the particle.\r\n */\r\n public velocity: Vector3 = Vector3.Zero();\r\n /**\r\n * The pivot point in the particle local space.\r\n */\r\n public pivot: Vector3 = Vector3.Zero();\r\n /**\r\n * Must the particle be translated from its pivot point in its local space ?\r\n * In this case, the pivot point is set at the origin of the particle local space and the particle is translated.\r\n * Default : false\r\n */\r\n public translateFromPivot: boolean = false;\r\n /**\r\n * Is the particle active or not ?\r\n */\r\n public alive: boolean = true;\r\n /**\r\n * Is the particle visible or not ?\r\n */\r\n public isVisible: boolean = true;\r\n /**\r\n * Defines how long will the life of the particle be.\r\n * Set to Infinity for particles that should never die (default behavior for SolidParticleSystem).\r\n */\r\n public lifeTime = Infinity;\r\n /**\r\n * The current age of the particle.\r\n */\r\n public age = 0;\r\n /**\r\n * Index of this particle in the global \"positions\" array (Internal use)\r\n * @internal\r\n */\r\n public _pos: number = 0;\r\n /**\r\n * @internal Index of this particle in the global \"indices\" array (Internal use)\r\n */\r\n public _ind: number = 0;\r\n /**\r\n * @internal ModelShape of this particle (Internal use)\r\n */\r\n public _model: ModelShape;\r\n /**\r\n * ModelShape id of this particle\r\n */\r\n public shapeId: number = 0;\r\n /**\r\n * Index of the particle in its shape id\r\n */\r\n public idxInShape: number = 0;\r\n /**\r\n * @internal Reference to the shape model BoundingInfo object (Internal use)\r\n */\r\n public _modelBoundingInfo: BoundingInfo;\r\n private _boundingInfo: BoundingInfo;\r\n /**\r\n * @internal Reference to the SPS what the particle belongs to (Internal use)\r\n */\r\n public _sps: SolidParticleSystem;\r\n /**\r\n * @internal Still set as invisible in order to skip useless computations (Internal use)\r\n */\r\n public _stillInvisible: boolean = false;\r\n /**\r\n * @internal Last computed particle rotation matrix\r\n */\r\n public _rotationMatrix: number[] = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0];\r\n /**\r\n * Parent particle Id, if any.\r\n * Default null.\r\n */\r\n public parentId: Nullable<number> = null;\r\n /**\r\n * The particle material identifier (integer) when MultiMaterials are enabled in the SPS.\r\n */\r\n public materialIndex: Nullable<number> = null;\r\n /**\r\n * Custom object or properties.\r\n */\r\n public props: Nullable<any> = null;\r\n /**\r\n * The culling strategy to use to check whether the solid particle must be culled or not when using isInFrustum().\r\n * The possible values are :\r\n * - AbstractMesh.CULLINGSTRATEGY_STANDARD\r\n * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY\r\n * The default value for solid particles is AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * Please read each static variable documentation in the class AbstractMesh to get details about the culling process.\r\n * */\r\n public cullingStrategy = AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY;\r\n\r\n /**\r\n * @internal Internal global position in the SPS.\r\n */\r\n public _globalPosition: Vector3 = Vector3.Zero();\r\n\r\n /**\r\n * Particle BoundingInfo object\r\n * @returns a BoundingInfo\r\n */\r\n public getBoundingInfo(): BoundingInfo {\r\n return this._boundingInfo;\r\n }\r\n\r\n /**\r\n * Returns true if there is already a bounding info\r\n */\r\n public get hasBoundingInfo(): boolean {\r\n return this._boundingInfo !== null;\r\n }\r\n\r\n /**\r\n * Creates a Solid Particle object.\r\n * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()\r\n * @param particleIndex (integer) is the particle index in the Solid Particle System pool.\r\n * @param particleId (integer) is the particle identifier. Unless some particles are removed from the SPS, it's the same value than the particle idx.\r\n * @param positionIndex (integer) is the starting index of the particle vertices in the SPS \"positions\" array.\r\n * @param indiceIndex (integer) is the starting index of the particle indices in the SPS \"indices\" array.\r\n * @param model (ModelShape) is a reference to the model shape on what the particle is designed.\r\n * @param shapeId (integer) is the model shape identifier in the SPS.\r\n * @param idxInShape (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))\r\n * @param sps defines the sps it is associated to\r\n * @param modelBoundingInfo is the reference to the model BoundingInfo used for intersection computations.\r\n * @param materialIndex is the particle material identifier (integer) when the MultiMaterials are enabled in the SPS.\r\n */\r\n constructor(\r\n particleIndex: number,\r\n particleId: number,\r\n positionIndex: number,\r\n indiceIndex: number,\r\n model: Nullable<ModelShape>,\r\n shapeId: number,\r\n idxInShape: number,\r\n sps: SolidParticleSystem,\r\n modelBoundingInfo: Nullable<BoundingInfo> = null,\r\n materialIndex: Nullable<number> = null\r\n ) {\r\n this.idx = particleIndex;\r\n this.id = particleId;\r\n this._pos = positionIndex;\r\n this._ind = indiceIndex;\r\n this._model = <ModelShape>model;\r\n this.shapeId = shapeId;\r\n this.idxInShape = idxInShape;\r\n this._sps = sps;\r\n if (modelBoundingInfo) {\r\n this._modelBoundingInfo = modelBoundingInfo;\r\n this._boundingInfo = new BoundingInfo(modelBoundingInfo.minimum, modelBoundingInfo.maximum);\r\n }\r\n if (materialIndex !== null) {\r\n this.materialIndex = materialIndex;\r\n }\r\n }\r\n /**\r\n * Copies the particle property values into the existing target : position, rotation, scaling, uvs, colors, pivot, parent, visibility, alive\r\n * @param target the particle target\r\n * @returns the current particle\r\n */\r\n public copyToRef(target: SolidParticle): SolidParticle {\r\n target.position.copyFrom(this.position);\r\n target.rotation.copyFrom(this.rotation);\r\n if (this.rotationQuaternion) {\r\n if (target.rotationQuaternion) {\r\n target.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n } else {\r\n target.rotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n }\r\n target.scaling.copyFrom(this.scaling);\r\n if (this.color) {\r\n if (target.color) {\r\n target.color.copyFrom(this.color);\r\n } else {\r\n target.color = this.color.clone();\r\n }\r\n }\r\n target.uvs.copyFrom(this.uvs);\r\n target.velocity.copyFrom(this.velocity);\r\n target.pivot.copyFrom(this.pivot);\r\n target.translateFromPivot = this.translateFromPivot;\r\n target.alive = this.alive;\r\n target.isVisible = this.isVisible;\r\n target.parentId = this.parentId;\r\n target.cullingStrategy = this.cullingStrategy;\r\n target.lifeTime = this.lifeTime;\r\n target.age = this.age;\r\n if (this.materialIndex !== null) {\r\n target.materialIndex = this.materialIndex;\r\n }\r\n return this;\r\n }\r\n /**\r\n * Legacy support, changed scale to scaling\r\n */\r\n public get scale(): Vector3 {\r\n return this.scaling;\r\n }\r\n\r\n /**\r\n * Legacy support, changed scale to scaling\r\n */\r\n public set scale(scale: Vector3) {\r\n this.scaling = scale;\r\n }\r\n\r\n /**\r\n * Legacy support, changed quaternion to rotationQuaternion\r\n */\r\n public get quaternion(): Nullable<Quaternion> {\r\n return this.rotationQuaternion;\r\n }\r\n\r\n /**\r\n * Legacy support, changed quaternion to rotationQuaternion\r\n */\r\n public set quaternion(q: Nullable<Quaternion>) {\r\n this.rotationQuaternion = q;\r\n }\r\n\r\n /**\r\n * Returns a boolean. True if the particle intersects another particle or another mesh, else false.\r\n * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)\r\n * @param target is the object (solid particle or mesh) what the intersection is computed against.\r\n * @returns true if it intersects\r\n */\r\n public intersectsMesh(target: Mesh | SolidParticle): boolean {\r\n if (!this._boundingInfo || !target.hasBoundingInfo) {\r\n return false;\r\n }\r\n if (this._sps._bSphereOnly) {\r\n return BoundingSphere.Intersects(this._boundingInfo.boundingSphere, target.getBoundingInfo().boundingSphere);\r\n }\r\n return this._boundingInfo.intersects(target.getBoundingInfo(), false);\r\n }\r\n\r\n /**\r\n * Returns `true` if the solid particle is within the frustum defined by the passed array of planes.\r\n * A particle is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the particle is in the frustum planes\r\n */\r\n public isInFrustum(frustumPlanes: Plane[]): boolean {\r\n return this._boundingInfo !== null && this._boundingInfo.isInFrustum(frustumPlanes, this.cullingStrategy);\r\n }\r\n\r\n /**\r\n * get the rotation matrix of the particle\r\n * @internal\r\n */\r\n public getRotationMatrix(m: Matrix) {\r\n let quaternion: Quaternion;\r\n if (this.rotationQuaternion) {\r\n quaternion = this.rotationQuaternion;\r\n } else {\r\n quaternion = TmpVectors.Quaternion[0];\r\n const rotation = this.rotation;\r\n Quaternion.RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, quaternion);\r\n }\r\n\r\n quaternion.toRotationMatrix(m);\r\n }\r\n}\r\n\r\n/**\r\n * Represents the shape of the model used by one particle of a solid particle system.\r\n * SPS internal tool, don't use it manually.\r\n */\r\nexport class ModelShape {\r\n /**\r\n * Get or set the shapeId\r\n * @deprecated Please use shapeId instead\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public get shapeID(): number {\r\n return this.shapeId;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public set shapeID(shapeID: number) {\r\n this.shapeId = shapeID;\r\n }\r\n /**\r\n * The shape id\r\n * @internal\r\n */\r\n public shapeId: number;\r\n /**\r\n * flat array of model positions (internal use)\r\n * @internal\r\n */\r\n public _shape: Vector3[];\r\n /**\r\n * flat array of model UVs (internal use)\r\n * @internal\r\n */\r\n public _shapeUV: number[];\r\n /**\r\n * color array of the model\r\n * @internal\r\n */\r\n public _shapeColors: number[];\r\n /**\r\n * indices array of the model\r\n * @internal\r\n */\r\n public _indices: number[];\r\n /**\r\n * The winding convention of the stored indices, independent of scene handedness.\r\n * @internal\r\n */\r\n public _indicesSideOrientation: Nullable<number> = null;\r\n /**\r\n * normals array of the model\r\n * @internal\r\n */\r\n public _normals: number[];\r\n /**\r\n * length of the shape in the model indices array (internal use)\r\n * @internal\r\n */\r\n public _indicesLength: number = 0;\r\n /**\r\n * Custom position function (internal use)\r\n * @internal\r\n */\r\n public _positionFunction: Nullable<(particle: SolidParticle, i: number, s: number) => void>;\r\n /**\r\n * Custom vertex function (internal use)\r\n * @internal\r\n */\r\n public _vertexFunction: Nullable<(particle: SolidParticle, vertex: Vector3, i: number) => void>;\r\n /**\r\n * Model material (internal use)\r\n * @internal\r\n */\r\n public _material: Nullable<Material>;\r\n\r\n /**\r\n * Creates a ModelShape object. This is an internal simplified reference to a mesh used as for a model to replicate particles from by the SPS.\r\n * SPS internal tool, don't use it manually.\r\n * @internal\r\n */\r\n constructor(\r\n id: number,\r\n shape: Vector3[],\r\n indices: number[],\r\n normals: number[],\r\n colors: number[],\r\n shapeUV: number[],\r\n posFunction: Nullable<(particle: SolidParticle, i: number, s: number) => void>,\r\n vtxFunction: Nullable<(particle: SolidParticle, vertex: Vector3, i: number) => void>,\r\n material: Nullable<Material>\r\n ) {\r\n this.shapeId = id;\r\n this._shape = shape;\r\n this._indices = indices;\r\n this._indicesLength = indices.length;\r\n this._shapeUV = shapeUV;\r\n this._shapeColors = colors;\r\n this._normals = normals;\r\n this._positionFunction = posFunction;\r\n this._vertexFunction = vtxFunction;\r\n this._material = material;\r\n }\r\n}\r\n\r\n/**\r\n * Represents a Depth Sorted Particle in the solid particle system.\r\n * @internal\r\n */\r\nexport class DepthSortedParticle {\r\n /**\r\n * Particle index\r\n */\r\n public idx: number = 0;\r\n /**\r\n * Index of the particle in the \"indices\" array\r\n */\r\n public ind: number = 0;\r\n /**\r\n * Length of the particle shape in the \"indices\" array\r\n */\r\n public indicesLength: number = 0;\r\n /**\r\n * Squared distance from the particle to the camera\r\n */\r\n public sqDistance: number = 0.0;\r\n /**\r\n * Material index when used with MultiMaterials\r\n */\r\n public materialIndex: number = 0;\r\n\r\n /**\r\n * Creates a new sorted particle\r\n * @param idx\r\n * @param ind\r\n * @param indLength\r\n * @param materialIndex\r\n */\r\n constructor(idx: number, ind: number, indLength: number, materialIndex: number) {\r\n this.idx = idx;\r\n this.ind = ind;\r\n this.indicesLength = indLength;\r\n this.materialIndex = materialIndex;\r\n }\r\n}\r\n\r\n/**\r\n * Represents a solid particle vertex\r\n */\r\nexport class SolidParticleVertex {\r\n /**\r\n * Vertex position\r\n */\r\n public position: Vector3;\r\n /**\r\n * Vertex color\r\n */\r\n public color: Color4;\r\n /**\r\n * Vertex UV\r\n */\r\n public uv: Vector2;\r\n /**\r\n * Creates a new solid particle vertex\r\n */\r\n constructor() {\r\n this.position = Vector3.Zero();\r\n this.color = new Color4(1.0, 1.0, 1.0, 1.0);\r\n this.uv = Vector2.Zero();\r\n }\r\n // Getters and Setters for back-compatibility\r\n /** Vertex x coordinate */\r\n public get x(): number {\r\n return this.position.x;\r\n }\r\n public set x(val: number) {\r\n this.position.x = val;\r\n }\r\n /** Vertex y coordinate */\r\n public get y(): number {\r\n return this.position.y;\r\n }\r\n public set y(val: number) {\r\n this.position.y = val;\r\n }\r\n /** Vertex z coordinate */\r\n public get z(): number {\r\n return this.position.z;\r\n }\r\n public set z(val: number) {\r\n this.position.z = val;\r\n }\r\n}\r\n"]}
@@ -128,6 +128,8 @@ export declare class SolidParticleSystem implements IDisposable {
128
128
  protected _computeParticleVertex: boolean;
129
129
  protected _computeBoundingBox: boolean;
130
130
  protected _autoFixFaceOrientation: boolean;
131
+ private _modelSideOrientation;
132
+ private _modelDefaultMaterialSideOrientation;
131
133
  protected _depthSortParticles: boolean;
132
134
  protected _camera: TargetCamera;
133
135
  protected _mustUnrotateFixedNormals: boolean;
@@ -214,6 +216,8 @@ export declare class SolidParticleSystem implements IDisposable {
214
216
  * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.
215
217
  * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.
216
218
  * Thus the particles generated from `digest()` have their property `position` set yet.
219
+ * Source transforms are not applied, and winding is normalized to the initial SPS face-orientation convention.
220
+ * Later changes to the SPS mesh or material orientation apply to the whole system, including newly added models.
217
221
  * @param mesh ( Mesh ) is the mesh to be digested
218
222
  * @param options {facetNb} (optional integer, default 1) is the number of mesh facets per particle, this parameter is overridden by the parameter `number` if any
219
223
  * {delta} (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets
@@ -295,10 +299,15 @@ export declare class SolidParticleSystem implements IDisposable {
295
299
  */
296
300
  protected _addParticle(idx: number, id: number, idxpos: number, idxind: number, model: ModelShape, shapeId: number, idxInShape: number, bInfo?: Nullable<BoundingInfo>, storage?: Nullable<[]>): SolidParticle;
297
301
  private _normalizeMeshVertexColors;
302
+ private _getModelIndicesSideOrientation;
303
+ private _flipModelIndices;
304
+ private _getModelIndices;
298
305
  /**
299
306
  * Adds some particles to the SPS from the model shape. Returns the shape id.
300
307
  * Please read the doc : https://doc.babylonjs.com/features/featuresDeepDive/particles/solid_particle_system/immutable_sps
301
308
  * @param mesh is any Mesh object that will be used as a model for the solid particles. If the mesh does not have vertex normals, it will turn on the recomputeNormals attribute.
309
+ * Only local geometry is copied: source transforms are not applied, and winding is normalized to the initial SPS face-orientation convention.
310
+ * Later changes to the SPS mesh or material orientation apply to the whole system, including newly added models.
302
311
  * @param nb (positive integer) the number of particles to be created from this model
303
312
  * @param options {positionFunction} is an optional javascript function to called for each particle on SPS creation.
304
313
  * {vertexFunction} is an optional javascript function to called for each vertex of each particle on SPS creation
@@ -336,6 +345,7 @@ export declare class SolidParticleSystem implements IDisposable {
336
345
  removeParticles(start: number, end: number): SolidParticle[];
337
346
  /**
338
347
  * Inserts some pre-created particles in the solid particle system so that they can be managed by setParticles().
348
+ * Stored model winding is adapted to this SPS without modifying the source model.
339
349
  * @param solidParticleArray an array populated with Solid Particles objects
340
350
  * @returns the SPS
341
351
  */
@@ -11,6 +11,7 @@ import { Axis } from "../Maths/math.axis.js";
11
11
  import { SubMesh } from "../Meshes/subMesh.js";
12
12
  import { StandardMaterial } from "../Materials/standardMaterial.pure.js";
13
13
  import { MultiMaterial } from "../Materials/multiMaterial.pure.js";
14
+
14
15
  /**
15
16
  * The SPS is a single updatable mesh. The solid particles are simply separate parts or faces of this big mesh.
16
17
  *As it is just a mesh, the SPS has all the same properties than any other BJS mesh : not more, not less. It can be scaled, rotated, translated, enlighted, textured, moved, etc.
@@ -110,6 +111,8 @@ export class SolidParticleSystem {
110
111
  this._computeParticleVertex = false;
111
112
  this._computeBoundingBox = false;
112
113
  this._autoFixFaceOrientation = false;
114
+ this._modelSideOrientation = null;
115
+ this._modelDefaultMaterialSideOrientation = null;
113
116
  this._depthSortParticles = true;
114
117
  this._mustUnrotateFixedNormals = false;
115
118
  this._particlesIntersect = false;
@@ -262,6 +265,8 @@ export class SolidParticleSystem {
262
265
  * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.
263
266
  * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.
264
267
  * Thus the particles generated from `digest()` have their property `position` set yet.
268
+ * Source transforms are not applied, and winding is normalized to the initial SPS face-orientation convention.
269
+ * Later changes to the SPS mesh or material orientation apply to the whole system, including newly added models.
265
270
  * @param mesh ( Mesh ) is the mesh to be digested
266
271
  * @param options {facetNb} (optional integer, default 1) is the number of mesh facets per particle, this parameter is overridden by the parameter `number` if any
267
272
  * {delta} (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets
@@ -280,7 +285,9 @@ export class SolidParticleSystem {
280
285
  let number = (options && options.number) || 0;
281
286
  let delta = (options && options.delta) || 0;
282
287
  const meshPos = mesh.getVerticesData(VertexBuffer.PositionKind);
283
- const meshInd = mesh.getIndices();
288
+ const material = this._useModelMaterial ? (mesh.material ?? this._setDefaultMaterial()) : null;
289
+ const indicesSideOrientation = this._getModelIndicesSideOrientation(material);
290
+ const meshInd = this._getModelIndices(mesh, indicesSideOrientation);
284
291
  const meshUV = mesh.getVerticesData(this._getUVKind(mesh, options?.uvKind ?? 0));
285
292
  let meshCol = mesh.getVerticesData(VertexBuffer.ColorKind);
286
293
  const meshNor = mesh.getVerticesData(VertexBuffer.NormalKind);
@@ -362,11 +369,8 @@ export class SolidParticleSystem {
362
369
  if (this._particlesIntersect) {
363
370
  bInfo = new BoundingInfo(minimum, maximum);
364
371
  }
365
- let material = null;
366
- if (this._useModelMaterial) {
367
- material = mesh.material ? mesh.material : this._setDefaultMaterial();
368
- }
369
372
  const modelShape = new ModelShape(this._shapeCounter, shape, shapeInd, shapeNor, shapeCol, shapeUV, null, null, material);
373
+ modelShape._indicesSideOrientation = indicesSideOrientation;
370
374
  // add the particle in the SPS
371
375
  const currentPos = this._positions.length;
372
376
  const currentInd = this._indices.length;
@@ -635,10 +639,54 @@ export class SolidParticleSystem {
635
639
  }
636
640
  return rgba;
637
641
  }
642
+ _getModelIndicesSideOrientation(material) {
643
+ const meshOrientation = this._scene.useRightHandedSystem ? 0 : 1;
644
+ if (this._modelSideOrientation === null) {
645
+ const defaultMaterial = !this._useModelMaterial && this._scene._hasDefaultMaterial ? this._scene.defaultMaterial : null;
646
+ this._modelDefaultMaterialSideOrientation = defaultMaterial?.sideOrientation ?? null;
647
+ this._modelSideOrientation = this._modelDefaultMaterialSideOrientation ?? meshOrientation;
648
+ }
649
+ const targetOrientation = (this._useModelMaterial ? material?.sideOrientation : null) ?? this._modelSideOrientation;
650
+ // Store a scene-independent convention for transfers between left- and right-handed scenes.
651
+ return targetOrientation === meshOrientation ? 1 : 0;
652
+ }
653
+ _flipModelIndices(indices, start = 0, end = indices.length) {
654
+ for (let i = start; i < end; i += 3) {
655
+ const second = indices[i + 1];
656
+ indices[i + 1] = indices[i + 2];
657
+ indices[i + 2] = second;
658
+ }
659
+ }
660
+ _getModelIndices(mesh, targetOrientation) {
661
+ const indices = Array.from(mesh.getIndices());
662
+ const model = mesh.isAnInstance ? mesh.sourceMesh : mesh;
663
+ const sourceScene = mesh.getScene();
664
+ const meshOrientation = sourceScene.useRightHandedSystem ? 0 : 1;
665
+ const defaultMaterial = !this._useModelMaterial && this._scene._hasDefaultMaterial ? this._scene.defaultMaterial : null;
666
+ const sourceMaterial = mesh.material ?? (sourceScene._hasDefaultMaterial ? sourceScene.defaultMaterial : null);
667
+ const modelOrientation = model instanceof Mesh ? model.sideOrientation : meshOrientation;
668
+ const subMeshCount = Math.max(1, model.subMeshes.length);
669
+ for (let subMeshIndex = 0; subMeshIndex < subMeshCount; subMeshIndex++) {
670
+ const subMesh = model.subMeshes[subMeshIndex];
671
+ const material = subMesh?.getMaterial() ?? sourceMaterial;
672
+ // A shared default-material override changes rendering globally, not the stored geometry convention.
673
+ const materialOrientation = !this._useModelMaterial && material === defaultMaterial ? this._modelDefaultMaterialSideOrientation : material?.sideOrientation;
674
+ const orientation = materialOrientation ?? modelOrientation;
675
+ const indicesOrientation = orientation === meshOrientation ? 1 : 0;
676
+ if (indicesOrientation !== targetOrientation) {
677
+ const start = subMesh?.indexStart ?? 0;
678
+ const end = subMesh ? start + subMesh.indexCount : indices.length;
679
+ this._flipModelIndices(indices, start, end);
680
+ }
681
+ }
682
+ return indices;
683
+ }
638
684
  /**
639
685
  * Adds some particles to the SPS from the model shape. Returns the shape id.
640
686
  * Please read the doc : https://doc.babylonjs.com/features/featuresDeepDive/particles/solid_particle_system/immutable_sps
641
687
  * @param mesh is any Mesh object that will be used as a model for the solid particles. If the mesh does not have vertex normals, it will turn on the recomputeNormals attribute.
688
+ * Only local geometry is copied: source transforms are not applied, and winding is normalized to the initial SPS face-orientation convention.
689
+ * Later changes to the SPS mesh or material orientation apply to the whole system, including newly added models.
642
690
  * @param nb (positive integer) the number of particles to be created from this model
643
691
  * @param options {positionFunction} is an optional javascript function to called for each particle on SPS creation.
644
692
  * {vertexFunction} is an optional javascript function to called for each vertex of each particle on SPS creation
@@ -650,7 +698,9 @@ export class SolidParticleSystem {
650
698
  */
651
699
  addShape(mesh, nb, options) {
652
700
  const meshPos = mesh.getVerticesData(VertexBuffer.PositionKind);
653
- const meshInd = mesh.getIndices();
701
+ const material = this._useModelMaterial ? (mesh.material ?? this._setDefaultMaterial()) : null;
702
+ const indicesSideOrientation = this._getModelIndicesSideOrientation(material);
703
+ const indices = this._getModelIndices(mesh, indicesSideOrientation);
654
704
  const meshUV = mesh.getVerticesData(VertexBuffer.UVKind);
655
705
  let meshCol = mesh.getVerticesData(VertexBuffer.ColorKind);
656
706
  const meshNor = mesh.getVerticesData(VertexBuffer.NormalKind);
@@ -658,7 +708,6 @@ export class SolidParticleSystem {
658
708
  // Normalize vertex colors to RGBA (4 components) since _meshBuilder always reads 4 components per color.
659
709
  // Source meshes (e.g. from glTF) may provide RGB (3 components) vertex colors.
660
710
  meshCol = this._normalizeMeshVertexColors(mesh, meshPos, meshCol);
661
- const indices = Array.from(meshInd);
662
711
  const shapeNormals = meshNor ? Array.from(meshNor) : [];
663
712
  const shapeColors = meshCol ? Array.from(meshCol) : [];
664
713
  const storage = options && options.storage ? options.storage : null;
@@ -670,14 +719,11 @@ export class SolidParticleSystem {
670
719
  const shapeUV = this._uvsToShapeUV(meshUV);
671
720
  const posfunc = options ? options.positionFunction : null;
672
721
  const vtxfunc = options ? options.vertexFunction : null;
673
- let material = null;
674
- if (this._useModelMaterial) {
675
- material = mesh.material ? mesh.material : this._setDefaultMaterial();
676
- }
677
722
  const modelShape = new ModelShape(this._shapeCounter, shape, indices, shapeNormals, shapeColors, shapeUV, posfunc, vtxfunc, material);
723
+ modelShape._indicesSideOrientation = indicesSideOrientation;
678
724
  // particles
679
725
  for (let i = 0; i < nb; i++) {
680
- this._insertNewParticle(this.nbParticles, i, modelShape, shape, meshInd, meshUV, meshCol, meshNor, bbInfo, storage, options);
726
+ this._insertNewParticle(this.nbParticles, i, modelShape, shape, indices, meshUV, meshCol, meshNor, bbInfo, storage, options);
681
727
  }
682
728
  this._shapeCounter++;
683
729
  this._isNotBuilt = true; // buildMesh() call is now expected for setParticles() to work
@@ -803,6 +849,7 @@ export class SolidParticleSystem {
803
849
  }
804
850
  /**
805
851
  * Inserts some pre-created particles in the solid particle system so that they can be managed by setParticles().
852
+ * Stored model winding is adapted to this SPS without modifying the source model.
806
853
  * @param solidParticleArray an array populated with Solid Particles objects
807
854
  * @returns the SPS
808
855
  */
@@ -813,9 +860,21 @@ export class SolidParticleSystem {
813
860
  let idxInShape = 0;
814
861
  let currentShapeId = solidParticleArray[0].shapeId;
815
862
  const nb = solidParticleArray.length;
863
+ const models = new Map();
816
864
  for (let i = 0; i < nb; i++) {
817
865
  const sp = solidParticleArray[i];
818
- const model = sp._model;
866
+ let model = models.get(sp._model);
867
+ if (!model) {
868
+ model = sp._model;
869
+ const indicesSideOrientation = this._getModelIndicesSideOrientation(model._material);
870
+ if (model._indicesSideOrientation !== null && model._indicesSideOrientation !== indicesSideOrientation) {
871
+ const indices = model._indices.slice();
872
+ this._flipModelIndices(indices);
873
+ model = new ModelShape(model.shapeId, model._shape, indices, model._normals, model._shapeColors, model._shapeUV, model._positionFunction, model._vertexFunction, model._material);
874
+ model._indicesSideOrientation = indicesSideOrientation;
875
+ }
876
+ models.set(sp._model, model);
877
+ }
819
878
  const shape = model._shape;
820
879
  const meshInd = model._indices;
821
880
  const meshUV = model._shapeUV;