@onerjs/core 8.54.4 → 8.54.6

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 (234) hide show
  1. package/Engines/Native/nativeHelpers.js +5 -0
  2. package/Engines/Native/nativeHelpers.js.map +1 -1
  3. package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js +1 -1
  4. package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js.map +1 -1
  5. package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js +2 -2
  6. package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js.map +1 -1
  7. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -0
  8. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +18 -4
  9. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  10. package/Engines/WebGPU/webgpuCacheTextureView.d.ts +13 -0
  11. package/Engines/WebGPU/webgpuCacheTextureView.js +32 -0
  12. package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -0
  13. package/Engines/WebGPU/webgpuRenderTargetWrapper.d.ts +10 -0
  14. package/Engines/WebGPU/webgpuRenderTargetWrapper.js +10 -0
  15. package/Engines/WebGPU/webgpuRenderTargetWrapper.js.map +1 -1
  16. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js +57 -4
  17. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js.map +1 -1
  18. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
  19. package/Engines/WebGPU/webgpuTextureManager.js +4 -2
  20. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  21. package/Engines/abstractEngine.pure.js +2 -2
  22. package/Engines/abstractEngine.pure.js.map +1 -1
  23. package/Engines/engineCapabilities.d.ts +5 -0
  24. package/Engines/engineCapabilities.js.map +1 -1
  25. package/Engines/thinNativeEngine.pure.d.ts +5 -0
  26. package/Engines/thinNativeEngine.pure.js +52 -10
  27. package/Engines/thinNativeEngine.pure.js.map +1 -1
  28. package/Engines/webgpuEngine.pure.d.ts +1 -0
  29. package/Engines/webgpuEngine.pure.js +22 -8
  30. package/Engines/webgpuEngine.pure.js.map +1 -1
  31. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.d.ts +95 -1
  32. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +169 -4
  33. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
  34. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.d.ts +21 -6
  35. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js +28 -26
  36. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js.map +1 -1
  37. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.d.ts +30 -2
  38. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js +111 -29
  39. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js.map +1 -1
  40. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.d.ts +56 -2
  41. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js +99 -14
  42. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js.map +1 -1
  43. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js +10 -2
  44. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js.map +1 -1
  45. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +21 -1
  46. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
  47. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +18 -0
  48. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +29 -2
  49. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  50. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +15 -0
  51. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +44 -7
  52. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
  53. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +9 -0
  54. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +9 -1
  55. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
  56. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +7 -0
  57. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +8 -1
  58. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
  59. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.d.ts +5 -0
  60. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js +8 -0
  61. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js.map +1 -0
  62. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.d.ts +37 -0
  63. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js +44 -0
  64. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js.map +1 -0
  65. package/FlowGraph/Blocks/Event/index.d.ts +1 -0
  66. package/FlowGraph/Blocks/Event/index.js +1 -0
  67. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  68. package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
  69. package/FlowGraph/Blocks/Event/pure.js +1 -0
  70. package/FlowGraph/Blocks/Event/pure.js.map +1 -1
  71. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.d.ts +4 -1
  72. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js +67 -2
  73. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js.map +1 -1
  74. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +13 -0
  75. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +102 -7
  76. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
  77. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +5 -1
  78. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
  79. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +5 -1
  80. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
  81. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.d.ts +11 -2
  82. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js +21 -3
  83. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js.map +1 -1
  84. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js +25 -4
  85. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js.map +1 -1
  86. package/FlowGraph/Blocks/flowGraphBlockFactory.js +18 -0
  87. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  88. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +9 -0
  89. package/FlowGraph/Blocks/flowGraphBlockNames.js +9 -0
  90. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  91. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +17 -3
  92. package/FlowGraph/CustomTypes/flowGraphMatrix.js +27 -21
  93. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
  94. package/FlowGraph/flowGraphContext.d.ts +23 -0
  95. package/FlowGraph/flowGraphContext.js +29 -0
  96. package/FlowGraph/flowGraphContext.js.map +1 -1
  97. package/FlowGraph/flowGraphCoordinator.d.ts +58 -1
  98. package/FlowGraph/flowGraphCoordinator.js +72 -0
  99. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  100. package/FlowGraph/flowGraphDelayRegistry.d.ts +31 -0
  101. package/FlowGraph/flowGraphDelayRegistry.js +50 -0
  102. package/FlowGraph/flowGraphDelayRegistry.js.map +1 -0
  103. package/FlowGraph/flowGraphHostResolver.d.ts +69 -0
  104. package/FlowGraph/flowGraphHostResolver.js +25 -0
  105. package/FlowGraph/flowGraphHostResolver.js.map +1 -0
  106. package/FlowGraph/flowGraphMath.d.ts +48 -1
  107. package/FlowGraph/flowGraphMath.js +169 -4
  108. package/FlowGraph/flowGraphMath.js.map +1 -1
  109. package/FlowGraph/flowGraphPathConverterComponent.d.ts +14 -3
  110. package/FlowGraph/flowGraphPathConverterComponent.js +110 -18
  111. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  112. package/FlowGraph/flowGraphSignalConnection.pure.js +7 -1
  113. package/FlowGraph/flowGraphSignalConnection.pure.js.map +1 -1
  114. package/FlowGraph/index.d.ts +2 -0
  115. package/FlowGraph/index.js +2 -0
  116. package/FlowGraph/index.js.map +1 -1
  117. package/FlowGraph/pure.d.ts +2 -0
  118. package/FlowGraph/pure.js +2 -0
  119. package/FlowGraph/pure.js.map +1 -1
  120. package/Materials/Node/nodeMaterial.pure.d.ts +3 -1
  121. package/Materials/Node/nodeMaterial.pure.js +18 -1
  122. package/Materials/Node/nodeMaterial.pure.js.map +1 -1
  123. package/Materials/Textures/envCubeTexture.pure.js +7 -2
  124. package/Materials/Textures/envCubeTexture.pure.js.map +1 -1
  125. package/Materials/materialHelper.functions.d.ts +14 -0
  126. package/Materials/materialHelper.functions.js +67 -0
  127. package/Materials/materialHelper.functions.js.map +1 -1
  128. package/Maths/math.vector.pure.d.ts +11 -1
  129. package/Maths/math.vector.pure.js +13 -0
  130. package/Maths/math.vector.pure.js.map +1 -1
  131. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +216 -1
  132. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +714 -67
  133. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  134. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +81 -4
  135. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +466 -52
  136. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  137. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +19 -0
  138. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +24 -0
  139. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
  140. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +31 -6
  141. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
  142. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +5 -1
  143. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
  144. package/Meshes/abstractMesh.pure.js +1 -0
  145. package/Meshes/abstractMesh.pure.js.map +1 -1
  146. package/Meshes/mesh.pure.js +5 -0
  147. package/Meshes/mesh.pure.js.map +1 -1
  148. package/Meshes/transformNode.pure.js +1 -0
  149. package/Meshes/transformNode.pure.js.map +1 -1
  150. package/Misc/areaLightsTextureTools.js +1 -1
  151. package/Misc/areaLightsTextureTools.js.map +1 -1
  152. package/Misc/greasedLineTools.js +1 -1
  153. package/Misc/greasedLineTools.js.map +1 -1
  154. package/Misc/tools.pure.js +14 -2
  155. package/Misc/tools.pure.js.map +1 -1
  156. package/Particles/gpuParticleSystem.pure.d.ts +66 -1
  157. package/Particles/gpuParticleSystem.pure.js +189 -49
  158. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  159. package/Physics/v2/characterController.js +69 -17
  160. package/Physics/v2/characterController.js.map +1 -1
  161. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.d.ts +79 -0
  162. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.js +171 -0
  163. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.js.map +1 -0
  164. package/PostProcesses/RenderPipeline/Pipelines/index.d.ts +5 -0
  165. package/PostProcesses/RenderPipeline/Pipelines/index.js +6 -0
  166. package/PostProcesses/RenderPipeline/Pipelines/index.js.map +1 -1
  167. package/PostProcesses/RenderPipeline/Pipelines/pure.d.ts +1 -0
  168. package/PostProcesses/RenderPipeline/Pipelines/pure.js +1 -0
  169. package/PostProcesses/RenderPipeline/Pipelines/pure.js.map +1 -1
  170. package/PostProcesses/thinFSR1SharpenPostProcess.d.ts +32 -0
  171. package/PostProcesses/thinFSR1SharpenPostProcess.js +58 -0
  172. package/PostProcesses/thinFSR1SharpenPostProcess.js.map +1 -0
  173. package/PostProcesses/thinFSR1UpscalePostProcess.d.ts +37 -0
  174. package/PostProcesses/thinFSR1UpscalePostProcess.js +68 -0
  175. package/PostProcesses/thinFSR1UpscalePostProcess.js.map +1 -0
  176. package/Shaders/ShadersInclude/ffxFunctions.d.ts +5 -0
  177. package/Shaders/ShadersInclude/ffxFunctions.js +18 -0
  178. package/Shaders/ShadersInclude/ffxFunctions.js.map +1 -0
  179. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +2 -2
  180. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  181. package/Shaders/ShadersInclude/openpbrIblFunctions.js +1 -6
  182. package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  183. package/Shaders/fsr1Sharpen.fragment.d.ts +5 -0
  184. package/Shaders/fsr1Sharpen.fragment.js +26 -0
  185. package/Shaders/fsr1Sharpen.fragment.js.map +1 -0
  186. package/Shaders/fsr1Upscale.fragment.d.ts +5 -0
  187. package/Shaders/fsr1Upscale.fragment.js +77 -0
  188. package/Shaders/fsr1Upscale.fragment.js.map +1 -0
  189. package/ShadersWGSL/ShadersInclude/ffxFunctions.d.ts +5 -0
  190. package/ShadersWGSL/ShadersInclude/ffxFunctions.js +18 -0
  191. package/ShadersWGSL/ShadersInclude/ffxFunctions.js.map +1 -0
  192. package/ShadersWGSL/fsr1Sharpen.fragment.d.ts +5 -0
  193. package/ShadersWGSL/fsr1Sharpen.fragment.js +34 -0
  194. package/ShadersWGSL/fsr1Sharpen.fragment.js.map +1 -0
  195. package/ShadersWGSL/fsr1Upscale.fragment.d.ts +5 -0
  196. package/ShadersWGSL/fsr1Upscale.fragment.js +68 -0
  197. package/ShadersWGSL/fsr1Upscale.fragment.js.map +1 -0
  198. package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +3 -9
  199. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +4 -11
  200. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
  201. package/XR/features/WebXRAbstractFeature.d.ts +9 -0
  202. package/XR/features/WebXRAbstractFeature.js +16 -0
  203. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  204. package/XR/features/WebXRDepthSensing.pure.d.ts +7 -0
  205. package/XR/features/WebXRDepthSensing.pure.js +350 -39
  206. package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
  207. package/XR/features/WebXRImageTracking.pure.js.map +1 -1
  208. package/XR/features/WebXRLayers.pure.d.ts +6 -5
  209. package/XR/features/WebXRLayers.pure.js +65 -8
  210. package/XR/features/WebXRLayers.pure.js.map +1 -1
  211. package/XR/features/WebXRRawCameraAccess.pure.js +9 -2
  212. package/XR/features/WebXRRawCameraAccess.pure.js.map +1 -1
  213. package/XR/features/WebXRSpaceWarp.pure.d.ts +0 -1
  214. package/XR/features/WebXRSpaceWarp.pure.js +13 -4
  215. package/XR/features/WebXRSpaceWarp.pure.js.map +1 -1
  216. package/XR/features/WebXRWalkingLocomotion.pure.js.map +1 -1
  217. package/XR/webXRCamera.js +27 -0
  218. package/XR/webXRCamera.js.map +1 -1
  219. package/XR/webXRFeatureWarningRegistry.d.ts +14 -0
  220. package/XR/webXRFeatureWarningRegistry.js +19 -0
  221. package/XR/webXRFeatureWarningRegistry.js.map +1 -0
  222. package/XR/webXRFeaturesManager.d.ts +5 -0
  223. package/XR/webXRFeaturesManager.js +23 -4
  224. package/XR/webXRFeaturesManager.js.map +1 -1
  225. package/XR/webXRGraphicsBinding.d.ts +17 -10
  226. package/XR/webXRGraphicsBinding.js +8 -5
  227. package/XR/webXRGraphicsBinding.js.map +1 -1
  228. package/XR/webXRSessionManager.d.ts +3 -5
  229. package/XR/webXRSessionManager.js +1 -3
  230. package/XR/webXRSessionManager.js.map +1 -1
  231. package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +21 -5
  232. package/XR/webXRWebGPURenderTargetTextureProvider.js +38 -10
  233. package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
  234. package/package.json +1 -1
