@onerjs/core 8.54.3 → 8.54.5
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.
- package/DeviceInput/webDeviceInputSystem.js +4 -0
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js +2 -2
- package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -0
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +18 -4
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheTextureView.d.ts +13 -0
- package/Engines/WebGPU/webgpuCacheTextureView.js +32 -0
- package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -0
- package/Engines/WebGPU/webgpuRenderTargetWrapper.d.ts +10 -0
- package/Engines/WebGPU/webgpuRenderTargetWrapper.js +10 -0
- package/Engines/WebGPU/webgpuRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js +57 -4
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +4 -2
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.pure.js +2 -2
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/thinNativeEngine.pure.d.ts +5 -0
- package/Engines/thinNativeEngine.pure.js +29 -6
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Engines/webgpuEngine.pure.d.ts +1 -0
- package/Engines/webgpuEngine.pure.js +21 -8
- package/Engines/webgpuEngine.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.d.ts +95 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +169 -4
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.d.ts +21 -6
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js +28 -26
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.d.ts +30 -2
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js +111 -29
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.d.ts +56 -2
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js +99 -14
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js +10 -2
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +21 -1
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +18 -0
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +29 -2
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +15 -0
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +44 -7
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +9 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +9 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +7 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +8 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.d.ts +5 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js +8 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.d.ts +37 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js +44 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js.map +1 -0
- package/FlowGraph/Blocks/Event/index.d.ts +1 -0
- package/FlowGraph/Blocks/Event/index.js +1 -0
- package/FlowGraph/Blocks/Event/index.js.map +1 -1
- package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
- package/FlowGraph/Blocks/Event/pure.js +1 -0
- package/FlowGraph/Blocks/Event/pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.d.ts +4 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js +67 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +13 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +102 -7
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +5 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +5 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.d.ts +11 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js +21 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js +25 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +18 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +9 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js +9 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
- package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +17 -3
- package/FlowGraph/CustomTypes/flowGraphMatrix.js +27 -21
- package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +23 -0
- package/FlowGraph/flowGraphContext.js +29 -0
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +58 -1
- package/FlowGraph/flowGraphCoordinator.js +72 -0
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphDelayRegistry.d.ts +31 -0
- package/FlowGraph/flowGraphDelayRegistry.js +50 -0
- package/FlowGraph/flowGraphDelayRegistry.js.map +1 -0
- package/FlowGraph/flowGraphHostResolver.d.ts +69 -0
- package/FlowGraph/flowGraphHostResolver.js +25 -0
- package/FlowGraph/flowGraphHostResolver.js.map +1 -0
- package/FlowGraph/flowGraphMath.d.ts +48 -1
- package/FlowGraph/flowGraphMath.js +169 -4
- package/FlowGraph/flowGraphMath.js.map +1 -1
- package/FlowGraph/flowGraphPathConverterComponent.d.ts +14 -3
- package/FlowGraph/flowGraphPathConverterComponent.js +110 -18
- package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
- package/FlowGraph/flowGraphSignalConnection.pure.js +7 -1
- package/FlowGraph/flowGraphSignalConnection.pure.js.map +1 -1
- package/FlowGraph/index.d.ts +2 -0
- package/FlowGraph/index.js +2 -0
- package/FlowGraph/index.js.map +1 -1
- package/FlowGraph/pure.d.ts +2 -0
- package/FlowGraph/pure.js +2 -0
- package/FlowGraph/pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +3 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
- package/Maths/math.vector.pure.d.ts +10 -0
- package/Maths/math.vector.pure.js +13 -0
- package/Maths/math.vector.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +216 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +714 -67
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +81 -4
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +487 -54
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +19 -0
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +24 -0
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +48 -10
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +5 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
- package/Meshes/abstractMesh.pure.js +5 -3
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Misc/greasedLineTools.js +1 -1
- package/Misc/greasedLineTools.js.map +1 -1
- package/Misc/tools.pure.js +14 -2
- package/Misc/tools.pure.js.map +1 -1
- package/Particles/gpuParticleSystem.pure.d.ts +66 -1
- package/Particles/gpuParticleSystem.pure.js +189 -49
- package/Particles/gpuParticleSystem.pure.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +15 -0
- package/Physics/v2/Plugins/havokPlugin.js +16 -6
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/characterController.js +71 -19
- package/Physics/v2/characterController.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/clusteredLightingCompute.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/clusteredLightingCompute.js +29 -0
- package/ShadersWGSL/ShadersInclude/clusteredLightingCompute.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/lightFragment.js +2 -3
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.d.ts +1 -0
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +2 -17
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.d.ts +6 -0
- package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js +123 -0
- package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +2 -111
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/ShadersWGSL/background.fragment.js +2 -1
- package/ShadersWGSL/background.fragment.js.map +1 -1
- package/ShadersWGSL/default.fragment.js +2 -1
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/openpbr.fragment.js +2 -1
- package/ShadersWGSL/openpbr.fragment.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +2 -1
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +3 -9
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +4 -11
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
- package/XR/features/WebXRAbstractFeature.d.ts +9 -0
- package/XR/features/WebXRAbstractFeature.js +16 -0
- package/XR/features/WebXRAbstractFeature.js.map +1 -1
- package/XR/features/WebXRDepthSensing.pure.d.ts +7 -0
- package/XR/features/WebXRDepthSensing.pure.js +350 -39
- package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
- package/XR/features/WebXRImageTracking.pure.js.map +1 -1
- package/XR/features/WebXRLayers.pure.d.ts +6 -5
- package/XR/features/WebXRLayers.pure.js +65 -8
- package/XR/features/WebXRLayers.pure.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.pure.js +9 -2
- package/XR/features/WebXRRawCameraAccess.pure.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.pure.d.ts +0 -1
- package/XR/features/WebXRSpaceWarp.pure.js +13 -4
- package/XR/features/WebXRSpaceWarp.pure.js.map +1 -1
- package/XR/features/WebXRWalkingLocomotion.pure.js.map +1 -1
- package/XR/webXRCamera.js +27 -0
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRFeatureWarningRegistry.d.ts +14 -0
- package/XR/webXRFeatureWarningRegistry.js +19 -0
- package/XR/webXRFeatureWarningRegistry.js.map +1 -0
- package/XR/webXRFeaturesManager.d.ts +5 -0
- package/XR/webXRFeaturesManager.js +23 -4
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/XR/webXRGraphicsBinding.d.ts +17 -10
- package/XR/webXRGraphicsBinding.js +8 -5
- package/XR/webXRGraphicsBinding.js.map +1 -1
- package/XR/webXRSessionManager.d.ts +3 -5
- package/XR/webXRSessionManager.js +1 -3
- package/XR/webXRSessionManager.js.map +1 -1
- package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +21 -5
- package/XR/webXRWebGPURenderTargetTextureProvider.js +38 -10
- package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
- package/package.json +1 -1
- package/scene.pure.d.ts +7 -0
- package/scene.pure.js +8 -0
- package/scene.pure.js.map +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
|
-
/**
|
|
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
|
-
|
|
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
|
-
/**
|
|
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
|
-
|
|
349
|
-
this.
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
this._refreshFactorGradient(this.
|
|
353
|
-
|
|
354
|
-
|
|
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
|
-
|
|
363
|
-
|
|
364
|
-
//
|
|
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
|
-
|
|
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.
|
|
400
|
-
this._sizeGradientsTexture
|
|
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
|
-
|
|
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.
|
|
436
|
-
this._angularSpeedGradientsTexture
|
|
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
|
-
|
|
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.
|
|
462
|
-
this._velocityGradientsTexture
|
|
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
|
-
|
|
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.
|
|
488
|
-
this._limitVelocityGradientsTexture
|
|
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
|
-
|
|
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.
|
|
514
|
-
this._dragGradientsTexture
|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
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
|
}
|