@babylonjs/core 8.34.0 → 8.34.1
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/AudioV2/webAudio/webAudioStreamingSound.js +3 -0
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.js +7 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +9 -5
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.d.ts +14 -0
- package/Materials/PBR/openpbrMaterial.js +16 -0
- package/Materials/PBR/openpbrMaterial.js.map +1 -1
- package/Meshes/mesh.js +1 -1
- package/Meshes/mesh.js.map +1 -1
- package/Misc/sceneSerializer.js +4 -1
- package/Misc/sceneSerializer.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.d.ts +57 -0
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +163 -0
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -0
- package/Particles/Node/Blocks/Emitters/index.d.ts +5 -4
- package/Particles/Node/Blocks/Emitters/index.js +5 -4
- package/Particles/Node/Blocks/Emitters/index.js.map +1 -1
- package/Particles/Node/Blocks/particleInputBlock.js +2 -0
- package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
- package/Particles/Node/Blocks/systemBlock.js +8 -0
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +5 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.js +4 -0
- package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
- package/Particles/Node/nodeParticleBuildState.js +5 -0
- package/Particles/Node/nodeParticleBuildState.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.d.ts +4 -3
- package/Particles/Node/nodeParticleSystemSet.helper.js +182 -115
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -0
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +8 -0
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +4 -0
- package/PostProcesses/postProcess.js +4 -0
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/thinSSAO2PostProcess.d.ts +1 -0
- package/PostProcesses/thinSSAO2PostProcess.js +9 -4
- package/PostProcesses/thinSSAO2PostProcess.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrCoatLayerData.js +4 -0
- package/Shaders/ShadersInclude/openpbrCoatLayerData.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrDirectLighting.js +5 -2
- package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +2 -2
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrFuzzLayerData.js +1 -1
- package/Shaders/ShadersInclude/openpbrFuzzLayerData.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/Shaders/particles.vertex.js +1 -1
- package/Shaders/particles.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrCoatLayerData.js +4 -0
- package/ShadersWGSL/ShadersInclude/openpbrCoatLayerData.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +5 -2
- package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +2 -2
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.js.map +1 -1
- package/ShadersWGSL/particles.vertex.js +1 -1
- package/ShadersWGSL/particles.vertex.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,147 +1,214 @@
|
|
|
1
|
+
import { NodeParticleBlockConnectionPointTypes } from "./Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
1
2
|
import { NodeParticleSystemSet } from "./nodeParticleSystemSet.js";
|
|
3
|
+
import { NodeParticleContextualSources } from "./Enums/nodeParticleContextualSources.js";
|
|
4
|
+
import { ParticleConverterBlock } from "./Blocks/particleConverterBlock.js";
|
|
5
|
+
import { ParticleInputBlock } from "./Blocks/particleInputBlock.js";
|
|
6
|
+
import { ParticleMathBlock, ParticleMathBlockOperations } from "./Blocks/particleMathBlock.js";
|
|
7
|
+
import { ParticleRandomBlock } from "./Blocks/particleRandomBlock.js";
|
|
8
|
+
import { ParticleTextureSourceBlock } from "./Blocks/particleSourceTextureBlock.js";
|
|
2
9
|
import { SystemBlock } from "./Blocks/systemBlock.js";
|
|
3
10
|
import { CreateParticleBlock } from "./Blocks/Emitters/createParticleBlock.js";
|
|
4
11
|
import { BoxShapeBlock } from "./Blocks/Emitters/boxShapeBlock.js";
|
|
5
|
-
import {
|
|
6
|
-
import { PointShapeBlock } from "./Blocks/Emitters/pointShapeBlock.js";
|
|
7
|
-
import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
|
|
12
|
+
import { ConeShapeBlock } from "./Blocks/Emitters/coneShapeBlock.js";
|
|
8
13
|
import { CylinderShapeBlock } from "./Blocks/Emitters/cylinderShapeBlock.js";
|
|
9
14
|
import { MeshShapeBlock } from "./Blocks/Emitters/meshShapeBlock.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import { PointShapeBlock } from "./Blocks/Emitters/pointShapeBlock.js";
|
|
16
|
+
import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
|
|
17
|
+
import { UpdateColorBlock } from "./Blocks/Update/updateColorBlock.js";
|
|
18
|
+
import { UpdatePositionBlock } from "./Blocks/Update/updatePositionBlock.js";
|
|
19
|
+
/**
|
|
20
|
+
* Converts a ParticleSystem to a NodeParticleSystemSet.
|
|
21
|
+
* @param name The name of the node particle system set.
|
|
22
|
+
* @param particleSystemsList The particle systems to convert.
|
|
23
|
+
* @returns The converted node particle system set or null if conversion failed.
|
|
24
|
+
* #0K3AQ2#3672
|
|
25
|
+
* #7J0NXA#4
|
|
26
|
+
*/
|
|
27
|
+
export async function ConvertToNodeParticleSystemSetAsync(name, particleSystemsList) {
|
|
28
|
+
if (!particleSystemsList || !particleSystemsList.length) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const nodeParticleSystemSet = new NodeParticleSystemSet(name);
|
|
32
|
+
const promises = [];
|
|
33
|
+
for (const particleSystem of particleSystemsList) {
|
|
34
|
+
promises.push(_ExtractDatafromParticleSystemAsync(nodeParticleSystemSet, particleSystem));
|
|
35
|
+
}
|
|
36
|
+
await Promise.all(promises);
|
|
37
|
+
return nodeParticleSystemSet;
|
|
38
|
+
}
|
|
39
|
+
async function _ExtractDatafromParticleSystemAsync(newSet, oldSystem) {
|
|
40
|
+
// System block
|
|
41
|
+
const newSystem = _CreateSystemBlock(oldSystem);
|
|
42
|
+
// Shape block
|
|
43
|
+
const shapeBlock = _CreateShapeBlock(oldSystem);
|
|
44
|
+
// CreateParticle block
|
|
45
|
+
const createParticleBlock = _CreateCreateParticleBlock(oldSystem);
|
|
46
|
+
createParticleBlock.particle.connectTo(shapeBlock.particle);
|
|
47
|
+
// Texture
|
|
48
|
+
const textureBlock = new ParticleTextureSourceBlock("Texture");
|
|
49
|
+
const url = oldSystem.particleTexture.url || "";
|
|
50
|
+
if (url) {
|
|
51
|
+
textureBlock.url = url;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
textureBlock.sourceTexture = oldSystem.particleTexture;
|
|
55
|
+
}
|
|
56
|
+
textureBlock.texture.connectTo(newSystem.texture);
|
|
57
|
+
// Default position update
|
|
58
|
+
const positionUpdateblock = new UpdatePositionBlock("Position update");
|
|
59
|
+
shapeBlock.output.connectTo(positionUpdateblock.particle);
|
|
60
|
+
const addPositionBlock = new ParticleMathBlock("Add Position");
|
|
61
|
+
addPositionBlock.operation = ParticleMathBlockOperations.Add;
|
|
62
|
+
_CreateAndConnectContextual("Position", NodeParticleContextualSources.Position, addPositionBlock.left);
|
|
63
|
+
_CreateAndConnectContextual("Scaled Direction", NodeParticleContextualSources.ScaledDirection, addPositionBlock.right);
|
|
64
|
+
addPositionBlock.output.connectTo(positionUpdateblock.position);
|
|
65
|
+
// Default color update
|
|
66
|
+
const colorUpdateblock = new UpdateColorBlock("Color update");
|
|
67
|
+
positionUpdateblock.output.connectTo(colorUpdateblock.particle);
|
|
68
|
+
const addColorBlock = new ParticleMathBlock("Add Color");
|
|
69
|
+
addColorBlock.operation = ParticleMathBlockOperations.Add;
|
|
70
|
+
_CreateAndConnectContextual("Color", NodeParticleContextualSources.Color, addColorBlock.left);
|
|
71
|
+
_CreateAndConnectContextual("Scaled Color Step", NodeParticleContextualSources.ScaledColorStep, addColorBlock.right);
|
|
72
|
+
addColorBlock.output.connectTo(colorUpdateblock.color);
|
|
73
|
+
const decomposeColorBlock = new ParticleConverterBlock("Decompose Color");
|
|
74
|
+
addColorBlock.output.connectTo(decomposeColorBlock.colorIn);
|
|
75
|
+
// Clamp alpha to be >= 0
|
|
76
|
+
const maxAlphaBlock = new ParticleMathBlock("Alpha >= 0");
|
|
77
|
+
maxAlphaBlock.operation = ParticleMathBlockOperations.Max;
|
|
78
|
+
decomposeColorBlock.wOut.connectTo(maxAlphaBlock.left);
|
|
79
|
+
_CreateAndConnectInput("Zero", 0, maxAlphaBlock.right);
|
|
80
|
+
const composeColorBlock = new ParticleConverterBlock("Compose Color");
|
|
81
|
+
decomposeColorBlock.xyzOut.connectTo(composeColorBlock.xyzIn);
|
|
82
|
+
maxAlphaBlock.output.connectTo(composeColorBlock.wIn);
|
|
83
|
+
composeColorBlock.colorOut.connectTo(colorUpdateblock.color);
|
|
84
|
+
colorUpdateblock.output.connectTo(newSystem.particle);
|
|
85
|
+
// Register
|
|
86
|
+
newSet.systemBlocks.push(newSystem);
|
|
87
|
+
}
|
|
88
|
+
function _CreateSystemBlock(oldSystem) {
|
|
89
|
+
const newSystem = new SystemBlock(oldSystem.name);
|
|
90
|
+
newSystem.blendMode = oldSystem.blendMode;
|
|
91
|
+
newSystem.capacity = oldSystem.getCapacity();
|
|
92
|
+
newSystem.emitRate = oldSystem.emitRate;
|
|
93
|
+
newSystem.targetStopDuration = oldSystem.targetStopDuration;
|
|
94
|
+
newSystem.startDelay = oldSystem.startDelay;
|
|
95
|
+
newSystem.updateSpeed = oldSystem.updateSpeed;
|
|
96
|
+
return newSystem;
|
|
18
97
|
}
|
|
19
|
-
|
|
20
|
-
// Main system
|
|
21
|
-
const system = new SystemBlock(particleSystem.name);
|
|
22
|
-
system.capacity = particleSystem.getCapacity();
|
|
23
|
-
system.emitRate = particleSystem.emitRate;
|
|
98
|
+
function _CreateCreateParticleBlock(oldSystem) {
|
|
24
99
|
// Create particle
|
|
25
|
-
const createParticleBlock = new CreateParticleBlock("Create
|
|
26
|
-
//
|
|
100
|
+
const createParticleBlock = new CreateParticleBlock("Create Particle");
|
|
101
|
+
// Color
|
|
102
|
+
const randomColorBlock = new ParticleRandomBlock("Random Color");
|
|
103
|
+
_CreateAndConnectInput("Color 1", oldSystem.color1, randomColorBlock.min);
|
|
104
|
+
_CreateAndConnectInput("Color 2", oldSystem.color2, randomColorBlock.max);
|
|
105
|
+
randomColorBlock.output.connectTo(createParticleBlock.color);
|
|
106
|
+
// Dead color
|
|
107
|
+
_CreateAndConnectInput("Dead Color", oldSystem.colorDead, createParticleBlock.colorDead);
|
|
108
|
+
// Emit power
|
|
109
|
+
const randomEmitPowerBlock = new ParticleRandomBlock("Random Emit Power");
|
|
110
|
+
_CreateAndConnectInput("Min Emit Power", oldSystem.minEmitPower, randomEmitPowerBlock.min);
|
|
111
|
+
_CreateAndConnectInput("Max Emit Power", oldSystem.maxEmitPower, randomEmitPowerBlock.max);
|
|
112
|
+
randomEmitPowerBlock.output.connectTo(createParticleBlock.emitPower);
|
|
113
|
+
// Scale
|
|
114
|
+
const randomScaleBlock = new ParticleRandomBlock("Random Scale");
|
|
115
|
+
_CreateAndConnectInput("Min Scale", oldSystem.minSize, randomScaleBlock.min);
|
|
116
|
+
_CreateAndConnectInput("Max Scale", oldSystem.maxSize, randomScaleBlock.max);
|
|
117
|
+
randomScaleBlock.output.connectTo(createParticleBlock.scale);
|
|
118
|
+
// Lifetime
|
|
119
|
+
const randomLifetimeBlock = new ParticleRandomBlock("Random Lifetime");
|
|
120
|
+
_CreateAndConnectInput("Min Lifetime", oldSystem.minLifeTime, randomLifetimeBlock.min);
|
|
121
|
+
_CreateAndConnectInput("Max Lifetime", oldSystem.maxLifeTime, randomLifetimeBlock.max);
|
|
122
|
+
randomLifetimeBlock.output.connectTo(createParticleBlock.lifeTime);
|
|
123
|
+
return createParticleBlock;
|
|
124
|
+
}
|
|
125
|
+
function _CreateShapeBlock(oldSystem) {
|
|
126
|
+
const emitter = oldSystem.particleEmitterType;
|
|
127
|
+
if (!emitter) {
|
|
128
|
+
throw new Error("Particle system has no emitter type.");
|
|
129
|
+
}
|
|
27
130
|
let shapeBlock = null;
|
|
28
|
-
switch (
|
|
131
|
+
switch (emitter.getClassName()) {
|
|
29
132
|
case "BoxParticleEmitter": {
|
|
30
|
-
const source =
|
|
31
|
-
shapeBlock = new BoxShapeBlock("Box
|
|
133
|
+
const source = emitter;
|
|
134
|
+
shapeBlock = new BoxShapeBlock("Box Shape");
|
|
32
135
|
const target = shapeBlock;
|
|
33
|
-
_CreateAndConnectInput(
|
|
34
|
-
_CreateAndConnectInput(
|
|
35
|
-
_CreateAndConnectInput(
|
|
36
|
-
_CreateAndConnectInput(
|
|
136
|
+
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
137
|
+
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
138
|
+
_CreateAndConnectInput("Min Emit Box", source.minEmitBox, target.minEmitBox);
|
|
139
|
+
_CreateAndConnectInput("Max Emit Box", source.maxEmitBox, target.maxEmitBox);
|
|
37
140
|
break;
|
|
38
141
|
}
|
|
39
|
-
case "
|
|
40
|
-
const source =
|
|
41
|
-
shapeBlock = new
|
|
142
|
+
case "ConeParticleEmitter": {
|
|
143
|
+
const source = emitter;
|
|
144
|
+
shapeBlock = new ConeShapeBlock("Cone Shape");
|
|
42
145
|
const target = shapeBlock;
|
|
43
|
-
_CreateAndConnectInput(
|
|
44
|
-
_CreateAndConnectInput(
|
|
146
|
+
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
147
|
+
_CreateAndConnectInput("Angle", source.angle, target.angle);
|
|
148
|
+
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
149
|
+
_CreateAndConnectInput("Height Range", source.heightRange, target.heightRange);
|
|
150
|
+
_CreateAndConnectInput("Emit From Spawn Point Only", source.emitFromSpawnPointOnly ? 1 : 0, target.emitFromSpawnPointOnly, NodeParticleBlockConnectionPointTypes.Int);
|
|
151
|
+
_CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
|
|
45
152
|
break;
|
|
46
153
|
}
|
|
47
|
-
case "
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const target = shapeBlock;
|
|
51
|
-
_CreateAndConnectInput(target.radius, "Radius", source.radius);
|
|
52
|
-
_CreateAndConnectInput(target.radiusRange, "Radius Range", source.radiusRange);
|
|
53
|
-
_CreateAndConnectInput(target.directionRandomizer, "Direction Randomizer", source.directionRandomizer);
|
|
54
|
-
break;
|
|
154
|
+
case "CustomParticleEmitter": {
|
|
155
|
+
// Custom emitter is not supported in nodes yet
|
|
156
|
+
throw new Error("CustomParticleEmitter is not supported in Node Particle System.");
|
|
55
157
|
}
|
|
56
158
|
case "CylinderParticleEmitter": {
|
|
57
|
-
const source =
|
|
58
|
-
shapeBlock = new CylinderShapeBlock("Cylinder
|
|
159
|
+
const source = emitter;
|
|
160
|
+
shapeBlock = new CylinderShapeBlock("Cylinder Shape");
|
|
59
161
|
const target = shapeBlock;
|
|
60
|
-
_CreateAndConnectInput(
|
|
61
|
-
_CreateAndConnectInput(
|
|
62
|
-
_CreateAndConnectInput(
|
|
63
|
-
_CreateAndConnectInput(
|
|
162
|
+
_CreateAndConnectInput("Height", source.height, target.height);
|
|
163
|
+
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
164
|
+
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
165
|
+
_CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
|
|
64
166
|
break;
|
|
65
167
|
}
|
|
168
|
+
case "HemisphericParticleEmitter": {
|
|
169
|
+
// Hemispheric emitter is not supported in nodes yet
|
|
170
|
+
throw new Error("HemisphericParticleEmitter is not supported in Node Particle System.");
|
|
171
|
+
}
|
|
66
172
|
case "MeshParticleEmitter": {
|
|
67
|
-
const source =
|
|
68
|
-
shapeBlock = new MeshShapeBlock("Mesh
|
|
173
|
+
const source = emitter;
|
|
174
|
+
shapeBlock = new MeshShapeBlock("Mesh Shape");
|
|
69
175
|
const target = shapeBlock;
|
|
70
|
-
_CreateAndConnectInput(
|
|
71
|
-
_CreateAndConnectInput(
|
|
176
|
+
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
177
|
+
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
72
178
|
target.mesh = source.mesh;
|
|
73
179
|
break;
|
|
74
180
|
}
|
|
181
|
+
case "PointParticleEmitter": {
|
|
182
|
+
const source = emitter;
|
|
183
|
+
shapeBlock = new PointShapeBlock("Point Shape");
|
|
184
|
+
const target = shapeBlock;
|
|
185
|
+
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
186
|
+
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
case "SphereParticleEmitter": {
|
|
190
|
+
const source = emitter;
|
|
191
|
+
shapeBlock = new SphereShapeBlock("Sphere Shape");
|
|
192
|
+
const target = shapeBlock;
|
|
193
|
+
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
194
|
+
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
195
|
+
_CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
75
198
|
}
|
|
76
199
|
if (!shapeBlock) {
|
|
77
|
-
throw new Error(`Unsupported particle emitter type: ${
|
|
78
|
-
}
|
|
79
|
-
createParticleBlock.particle.connectTo(shapeBlock.particle);
|
|
80
|
-
createParticleBlock.colorDead.value = particleSystem.colorDead;
|
|
81
|
-
// Color
|
|
82
|
-
const color0Block = new ParticleInputBlock("Color0");
|
|
83
|
-
color0Block.value = particleSystem.color1;
|
|
84
|
-
const color1Block = new ParticleInputBlock("Color1");
|
|
85
|
-
color1Block.value = particleSystem.color2;
|
|
86
|
-
const randomColorBlock = new ParticleRandomBlock("Random Color");
|
|
87
|
-
color0Block.output.connectTo(randomColorBlock.min);
|
|
88
|
-
color1Block.output.connectTo(randomColorBlock.max);
|
|
89
|
-
randomColorBlock.output.connectTo(createParticleBlock.color);
|
|
90
|
-
// Emit power
|
|
91
|
-
const minEmitPowerBlock = new ParticleInputBlock("Min Emit Power");
|
|
92
|
-
minEmitPowerBlock.value = particleSystem.minEmitPower;
|
|
93
|
-
const maxEmitPowerBlock = new ParticleInputBlock("Max Emit Power");
|
|
94
|
-
maxEmitPowerBlock.value = particleSystem.maxEmitPower;
|
|
95
|
-
const randomEmitPowerBlock = new ParticleRandomBlock("Random Emit Power");
|
|
96
|
-
minEmitPowerBlock.output.connectTo(randomEmitPowerBlock.min);
|
|
97
|
-
maxEmitPowerBlock.output.connectTo(randomEmitPowerBlock.max);
|
|
98
|
-
randomEmitPowerBlock.output.connectTo(createParticleBlock.emitPower);
|
|
99
|
-
// Lifetime
|
|
100
|
-
const minLifetimeBlock = new ParticleInputBlock("Min Lifetime");
|
|
101
|
-
minLifetimeBlock.value = particleSystem.minLifeTime;
|
|
102
|
-
const maxLifetimeBlock = new ParticleInputBlock("Max Lifetime");
|
|
103
|
-
maxLifetimeBlock.value = particleSystem.maxLifeTime;
|
|
104
|
-
const randomLifetimeBlock = new ParticleRandomBlock("Random Lifetime");
|
|
105
|
-
minLifetimeBlock.output.connectTo(randomLifetimeBlock.min);
|
|
106
|
-
maxLifetimeBlock.output.connectTo(randomLifetimeBlock.max);
|
|
107
|
-
randomLifetimeBlock.output.connectTo(createParticleBlock.lifeTime);
|
|
108
|
-
// Texture
|
|
109
|
-
const textureBlock = new ParticleTextureSourceBlock("Texture");
|
|
110
|
-
const url = particleSystem.particleTexture.url || "";
|
|
111
|
-
if (url) {
|
|
112
|
-
textureBlock.url = url;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
textureBlock.sourceTexture = particleSystem.particleTexture;
|
|
200
|
+
throw new Error(`Unsupported particle emitter type: ${emitter.getClassName()}`);
|
|
116
201
|
}
|
|
117
|
-
|
|
118
|
-
// Default position update
|
|
119
|
-
const basicPositionUpdateBlock = new BasicPositionUpdateBlock("Position update");
|
|
120
|
-
shapeBlock.output.connectTo(basicPositionUpdateBlock.particle);
|
|
121
|
-
// Default color update
|
|
122
|
-
const basicColorUpdateBlock = new BasicColorUpdateBlock("Color update");
|
|
123
|
-
basicPositionUpdateBlock.output.connectTo(basicColorUpdateBlock.particle);
|
|
124
|
-
basicColorUpdateBlock.output.connectTo(system.particle);
|
|
125
|
-
// Register
|
|
126
|
-
target.systemBlocks.push(system);
|
|
202
|
+
return shapeBlock;
|
|
127
203
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
const nodeParticleSystemSet = new NodeParticleSystemSet(name);
|
|
140
|
-
const promises = [];
|
|
141
|
-
for (const particleSystem of particleSystems) {
|
|
142
|
-
promises.push(_ExtractDatafromParticleSystemAsync(particleSystem, nodeParticleSystemSet));
|
|
143
|
-
}
|
|
144
|
-
await Promise.all(promises);
|
|
145
|
-
return nodeParticleSystemSet;
|
|
204
|
+
function _CreateAndConnectInput(inputBlockName, value, targetToConnectTo, inputType) {
|
|
205
|
+
const input = new ParticleInputBlock(inputBlockName, inputType);
|
|
206
|
+
input.value = value;
|
|
207
|
+
input.output.connectTo(targetToConnectTo);
|
|
208
|
+
}
|
|
209
|
+
function _CreateAndConnectContextual(contextualBlockName, contextValue, targetToConnectTo) {
|
|
210
|
+
const input = new ParticleInputBlock(contextualBlockName);
|
|
211
|
+
input.contextualValue = contextValue;
|
|
212
|
+
input.output.connectTo(targetToConnectTo);
|
|
146
213
|
}
|
|
147
214
|
//# sourceMappingURL=nodeParticleSystemSet.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeParticleSystemSet.helper.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleSystemSet.helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E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;IACvB,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,CAAC,cAAc,CAAC,CAAC;IACxE,wBAAwB,CAAC,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAC1E,qBAAqB,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAExD,WAAW;IACX,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mCAAmC,CAAC,IAAY,EAAE,eAAiC;IACrG,IAAI,CAAC,eAAe,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;QAC3C,QAAQ,CAAC,IAAI,CAAC,mCAAmC,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAC9F,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,qBAAqB,CAAC;AACjC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { ParticleSystem } from \"../particleSystem\";\r\nimport { NodeParticleSystemSet } from \"./nodeParticleSystemSet\";\r\nimport { SystemBlock } from \"./Blocks/systemBlock\";\r\nimport { CreateParticleBlock } from \"./Blocks/Emitters/createParticleBlock\";\r\nimport { BoxShapeBlock } from \"./Blocks/Emitters/boxShapeBlock\";\r\nimport type { IShapeBlock } from \"./Blocks/Emitters/IShapeBlock\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { NodeParticleConnectionPoint } from \"./nodeParticleBlockConnectionPoint\";\r\nimport type { BoxParticleEmitter } from \"../EmitterTypes/boxParticleEmitter\";\r\nimport type { PointParticleEmitter } from \"../EmitterTypes/pointParticleEmitter\";\r\nimport type { SphereParticleEmitter } from \"../EmitterTypes/sphereParticleEmitter\";\r\nimport type { CylinderParticleEmitter, MeshParticleEmitter } from \"../EmitterTypes\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { ParticleInputBlock } from \"./Blocks/particleInputBlock\";\r\nimport { PointShapeBlock } from \"./Blocks/Emitters/pointShapeBlock\";\r\nimport { SphereShapeBlock } from \"./Blocks/Emitters/sphereShapeBlock\";\r\nimport { CylinderShapeBlock } from \"./Blocks/Emitters/cylinderShapeBlock\";\r\nimport { MeshShapeBlock } from \"./Blocks/Emitters/meshShapeBlock\";\r\nimport { ParticleTextureSourceBlock } from \"./Blocks/particleSourceTextureBlock\";\r\nimport type { Texture } from \"../../Materials/Textures/texture\";\r\nimport { BasicPositionUpdateBlock } from \"./Blocks/Update/basicPositionUpdateBlock\";\r\nimport { BasicColorUpdateBlock } from \"./Blocks/Update/basicColorUpdateBlock\";\r\nimport { ParticleRandomBlock } from \"./Blocks/particleRandomBlock\";\r\n\r\nfunction _CreateAndConnectInput(connectionPoint: NodeParticleConnectionPoint, name: string, defaultValue: Vector3 | number) {\r\n const input = new ParticleInputBlock(name);\r\n input.value = defaultValue;\r\n input.output.connectTo(connectionPoint);\r\n}\r\n\r\nasync function _ExtractDatafromParticleSystemAsync(particleSystem: ParticleSystem, target: NodeParticleSystemSet) {\r\n // Main system\r\n const system = new SystemBlock(particleSystem.name);\r\n system.capacity = particleSystem.getCapacity();\r\n system.emitRate = particleSystem.emitRate;\r\n\r\n // Create particle\r\n const createParticleBlock = new CreateParticleBlock(\"Create particle\");\r\n\r\n // Shape\r\n let shapeBlock: Nullable<IShapeBlock> = null;\r\n switch (particleSystem.particleEmitterType.getClassName()) {\r\n case \"BoxParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as BoxParticleEmitter;\r\n shapeBlock = new BoxShapeBlock(\"Box shape\");\r\n\r\n const target = shapeBlock as BoxShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n _CreateAndConnectInput(target.minEmitBox, \"Min Emit Box\", source.minEmitBox);\r\n _CreateAndConnectInput(target.maxEmitBox, \"Max Emit Box\", source.maxEmitBox);\r\n break;\r\n }\r\n case \"PointParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as PointParticleEmitter;\r\n shapeBlock = new PointShapeBlock(\"Point shape\");\r\n\r\n const target = shapeBlock as PointShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n break;\r\n }\r\n case \"SphereParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as SphereParticleEmitter;\r\n shapeBlock = new SphereShapeBlock(\"Sphere shape\");\r\n\r\n const target = shapeBlock as SphereShapeBlock;\r\n _CreateAndConnectInput(target.radius, \"Radius\", source.radius);\r\n _CreateAndConnectInput(target.radiusRange, \"Radius Range\", source.radiusRange);\r\n _CreateAndConnectInput(target.directionRandomizer, \"Direction Randomizer\", source.directionRandomizer);\r\n break;\r\n }\r\n case \"CylinderParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as CylinderParticleEmitter;\r\n shapeBlock = new CylinderShapeBlock(\"Cylinder shape\");\r\n\r\n const target = shapeBlock as CylinderShapeBlock;\r\n _CreateAndConnectInput(target.height, \"Height\", source.height);\r\n _CreateAndConnectInput(target.radius, \"Radius\", source.radius);\r\n _CreateAndConnectInput(target.radiusRange, \"Radius Range\", source.radiusRange);\r\n _CreateAndConnectInput(target.directionRandomizer, \"Direction Randomizer\", source.directionRandomizer);\r\n break;\r\n }\r\n case \"MeshParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as MeshParticleEmitter;\r\n shapeBlock = new MeshShapeBlock(\"Mesh shape\");\r\n\r\n const target = shapeBlock as MeshShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n\r\n target.mesh = source.mesh as Mesh;\r\n break;\r\n }\r\n }\r\n\r\n if (!shapeBlock) {\r\n throw new Error(`Unsupported particle emitter type: ${particleSystem.particleEmitterType.getClassName()}`);\r\n }\r\n\r\n createParticleBlock.particle.connectTo(shapeBlock.particle);\r\n createParticleBlock.colorDead.value = particleSystem.colorDead;\r\n\r\n // Color\r\n const color0Block = new ParticleInputBlock(\"Color0\");\r\n color0Block.value = particleSystem.color1;\r\n\r\n const color1Block = new ParticleInputBlock(\"Color1\");\r\n color1Block.value = particleSystem.color2;\r\n\r\n const randomColorBlock = new ParticleRandomBlock(\"Random Color\");\r\n color0Block.output.connectTo(randomColorBlock.min);\r\n color1Block.output.connectTo(randomColorBlock.max);\r\n\r\n randomColorBlock.output.connectTo(createParticleBlock.color);\r\n\r\n // Emit power\r\n const minEmitPowerBlock = new ParticleInputBlock(\"Min Emit Power\");\r\n minEmitPowerBlock.value = particleSystem.minEmitPower;\r\n\r\n const maxEmitPowerBlock = new ParticleInputBlock(\"Max Emit Power\");\r\n maxEmitPowerBlock.value = particleSystem.maxEmitPower;\r\n\r\n const randomEmitPowerBlock = new ParticleRandomBlock(\"Random Emit Power\");\r\n minEmitPowerBlock.output.connectTo(randomEmitPowerBlock.min);\r\n maxEmitPowerBlock.output.connectTo(randomEmitPowerBlock.max);\r\n\r\n randomEmitPowerBlock.output.connectTo(createParticleBlock.emitPower);\r\n\r\n // Lifetime\r\n const minLifetimeBlock = new ParticleInputBlock(\"Min Lifetime\");\r\n minLifetimeBlock.value = particleSystem.minLifeTime;\r\n\r\n const maxLifetimeBlock = new ParticleInputBlock(\"Max Lifetime\");\r\n maxLifetimeBlock.value = particleSystem.maxLifeTime;\r\n\r\n const randomLifetimeBlock = new ParticleRandomBlock(\"Random Lifetime\");\r\n minLifetimeBlock.output.connectTo(randomLifetimeBlock.min);\r\n maxLifetimeBlock.output.connectTo(randomLifetimeBlock.max);\r\n\r\n randomLifetimeBlock.output.connectTo(createParticleBlock.lifeTime);\r\n\r\n // Texture\r\n const textureBlock = new ParticleTextureSourceBlock(\"Texture\");\r\n const url = (particleSystem.particleTexture as Texture).url || \"\";\r\n if (url) {\r\n textureBlock.url = url;\r\n } else {\r\n textureBlock.sourceTexture = particleSystem.particleTexture;\r\n }\r\n textureBlock.texture.connectTo(system.texture);\r\n\r\n // Default position update\r\n const basicPositionUpdateBlock = new BasicPositionUpdateBlock(\"Position update\");\r\n shapeBlock.output.connectTo(basicPositionUpdateBlock.particle);\r\n\r\n // Default color update\r\n const basicColorUpdateBlock = new BasicColorUpdateBlock(\"Color update\");\r\n basicPositionUpdateBlock.output.connectTo(basicColorUpdateBlock.particle);\r\n basicColorUpdateBlock.output.connectTo(system.particle);\r\n\r\n // Register\r\n target.systemBlocks.push(system);\r\n}\r\n\r\n/**\r\n * Converts a ParticleSystem to a NodeParticleSystemSet.\r\n * @param name The name of the node particle system set.\r\n * @param particleSystems The particle systems to convert.\r\n * @returns The converted node particle system set or null if conversion failed.\r\n * #0K3AQ2#3627\r\n */\r\nexport async function ConvertToNodeParticleSystemSetAsync(name: string, particleSystems: ParticleSystem[]): Promise<Nullable<NodeParticleSystemSet>> {\r\n if (!particleSystems || !particleSystems.length) {\r\n return null;\r\n }\r\n\r\n const nodeParticleSystemSet = new NodeParticleSystemSet(name);\r\n const promises: Promise<void>[] = [];\r\n\r\n for (const particleSystem of particleSystems) {\r\n promises.push(_ExtractDatafromParticleSystemAsync(particleSystem, nodeParticleSystemSet));\r\n }\r\n\r\n await Promise.all(promises);\r\n return nodeParticleSystemSet;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeParticleSystemSet.helper.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleSystemSet.helper.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,qCAAqC,EAA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AAE,MAAM,CAAC,mBAAmB,CAAC,CAAC;YACvG,MAAM;QACV,CAAC;IACL,CAAC;IAED,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,sCAAsC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC;AAED,SAAS,sBAAsB,CAC3B,cAAsB,EACtB,KAAgC,EAChC,iBAA8C,EAC9C,SAAiD;IAEjD,MAAM,KAAK,GAAG,IAAI,kBAAkB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAChE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,2BAA2B,CAAC,mBAA2B,EAAE,YAA2C,EAAE,iBAA8C;IACzJ,MAAM,KAAK,GAAG,IAAI,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAC1D,KAAK,CAAC,eAAe,GAAG,YAAY,CAAC;IACrC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Color4 } from \"core/Maths/math.color\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { IParticleSystem } from \"core/Particles/IParticleSystem\";\r\nimport type { BoxParticleEmitter } from \"core/Particles/EmitterTypes/boxParticleEmitter\";\r\nimport type { ConeParticleEmitter } from \"core/Particles/EmitterTypes/coneParticleEmitter\";\r\nimport type { CylinderParticleEmitter } from \"core/Particles/EmitterTypes/cylinderParticleEmitter\";\r\nimport type { MeshParticleEmitter } from \"core/Particles/EmitterTypes/meshParticleEmitter\";\r\nimport type { PointParticleEmitter } from \"core/Particles/EmitterTypes/pointParticleEmitter\";\r\nimport type { SphereParticleEmitter } from \"core/Particles/EmitterTypes/sphereParticleEmitter\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { IShapeBlock } from \"core/Particles/Node/Blocks/Emitters/IShapeBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\n\r\nimport { NodeParticleSystemSet } from \"./nodeParticleSystemSet\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport { ParticleConverterBlock } from \"./Blocks/particleConverterBlock\";\r\nimport { ParticleInputBlock } from \"./Blocks/particleInputBlock\";\r\nimport { ParticleMathBlock, ParticleMathBlockOperations } from \"./Blocks/particleMathBlock\";\r\nimport { ParticleRandomBlock } from \"./Blocks/particleRandomBlock\";\r\nimport { ParticleTextureSourceBlock } from \"./Blocks/particleSourceTextureBlock\";\r\nimport { SystemBlock } from \"./Blocks/systemBlock\";\r\nimport { CreateParticleBlock } from \"./Blocks/Emitters/createParticleBlock\";\r\nimport { BoxShapeBlock } from \"./Blocks/Emitters/boxShapeBlock\";\r\nimport { ConeShapeBlock } from \"./Blocks/Emitters/coneShapeBlock\";\r\nimport { CylinderShapeBlock } from \"./Blocks/Emitters/cylinderShapeBlock\";\r\nimport { MeshShapeBlock } from \"./Blocks/Emitters/meshShapeBlock\";\r\nimport { PointShapeBlock } from \"./Blocks/Emitters/pointShapeBlock\";\r\nimport { SphereShapeBlock } from \"./Blocks/Emitters/sphereShapeBlock\";\r\nimport { UpdateColorBlock } from \"./Blocks/Update/updateColorBlock\";\r\nimport { UpdatePositionBlock } from \"./Blocks/Update/updatePositionBlock\";\r\n\r\n/**\r\n * Converts a ParticleSystem to a NodeParticleSystemSet.\r\n * @param name The name of the node particle system set.\r\n * @param particleSystemsList The particle systems to convert.\r\n * @returns The converted node particle system set or null if conversion failed.\r\n * #0K3AQ2#3672\r\n * #7J0NXA#4\r\n */\r\nexport async function ConvertToNodeParticleSystemSetAsync(name: string, particleSystemsList: ParticleSystem[]): Promise<Nullable<NodeParticleSystemSet>> {\r\n if (!particleSystemsList || !particleSystemsList.length) {\r\n return null;\r\n }\r\n\r\n const nodeParticleSystemSet = new NodeParticleSystemSet(name);\r\n const promises: Promise<void>[] = [];\r\n\r\n for (const particleSystem of particleSystemsList) {\r\n promises.push(_ExtractDatafromParticleSystemAsync(nodeParticleSystemSet, particleSystem));\r\n }\r\n\r\n await Promise.all(promises);\r\n return nodeParticleSystemSet;\r\n}\r\n\r\nasync function _ExtractDatafromParticleSystemAsync(newSet: NodeParticleSystemSet, oldSystem: ParticleSystem): Promise<void> {\r\n // System block\r\n const newSystem = _CreateSystemBlock(oldSystem);\r\n\r\n // Shape block\r\n const shapeBlock = _CreateShapeBlock(oldSystem);\r\n\r\n // CreateParticle block\r\n const createParticleBlock = _CreateCreateParticleBlock(oldSystem);\r\n createParticleBlock.particle.connectTo(shapeBlock.particle);\r\n\r\n // Texture\r\n const textureBlock = new ParticleTextureSourceBlock(\"Texture\");\r\n const url = (oldSystem.particleTexture as Texture).url || \"\";\r\n if (url) {\r\n textureBlock.url = url;\r\n } else {\r\n textureBlock.sourceTexture = oldSystem.particleTexture;\r\n }\r\n textureBlock.texture.connectTo(newSystem.texture);\r\n\r\n // Default position update\r\n const positionUpdateblock = new UpdatePositionBlock(\"Position update\");\r\n shapeBlock.output.connectTo(positionUpdateblock.particle);\r\n\r\n const addPositionBlock = new ParticleMathBlock(\"Add Position\");\r\n addPositionBlock.operation = ParticleMathBlockOperations.Add;\r\n _CreateAndConnectContextual(\"Position\", NodeParticleContextualSources.Position, addPositionBlock.left);\r\n _CreateAndConnectContextual(\"Scaled Direction\", NodeParticleContextualSources.ScaledDirection, addPositionBlock.right);\r\n addPositionBlock.output.connectTo(positionUpdateblock.position);\r\n\r\n // Default color update\r\n const colorUpdateblock = new UpdateColorBlock(\"Color update\");\r\n positionUpdateblock.output.connectTo(colorUpdateblock.particle);\r\n\r\n const addColorBlock = new ParticleMathBlock(\"Add Color\");\r\n addColorBlock.operation = ParticleMathBlockOperations.Add;\r\n _CreateAndConnectContextual(\"Color\", NodeParticleContextualSources.Color, addColorBlock.left);\r\n _CreateAndConnectContextual(\"Scaled Color Step\", NodeParticleContextualSources.ScaledColorStep, addColorBlock.right);\r\n addColorBlock.output.connectTo(colorUpdateblock.color);\r\n\r\n const decomposeColorBlock = new ParticleConverterBlock(\"Decompose Color\");\r\n addColorBlock.output.connectTo(decomposeColorBlock.colorIn);\r\n\r\n // Clamp alpha to be >= 0\r\n const maxAlphaBlock = new ParticleMathBlock(\"Alpha >= 0\");\r\n maxAlphaBlock.operation = ParticleMathBlockOperations.Max;\r\n decomposeColorBlock.wOut.connectTo(maxAlphaBlock.left);\r\n _CreateAndConnectInput(\"Zero\", 0, maxAlphaBlock.right);\r\n\r\n const composeColorBlock = new ParticleConverterBlock(\"Compose Color\");\r\n decomposeColorBlock.xyzOut.connectTo(composeColorBlock.xyzIn);\r\n maxAlphaBlock.output.connectTo(composeColorBlock.wIn);\r\n composeColorBlock.colorOut.connectTo(colorUpdateblock.color);\r\n\r\n colorUpdateblock.output.connectTo(newSystem.particle);\r\n\r\n // Register\r\n newSet.systemBlocks.push(newSystem);\r\n}\r\n\r\nfunction _CreateSystemBlock(oldSystem: IParticleSystem): SystemBlock {\r\n const newSystem = new SystemBlock(oldSystem.name);\r\n\r\n newSystem.blendMode = oldSystem.blendMode;\r\n newSystem.capacity = oldSystem.getCapacity();\r\n newSystem.emitRate = oldSystem.emitRate;\r\n newSystem.targetStopDuration = oldSystem.targetStopDuration;\r\n newSystem.startDelay = oldSystem.startDelay;\r\n newSystem.updateSpeed = oldSystem.updateSpeed;\r\n\r\n return newSystem;\r\n}\r\n\r\nfunction _CreateCreateParticleBlock(oldSystem: IParticleSystem): CreateParticleBlock {\r\n // Create particle\r\n const createParticleBlock = new CreateParticleBlock(\"Create Particle\");\r\n\r\n // Color\r\n const randomColorBlock = new ParticleRandomBlock(\"Random Color\");\r\n _CreateAndConnectInput(\"Color 1\", oldSystem.color1, randomColorBlock.min);\r\n _CreateAndConnectInput(\"Color 2\", oldSystem.color2, randomColorBlock.max);\r\n randomColorBlock.output.connectTo(createParticleBlock.color);\r\n\r\n // Dead color\r\n _CreateAndConnectInput(\"Dead Color\", oldSystem.colorDead, createParticleBlock.colorDead);\r\n\r\n // Emit power\r\n const randomEmitPowerBlock = new ParticleRandomBlock(\"Random Emit Power\");\r\n _CreateAndConnectInput(\"Min Emit Power\", oldSystem.minEmitPower, randomEmitPowerBlock.min);\r\n _CreateAndConnectInput(\"Max Emit Power\", oldSystem.maxEmitPower, randomEmitPowerBlock.max);\r\n randomEmitPowerBlock.output.connectTo(createParticleBlock.emitPower);\r\n\r\n // Scale\r\n const randomScaleBlock = new ParticleRandomBlock(\"Random Scale\");\r\n _CreateAndConnectInput(\"Min Scale\", oldSystem.minSize, randomScaleBlock.min);\r\n _CreateAndConnectInput(\"Max Scale\", oldSystem.maxSize, randomScaleBlock.max);\r\n randomScaleBlock.output.connectTo(createParticleBlock.scale);\r\n\r\n // Lifetime\r\n const randomLifetimeBlock = new ParticleRandomBlock(\"Random Lifetime\");\r\n _CreateAndConnectInput(\"Min Lifetime\", oldSystem.minLifeTime, randomLifetimeBlock.min);\r\n _CreateAndConnectInput(\"Max Lifetime\", oldSystem.maxLifeTime, randomLifetimeBlock.max);\r\n randomLifetimeBlock.output.connectTo(createParticleBlock.lifeTime);\r\n\r\n return createParticleBlock;\r\n}\r\n\r\nfunction _CreateShapeBlock(oldSystem: IParticleSystem): IShapeBlock {\r\n const emitter = oldSystem.particleEmitterType;\r\n if (!emitter) {\r\n throw new Error(\"Particle system has no emitter type.\");\r\n }\r\n\r\n let shapeBlock: Nullable<IShapeBlock> = null;\r\n switch (emitter.getClassName()) {\r\n case \"BoxParticleEmitter\": {\r\n const source = emitter as BoxParticleEmitter;\r\n shapeBlock = new BoxShapeBlock(\"Box Shape\");\r\n\r\n const target = shapeBlock as BoxShapeBlock;\r\n _CreateAndConnectInput(\"Direction 1\", source.direction1, target.direction1);\r\n _CreateAndConnectInput(\"Direction 2\", source.direction2, target.direction2);\r\n _CreateAndConnectInput(\"Min Emit Box\", source.minEmitBox, target.minEmitBox);\r\n _CreateAndConnectInput(\"Max Emit Box\", source.maxEmitBox, target.maxEmitBox);\r\n break;\r\n }\r\n case \"ConeParticleEmitter\": {\r\n const source = emitter as ConeParticleEmitter;\r\n shapeBlock = new ConeShapeBlock(\"Cone Shape\");\r\n\r\n const target = shapeBlock as ConeShapeBlock;\r\n _CreateAndConnectInput(\"Radius\", source.radius, target.radius);\r\n _CreateAndConnectInput(\"Angle\", source.angle, target.angle);\r\n _CreateAndConnectInput(\"Radius Range\", source.radiusRange, target.radiusRange);\r\n _CreateAndConnectInput(\"Height Range\", source.heightRange, target.heightRange);\r\n _CreateAndConnectInput(\"Emit From Spawn Point Only\", source.emitFromSpawnPointOnly ? 1 : 0, target.emitFromSpawnPointOnly, NodeParticleBlockConnectionPointTypes.Int);\r\n _CreateAndConnectInput(\"Direction Randomizer\", source.directionRandomizer, target.directionRandomizer);\r\n break;\r\n }\r\n case \"CustomParticleEmitter\": {\r\n // Custom emitter is not supported in nodes yet\r\n throw new Error(\"CustomParticleEmitter is not supported in Node Particle System.\");\r\n }\r\n case \"CylinderParticleEmitter\": {\r\n const source = emitter as CylinderParticleEmitter;\r\n shapeBlock = new CylinderShapeBlock(\"Cylinder Shape\");\r\n\r\n const target = shapeBlock as CylinderShapeBlock;\r\n _CreateAndConnectInput(\"Height\", source.height, target.height);\r\n _CreateAndConnectInput(\"Radius\", source.radius, target.radius);\r\n _CreateAndConnectInput(\"Radius Range\", source.radiusRange, target.radiusRange);\r\n _CreateAndConnectInput(\"Direction Randomizer\", source.directionRandomizer, target.directionRandomizer);\r\n break;\r\n }\r\n case \"HemisphericParticleEmitter\": {\r\n // Hemispheric emitter is not supported in nodes yet\r\n throw new Error(\"HemisphericParticleEmitter is not supported in Node Particle System.\");\r\n }\r\n case \"MeshParticleEmitter\": {\r\n const source = emitter as MeshParticleEmitter;\r\n shapeBlock = new MeshShapeBlock(\"Mesh Shape\");\r\n\r\n const target = shapeBlock as MeshShapeBlock;\r\n _CreateAndConnectInput(\"Direction 1\", source.direction1, target.direction1);\r\n _CreateAndConnectInput(\"Direction 2\", source.direction2, target.direction2);\r\n\r\n target.mesh = source.mesh as Mesh;\r\n break;\r\n }\r\n case \"PointParticleEmitter\": {\r\n const source = emitter as PointParticleEmitter;\r\n shapeBlock = new PointShapeBlock(\"Point Shape\");\r\n\r\n const target = shapeBlock as PointShapeBlock;\r\n _CreateAndConnectInput(\"Direction 1\", source.direction1, target.direction1);\r\n _CreateAndConnectInput(\"Direction 2\", source.direction2, target.direction2);\r\n break;\r\n }\r\n case \"SphereParticleEmitter\": {\r\n const source = emitter as SphereParticleEmitter;\r\n shapeBlock = new SphereShapeBlock(\"Sphere Shape\");\r\n\r\n const target = shapeBlock as SphereShapeBlock;\r\n _CreateAndConnectInput(\"Radius\", source.radius, target.radius);\r\n _CreateAndConnectInput(\"Radius Range\", source.radiusRange, target.radiusRange);\r\n _CreateAndConnectInput(\"Direction Randomizer\", source.directionRandomizer, target.directionRandomizer);\r\n break;\r\n }\r\n }\r\n\r\n if (!shapeBlock) {\r\n throw new Error(`Unsupported particle emitter type: ${emitter.getClassName()}`);\r\n }\r\n\r\n return shapeBlock;\r\n}\r\n\r\nfunction _CreateAndConnectInput(\r\n inputBlockName: string,\r\n value: number | Vector3 | Color4,\r\n targetToConnectTo: NodeParticleConnectionPoint,\r\n inputType?: NodeParticleBlockConnectionPointTypes\r\n): void {\r\n const input = new ParticleInputBlock(inputBlockName, inputType);\r\n input.value = value;\r\n input.output.connectTo(targetToConnectTo);\r\n}\r\n\r\nfunction _CreateAndConnectContextual(contextualBlockName: string, contextValue: NodeParticleContextualSources, targetToConnectTo: NodeParticleConnectionPoint): void {\r\n const input = new ParticleInputBlock(contextualBlockName);\r\n input.contextualValue = contextValue;\r\n input.output.connectTo(targetToConnectTo);\r\n}\r\n"]}
|
|
@@ -248,6 +248,7 @@ export class SSAO2RenderingPipeline extends PostProcessRenderPipeline {
|
|
|
248
248
|
* Force rendering the geometry through geometry buffer.
|
|
249
249
|
*/
|
|
250
250
|
this._forceGeometryBuffer = false;
|
|
251
|
+
this._currentCameraMode = -1;
|
|
251
252
|
this._thinSSAORenderingPipeline = new ThinSSAO2RenderingPipeline(name, scene);
|
|
252
253
|
this._scene = scene;
|
|
253
254
|
this._ratio = ratio;
|
|
@@ -281,6 +282,13 @@ export class SSAO2RenderingPipeline extends PostProcessRenderPipeline {
|
|
|
281
282
|
}
|
|
282
283
|
}
|
|
283
284
|
this._originalColorPostProcess = new PassPostProcess("SSAOOriginalSceneColor", 1.0, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), undefined, this._textureType);
|
|
285
|
+
this._originalColorPostProcess.onBeforeRenderObservable.add(() => {
|
|
286
|
+
const camera = this._scene.activeCamera;
|
|
287
|
+
if (camera && this._currentCameraMode !== camera.mode) {
|
|
288
|
+
this._currentCameraMode = camera.mode;
|
|
289
|
+
this._thinSSAORenderingPipeline._ssaoPostProcess.updateEffect();
|
|
290
|
+
}
|
|
291
|
+
});
|
|
284
292
|
this._originalColorPostProcess.samples = this.textureSamples;
|
|
285
293
|
this._createSSAOPostProcess(1.0, textureType);
|
|
286
294
|
this._createBlurPostProcess(ssaoRatio, blurRatio, this._textureType);
|