@@ -271,9 +271,45 @@ export declare class GPUParticleSystem extends BaseParticleSystem implements IDi
271
271
  * @returns the current particle system
272
272
  */
273
273
  addColorGradient(gradient: number, color1: Color4, color2?: Color4): GPUParticleSystem;
274
+ /**
275
+ * Resyncs the color gradient state after a change.
276
+ * @param reorder true to re-sort the gradient list by position
277
+ * @returns true when the existing lookup texture was re-baked in place (value-only change — nothing to
278
+ * release, the live particle pool survives), false when the change is structural (family emptied, color2 row
279
+ * layout flipped, or no texture yet) and the caller must release the buffers; in that case the outdated
280
+ * texture is disposed for lazy recreation.
281
+ */
274
282
  private _refreshColorGradient;
275
- /** Force the system to rebuild all gradients that need to be resync */
283
+ /**
284
+ * Force the system to rebuild all gradients that need to be resync.
285
+ *
286
+ * This is the live-edit entry point both Inspectors call from their gradient onChange handlers, so a
287
+ * value-only edit must preserve the running simulation: every family whose lookup texture can be re-baked
288
+ * in place is updated without touching the particle buffers. Only a STRUCTURAL change — a family that has
289
+ * no texture to re-bake yet, one that was emptied, or a color2 row-layout flip — rebuilds the pool.
290
+ *
291
+ * An ABSENT family is not a structural change: it has nothing to resync, and counting it as one would
292
+ * reset the pool on every call (the destruction this method exists to avoid). Absence has two spellings —
293
+ * see _gradientFamilyNeedsResync.
294
+ */
276
295
  forceRefreshGradients(): void;
