@babylonjs/core 8.44.0 → 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/dynamicTexture.d.ts +2 -2
- package/Materials/Textures/dynamicTexture.js +1 -1
- package/Materials/Textures/dynamicTexture.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/Meshes/GaussianSplatting/gaussianSplattingMesh.js +4 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.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/Blocks/Emitters/setupSpriteSheetBlock.js +3 -0
- package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js.map +1 -1
- package/Particles/Node/Blocks/index.d.ts +1 -0
- package/Particles/Node/Blocks/index.js +1 -0
- package/Particles/Node/Blocks/index.js.map +1 -1
- package/Particles/Node/Blocks/particleModuloBlock.d.ts +37 -0
- package/Particles/Node/Blocks/particleModuloBlock.js +98 -0
- package/Particles/Node/Blocks/particleModuloBlock.js.map +1 -0
- package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +22 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.js +83 -9
- package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +94 -66
- 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
|
@@ -20,8 +20,10 @@ import { CylinderShapeBlock } from "./Blocks/Emitters/cylinderShapeBlock.js";
|
|
|
20
20
|
import { CustomShapeBlock } from "./Blocks/Emitters/customShapeBlock.js";
|
|
21
21
|
import { MeshShapeBlock } from "./Blocks/Emitters/meshShapeBlock.js";
|
|
22
22
|
import { PointShapeBlock } from "./Blocks/Emitters/pointShapeBlock.js";
|
|
23
|
+
import { SetupSpriteSheetBlock } from "./Blocks/Emitters/setupSpriteSheetBlock.js";
|
|
23
24
|
import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
|
|
24
25
|
import { UpdateAngleBlock } from "./Blocks/Update/updateAngleBlock.js";
|
|
26
|
+
import { BasicSpriteUpdateBlock } from "./Blocks/Update/basicSpriteUpdateBlock.js";
|
|
25
27
|
import { UpdateColorBlock } from "./Blocks/Update/updateColorBlock.js";
|
|
26
28
|
import { UpdateDirectionBlock } from "./Blocks/Update/updateDirectionBlock.js";
|
|
27
29
|
import { UpdateNoiseBlock } from "./Blocks/Update/updateNoiseBlock.js";
|
|
@@ -48,14 +50,10 @@ export async function ConvertToNodeParticleSystemSetAsync(name, particleSystemsL
|
|
|
48
50
|
async function _ExtractDatafromParticleSystemAsync(newSet, oldSystem, context) {
|
|
49
51
|
// CreateParticle block group
|
|
50
52
|
const createParticleOutput = _CreateParticleBlockGroup(oldSystem, context);
|
|
51
|
-
// Emitter Shape block
|
|
52
|
-
const shapeOutput = _EmitterShapeBlock(oldSystem);
|
|
53
|
-
createParticleOutput.particle.connectTo(shapeOutput.particle);
|
|
54
53
|
// UpdateParticle block group
|
|
55
|
-
const updateParticleOutput = _UpdateParticleBlockGroup(
|
|
54
|
+
const updateParticleOutput = _UpdateParticleBlockGroup(createParticleOutput, oldSystem, context);
|
|
56
55
|
// System block
|
|
57
|
-
const newSystem = _SystemBlockGroup(oldSystem, context);
|
|
58
|
-
updateParticleOutput.connectTo(newSystem.particle);
|
|
56
|
+
const newSystem = _SystemBlockGroup(updateParticleOutput, oldSystem, context);
|
|
59
57
|
// Register
|
|
60
58
|
newSet.systemBlocks.push(newSystem);
|
|
61
59
|
}
|
|
@@ -65,6 +63,7 @@ async function _ExtractDatafromParticleSystemAsync(newSet, oldSystem, context) {
|
|
|
65
63
|
function _CreateParticleBlockGroup(oldSystem, context) {
|
|
66
64
|
// Create particle block
|
|
67
65
|
const createParticleBlock = new CreateParticleBlock("Create Particle");
|
|
66
|
+
let createdParticle = createParticleBlock.particle;
|
|
68
67
|
_CreateParticleLifetimeBlockGroup(oldSystem, context).connectTo(createParticleBlock.lifeTime);
|
|
69
68
|
_CreateParticleEmitPowerBlockGroup(oldSystem).connectTo(createParticleBlock.emitPower);
|
|
70
69
|
_CreateParticleSizeBlockGroup(oldSystem, context).connectTo(createParticleBlock.size);
|
|
@@ -72,8 +71,14 @@ function _CreateParticleBlockGroup(oldSystem, context) {
|
|
|
72
71
|
_CreateParticleAngleBlockGroup(oldSystem).connectTo(createParticleBlock.angle);
|
|
73
72
|
_CreateParticleColorBlockGroup(oldSystem, context).connectTo(createParticleBlock.color);
|
|
74
73
|
// Dead color
|
|
75
|
-
_CreateAndConnectInput("Dead Color", oldSystem.colorDead, createParticleBlock.colorDead);
|
|
76
|
-
|
|
74
|
+
_CreateAndConnectInput("Dead Color", oldSystem.colorDead.clone(), createParticleBlock.colorDead);
|
|
75
|
+
// Emitter shape
|
|
76
|
+
createdParticle = _EmitterShapeBlock(createdParticle, oldSystem);
|
|
77
|
+
// Sprite sheet setup
|
|
78
|
+
if (oldSystem.isAnimationSheetEnabled) {
|
|
79
|
+
createdParticle = _SpriteSheetBlock(createdParticle, oldSystem);
|
|
80
|
+
}
|
|
81
|
+
return createdParticle;
|
|
77
82
|
}
|
|
78
83
|
/**
|
|
79
84
|
* Creates the group of blocks that represent the particle lifetime
|
|
@@ -83,7 +88,7 @@ function _CreateParticleBlockGroup(oldSystem, context) {
|
|
|
83
88
|
*/
|
|
84
89
|
function _CreateParticleLifetimeBlockGroup(oldSystem, context) {
|
|
85
90
|
if (oldSystem.targetStopDuration && oldSystem._lifeTimeGradients && oldSystem._lifeTimeGradients.length > 0) {
|
|
86
|
-
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(oldSystem, context);
|
|
91
|
+
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(oldSystem.targetStopDuration, context);
|
|
87
92
|
const gradientBlockGroupOutput = _CreateGradientBlockGroup(context.timeToStopTimeRatioBlockGroupOutput, oldSystem._lifeTimeGradients, ParticleRandomBlockLocks.PerParticle, "Lifetime");
|
|
88
93
|
return gradientBlockGroupOutput;
|
|
89
94
|
}
|
|
@@ -136,7 +141,7 @@ function _CreateParticleScaleBlockGroup(oldSystem, context) {
|
|
|
136
141
|
_CreateAndConnectInput("Max Scale", new Vector2(oldSystem.maxScaleX, oldSystem.maxScaleY), randomScaleBlock.max);
|
|
137
142
|
if (oldSystem.targetStopDuration && oldSystem._startSizeGradients && oldSystem._startSizeGradients.length > 0) {
|
|
138
143
|
// Create the start size gradient
|
|
139
|
-
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(oldSystem, context);
|
|
144
|
+
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(oldSystem.targetStopDuration, context);
|
|
140
145
|
const gradientBlockGroupOutput = _CreateGradientBlockGroup(context.timeToStopTimeRatioBlockGroupOutput, oldSystem._startSizeGradients, ParticleRandomBlockLocks.PerParticle, "Start Size");
|
|
141
146
|
// Multiply the initial random scale by the start size gradient
|
|
142
147
|
const multiplyScaleBlock = new ParticleMathBlock("Multiply Scale by Start Size Gradient");
|
|
@@ -173,8 +178,8 @@ function _CreateParticleColorBlockGroup(oldSystem, context) {
|
|
|
173
178
|
}
|
|
174
179
|
else {
|
|
175
180
|
const randomColorBlock = new ParticleRandomBlock("Random color");
|
|
176
|
-
_CreateAndConnectInput("Color 1", oldSystem.color1, randomColorBlock.min);
|
|
177
|
-
_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);
|
|
178
183
|
return randomColorBlock.output;
|
|
179
184
|
}
|
|
180
185
|
}
|
|
@@ -200,8 +205,7 @@ function _CreateParticleInitialValueFromGradient(gradients) {
|
|
|
200
205
|
return sizeBlock.output;
|
|
201
206
|
}
|
|
202
207
|
}
|
|
203
|
-
|
|
204
|
-
function _EmitterShapeBlock(oldSystem) {
|
|
208
|
+
function _EmitterShapeBlock(particle, oldSystem) {
|
|
205
209
|
const emitter = oldSystem.particleEmitterType;
|
|
206
210
|
if (!emitter) {
|
|
207
211
|
throw new Error("Particle system has no emitter type.");
|
|
@@ -212,10 +216,10 @@ function _EmitterShapeBlock(oldSystem) {
|
|
|
212
216
|
const source = emitter;
|
|
213
217
|
shapeBlock = new BoxShapeBlock("Box Shape");
|
|
214
218
|
const target = shapeBlock;
|
|
215
|
-
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
216
|
-
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
217
|
-
_CreateAndConnectInput("Min Emit Box", source.minEmitBox, target.minEmitBox);
|
|
218
|
-
_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);
|
|
219
223
|
break;
|
|
220
224
|
}
|
|
221
225
|
case "ConeParticleEmitter": {
|
|
@@ -239,8 +243,8 @@ function _EmitterShapeBlock(oldSystem) {
|
|
|
239
243
|
_CreateAndConnectInput("Angle", source.angle, target.angle);
|
|
240
244
|
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
241
245
|
_CreateAndConnectInput("Height Range", source.heightRange, target.heightRange);
|
|
242
|
-
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
243
|
-
_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);
|
|
244
248
|
break;
|
|
245
249
|
}
|
|
246
250
|
case "CustomParticleEmitter": {
|
|
@@ -269,8 +273,8 @@ function _EmitterShapeBlock(oldSystem) {
|
|
|
269
273
|
_CreateAndConnectInput("Height", source.height, target.height);
|
|
270
274
|
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
271
275
|
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
272
|
-
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
273
|
-
_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);
|
|
274
278
|
break;
|
|
275
279
|
}
|
|
276
280
|
case "HemisphericParticleEmitter": {
|
|
@@ -288,8 +292,8 @@ function _EmitterShapeBlock(oldSystem) {
|
|
|
288
292
|
shapeBlock = new MeshShapeBlock("Mesh Shape");
|
|
289
293
|
const target = shapeBlock;
|
|
290
294
|
target.useMeshNormalsForDirection = source.useMeshNormalsForDirection;
|
|
291
|
-
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
292
|
-
_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);
|
|
293
297
|
target.mesh = source.mesh;
|
|
294
298
|
break;
|
|
295
299
|
}
|
|
@@ -297,8 +301,8 @@ function _EmitterShapeBlock(oldSystem) {
|
|
|
297
301
|
const source = emitter;
|
|
298
302
|
shapeBlock = new PointShapeBlock("Point Shape");
|
|
299
303
|
const target = shapeBlock;
|
|
300
|
-
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
301
|
-
_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);
|
|
302
306
|
break;
|
|
303
307
|
}
|
|
304
308
|
case "SphereParticleEmitter": {
|
|
@@ -316,15 +320,27 @@ function _EmitterShapeBlock(oldSystem) {
|
|
|
316
320
|
const target = shapeBlock;
|
|
317
321
|
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
318
322
|
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
319
|
-
_CreateAndConnectInput("Direction1", source.direction1, target.direction1);
|
|
320
|
-
_CreateAndConnectInput("Direction2", source.direction2, target.direction2);
|
|
323
|
+
_CreateAndConnectInput("Direction1", source.direction1.clone(), target.direction1);
|
|
324
|
+
_CreateAndConnectInput("Direction2", source.direction2.clone(), target.direction2);
|
|
321
325
|
break;
|
|
322
326
|
}
|
|
323
327
|
}
|
|
324
328
|
if (!shapeBlock) {
|
|
325
329
|
throw new Error(`Unsupported particle emitter type: ${emitter.getClassName()}`);
|
|
326
330
|
}
|
|
327
|
-
|
|
331
|
+
particle.connectTo(shapeBlock.particle);
|
|
332
|
+
return shapeBlock.output;
|
|
333
|
+
}
|
|
334
|
+
function _SpriteSheetBlock(particle, oldSystem) {
|
|
335
|
+
const spriteSheetBlock = new SetupSpriteSheetBlock("Sprite Sheet Setup");
|
|
336
|
+
particle.connectTo(spriteSheetBlock.particle);
|
|
337
|
+
spriteSheetBlock.start = oldSystem.startSpriteCellID;
|
|
338
|
+
spriteSheetBlock.end = oldSystem.endSpriteCellID;
|
|
339
|
+
spriteSheetBlock.width = oldSystem.spriteCellWidth;
|
|
340
|
+
spriteSheetBlock.height = oldSystem.spriteCellHeight;
|
|
341
|
+
spriteSheetBlock.loop = oldSystem.spriteCellLoop;
|
|
342
|
+
spriteSheetBlock.randomStartCell = oldSystem.spriteRandomStartCell;
|
|
343
|
+
return spriteSheetBlock.output;
|
|
328
344
|
}
|
|
329
345
|
// ------------- UPDATE PARTICLE FUNCTIONS -------------
|
|
330
346
|
/**
|
|
@@ -339,7 +355,7 @@ function _EmitterShapeBlock(oldSystem) {
|
|
|
339
355
|
function _UpdateParticleBlockGroup(inputParticle, oldSystem, context) {
|
|
340
356
|
let updatedParticle = inputParticle;
|
|
341
357
|
updatedParticle = _UpdateParticleColorBlockGroup(updatedParticle, oldSystem._colorGradients, context);
|
|
342
|
-
updatedParticle = _UpdateParticleAngleBlockGroup(updatedParticle, oldSystem, context);
|
|
358
|
+
updatedParticle = _UpdateParticleAngleBlockGroup(updatedParticle, oldSystem._angularSpeedGradients, oldSystem.minAngularSpeed, oldSystem.maxAngularSpeed, context);
|
|
343
359
|
if (oldSystem._velocityGradients && oldSystem._velocityGradients.length > 0) {
|
|
344
360
|
context.scaledDirection = _UpdateParticleVelocityGradientBlockGroup(oldSystem._velocityGradients, context);
|
|
345
361
|
}
|
|
@@ -351,7 +367,7 @@ function _UpdateParticleBlockGroup(inputParticle, oldSystem, context) {
|
|
|
351
367
|
updatedParticle = _UpdateParticleVelocityLimitGradientBlockGroup(updatedParticle, oldSystem._limitVelocityGradients, oldSystem.limitVelocityDamping, context);
|
|
352
368
|
}
|
|
353
369
|
if (oldSystem.noiseTexture && oldSystem.noiseStrength) {
|
|
354
|
-
updatedParticle = _UpdateParticleNoiseBlockGroup(updatedParticle, oldSystem.noiseTexture, oldSystem.noiseStrength);
|
|
370
|
+
updatedParticle = _UpdateParticleNoiseBlockGroup(updatedParticle, oldSystem.noiseTexture.clone(), oldSystem.noiseStrength.clone());
|
|
355
371
|
}
|
|
356
372
|
if (oldSystem._sizeGradients && oldSystem._sizeGradients.length > 0) {
|
|
357
373
|
updatedParticle = _UpdateParticleSizeGradientBlockGroup(updatedParticle, oldSystem._sizeGradients, context);
|
|
@@ -359,6 +375,9 @@ function _UpdateParticleBlockGroup(inputParticle, oldSystem, context) {
|
|
|
359
375
|
if (oldSystem.gravity.equalsToFloats(0, 0, 0) === false) {
|
|
360
376
|
updatedParticle = _UpdateParticleGravityBlockGroup(updatedParticle, oldSystem.gravity);
|
|
361
377
|
}
|
|
378
|
+
if (oldSystem.isAnimationSheetEnabled) {
|
|
379
|
+
updatedParticle = _UpdateParticleSpriteCellBlockGroup(updatedParticle);
|
|
380
|
+
}
|
|
362
381
|
return updatedParticle;
|
|
363
382
|
}
|
|
364
383
|
/**
|
|
@@ -391,19 +410,21 @@ function _UpdateParticleColorBlockGroup(inputParticle, colorGradients, context)
|
|
|
391
410
|
/**
|
|
392
411
|
* Creates the group of blocks that represent the particle angle update
|
|
393
412
|
* @param inputParticle The input particle to update
|
|
394
|
-
* @param
|
|
413
|
+
* @param angularSpeedGradients The angular speed gradients (if any)
|
|
414
|
+
* @param minAngularSpeed The minimum angular speed
|
|
415
|
+
* @param maxAngularSpeed The maximum angular speed
|
|
395
416
|
* @param context The context of the current conversion
|
|
396
417
|
* @returns The output of the group of blocks that represent the particle color update
|
|
397
418
|
*/
|
|
398
|
-
function _UpdateParticleAngleBlockGroup(inputParticle,
|
|
419
|
+
function _UpdateParticleAngleBlockGroup(inputParticle, angularSpeedGradients, minAngularSpeed, maxAngularSpeed, context) {
|
|
399
420
|
// We will try to use gradients if they exist
|
|
400
421
|
// If not, we will try to use min/max angular speed
|
|
401
422
|
let angularSpeedCalculation = null;
|
|
402
|
-
if (
|
|
403
|
-
angularSpeedCalculation = _UpdateParticleAngularSpeedGradientBlockGroup(
|
|
423
|
+
if (angularSpeedGradients && angularSpeedGradients.length > 0) {
|
|
424
|
+
angularSpeedCalculation = _UpdateParticleAngularSpeedGradientBlockGroup(angularSpeedGradients, context);
|
|
404
425
|
}
|
|
405
|
-
else if (
|
|
406
|
-
angularSpeedCalculation = _UpdateParticleAngularSpeedBlockGroup(
|
|
426
|
+
else if (minAngularSpeed !== 0 || maxAngularSpeed !== 0) {
|
|
427
|
+
angularSpeedCalculation = _UpdateParticleAngularSpeedBlockGroup(minAngularSpeed, maxAngularSpeed);
|
|
407
428
|
}
|
|
408
429
|
// If we have an angular speed calculation, then update the angle
|
|
409
430
|
if (angularSpeedCalculation) {
|
|
@@ -595,6 +616,16 @@ function _UpdateParticleGravityBlockGroup(inputParticle, gravity) {
|
|
|
595
616
|
addDirectionBlock.output.connectTo(updateDirection.direction);
|
|
596
617
|
return updateDirection.output;
|
|
597
618
|
}
|
|
619
|
+
/**
|
|
620
|
+
* Creates the group of blocks that represent the particle sprite cell update
|
|
621
|
+
* @param inputParticle The input particle to update
|
|
622
|
+
* @returns The output of the group of blocks that represent the particle sprite cell update #2MI0A1#3
|
|
623
|
+
*/
|
|
624
|
+
function _UpdateParticleSpriteCellBlockGroup(inputParticle) {
|
|
625
|
+
const updateSpriteCell = new BasicSpriteUpdateBlock("Sprite Cell Update");
|
|
626
|
+
inputParticle.connectTo(updateSpriteCell.particle);
|
|
627
|
+
return updateSpriteCell.output;
|
|
628
|
+
}
|
|
598
629
|
function _UpdateParticleAngularSpeedGradientBlockGroup(angularSpeedGradients, context) {
|
|
599
630
|
context.ageToLifeTimeRatioBlockGroupOutput = _CreateAgeToLifeTimeRatioBlockGroup(context);
|
|
600
631
|
// Generate the gradient
|
|
@@ -632,10 +663,10 @@ function _ClampUpdateColorAlpha(colorCalculationOutput) {
|
|
|
632
663
|
return composeColorBlock.colorOut;
|
|
633
664
|
}
|
|
634
665
|
// ------------- SYSTEM FUNCTIONS -------------
|
|
635
|
-
function _SystemBlockGroup(oldSystem, context) {
|
|
666
|
+
function _SystemBlockGroup(updateParticleOutput, oldSystem, context) {
|
|
636
667
|
const newSystem = new SystemBlock(oldSystem.name);
|
|
637
|
-
newSystem.translationPivot.value = oldSystem.translationPivot;
|
|
638
|
-
newSystem.textureMask.value = oldSystem.textureMask;
|
|
668
|
+
newSystem.translationPivot.value = oldSystem.translationPivot.clone();
|
|
669
|
+
newSystem.textureMask.value = oldSystem.textureMask.clone();
|
|
639
670
|
newSystem.manualEmitCount = oldSystem.manualEmitCount;
|
|
640
671
|
newSystem.blendMode = oldSystem.blendMode;
|
|
641
672
|
newSystem.capacity = oldSystem.getCapacity();
|
|
@@ -646,16 +677,19 @@ function _SystemBlockGroup(oldSystem, context) {
|
|
|
646
677
|
newSystem.isBillboardBased = oldSystem.isBillboardBased;
|
|
647
678
|
newSystem.isLocal = oldSystem.isLocal;
|
|
648
679
|
newSystem.disposeOnStop = oldSystem.disposeOnStop;
|
|
649
|
-
_SystemEmitRateValue(oldSystem, newSystem, context);
|
|
650
|
-
|
|
651
|
-
|
|
680
|
+
_SystemEmitRateValue(oldSystem.getEmitRateGradients(), oldSystem.targetStopDuration, oldSystem.emitRate, newSystem, context);
|
|
681
|
+
const texture = oldSystem.particleTexture;
|
|
682
|
+
if (texture) {
|
|
683
|
+
_CreateTextureBlock(texture).connectTo(newSystem.texture);
|
|
684
|
+
}
|
|
685
|
+
_SystemTargetStopDuration(oldSystem.targetStopDuration, newSystem, context);
|
|
686
|
+
updateParticleOutput.connectTo(newSystem.particle);
|
|
652
687
|
return newSystem;
|
|
653
688
|
}
|
|
654
|
-
function _SystemEmitRateValue(
|
|
655
|
-
|
|
656
|
-
if (emitGradients && emitGradients.length > 0 && oldSystem.targetStopDuration > 0) {
|
|
689
|
+
function _SystemEmitRateValue(emitGradients, targetStopDuration, emitRate, newSystem, context) {
|
|
690
|
+
if (emitGradients && emitGradients.length > 0 && targetStopDuration > 0) {
|
|
657
691
|
// Create the emit gradients
|
|
658
|
-
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(
|
|
692
|
+
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(targetStopDuration, context);
|
|
659
693
|
const gradientValue = _CreateGradientBlockGroup(context.timeToStopTimeRatioBlockGroupOutput, emitGradients, ParticleRandomBlockLocks.PerSystem, "Emit Rate");
|
|
660
694
|
// Round the value to an int
|
|
661
695
|
const roundBlock = new ParticleFloatToIntBlock("Round to Int");
|
|
@@ -664,10 +698,10 @@ function _SystemEmitRateValue(oldSystem, newSystem, context) {
|
|
|
664
698
|
roundBlock.output.connectTo(newSystem.emitRate);
|
|
665
699
|
}
|
|
666
700
|
else {
|
|
667
|
-
newSystem.emitRate.value =
|
|
701
|
+
newSystem.emitRate.value = emitRate;
|
|
668
702
|
}
|
|
669
703
|
}
|
|
670
|
-
function _SystemTargetStopDuration(
|
|
704
|
+
function _SystemTargetStopDuration(targetStopDuration, newSystem, context) {
|
|
671
705
|
// If something else uses the target stop duration (like a gradient),
|
|
672
706
|
// then the block is already created and stored in the context
|
|
673
707
|
if (context.targetStopDurationBlockOutput) {
|
|
@@ -675,7 +709,7 @@ function _SystemTargetStopDuration(oldSystem, newSystem, context) {
|
|
|
675
709
|
}
|
|
676
710
|
else {
|
|
677
711
|
// If no one used it, do not create a block just set the value
|
|
678
|
-
newSystem.targetStopDuration.value =
|
|
712
|
+
newSystem.targetStopDuration.value = targetStopDuration;
|
|
679
713
|
}
|
|
680
714
|
}
|
|
681
715
|
// ------------- UTILITY FUNCTIONS -------------
|
|
@@ -709,18 +743,18 @@ function _CreateAndConnectSystemSource(systemBlockName, systemSource, targetToCo
|
|
|
709
743
|
/**
|
|
710
744
|
* Creates the target stop duration input block, as it can be shared in multiple places
|
|
711
745
|
* This block is stored in the context so the same block is shared in the graph
|
|
712
|
-
* @param
|
|
746
|
+
* @param targetStopDuration The target stop duration value
|
|
713
747
|
* @param context The context of the current conversion
|
|
714
748
|
* @returns
|
|
715
749
|
*/
|
|
716
|
-
function _CreateTargetStopDurationInputBlock(
|
|
750
|
+
function _CreateTargetStopDurationInputBlock(targetStopDuration, context) {
|
|
717
751
|
// If we have already created the target stop duration input block, return it
|
|
718
752
|
if (context.targetStopDurationBlockOutput) {
|
|
719
753
|
return context.targetStopDurationBlockOutput;
|
|
720
754
|
}
|
|
721
755
|
// Create the target stop duration input block if not already created
|
|
722
756
|
const targetStopDurationInputBlock = new ParticleInputBlock("Target Stop Duration");
|
|
723
|
-
targetStopDurationInputBlock.value =
|
|
757
|
+
targetStopDurationInputBlock.value = targetStopDuration;
|
|
724
758
|
// Save the output in our context to avoid regenerating it again
|
|
725
759
|
context.targetStopDurationBlockOutput = targetStopDurationInputBlock.output;
|
|
726
760
|
return context.targetStopDurationBlockOutput;
|
|
@@ -729,16 +763,16 @@ function _CreateTargetStopDurationInputBlock(oldSystem, context) {
|
|
|
729
763
|
* Create a group of blocks that calculates the ratio between the actual frame and the target stop duration, clamped between 0 and 1.
|
|
730
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.
|
|
731
765
|
* This block group is stored in the context so the same group is shared in the graph
|
|
732
|
-
* @param
|
|
766
|
+
* @param targetStopDuration The target stop duration value
|
|
733
767
|
* @param context The context of the current conversion
|
|
734
768
|
* @returns The ratio block output connection point
|
|
735
769
|
*/
|
|
736
|
-
function _CreateTimeToStopTimeRatioBlockGroup(
|
|
770
|
+
function _CreateTimeToStopTimeRatioBlockGroup(targetStopDuration, context) {
|
|
737
771
|
// If we have already generated this group, return it
|
|
738
772
|
if (context.timeToStopTimeRatioBlockGroupOutput) {
|
|
739
773
|
return context.timeToStopTimeRatioBlockGroupOutput;
|
|
740
774
|
}
|
|
741
|
-
context.targetStopDurationBlockOutput = _CreateTargetStopDurationInputBlock(
|
|
775
|
+
context.targetStopDurationBlockOutput = _CreateTargetStopDurationInputBlock(targetStopDuration, context);
|
|
742
776
|
// Find the ratio between the actual frame and the target stop duration
|
|
743
777
|
const ratio = new ParticleMathBlock("Frame/Stop Ratio");
|
|
744
778
|
ratio.operation = ParticleMathBlockOperations.Divide;
|
|
@@ -813,8 +847,8 @@ function _CreateGradientBlockGroup(gradientSelector, gradientValues, randomLockM
|
|
|
813
847
|
function _CreateGradientValueBlockGroup(gradientStep, randomLockMode, prefix, index) {
|
|
814
848
|
const gradientValueBlock = new ParticleGradientValueBlock(prefix + " Gradient Value " + index);
|
|
815
849
|
gradientValueBlock.reference = gradientStep.gradient;
|
|
816
|
-
const value1 = gradientStep.factor1 ?? gradientStep.color1;
|
|
817
|
-
const value2 = gradientStep.factor2 ?? gradientStep.color2;
|
|
850
|
+
const value1 = gradientStep.factor1 ?? gradientStep.color1.clone();
|
|
851
|
+
const value2 = gradientStep.factor2 ?? gradientStep.color2?.clone();
|
|
818
852
|
if (value2 !== undefined) {
|
|
819
853
|
// Create a random between value1 and value2
|
|
820
854
|
const randomBlock = new ParticleRandomBlock("Random Value " + index);
|
|
@@ -830,15 +864,9 @@ function _CreateGradientValueBlockGroup(gradientStep, randomLockMode, prefix, in
|
|
|
830
864
|
return gradientValueBlock.output;
|
|
831
865
|
}
|
|
832
866
|
function _CreateTextureBlock(texture) {
|
|
833
|
-
// Texture
|
|
867
|
+
// Texture - always use sourceTexture to preserve all texture options
|
|
834
868
|
const textureBlock = new ParticleTextureSourceBlock("Texture");
|
|
835
|
-
|
|
836
|
-
if (url) {
|
|
837
|
-
textureBlock.url = url;
|
|
838
|
-
}
|
|
839
|
-
else {
|
|
840
|
-
textureBlock.sourceTexture = texture;
|
|
841
|
-
}
|
|
869
|
+
textureBlock.sourceTexture = texture;
|
|
842
870
|
return textureBlock.texture;
|
|
843
871
|
}
|
|
844
872
|
//# sourceMappingURL=nodeParticleSystemSet.helper.js.map
|