@babylonjs/core 8.44.1 → 8.45.0
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/Cameras/Inputs/geospatialCameraKeyboardInput.js +6 -10
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraMouseWheelInput.js +1 -1
- package/Cameras/Inputs/geospatialCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Limits/geospatialLimits.d.ts +4 -22
- package/Cameras/Limits/geospatialLimits.js +4 -36
- package/Cameras/Limits/geospatialLimits.js.map +1 -1
- package/Cameras/geospatialCamera.d.ts +15 -4
- package/Cameras/geospatialCamera.js +90 -37
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Cameras/geospatialCameraMovement.d.ts +1 -3
- package/Cameras/geospatialCameraMovement.js +15 -51
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Collisions/collisionCoordinator.d.ts +2 -2
- package/Collisions/collisionCoordinator.js +1 -0
- package/Collisions/collisionCoordinator.js.map +1 -1
- package/Engines/Extensions/engine.debugging.d.ts +3 -5
- package/Engines/Extensions/engine.debugging.js +3 -4
- package/Engines/Extensions/engine.debugging.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.debugging.js +15 -65
- package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +9 -9
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +2 -0
- package/Engines/abstractEngine.js +4 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/thinWebGPUEngine.d.ts +0 -2
- package/Engines/thinWebGPUEngine.js +0 -8
- package/Engines/thinWebGPUEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +1 -3
- package/Engines/webgpuEngine.js +4 -10
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Passes/renderPass.js +4 -9
- package/FrameGraph/Passes/renderPass.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +4 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +2 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +31 -7
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/frameGraph.js +2 -2
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphContext.d.ts +9 -0
- package/FrameGraph/frameGraphContext.js +13 -2
- package/FrameGraph/frameGraphContext.js.map +1 -1
- package/FrameGraph/frameGraphObjectList.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +9 -8
- package/FrameGraph/frameGraphRenderContext.js +23 -20
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.d.ts +2 -0
- package/FrameGraph/frameGraphTask.js +14 -4
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +4 -1
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +8 -3
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/areaLight.d.ts +2 -1
- package/Lights/areaLight.js +3 -2
- package/Lights/areaLight.js.map +1 -1
- package/Lights/directionalLight.d.ts +2 -1
- package/Lights/directionalLight.js +3 -2
- package/Lights/directionalLight.js.map +1 -1
- package/Lights/hemisphericLight.d.ts +2 -1
- package/Lights/hemisphericLight.js +3 -2
- package/Lights/hemisphericLight.js.map +1 -1
- package/Lights/light.d.ts +2 -1
- package/Lights/light.js +8 -3
- package/Lights/light.js.map +1 -1
- package/Lights/lightingVolume.js +11 -6
- package/Lights/lightingVolume.js.map +1 -1
- package/Lights/pointLight.d.ts +2 -1
- package/Lights/pointLight.js +3 -2
- package/Lights/pointLight.js.map +1 -1
- package/Lights/rectAreaLight.d.ts +2 -1
- package/Lights/rectAreaLight.js +3 -2
- package/Lights/rectAreaLight.js.map +1 -1
- package/Lights/spotLight.d.ts +2 -1
- package/Lights/spotLight.js +3 -2
- package/Lights/spotLight.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +3 -0
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +1 -0
- package/Materials/Node/nodeMaterial.js +4 -0
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildStateSharedData.d.ts +6 -0
- package/Materials/Node/nodeMaterialBuildStateSharedData.js +4 -0
- package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
- package/Materials/Textures/Loaders/iesTextureLoader.js +1 -1
- package/Materials/Textures/Loaders/iesTextureLoader.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +7 -2
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +6 -4
- package/Materials/Textures/internalTexture.js +6 -4
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +2 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/textureSampler.d.ts +3 -3
- package/Materials/Textures/textureSampler.js.map +1 -1
- package/Misc/minMaxReducer.js +2 -2
- package/Misc/minMaxReducer.js.map +1 -1
- package/Misc/screenshotTools.d.ts +3 -1
- package/Misc/screenshotTools.js +5 -2
- package/Misc/screenshotTools.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +47 -46
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.js +4 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.js.map +1 -1
- package/Probes/reflectionProbe.js +9 -2
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/depthRenderer.js +7 -2
- package/Rendering/depthRenderer.js.map +1 -1
- package/Shaders/particles.vertex.js +8 -1
- package/Shaders/particles.vertex.js.map +1 -1
- package/ShadersWGSL/particles.vertex.js +6 -0
- package/ShadersWGSL/particles.vertex.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +10 -0
- package/scene.js +30 -5
- package/scene.js.map +1 -1
|
@@ -71,7 +71,7 @@ function _CreateParticleBlockGroup(oldSystem, context) {
|
|
|
71
71
|
_CreateParticleAngleBlockGroup(oldSystem).connectTo(createParticleBlock.angle);
|
|
72
72
|
_CreateParticleColorBlockGroup(oldSystem, context).connectTo(createParticleBlock.color);
|
|
73
73
|
// Dead color
|
|
74
|
-
_CreateAndConnectInput("Dead Color", oldSystem.colorDead, createParticleBlock.colorDead);
|
|
74
|
+
_CreateAndConnectInput("Dead Color", oldSystem.colorDead.clone(), createParticleBlock.colorDead);
|
|
75
75
|
// Emitter shape
|
|
76
76
|
createdParticle = _EmitterShapeBlock(createdParticle, oldSystem);
|
|
77
77
|
// Sprite sheet setup
|
|
@@ -88,7 +88,7 @@ function _CreateParticleBlockGroup(oldSystem, context) {
|
|
|
88
88
|
*/
|
|
89
89
|
function _CreateParticleLifetimeBlockGroup(oldSystem, context) {
|
|
90
90
|
if (oldSystem.targetStopDuration && oldSystem._lifeTimeGradients && oldSystem._lifeTimeGradients.length > 0) {
|
|
91
|
-
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(oldSystem, context);
|
|
91
|
+
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(oldSystem.targetStopDuration, context);
|
|
92
92
|
const gradientBlockGroupOutput = _CreateGradientBlockGroup(context.timeToStopTimeRatioBlockGroupOutput, oldSystem._lifeTimeGradients, ParticleRandomBlockLocks.PerParticle, "Lifetime");
|
|
93
93
|
return gradientBlockGroupOutput;
|
|
94
94
|
}
|
|
@@ -141,7 +141,7 @@ function _CreateParticleScaleBlockGroup(oldSystem, context) {
|
|
|
141
141
|
_CreateAndConnectInput("Max Scale", new Vector2(oldSystem.maxScaleX, oldSystem.maxScaleY), randomScaleBlock.max);
|
|
142
142
|
if (oldSystem.targetStopDuration && oldSystem._startSizeGradients && oldSystem._startSizeGradients.length > 0) {
|
|
143
143
|
// Create the start size gradient
|
|
144
|
-
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(oldSystem, context);
|
|
144
|
+
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(oldSystem.targetStopDuration, context);
|
|
145
145
|
const gradientBlockGroupOutput = _CreateGradientBlockGroup(context.timeToStopTimeRatioBlockGroupOutput, oldSystem._startSizeGradients, ParticleRandomBlockLocks.PerParticle, "Start Size");
|
|
146
146
|
// Multiply the initial random scale by the start size gradient
|
|
147
147
|
const multiplyScaleBlock = new ParticleMathBlock("Multiply Scale by Start Size Gradient");
|
|
@@ -178,8 +178,8 @@ function _CreateParticleColorBlockGroup(oldSystem, context) {
|
|
|
178
178
|
}
|
|
179
179
|
else {
|
|
180
180
|
const randomColorBlock = new ParticleRandomBlock("Random color");
|
|
181
|
-
_CreateAndConnectInput("Color 1", oldSystem.color1, randomColorBlock.min);
|
|
182
|
-
_CreateAndConnectInput("Color 2", oldSystem.color2, randomColorBlock.max);
|
|
181
|
+
_CreateAndConnectInput("Color 1", oldSystem.color1.clone(), randomColorBlock.min);
|
|
182
|
+
_CreateAndConnectInput("Color 2", oldSystem.color2.clone(), randomColorBlock.max);
|
|
183
183
|
return randomColorBlock.output;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
@@ -216,10 +216,10 @@ function _EmitterShapeBlock(particle, oldSystem) {
|
|
|
216
216
|
const source = emitter;
|
|
217
217
|
shapeBlock = new BoxShapeBlock("Box Shape");
|
|
218
218
|
const target = shapeBlock;
|
|
219
|
-
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
220
|
-
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
221
|
-
_CreateAndConnectInput("Min Emit Box", source.minEmitBox, target.minEmitBox);
|
|
222
|
-
_CreateAndConnectInput("Max Emit Box", source.maxEmitBox, target.maxEmitBox);
|
|
219
|
+
_CreateAndConnectInput("Direction 1", source.direction1.clone(), target.direction1);
|
|
220
|
+
_CreateAndConnectInput("Direction 2", source.direction2.clone(), target.direction2);
|
|
221
|
+
_CreateAndConnectInput("Min Emit Box", source.minEmitBox.clone(), target.minEmitBox);
|
|
222
|
+
_CreateAndConnectInput("Max Emit Box", source.maxEmitBox.clone(), target.maxEmitBox);
|
|
223
223
|
break;
|
|
224
224
|
}
|
|
225
225
|
case "ConeParticleEmitter": {
|
|
@@ -243,8 +243,8 @@ function _EmitterShapeBlock(particle, oldSystem) {
|
|
|
243
243
|
_CreateAndConnectInput("Angle", source.angle, target.angle);
|
|
244
244
|
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
245
245
|
_CreateAndConnectInput("Height Range", source.heightRange, target.heightRange);
|
|
246
|
-
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
247
|
-
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
246
|
+
_CreateAndConnectInput("Direction 1", source.direction1.clone(), target.direction1);
|
|
247
|
+
_CreateAndConnectInput("Direction 2", source.direction2.clone(), target.direction2);
|
|
248
248
|
break;
|
|
249
249
|
}
|
|
250
250
|
case "CustomParticleEmitter": {
|
|
@@ -273,8 +273,8 @@ function _EmitterShapeBlock(particle, oldSystem) {
|
|
|
273
273
|
_CreateAndConnectInput("Height", source.height, target.height);
|
|
274
274
|
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
275
275
|
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
276
|
-
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
277
|
-
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
276
|
+
_CreateAndConnectInput("Direction 1", source.direction1.clone(), target.direction1);
|
|
277
|
+
_CreateAndConnectInput("Direction 2", source.direction2.clone(), target.direction2);
|
|
278
278
|
break;
|
|
279
279
|
}
|
|
280
280
|
case "HemisphericParticleEmitter": {
|
|
@@ -292,8 +292,8 @@ function _EmitterShapeBlock(particle, oldSystem) {
|
|
|
292
292
|
shapeBlock = new MeshShapeBlock("Mesh Shape");
|
|
293
293
|
const target = shapeBlock;
|
|
294
294
|
target.useMeshNormalsForDirection = source.useMeshNormalsForDirection;
|
|
295
|
-
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
296
|
-
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
295
|
+
_CreateAndConnectInput("Direction 1", source.direction1.clone(), target.direction1);
|
|
296
|
+
_CreateAndConnectInput("Direction 2", source.direction2.clone(), target.direction2);
|
|
297
297
|
target.mesh = source.mesh;
|
|
298
298
|
break;
|
|
299
299
|
}
|
|
@@ -301,8 +301,8 @@ function _EmitterShapeBlock(particle, oldSystem) {
|
|
|
301
301
|
const source = emitter;
|
|
302
302
|
shapeBlock = new PointShapeBlock("Point Shape");
|
|
303
303
|
const target = shapeBlock;
|
|
304
|
-
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
305
|
-
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
304
|
+
_CreateAndConnectInput("Direction 1", source.direction1.clone(), target.direction1);
|
|
305
|
+
_CreateAndConnectInput("Direction 2", source.direction2.clone(), target.direction2);
|
|
306
306
|
break;
|
|
307
307
|
}
|
|
308
308
|
case "SphereParticleEmitter": {
|
|
@@ -320,8 +320,8 @@ function _EmitterShapeBlock(particle, oldSystem) {
|
|
|
320
320
|
const target = shapeBlock;
|
|
321
321
|
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
322
322
|
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
323
|
-
_CreateAndConnectInput("Direction1", source.direction1, target.direction1);
|
|
324
|
-
_CreateAndConnectInput("Direction2", source.direction2, target.direction2);
|
|
323
|
+
_CreateAndConnectInput("Direction1", source.direction1.clone(), target.direction1);
|
|
324
|
+
_CreateAndConnectInput("Direction2", source.direction2.clone(), target.direction2);
|
|
325
325
|
break;
|
|
326
326
|
}
|
|
327
327
|
}
|
|
@@ -355,7 +355,7 @@ function _SpriteSheetBlock(particle, oldSystem) {
|
|
|
355
355
|
function _UpdateParticleBlockGroup(inputParticle, oldSystem, context) {
|
|
356
356
|
let updatedParticle = inputParticle;
|
|
357
357
|
updatedParticle = _UpdateParticleColorBlockGroup(updatedParticle, oldSystem._colorGradients, context);
|
|
358
|
-
updatedParticle = _UpdateParticleAngleBlockGroup(updatedParticle, oldSystem, context);
|
|
358
|
+
updatedParticle = _UpdateParticleAngleBlockGroup(updatedParticle, oldSystem._angularSpeedGradients, oldSystem.minAngularSpeed, oldSystem.maxAngularSpeed, context);
|
|
359
359
|
if (oldSystem._velocityGradients && oldSystem._velocityGradients.length > 0) {
|
|
360
360
|
context.scaledDirection = _UpdateParticleVelocityGradientBlockGroup(oldSystem._velocityGradients, context);
|
|
361
361
|
}
|
|
@@ -367,7 +367,7 @@ function _UpdateParticleBlockGroup(inputParticle, oldSystem, context) {
|
|
|
367
367
|
updatedParticle = _UpdateParticleVelocityLimitGradientBlockGroup(updatedParticle, oldSystem._limitVelocityGradients, oldSystem.limitVelocityDamping, context);
|
|
368
368
|
}
|
|
369
369
|
if (oldSystem.noiseTexture && oldSystem.noiseStrength) {
|
|
370
|
-
updatedParticle = _UpdateParticleNoiseBlockGroup(updatedParticle, oldSystem.noiseTexture, oldSystem.noiseStrength);
|
|
370
|
+
updatedParticle = _UpdateParticleNoiseBlockGroup(updatedParticle, oldSystem.noiseTexture.clone(), oldSystem.noiseStrength.clone());
|
|
371
371
|
}
|
|
372
372
|
if (oldSystem._sizeGradients && oldSystem._sizeGradients.length > 0) {
|
|
373
373
|
updatedParticle = _UpdateParticleSizeGradientBlockGroup(updatedParticle, oldSystem._sizeGradients, context);
|
|
@@ -410,19 +410,21 @@ function _UpdateParticleColorBlockGroup(inputParticle, colorGradients, context)
|
|
|
410
410
|
/**
|
|
411
411
|
* Creates the group of blocks that represent the particle angle update
|
|
412
412
|
* @param inputParticle The input particle to update
|
|
413
|
-
* @param
|
|
413
|
+
* @param angularSpeedGradients The angular speed gradients (if any)
|
|
414
|
+
* @param minAngularSpeed The minimum angular speed
|
|
415
|
+
* @param maxAngularSpeed The maximum angular speed
|
|
414
416
|
* @param context The context of the current conversion
|
|
415
417
|
* @returns The output of the group of blocks that represent the particle color update
|
|
416
418
|
*/
|
|
417
|
-
function _UpdateParticleAngleBlockGroup(inputParticle,
|
|
419
|
+
function _UpdateParticleAngleBlockGroup(inputParticle, angularSpeedGradients, minAngularSpeed, maxAngularSpeed, context) {
|
|
418
420
|
// We will try to use gradients if they exist
|
|
419
421
|
// If not, we will try to use min/max angular speed
|
|
420
422
|
let angularSpeedCalculation = null;
|
|
421
|
-
if (
|
|
422
|
-
angularSpeedCalculation = _UpdateParticleAngularSpeedGradientBlockGroup(
|
|
423
|
+
if (angularSpeedGradients && angularSpeedGradients.length > 0) {
|
|
424
|
+
angularSpeedCalculation = _UpdateParticleAngularSpeedGradientBlockGroup(angularSpeedGradients, context);
|
|
423
425
|
}
|
|
424
|
-
else if (
|
|
425
|
-
angularSpeedCalculation = _UpdateParticleAngularSpeedBlockGroup(
|
|
426
|
+
else if (minAngularSpeed !== 0 || maxAngularSpeed !== 0) {
|
|
427
|
+
angularSpeedCalculation = _UpdateParticleAngularSpeedBlockGroup(minAngularSpeed, maxAngularSpeed);
|
|
426
428
|
}
|
|
427
429
|
// If we have an angular speed calculation, then update the angle
|
|
428
430
|
if (angularSpeedCalculation) {
|
|
@@ -663,8 +665,8 @@ function _ClampUpdateColorAlpha(colorCalculationOutput) {
|
|
|
663
665
|
// ------------- SYSTEM FUNCTIONS -------------
|
|
664
666
|
function _SystemBlockGroup(updateParticleOutput, oldSystem, context) {
|
|
665
667
|
const newSystem = new SystemBlock(oldSystem.name);
|
|
666
|
-
newSystem.translationPivot.value = oldSystem.translationPivot;
|
|
667
|
-
newSystem.textureMask.value = oldSystem.textureMask;
|
|
668
|
+
newSystem.translationPivot.value = oldSystem.translationPivot.clone();
|
|
669
|
+
newSystem.textureMask.value = oldSystem.textureMask.clone();
|
|
668
670
|
newSystem.manualEmitCount = oldSystem.manualEmitCount;
|
|
669
671
|
newSystem.blendMode = oldSystem.blendMode;
|
|
670
672
|
newSystem.capacity = oldSystem.getCapacity();
|
|
@@ -675,20 +677,19 @@ function _SystemBlockGroup(updateParticleOutput, oldSystem, context) {
|
|
|
675
677
|
newSystem.isBillboardBased = oldSystem.isBillboardBased;
|
|
676
678
|
newSystem.isLocal = oldSystem.isLocal;
|
|
677
679
|
newSystem.disposeOnStop = oldSystem.disposeOnStop;
|
|
678
|
-
_SystemEmitRateValue(oldSystem, newSystem, context);
|
|
680
|
+
_SystemEmitRateValue(oldSystem.getEmitRateGradients(), oldSystem.targetStopDuration, oldSystem.emitRate, newSystem, context);
|
|
679
681
|
const texture = oldSystem.particleTexture;
|
|
680
682
|
if (texture) {
|
|
681
683
|
_CreateTextureBlock(texture).connectTo(newSystem.texture);
|
|
682
684
|
}
|
|
683
|
-
_SystemTargetStopDuration(oldSystem, newSystem, context);
|
|
685
|
+
_SystemTargetStopDuration(oldSystem.targetStopDuration, newSystem, context);
|
|
684
686
|
updateParticleOutput.connectTo(newSystem.particle);
|
|
685
687
|
return newSystem;
|
|
686
688
|
}
|
|
687
|
-
function _SystemEmitRateValue(
|
|
688
|
-
|
|
689
|
-
if (emitGradients && emitGradients.length > 0 && oldSystem.targetStopDuration > 0) {
|
|
689
|
+
function _SystemEmitRateValue(emitGradients, targetStopDuration, emitRate, newSystem, context) {
|
|
690
|
+
if (emitGradients && emitGradients.length > 0 && targetStopDuration > 0) {
|
|
690
691
|
// Create the emit gradients
|
|
691
|
-
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(
|
|
692
|
+
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(targetStopDuration, context);
|
|
692
693
|
const gradientValue = _CreateGradientBlockGroup(context.timeToStopTimeRatioBlockGroupOutput, emitGradients, ParticleRandomBlockLocks.PerSystem, "Emit Rate");
|
|
693
694
|
// Round the value to an int
|
|
694
695
|
const roundBlock = new ParticleFloatToIntBlock("Round to Int");
|
|
@@ -697,10 +698,10 @@ function _SystemEmitRateValue(oldSystem, newSystem, context) {
|
|
|
697
698
|
roundBlock.output.connectTo(newSystem.emitRate);
|
|
698
699
|
}
|
|
699
700
|
else {
|
|
700
|
-
newSystem.emitRate.value =
|
|
701
|
+
newSystem.emitRate.value = emitRate;
|
|
701
702
|
}
|
|
702
703
|
}
|
|
703
|
-
function _SystemTargetStopDuration(
|
|
704
|
+
function _SystemTargetStopDuration(targetStopDuration, newSystem, context) {
|
|
704
705
|
// If something else uses the target stop duration (like a gradient),
|
|
705
706
|
// then the block is already created and stored in the context
|
|
706
707
|
if (context.targetStopDurationBlockOutput) {
|
|
@@ -708,7 +709,7 @@ function _SystemTargetStopDuration(oldSystem, newSystem, context) {
|
|
|
708
709
|
}
|
|
709
710
|
else {
|
|
710
711
|
// If no one used it, do not create a block just set the value
|
|
711
|
-
newSystem.targetStopDuration.value =
|
|
712
|
+
newSystem.targetStopDuration.value = targetStopDuration;
|
|
712
713
|
}
|
|
713
714
|
}
|
|
714
715
|
// ------------- UTILITY FUNCTIONS -------------
|
|
@@ -742,18 +743,18 @@ function _CreateAndConnectSystemSource(systemBlockName, systemSource, targetToCo
|
|
|
742
743
|
/**
|
|
743
744
|
* Creates the target stop duration input block, as it can be shared in multiple places
|
|
744
745
|
* This block is stored in the context so the same block is shared in the graph
|
|
745
|
-
* @param
|
|
746
|
+
* @param targetStopDuration The target stop duration value
|
|
746
747
|
* @param context The context of the current conversion
|
|
747
748
|
* @returns
|
|
748
749
|
*/
|
|
749
|
-
function _CreateTargetStopDurationInputBlock(
|
|
750
|
+
function _CreateTargetStopDurationInputBlock(targetStopDuration, context) {
|
|
750
751
|
// If we have already created the target stop duration input block, return it
|
|
751
752
|
if (context.targetStopDurationBlockOutput) {
|
|
752
753
|
return context.targetStopDurationBlockOutput;
|
|
753
754
|
}
|
|
754
755
|
// Create the target stop duration input block if not already created
|
|
755
756
|
const targetStopDurationInputBlock = new ParticleInputBlock("Target Stop Duration");
|
|
756
|
-
targetStopDurationInputBlock.value =
|
|
757
|
+
targetStopDurationInputBlock.value = targetStopDuration;
|
|
757
758
|
// Save the output in our context to avoid regenerating it again
|
|
758
759
|
context.targetStopDurationBlockOutput = targetStopDurationInputBlock.output;
|
|
759
760
|
return context.targetStopDurationBlockOutput;
|
|
@@ -762,16 +763,16 @@ function _CreateTargetStopDurationInputBlock(oldSystem, context) {
|
|
|
762
763
|
* Create a group of blocks that calculates the ratio between the actual frame and the target stop duration, clamped between 0 and 1.
|
|
763
764
|
* This is used to simulate the behavior of the old particle system where several particle gradient values are affected by the target stop duration.
|
|
764
765
|
* This block group is stored in the context so the same group is shared in the graph
|
|
765
|
-
* @param
|
|
766
|
+
* @param targetStopDuration The target stop duration value
|
|
766
767
|
* @param context The context of the current conversion
|
|
767
768
|
* @returns The ratio block output connection point
|
|
768
769
|
*/
|
|
769
|
-
function _CreateTimeToStopTimeRatioBlockGroup(
|
|
770
|
+
function _CreateTimeToStopTimeRatioBlockGroup(targetStopDuration, context) {
|
|
770
771
|
// If we have already generated this group, return it
|
|
771
772
|
if (context.timeToStopTimeRatioBlockGroupOutput) {
|
|
772
773
|
return context.timeToStopTimeRatioBlockGroupOutput;
|
|
773
774
|
}
|
|
774
|
-
context.targetStopDurationBlockOutput = _CreateTargetStopDurationInputBlock(
|
|
775
|
+
context.targetStopDurationBlockOutput = _CreateTargetStopDurationInputBlock(targetStopDuration, context);
|
|
775
776
|
// Find the ratio between the actual frame and the target stop duration
|
|
776
777
|
const ratio = new ParticleMathBlock("Frame/Stop Ratio");
|
|
777
778
|
ratio.operation = ParticleMathBlockOperations.Divide;
|
|
@@ -846,8 +847,8 @@ function _CreateGradientBlockGroup(gradientSelector, gradientValues, randomLockM
|
|
|
846
847
|
function _CreateGradientValueBlockGroup(gradientStep, randomLockMode, prefix, index) {
|
|
847
848
|
const gradientValueBlock = new ParticleGradientValueBlock(prefix + " Gradient Value " + index);
|
|
848
849
|
gradientValueBlock.reference = gradientStep.gradient;
|
|
849
|
-
const value1 = gradientStep.factor1 ?? gradientStep.color1;
|
|
850
|
-
const value2 = gradientStep.factor2 ?? gradientStep.color2;
|
|
850
|
+
const value1 = gradientStep.factor1 ?? gradientStep.color1.clone();
|
|
851
|
+
const value2 = gradientStep.factor2 ?? gradientStep.color2?.clone();
|
|
851
852
|
if (value2 !== undefined) {
|
|
852
853
|
// Create a random between value1 and value2
|
|
853
854
|
const randomBlock = new ParticleRandomBlock("Random Value " + index);
|