296
+ /**
297
+ * Whether a gradient family still has anything for a resync pass to do.
298
+ *
299
+ * Absence has TWO spellings: a family that was never initialized is `null`, but one that has been emptied
300
+ * stays `[]`. Only the first is falsy, so a bare truthiness test reads an emptied family as unfinished
301
+ * business on every later call — its refresh finds nothing to re-bake, reports "structural", and
302
+ * forceRefreshGradients resets the live pool forever after, which is precisely the destruction it exists
303
+ * to prevent.
304
+ *
305
+ * Entries always mean work (re-bake in place, or build when there is no texture yet). An EMPTY family is
306
+ * work only while it still owns a texture: that is the just-emptied transition, whose stale texture must
307
+ * be disposed. `[]` with no texture is settled absence — nothing left to resync.
308
+ * @param gradients the gradient family to test, or null when it was never initialized
309
+ * @param textureName the name of the lookup texture property backing that family
310
+ * @returns true when the family still has work for a resync pass, false when its absence is settled
311
+ */
312
+ private _gradientFamilyNeedsResync;
277
313
  /**
278
314
  * Remove a specific color gradient
279
315
  * @param gradient defines the gradient to remove
@@ -308,6 +344,14 @@ export declare class GPUParticleSystem extends BaseParticleSystem implements IDi
308
344
  * @returns the current particle system
309
345
  */
310
346
  removeSizeGradient(gradient: number): GPUParticleSystem;
347
+ /**
348
+ * Resyncs a factor gradient family's lookup texture after a change.
349
+ * @param factorGradients defines the gradient family that changed
350
+ * @param textureName defines the name of the property holding the family's lookup texture
351
+ * @returns true when the existing texture was re-baked in place (value-only change — nothing to release, the
352
+ * live particle pool survives), false when the caller must release the buffers (no texture to re-bake, or the
353
+ * family was emptied); in that case the outdated texture is disposed for lazy recreation.
354
+ */
311
355
  private _refreshFactorGradient;
312
356
  /**
313
357
  * Adds a new angular speed gradient
@@ -490,6 +534,18 @@ export declare class GPUParticleSystem extends BaseParticleSystem implements IDi
490
534
  * @param preWarm defines if we are in the pre-warmimg phase
491
535
  */
492
536
  animate(preWarm?: boolean): void;
537
+ private _bakeFactorGradientData;
538
+ /**
539
+ * Re-bakes an active factor gradient family's lookup texture pixels in place. The texture identity is
540
+ * preserved, so retained bindings (e.g. the WebGPU update compute shader's) stay valid and no buffer
541
+ * release is needed — the live particle pool survives the edit. The texture layout is independent of the
542
+ * number of stops (fixed _rawTextureWidth x 1), so any change within an active family can be re-baked.
543
+ * @param factorGradients defines the gradient family to bake
544
+ * @param textureName defines the name of the property holding the family's lookup texture
545
+ * @returns false when there is nothing to re-bake (no texture yet, or the family was emptied) — callers
546
+ * fall back to the dispose + release path.
547
+ */
548
+ private _rebakeFactorGradientTexture;
493
549
  private _createFactorGradientTexture;
494
550
  private _createSizeGradientTexture;
495
551
  private _createAngularSpeedGradientTexture;
@@ -498,6 +554,15 @@ export declare class GPUParticleSystem extends BaseParticleSystem implements IDi
498
554
  private _createDragGradientTexture;
499
555
  private _disposeMeshEmitterTextures;
500
556
  private _createMeshEmitterTextures;
557
+ private _bakeColorGradientData;
558
+ /**
559
+ * Re-bakes the color gradient lookup texture pixels in place (same texture identity, so retained bindings —
560
+ * e.g. the WebGPU update compute shader's — stay valid and the live particle pool survives the edit). Only
561
+ * valid while the row layout is unchanged: a color2 range appearing or disappearing changes the texture
562
+ * height and the render vertex buffer layout, which must go through the structural dispose + release path.
563
+ * @returns false when the re-bake cannot handle the change (no texture yet, family emptied, or row layout flip)
564
+ */
565
+ private _rebakeColorGradientTexture;
501
566
  private _createColorGradientTexture;
502
567
  private _render;
503
568
  /** @internal */
@@ -307,10 +307,19 @@ export class GPUParticleSystem extends BaseParticleSystem {
307
307
  }
308
308
  const colorGradient = new ColorGradient(gradient, color1, color2);
309
309
  this._colorGradients.push(colorGradient);
310
- this._refreshColorGradient(true);
311
- this._releaseBuffers();
310
+ if (!this._refreshColorGradient(true)) {
311
+ this._releaseBuffers();
312
+ }
312
313
  return this;
313
314
  }
315
+ /**
316
+ * Resyncs the color gradient state after a change.
317
+ * @param reorder true to re-sort the gradient list by position
318
+ * @returns true when the existing lookup texture was re-baked in place (value-only change — nothing to
319
+ * release, the live particle pool survives), false when the change is structural (family emptied, color2 row
320
+ * layout flipped, or no texture yet) and the caller must release the buffers; in that case the outdated
321
+ * texture is disposed for lazy recreation.
322
+ */
314
323
  _refreshColorGradient(reorder = false) {
315
324
  if (this._colorGradients) {
316
325
  if (reorder) {
@@ -334,6 +343,12 @@ export class GPUParticleSystem extends BaseParticleSystem {
334
343
  break;
335
344
  }
336
345
  }
346
+ // When the texture layout is unchanged, re-bake the existing texture's pixels in place: identity is
347
+ // preserved, so retained bindings (e.g. the WebGPU update compute shader's) stay valid and no buffer
348
+ // release is needed.
349
+ if (this._rebakeColorGradientTexture()) {
350
+ return true;
351
+ }
337
352
  if (this._colorGradientsTexture) {
338
353
  this._colorGradientsTexture.dispose();
339
354
  this._colorGradientsTexture = null;
@@ -342,16 +357,68 @@ export class GPUParticleSystem extends BaseParticleSystem {
342
357
  else {
343
358
  this._hasColorGradientColor2 = false;
344
359
  }
360
+ return false;
345
361
  }
346
- /** Force the system to rebuild all gradients that need to be resync */
362
+ /**
363
+ * Force the system to rebuild all gradients that need to be resync.
364
+ *
365
+ * This is the live-edit entry point both Inspectors call from their gradient onChange handlers, so a
366
+ * value-only edit must preserve the running simulation: every family whose lookup texture can be re-baked
367
+ * in place is updated without touching the particle buffers. Only a STRUCTURAL change — a family that has
368
+ * no texture to re-bake yet, one that was emptied, or a color2 row-layout flip — rebuilds the pool.
369
+ *
370
+ * An ABSENT family is not a structural change: it has nothing to resync, and counting it as one would
371
+ * reset the pool on every call (the destruction this method exists to avoid). Absence has two spellings —
372
+ * see _gradientFamilyNeedsResync.
373
+ */
347
374
  forceRefreshGradients() {
348
- this._refreshColorGradient();
349
- this._refreshFactorGradient(this._sizeGradients, "_sizeGradientsTexture");
350
- this._refreshFactorGradient(this._angularSpeedGradients, "_angularSpeedGradientsTexture");
351
- this._refreshFactorGradient(this._velocityGradients, "_velocityGradientsTexture");
352
- this._refreshFactorGradient(this._limitVelocityGradients, "_limitVelocityGradientsTexture");
353
- this._refreshFactorGradient(this._dragGradients, "_dragGradientsTexture");
354
- this.reset();
375
+ let structural = false;
376
+ if (this._gradientFamilyNeedsResync(this._colorGradients, "_colorGradientsTexture") && !this._refreshColorGradient()) {
377
+ structural = true;
378
+ }
379
+ if (this._gradientFamilyNeedsResync(this._sizeGradients, "_sizeGradientsTexture") && !this._refreshFactorGradient(this._sizeGradients, "_sizeGradientsTexture")) {
380
+ structural = true;
381
+ }
382
+ if (this._gradientFamilyNeedsResync(this._angularSpeedGradients, "_angularSpeedGradientsTexture") &&
383
+ !this._refreshFactorGradient(this._angularSpeedGradients, "_angularSpeedGradientsTexture")) {
384
+ structural = true;
385
+ }
386
+ if (this._gradientFamilyNeedsResync(this._velocityGradients, "_velocityGradientsTexture") &&
387
+ !this._refreshFactorGradient(this._velocityGradients, "_velocityGradientsTexture")) {
388
+ structural = true;
389
+ }
390
+ if (this._gradientFamilyNeedsResync(this._limitVelocityGradients, "_limitVelocityGradientsTexture") &&
391
+ !this._refreshFactorGradient(this._limitVelocityGradients, "_limitVelocityGradientsTexture")) {
392
+ structural = true;
393
+ }
394
+ if (this._gradientFamilyNeedsResync(this._dragGradients, "_dragGradientsTexture") && !this._refreshFactorGradient(this._dragGradients, "_dragGradientsTexture")) {
395
+ structural = true;
396
+ }
397
+ if (structural) {
398
+ this.reset();
399
+ }
400
+ }
401
+ /**
402
+ * Whether a gradient family still has anything for a resync pass to do.
403
+ *
404
+ * Absence has TWO spellings: a family that was never initialized is `null`, but one that has been emptied
405
+ * stays `[]`. Only the first is falsy, so a bare truthiness test reads an emptied family as unfinished
406
+ * business on every later call — its refresh finds nothing to re-bake, reports "structural", and
407
+ * forceRefreshGradients resets the live pool forever after, which is precisely the destruction it exists
408
+ * to prevent.
409
+ *
410
+ * Entries always mean work (re-bake in place, or build when there is no texture yet). An EMPTY family is
411
+ * work only while it still owns a texture: that is the just-emptied transition, whose stale texture must
412
+ * be disposed. `[]` with no texture is settled absence — nothing left to resync.
413
+ * @param gradients the gradient family to test, or null when it was never initialized
414
+ * @param textureName the name of the lookup texture property backing that family
415
+ * @returns true when the family still has work for a resync pass, false when its absence is settled
416
+ */
417
+ _gradientFamilyNeedsResync(gradients, textureName) {
418
+ if (!gradients) {
419
+ return false;
420
+ }
421
+ return gradients.length > 0 || !!this[textureName];
355
422
  }
356
423
  /**
357
424
  * Remove a specific color gradient
@@ -359,10 +426,12 @@ export class GPUParticleSystem extends BaseParticleSystem {
359
426
  * @returns the current particle system
360
427
  */
361
428
  removeColorGradient(gradient) {
362
- this._removeGradientAndTexture(gradient, this._colorGradients, this._colorGradientsTexture);
363
- this._colorGradientsTexture = null;
364
- // The set of remaining gradients may no longer contain a color2; recompute the flag.
365
- this._refreshColorGradient();
429
+ super._removeGradientAndTexture(gradient, this._colorGradients, null);
430
+ // The set of remaining gradients may no longer contain a color2; _refreshColorGradient recomputes the flag
431
+ // and either re-bakes the texture in place (value-only change) or signals a structural change.
432
+ if (!this._refreshColorGradient()) {
433
+ this._releaseBuffers();
434
+ }
366
435
  return this;
367
436
  }
368
437
  /**
@@ -386,8 +455,9 @@ export class GPUParticleSystem extends BaseParticleSystem {
386
455
  this._sizeGradients = [];
387
456
  }
388
457
  this._addFactorGradient(this._sizeGradients, gradient, factor, factor2);
389
- this._refreshFactorGradient(this._sizeGradients, "_sizeGradientsTexture");
390
- this._releaseBuffers();
458
+ if (!this._refreshFactorGradient(this._sizeGradients, "_sizeGradientsTexture")) {
459
+ this._releaseBuffers();
460
+ }
391
461
  return this;
392
462
  }
393
463
  /**
@@ -396,19 +466,33 @@ export class GPUParticleSystem extends BaseParticleSystem {
396
466
  * @returns the current particle system
397
467
  */
398
468
  removeSizeGradient(gradient) {
399
- this._removeGradientAndTexture(gradient, this._sizeGradients, this._sizeGradientsTexture);
400
- this._sizeGradientsTexture = null;
469
+ this._removeFactorGradient(this._sizeGradients, gradient);
470
+ if (!this._refreshFactorGradient(this._sizeGradients, "_sizeGradientsTexture")) {
471
+ this._releaseBuffers();
472
+ }
401
473
  return this;
402
474
  }
475
+ /**
476
+ * Resyncs a factor gradient family's lookup texture after a change.
477
+ * @param factorGradients defines the gradient family that changed
478
+ * @param textureName defines the name of the property holding the family's lookup texture
479
+ * @returns true when the existing texture was re-baked in place (value-only change — nothing to release, the
480
+ * live particle pool survives), false when the caller must release the buffers (no texture to re-bake, or the
481
+ * family was emptied); in that case the outdated texture is disposed for lazy recreation.
482
+ */
403
483
  _refreshFactorGradient(factorGradients, textureName) {
404
484
  if (!factorGradients) {
405
- return;
485
+ return false;
486
+ }
487
+ if (this._rebakeFactorGradientTexture(factorGradients, textureName)) {
488
+ return true;
406
489
  }
407
490
  const that = this;
408
491
  if (that[textureName]) {
409
492
  that[textureName].dispose();
410
493
  that[textureName] = null;
411
494
  }
495
+ return false;
412
496
  }
413
497
  /**
414
498
  * Adds a new angular speed gradient
@@ -422,8 +506,9 @@ export class GPUParticleSystem extends BaseParticleSystem {
422
506
  this._angularSpeedGradients = [];
423
507
  }
424
508
  this._addFactorGradient(this._angularSpeedGradients, gradient, factor, factor2);
425
- this._refreshFactorGradient(this._angularSpeedGradients, "_angularSpeedGradientsTexture");
426
- this._releaseBuffers();
509
+ if (!this._refreshFactorGradient(this._angularSpeedGradients, "_angularSpeedGradientsTexture")) {
510
+ this._releaseBuffers();
511
+ }
427
512
  return this;
428
513
  }
429
514
  /**
@@ -432,8 +517,10 @@ export class GPUParticleSystem extends BaseParticleSystem {
432
517
  * @returns the current particle system
433
518
  */
434
519
  removeAngularSpeedGradient(gradient) {
435
- this._removeGradientAndTexture(gradient, this._angularSpeedGradients, this._angularSpeedGradientsTexture);
436
- this._angularSpeedGradientsTexture = null;
520
+ this._removeFactorGradient(this._angularSpeedGradients, gradient);
521
+ if (!this._refreshFactorGradient(this._angularSpeedGradients, "_angularSpeedGradientsTexture")) {
522
+ this._releaseBuffers();
523
+ }
437
524
  return this;
438
525
  }
439
526
  /**
@@ -448,8 +535,9 @@ export class GPUParticleSystem extends BaseParticleSystem {
448
535
  this._velocityGradients = [];
449
536
  }
450
537
  this._addFactorGradient(this._velocityGradients, gradient, factor, factor2);
451
- this._refreshFactorGradient(this._velocityGradients, "_velocityGradientsTexture");
452
- this._releaseBuffers();
538
+ if (!this._refreshFactorGradient(this._velocityGradients, "_velocityGradientsTexture")) {
539
+ this._releaseBuffers();
540
+ }
453
541
  return this;
454
542
  }
455
543
  /**
@@ -458,8 +546,10 @@ export class GPUParticleSystem extends BaseParticleSystem {
458
546
  * @returns the current particle system
459
547
  */
460
548
  removeVelocityGradient(gradient) {
461
- this._removeGradientAndTexture(gradient, this._velocityGradients, this._velocityGradientsTexture);
462
- this._velocityGradientsTexture = null;
549
+ this._removeFactorGradient(this._velocityGradients, gradient);
550
+ if (!this._refreshFactorGradient(this._velocityGradients, "_velocityGradientsTexture")) {
551
+ this._releaseBuffers();
552
+ }
463
553
  return this;
464
554
  }
465
555
  /**
@@ -474,8 +564,9 @@ export class GPUParticleSystem extends BaseParticleSystem {
474
564
  this._limitVelocityGradients = [];
475
565
  }
476
566
  this._addFactorGradient(this._limitVelocityGradients, gradient, factor, factor2);
477
- this._refreshFactorGradient(this._limitVelocityGradients, "_limitVelocityGradientsTexture");
478
- this._releaseBuffers();
567
+ if (!this._refreshFactorGradient(this._limitVelocityGradients, "_limitVelocityGradientsTexture")) {
568
+ this._releaseBuffers();
569
+ }
479
570
  return this;
480
571
  }
481
572
  /**
@@ -484,8 +575,10 @@ export class GPUParticleSystem extends BaseParticleSystem {
484
575
  * @returns the current particle system
485
576
  */
486
577
  removeLimitVelocityGradient(gradient) {
487
- this._removeGradientAndTexture(gradient, this._limitVelocityGradients, this._limitVelocityGradientsTexture);
488
- this._limitVelocityGradientsTexture = null;
578
+ this._removeFactorGradient(this._limitVelocityGradients, gradient);
579
+ if (!this._refreshFactorGradient(this._limitVelocityGradients, "_limitVelocityGradientsTexture")) {
580
+ this._releaseBuffers();
581
+ }
489
582
  return this;
490
583
  }
491
584
  /**
@@ -500,8 +593,9 @@ export class GPUParticleSystem extends BaseParticleSystem {
500
593
  this._dragGradients = [];
501
594
  }
502
595
  this._addFactorGradient(this._dragGradients, gradient, factor, factor2);
503
- this._refreshFactorGradient(this._dragGradients, "_dragGradientsTexture");
504
- this._releaseBuffers();
596
+ if (!this._refreshFactorGradient(this._dragGradients, "_dragGradientsTexture")) {
597
+ this._releaseBuffers();
598
+ }
505
599
  return this;
506
600
  }
507
601
  /**
@@ -510,8 +604,10 @@ export class GPUParticleSystem extends BaseParticleSystem {
510
604
  * @returns the current particle system
511
605
  */
512
606
  removeDragGradient(gradient) {
513
- this._removeGradientAndTexture(gradient, this._dragGradients, this._dragGradientsTexture);
514
- this._dragGradientsTexture = null;
607
+ this._removeFactorGradient(this._dragGradients, gradient);
608
+ if (!this._refreshFactorGradient(this._dragGradients, "_dragGradientsTexture")) {
609
+ this._releaseBuffers();
610
+ }
515
611
  return this;
516
612
  }
517
613
  /**
@@ -1330,11 +1426,7 @@ export class GPUParticleSystem extends BaseParticleSystem {
1330
1426
  this._update();
1331
1427
  }
1332
1428
  }
1333
- _createFactorGradientTexture(factorGradients, textureName) {
1334
- const texture = this[textureName];
1335
- if (!factorGradients || !factorGradients.length || texture) {
1336
- return;
1337
- }
1429
+ _bakeFactorGradientData(factorGradients) {
1338
1430
  const data = new Float32Array(this._rawTextureWidth * 2);
1339
1431
  for (let x = 0; x < this._rawTextureWidth; x++) {
1340
1432
  const ratio = x / this._rawTextureWidth;
@@ -1345,6 +1437,32 @@ export class GPUParticleSystem extends BaseParticleSystem {
1345
1437
  data[x * 2 + 1] = Lerp(cg.factor2 ?? cg.factor1, ng.factor2 ?? ng.factor1, scale);
1346
1438
  });
1347
1439
  }
1440
+ return data;
1441
+ }
1442
+ /**
1443
+ * Re-bakes an active factor gradient family's lookup texture pixels in place. The texture identity is
1444
+ * preserved, so retained bindings (e.g. the WebGPU update compute shader's) stay valid and no buffer
1445
+ * release is needed — the live particle pool survives the edit. The texture layout is independent of the
1446
+ * number of stops (fixed _rawTextureWidth x 1), so any change within an active family can be re-baked.
1447
+ * @param factorGradients defines the gradient family to bake
1448
+ * @param textureName defines the name of the property holding the family's lookup texture
1449
+ * @returns false when there is nothing to re-bake (no texture yet, or the family was emptied) — callers
1450
+ * fall back to the dispose + release path.
1451
+ */
1452
+ _rebakeFactorGradientTexture(factorGradients, textureName) {
1453
+ const texture = this[textureName];
1454
+ if (!texture || !factorGradients || !factorGradients.length) {
1455
+ return false;
1456
+ }
1457
+ texture.update(this._bakeFactorGradientData(factorGradients));
1458
+ return true;
1459
+ }
1460
+ _createFactorGradientTexture(factorGradients, textureName) {
1461
+ const texture = this[textureName];
1462
+ if (!factorGradients || !factorGradients.length || texture) {
1463
+ return;
1464
+ }
1465
+ const data = this._bakeFactorGradientData(factorGradients);
1348
1466
  this[textureName] = new RawTexture(data, this._rawTextureWidth, 1, 7, this._scene || this._engine, false, false, 1, 1);
1349
1467
  this[textureName].name = textureName.substring(1);
1350
1468
  }
@@ -1466,14 +1584,7 @@ export class GPUParticleSystem extends BaseParticleSystem {
1466
1584
  this._meshEmitterMeshId = mesh.uniqueId;
1467
1585
  this._meshEmitterUsedNormals = useNormals;
1468
1586
  }
1469
- _createColorGradientTexture() {
1470
- if (!this._colorGradients || !this._colorGradients.length || this._colorGradientsTexture) {
1471
- return;
1472
- }
1473
- // When any stop has a color2, pack color1 into row 0 and color2 into row 1. The render shader
1474
- // samples both rows and lerps using the particle's persistent seed.x for per-particle randomness.
1475
- const hasColor2 = this._hasColorGradientColor2;
1476
- const height = hasColor2 ? 2 : 1;
1587
+ _bakeColorGradientData(height) {
1477
1588
  const data = new Uint8Array(this._rawTextureWidth * 4 * height);
1478
1589
  const tmpColor = TmpColors.Color4[0];
1479
1590
  for (let x = 0; x < this._rawTextureWidth; x++) {
@@ -1486,7 +1597,7 @@ export class GPUParticleSystem extends BaseParticleSystem {
1486
1597
  data[x * 4 + 3] = tmpColor.a * 255;
1487
1598
  });
1488
1599
  }
1489
- if (hasColor2) {
1600
+ if (height === 2) {
1490
1601
  const rowOffset = this._rawTextureWidth * 4;
1491
1602
  for (let x = 0; x < this._rawTextureWidth; x++) {
1492
1603
  const ratio = x / this._rawTextureWidth;
@@ -1502,6 +1613,35 @@ export class GPUParticleSystem extends BaseParticleSystem {
1502
1613
  });
1503
1614
  }
1504
1615
  }
1616
+ return data;
1617
+ }
1618
+ /**
1619
+ * Re-bakes the color gradient lookup texture pixels in place (same texture identity, so retained bindings —
1620
+ * e.g. the WebGPU update compute shader's — stay valid and the live particle pool survives the edit). Only
1621
+ * valid while the row layout is unchanged: a color2 range appearing or disappearing changes the texture
1622
+ * height and the render vertex buffer layout, which must go through the structural dispose + release path.
1623
+ * @returns false when the re-bake cannot handle the change (no texture yet, family emptied, or row layout flip)
1624
+ */
1625
+ _rebakeColorGradientTexture() {
1626
+ const texture = this._colorGradientsTexture;
1627
+ if (!texture || !this._colorGradients || !this._colorGradients.length) {
1628
+ return false;
1629
+ }
1630
+ const height = this._hasColorGradientColor2 ? 2 : 1;
1631
+ if (texture.getSize().height !== height) {
1632
+ return false;
1633
+ }
1634
+ texture.update(this._bakeColorGradientData(height));
1635
+ return true;
1636
+ }
1637
+ _createColorGradientTexture() {
1638
+ if (!this._colorGradients || !this._colorGradients.length || this._colorGradientsTexture) {
1639
+ return;
1640
+ }
1641
+ // When any stop has a color2, pack color1 into row 0 and color2 into row 1. The render shader
1642
+ // samples both rows and lerps using the particle's persistent seed.x for per-particle randomness.
1643
+ const height = this._hasColorGradientColor2 ? 2 : 1;
1644
+ const data = this._bakeColorGradientData(height);
1505
1645
  this._colorGradientsTexture = RawTexture.CreateRGBATexture(data, this._rawTextureWidth, height, this._scene, false, false, 1);
1506
1646
  this._colorGradientsTexture.name = "colorGradients";
1507
1647
  }