@babylonjs/smart-filters-blocks 1.0.13 → 8.18.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/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.block.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.block.js +5 -5
- package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.block.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/blurBlock.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.d.ts +1 -1
- package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.js +3 -5
- package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/blurBlock.js +8 -13
- package/dist/blocks/babylon/demo/effects/blurBlock.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/blurBlock.serializer.d.ts +1 -1
- package/dist/blocks/babylon/demo/effects/blurBlock.serializer.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/blurBlock.serializer.js +1 -1
- package/dist/blocks/babylon/demo/effects/compositionBlock.d.ts +7 -7
- package/dist/blocks/babylon/demo/effects/compositionBlock.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.d.ts +1 -1
- package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.js +2 -3
- package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/compositionBlock.fragment.d.ts +4 -2
- package/dist/blocks/babylon/demo/effects/compositionBlock.fragment.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/compositionBlock.fragment.js +5 -2
- package/dist/blocks/babylon/demo/effects/compositionBlock.fragment.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/compositionBlock.js +2 -6
- package/dist/blocks/babylon/demo/effects/compositionBlock.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.d.ts +1 -1
- package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.js +1 -1
- package/dist/blocks/babylon/demo/effects/contrastBlock.block.d.ts +1 -1
- package/dist/blocks/babylon/demo/effects/contrastBlock.block.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/contrastBlock.block.js +6 -6
- package/dist/blocks/babylon/demo/effects/contrastBlock.block.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/desaturateBlock.block.d.ts +1 -1
- package/dist/blocks/babylon/demo/effects/desaturateBlock.block.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/desaturateBlock.block.js +6 -6
- package/dist/blocks/babylon/demo/effects/desaturateBlock.block.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.d.ts +3 -1
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.d.ts +1 -1
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.js +4 -5
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.js +32 -37
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.d.ts +1 -1
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.js +1 -1
- package/dist/blocks/babylon/demo/effects/exposureBlock.block.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/exposureBlock.block.js +7 -7
- package/dist/blocks/babylon/demo/effects/exposureBlock.block.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/greenScreenBlock.block.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/greenScreenBlock.block.js +11 -11
- package/dist/blocks/babylon/demo/effects/greenScreenBlock.block.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.d.ts +6 -1
- package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.js +71 -71
- package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/maskBlock.block.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/maskBlock.block.js +7 -7
- package/dist/blocks/babylon/demo/effects/maskBlock.block.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/pixelateBlock.block.d.ts +2 -2
- package/dist/blocks/babylon/demo/effects/pixelateBlock.block.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/pixelateBlock.block.js +8 -8
- package/dist/blocks/babylon/demo/effects/pixelateBlock.block.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/posterizeBlock.block.d.ts +1 -1
- package/dist/blocks/babylon/demo/effects/posterizeBlock.block.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/posterizeBlock.block.js +6 -6
- package/dist/blocks/babylon/demo/effects/posterizeBlock.block.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.d.ts +5 -5
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.fragment.d.ts +4 -2
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.fragment.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.fragment.js +5 -2
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.fragment.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.js.map +1 -1
- package/dist/blocks/babylon/demo/effects/tintBlock.d.ts +1 -1
- package/dist/blocks/babylon/demo/effects/tintBlock.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/effects/tintBlock.js +10 -10
- package/dist/blocks/babylon/demo/effects/tintBlock.js.map +1 -1
- package/dist/blocks/babylon/demo/transitions/wipeBlock.block.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/transitions/wipeBlock.block.js +9 -9
- package/dist/blocks/babylon/demo/transitions/wipeBlock.block.js.map +1 -1
- package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.d.ts.map +1 -1
- package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.js +5 -5
- package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.js.map +1 -1
- package/dist/blocks/blockNamespaces.d.ts.map +1 -1
- package/dist/blocks/blockNamespaces.js +2 -0
- package/dist/blocks/blockNamespaces.js.map +1 -1
- package/dist/blocks/blockTypes.d.ts.map +1 -1
- package/dist/blocks/blockTypes.js +2 -0
- package/dist/blocks/blockTypes.js.map +1 -1
- package/dist/blocks/index.d.ts.map +1 -1
- package/dist/blocks/index.js +1 -0
- package/dist/blocks/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/registration/IBlockRegistration.d.ts +1 -1
- package/dist/registration/IBlockRegistration.d.ts.map +1 -1
- package/dist/registration/blockSerializers.d.ts.map +1 -1
- package/dist/registration/blockSerializers.js +6 -8
- package/dist/registration/blockSerializers.js.map +1 -1
- package/dist/registration/builtInBlockRegistrations.d.ts +1 -1
- package/dist/registration/builtInBlockRegistrations.d.ts.map +1 -1
- package/dist/registration/builtInBlockRegistrations.js +50 -52
- package/dist/registration/builtInBlockRegistrations.js.map +1 -1
- package/dist/registration/index.d.ts +1 -0
- package/dist/registration/index.d.ts.map +1 -1
- package/dist/registration/index.js +2 -0
- package/dist/registration/index.js.map +1 -1
- package/license.md +21 -21
- package/package.json +15 -13
- package/src/blocks/babylon/demo/effects/blackAndWhiteBlock.block.ts +8 -7
- package/src/blocks/babylon/demo/effects/blurBlock.deserializer.ts +37 -37
- package/src/blocks/babylon/demo/effects/blurBlock.serializer.ts +31 -31
- package/src/blocks/babylon/demo/effects/blurBlock.ts +115 -122
- package/src/blocks/babylon/demo/effects/compositionBlock.deserializer.ts +31 -31
- package/src/blocks/babylon/demo/effects/compositionBlock.fragment.ts +7 -3
- package/src/blocks/babylon/demo/effects/compositionBlock.serializer.ts +28 -28
- package/src/blocks/babylon/demo/effects/compositionBlock.ts +211 -243
- package/src/blocks/babylon/demo/effects/contrastBlock.block.ts +9 -8
- package/src/blocks/babylon/demo/effects/desaturateBlock.block.ts +9 -8
- package/src/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.ts +43 -46
- package/src/blocks/babylon/demo/effects/directionalBlurBlock.serializer.ts +30 -30
- package/src/blocks/babylon/demo/effects/directionalBlurBlock.ts +192 -196
- package/src/blocks/babylon/demo/effects/exposureBlock.block.ts +10 -9
- package/src/blocks/babylon/demo/effects/greenScreenBlock.block.ts +14 -13
- package/src/blocks/babylon/demo/effects/index.ts +14 -14
- package/src/blocks/babylon/demo/effects/kaleidoscopeBlock.ts +188 -192
- package/src/blocks/babylon/demo/effects/maskBlock.block.ts +10 -9
- package/src/blocks/babylon/demo/effects/pixelateBlock.block.ts +11 -10
- package/src/blocks/babylon/demo/effects/posterizeBlock.block.ts +9 -8
- package/src/blocks/babylon/demo/effects/spritesheetBlock.fragment.ts +7 -3
- package/src/blocks/babylon/demo/effects/spritesheetBlock.ts +135 -138
- package/src/blocks/babylon/demo/effects/tintBlock.ts +51 -51
- package/src/blocks/babylon/demo/transitions/index.ts +1 -1
- package/src/blocks/babylon/demo/transitions/wipeBlock.block.ts +12 -11
- package/src/blocks/babylon/demo/utilities/index.ts +1 -1
- package/src/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.ts +8 -7
- package/src/blocks/blockNamespaces.ts +6 -4
- package/src/blocks/blockTypes.ts +23 -21
- package/src/blocks/index.ts +6 -5
- package/src/index.ts +3 -2
- package/src/registration/IBlockRegistration.ts +43 -48
- package/src/registration/blockSerializers.ts +50 -52
- package/src/registration/builtInBlockRegistrations.ts +293 -403
- package/src/registration/index.ts +4 -2
|
@@ -1,403 +1,293 @@
|
|
|
1
|
-
import type { ThinEngine } from "
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
smartFilter
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
);
|
|
97
|
-
const block = new module.
|
|
98
|
-
if (!serializedBlock) {
|
|
99
|
-
const input = new InputBlock(smartFilter, "Intensity", ConnectionPointType.Float, 0.5);
|
|
100
|
-
input.output.connectTo(block.intensity);
|
|
101
|
-
}
|
|
102
|
-
return block;
|
|
103
|
-
},
|
|
104
|
-
namespace: babylonDemoEffectsNamespace,
|
|
105
|
-
tooltip: "
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
blockType:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
serializedBlock
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
return block;
|
|
124
|
-
},
|
|
125
|
-
namespace: babylonDemoEffectsNamespace,
|
|
126
|
-
tooltip: "
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
blockType:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
serializedBlock
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
) => {
|
|
205
|
-
|
|
206
|
-
/* webpackChunkName: "
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
const module = await import(
|
|
295
|
-
/* webpackChunkName: "blurBlockDeserializer" */ "../blocks/babylon/demo/effects/blurBlock.deserializer.js"
|
|
296
|
-
);
|
|
297
|
-
return module.blurBlockDeserializer(smartFilter, serializedBlock);
|
|
298
|
-
} else {
|
|
299
|
-
const module = await import(
|
|
300
|
-
/* webpackChunkName: "blurBlock" */ "../blocks/babylon/demo/effects/blurBlock.js"
|
|
301
|
-
);
|
|
302
|
-
return new module.BlurBlock(smartFilter, "Blur");
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
namespace: babylonDemoEffectsNamespace,
|
|
306
|
-
tooltip: "Blur the input texture",
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
blockType: compositionBlockType,
|
|
310
|
-
factory: async (
|
|
311
|
-
smartFilter: SmartFilter,
|
|
312
|
-
_engine: ThinEngine,
|
|
313
|
-
_smartFilterDeserializer: SmartFilterDeserializer,
|
|
314
|
-
serializedBlock: ISerializedBlockV1 | undefined
|
|
315
|
-
) => {
|
|
316
|
-
if (serializedBlock) {
|
|
317
|
-
const module = await import(
|
|
318
|
-
/* webpackChunkName: "compositionBlockDeserializer" */ "../blocks/babylon/demo/effects/compositionBlock.deserializer.js"
|
|
319
|
-
);
|
|
320
|
-
return module.compositionDeserializer(smartFilter, serializedBlock);
|
|
321
|
-
} else {
|
|
322
|
-
const module = await import(
|
|
323
|
-
/* webpackChunkName: "compositionBlock" */ "../blocks/babylon/demo/effects/compositionBlock.js"
|
|
324
|
-
);
|
|
325
|
-
const block = new module.CompositionBlock(smartFilter, "Composition");
|
|
326
|
-
const top = new InputBlock(smartFilter, "Top", ConnectionPointType.Float, 0.0);
|
|
327
|
-
const left = new InputBlock(smartFilter, "Left", ConnectionPointType.Float, 0.0);
|
|
328
|
-
const width = new InputBlock(smartFilter, "Width", ConnectionPointType.Float, 1.0);
|
|
329
|
-
const height = new InputBlock(smartFilter, "Height", ConnectionPointType.Float, 1.0);
|
|
330
|
-
|
|
331
|
-
top.output.connectTo(block.foregroundTop);
|
|
332
|
-
left.output.connectTo(block.foregroundLeft);
|
|
333
|
-
width.output.connectTo(block.foregroundWidth);
|
|
334
|
-
height.output.connectTo(block.foregroundHeight);
|
|
335
|
-
return block;
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
namespace: babylonDemoEffectsNamespace,
|
|
339
|
-
tooltip: "Composite the foreground texture over the background texture",
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
// Blocks defined by serialized definitions
|
|
343
|
-
// ----------------------------------------
|
|
344
|
-
{
|
|
345
|
-
blockType: tintBlockType,
|
|
346
|
-
factory: async (
|
|
347
|
-
smartFilter: SmartFilter,
|
|
348
|
-
_engine: ThinEngine,
|
|
349
|
-
_smartFilterDeserializer: SmartFilterDeserializer,
|
|
350
|
-
serializedBlock: ISerializedBlockV1 | undefined
|
|
351
|
-
) => {
|
|
352
|
-
const module = await import(
|
|
353
|
-
/* webpackChunkName: "tintBlock" */ "../blocks/babylon/demo/effects/tintBlock.js"
|
|
354
|
-
);
|
|
355
|
-
return CustomShaderBlock.Create(
|
|
356
|
-
smartFilter,
|
|
357
|
-
serializedBlock?.name || "Tint",
|
|
358
|
-
module.deserializedTintBlockDefinition
|
|
359
|
-
);
|
|
360
|
-
},
|
|
361
|
-
namespace: babylonDemoEffectsNamespace,
|
|
362
|
-
tooltip: "Adds colored tint to the input texture",
|
|
363
|
-
},
|
|
364
|
-
|
|
365
|
-
// Standard input blocks
|
|
366
|
-
// ---------------------
|
|
367
|
-
{
|
|
368
|
-
blockType: "Float",
|
|
369
|
-
namespace: inputsNamespace,
|
|
370
|
-
isInput: true,
|
|
371
|
-
tooltip: "A floating point number representing a value with a fractional component",
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
blockType: "Color3",
|
|
375
|
-
namespace: inputsNamespace,
|
|
376
|
-
isInput: true,
|
|
377
|
-
tooltip: "A set of 3 floating point numbers representing a color",
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
blockType: "Color4",
|
|
381
|
-
namespace: inputsNamespace,
|
|
382
|
-
isInput: true,
|
|
383
|
-
tooltip: "A set of 4 floating point numbers representing a color",
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
blockType: "Texture",
|
|
387
|
-
namespace: inputsNamespace,
|
|
388
|
-
isInput: true,
|
|
389
|
-
tooltip: "A texture to be used as input",
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
blockType: "Vector2",
|
|
393
|
-
namespace: inputsNamespace,
|
|
394
|
-
isInput: true,
|
|
395
|
-
tooltip: "A Vector2 to be used as input",
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
blockType: "Boolean",
|
|
399
|
-
namespace: inputsNamespace,
|
|
400
|
-
isInput: true,
|
|
401
|
-
tooltip: "A boolean to be used as input",
|
|
402
|
-
},
|
|
403
|
-
];
|
|
1
|
+
import type { ThinEngine } from "core/Engines/thinEngine.js";
|
|
2
|
+
import { InputBlock, type SmartFilter, type SmartFilterDeserializer, type ISerializedBlockV1, ConnectionPointType, CustomShaderBlock } from "smart-filters";
|
|
3
|
+
import type { IBlockRegistration } from "./IBlockRegistration.js";
|
|
4
|
+
import { babylonDemoEffectsNamespace, babylonDemoTransitionsNamespace, babylonDemoUtilitiesNamespace, inputsNamespace } from "../blocks/blockNamespaces.js";
|
|
5
|
+
import {
|
|
6
|
+
blackAndWhiteBlockType,
|
|
7
|
+
kaleidoscopeBlockType,
|
|
8
|
+
posterizeBlockType,
|
|
9
|
+
desaturateBlockType,
|
|
10
|
+
contrastBlockType,
|
|
11
|
+
greenScreenBlockType,
|
|
12
|
+
pixelateBlockType,
|
|
13
|
+
exposureBlockType,
|
|
14
|
+
maskBlockType,
|
|
15
|
+
spritesheetBlockType,
|
|
16
|
+
premultiplyAlphaBlockType,
|
|
17
|
+
wipeBlockType,
|
|
18
|
+
blurBlockType,
|
|
19
|
+
compositionBlockType,
|
|
20
|
+
tintBlockType,
|
|
21
|
+
} from "../blocks/blockTypes.js";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The list of block registrations.
|
|
25
|
+
*
|
|
26
|
+
* Important notes:
|
|
27
|
+
* 1. Do not import the block code directly in this file. Instead, use dynamic imports to ensure that the block code
|
|
28
|
+
* is only loaded when needed.
|
|
29
|
+
* 2. If the deserializer is trivial (doesn't require consulting the serializedBlock.data), it can be implemented here
|
|
30
|
+
* 3. If the deserializer is non-trivial (needs serializedBlock.data), implement it in a separate file alongside the block
|
|
31
|
+
* in the form blockClassName.deserializer.ts
|
|
32
|
+
*/
|
|
33
|
+
export const BuiltInBlockRegistrations: IBlockRegistration[] = [
|
|
34
|
+
// Blocks with trivial deserializers
|
|
35
|
+
// Note that some choose to predefine corresponding input blocks if not being deserialized
|
|
36
|
+
// ---------------------------------------------------------------------------------------
|
|
37
|
+
{
|
|
38
|
+
blockType: blackAndWhiteBlockType,
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
40
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
41
|
+
const module = await import(/* webpackChunkName: "blackAndWhiteBlock" */ "../blocks/babylon/demo/effects/blackAndWhiteBlock.block.js");
|
|
42
|
+
return new module.BlackAndWhiteBlock(smartFilter, serializedBlock?.name || "BlackAndWhite");
|
|
43
|
+
},
|
|
44
|
+
namespace: babylonDemoEffectsNamespace,
|
|
45
|
+
tooltip: "Transform the input texture to black and white",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
blockType: kaleidoscopeBlockType,
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
50
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
51
|
+
const module = await import(/* webpackChunkName: "kaleidoscopeBlock" */ "../blocks/babylon/demo/effects/kaleidoscopeBlock.js");
|
|
52
|
+
const block = new module.KaleidoscopeBlock(smartFilter, serializedBlock?.name || "Kaleidoscope");
|
|
53
|
+
if (!serializedBlock) {
|
|
54
|
+
const input = new InputBlock(smartFilter, "Angle", ConnectionPointType.Float, 0);
|
|
55
|
+
input.output.connectTo(block.time);
|
|
56
|
+
}
|
|
57
|
+
return block;
|
|
58
|
+
},
|
|
59
|
+
namespace: babylonDemoEffectsNamespace,
|
|
60
|
+
tooltip: "Kaleidoscope effect",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
blockType: posterizeBlockType,
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
65
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
66
|
+
const module = await import(/* webpackChunkName: "posterizeBlock" */ "../blocks/babylon/demo/effects/posterizeBlock.block.js");
|
|
67
|
+
const block = new module.PosterizeBlock(smartFilter, serializedBlock?.name || "Posterize");
|
|
68
|
+
if (!serializedBlock) {
|
|
69
|
+
const input = new InputBlock(smartFilter, "Intensity", ConnectionPointType.Float, 0.5);
|
|
70
|
+
input.output.connectTo(block.intensity);
|
|
71
|
+
}
|
|
72
|
+
return block;
|
|
73
|
+
},
|
|
74
|
+
namespace: babylonDemoEffectsNamespace,
|
|
75
|
+
tooltip: "Posterize to the input texture",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
blockType: desaturateBlockType,
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
80
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
81
|
+
const module = await import(/* webpackChunkName: "desaturateBlock" */ "../blocks/babylon/demo/effects/desaturateBlock.block.js");
|
|
82
|
+
const block = new module.DesaturateBlock(smartFilter, serializedBlock?.name || "Desaturate");
|
|
83
|
+
if (!serializedBlock) {
|
|
84
|
+
const input = new InputBlock(smartFilter, "Intensity", ConnectionPointType.Float, 0.5);
|
|
85
|
+
input.output.connectTo(block.intensity);
|
|
86
|
+
}
|
|
87
|
+
return block;
|
|
88
|
+
},
|
|
89
|
+
namespace: babylonDemoEffectsNamespace,
|
|
90
|
+
tooltip: "Applies a desaturated effect to the input texture",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
blockType: contrastBlockType,
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
95
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
96
|
+
const module = await import(/* webpackChunkName: "contrastBlock" */ "../blocks/babylon/demo/effects/contrastBlock.block.js");
|
|
97
|
+
const block = new module.ContrastBlock(smartFilter, serializedBlock?.name || "Contrast");
|
|
98
|
+
if (!serializedBlock) {
|
|
99
|
+
const input = new InputBlock(smartFilter, "Intensity", ConnectionPointType.Float, 0.5);
|
|
100
|
+
input.output.connectTo(block.intensity);
|
|
101
|
+
}
|
|
102
|
+
return block;
|
|
103
|
+
},
|
|
104
|
+
namespace: babylonDemoEffectsNamespace,
|
|
105
|
+
tooltip: "Change the contrast of the input texture",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
blockType: greenScreenBlockType,
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
110
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
111
|
+
const module = await import(/* webpackChunkName: "greenScreenBlock" */ "../blocks/babylon/demo/effects/greenScreenBlock.block.js");
|
|
112
|
+
const block = new module.GreenScreenBlock(smartFilter, serializedBlock?.name || "GreenScreen");
|
|
113
|
+
if (!serializedBlock) {
|
|
114
|
+
const reference = new InputBlock(smartFilter, "Reference", ConnectionPointType.Color3, {
|
|
115
|
+
r: 92 / 255,
|
|
116
|
+
g: 204 / 255,
|
|
117
|
+
b: 78 / 255,
|
|
118
|
+
});
|
|
119
|
+
const distance = new InputBlock(smartFilter, "Distance", ConnectionPointType.Float, 0.25);
|
|
120
|
+
reference.output.connectTo(block.reference);
|
|
121
|
+
distance.output.connectTo(block.distance);
|
|
122
|
+
}
|
|
123
|
+
return block;
|
|
124
|
+
},
|
|
125
|
+
namespace: babylonDemoEffectsNamespace,
|
|
126
|
+
tooltip: "Replaces a green screen background with a different texture",
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
blockType: pixelateBlockType,
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
131
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
132
|
+
const module = await import(/* webpackChunkName: "pixelateBlock" */ "../blocks/babylon/demo/effects/pixelateBlock.block.js");
|
|
133
|
+
const block = new module.PixelateBlock(smartFilter, serializedBlock?.name || "Pixelate");
|
|
134
|
+
if (!serializedBlock) {
|
|
135
|
+
const input = new InputBlock(smartFilter, "Intensity", ConnectionPointType.Float, 0.4);
|
|
136
|
+
input.output.connectTo(block.intensity);
|
|
137
|
+
}
|
|
138
|
+
return block;
|
|
139
|
+
},
|
|
140
|
+
namespace: babylonDemoEffectsNamespace,
|
|
141
|
+
tooltip: "Add pixelation to the input texture",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
blockType: exposureBlockType,
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
146
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
147
|
+
const module = await import(/* webpackChunkName: "exposureBlock" */ "../blocks/babylon/demo/effects/exposureBlock.block.js");
|
|
148
|
+
const block = new module.ExposureBlock(smartFilter, serializedBlock?.name || "Exposure");
|
|
149
|
+
if (!serializedBlock) {
|
|
150
|
+
const input = new InputBlock(smartFilter, "Amount", ConnectionPointType.Float, 0.7);
|
|
151
|
+
input.output.connectTo(block.amount);
|
|
152
|
+
}
|
|
153
|
+
return block;
|
|
154
|
+
},
|
|
155
|
+
namespace: babylonDemoEffectsNamespace,
|
|
156
|
+
tooltip: "Alters the exposure of the input texture",
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
blockType: maskBlockType,
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
161
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
162
|
+
const module = await import(/* webpackChunkName: "maskBlock" */ "../blocks/babylon/demo/effects/maskBlock.block.js");
|
|
163
|
+
return new module.MaskBlock(smartFilter, serializedBlock?.name || "Mask");
|
|
164
|
+
},
|
|
165
|
+
namespace: babylonDemoEffectsNamespace,
|
|
166
|
+
tooltip: "Applies mask in one texture to another texture",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
blockType: spritesheetBlockType,
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
171
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
172
|
+
const module = await import(/* webpackChunkName: "spritesheetBlock" */ "../blocks/babylon/demo/effects/spritesheetBlock.js");
|
|
173
|
+
return new module.SpritesheetBlock(smartFilter, serializedBlock?.name || "Spritesheet");
|
|
174
|
+
},
|
|
175
|
+
namespace: babylonDemoEffectsNamespace,
|
|
176
|
+
tooltip: "Animates a sprite sheet texture",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
blockType: premultiplyAlphaBlockType,
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
181
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
182
|
+
const module = await import(/* webpackChunkName: "premultiplyAlphaBlock" */ "../blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.js");
|
|
183
|
+
return new module.PremultiplyAlphaBlock(smartFilter, serializedBlock?.name || "PremultiplyAlpha");
|
|
184
|
+
},
|
|
185
|
+
namespace: babylonDemoUtilitiesNamespace,
|
|
186
|
+
tooltip: "Premultiplies the input texture's color against its alpha",
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
blockType: wipeBlockType,
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
191
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
192
|
+
const module = await import(/* webpackChunkName: "wipeBlock" */ "../blocks/babylon/demo/transitions/wipeBlock.block.js");
|
|
193
|
+
return new module.WipeBlock(smartFilter, serializedBlock?.name || "Wipe");
|
|
194
|
+
},
|
|
195
|
+
namespace: babylonDemoTransitionsNamespace,
|
|
196
|
+
tooltip: "Transition from one texture to another using a wipe",
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
// Blocks with custom deserializers
|
|
200
|
+
// --------------------------------
|
|
201
|
+
{
|
|
202
|
+
blockType: blurBlockType,
|
|
203
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
204
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
205
|
+
if (serializedBlock) {
|
|
206
|
+
const module = await import(/* webpackChunkName: "blurBlockDeserializer" */ "../blocks/babylon/demo/effects/blurBlock.deserializer.js");
|
|
207
|
+
return module.BlurBlockDeserializer(smartFilter, serializedBlock);
|
|
208
|
+
} else {
|
|
209
|
+
const module = await import(/* webpackChunkName: "blurBlock" */ "../blocks/babylon/demo/effects/blurBlock.js");
|
|
210
|
+
return new module.BlurBlock(smartFilter, "Blur");
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
namespace: babylonDemoEffectsNamespace,
|
|
214
|
+
tooltip: "Blur the input texture",
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
blockType: compositionBlockType,
|
|
218
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
219
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
220
|
+
if (serializedBlock) {
|
|
221
|
+
const module = await import(/* webpackChunkName: "compositionBlockDeserializer" */ "../blocks/babylon/demo/effects/compositionBlock.deserializer.js");
|
|
222
|
+
return module.CompositionDeserializer(smartFilter, serializedBlock);
|
|
223
|
+
} else {
|
|
224
|
+
const module = await import(/* webpackChunkName: "compositionBlock" */ "../blocks/babylon/demo/effects/compositionBlock.js");
|
|
225
|
+
const block = new module.CompositionBlock(smartFilter, "Composition");
|
|
226
|
+
const top = new InputBlock(smartFilter, "Top", ConnectionPointType.Float, 0.0);
|
|
227
|
+
const left = new InputBlock(smartFilter, "Left", ConnectionPointType.Float, 0.0);
|
|
228
|
+
const width = new InputBlock(smartFilter, "Width", ConnectionPointType.Float, 1.0);
|
|
229
|
+
const height = new InputBlock(smartFilter, "Height", ConnectionPointType.Float, 1.0);
|
|
230
|
+
|
|
231
|
+
top.output.connectTo(block.foregroundTop);
|
|
232
|
+
left.output.connectTo(block.foregroundLeft);
|
|
233
|
+
width.output.connectTo(block.foregroundWidth);
|
|
234
|
+
height.output.connectTo(block.foregroundHeight);
|
|
235
|
+
return block;
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
namespace: babylonDemoEffectsNamespace,
|
|
239
|
+
tooltip: "Composite the foreground texture over the background texture",
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
// Blocks defined by serialized definitions
|
|
243
|
+
// ----------------------------------------
|
|
244
|
+
{
|
|
245
|
+
blockType: tintBlockType,
|
|
246
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
247
|
+
factory: async (smartFilter: SmartFilter, _engine: ThinEngine, _smartFilterDeserializer: SmartFilterDeserializer, serializedBlock: ISerializedBlockV1 | undefined) => {
|
|
248
|
+
const module = await import(/* webpackChunkName: "tintBlock" */ "../blocks/babylon/demo/effects/tintBlock.js");
|
|
249
|
+
return CustomShaderBlock.Create(smartFilter, serializedBlock?.name || "Tint", module.DeserializedTintBlockDefinition);
|
|
250
|
+
},
|
|
251
|
+
namespace: babylonDemoEffectsNamespace,
|
|
252
|
+
tooltip: "Adds colored tint to the input texture",
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
// Standard input blocks
|
|
256
|
+
// ---------------------
|
|
257
|
+
{
|
|
258
|
+
blockType: "Float",
|
|
259
|
+
namespace: inputsNamespace,
|
|
260
|
+
isInput: true,
|
|
261
|
+
tooltip: "A floating point number representing a value with a fractional component",
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
blockType: "Color3",
|
|
265
|
+
namespace: inputsNamespace,
|
|
266
|
+
isInput: true,
|
|
267
|
+
tooltip: "A set of 3 floating point numbers representing a color",
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
blockType: "Color4",
|
|
271
|
+
namespace: inputsNamespace,
|
|
272
|
+
isInput: true,
|
|
273
|
+
tooltip: "A set of 4 floating point numbers representing a color",
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
blockType: "Texture",
|
|
277
|
+
namespace: inputsNamespace,
|
|
278
|
+
isInput: true,
|
|
279
|
+
tooltip: "A texture to be used as input",
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
blockType: "Vector2",
|
|
283
|
+
namespace: inputsNamespace,
|
|
284
|
+
isInput: true,
|
|
285
|
+
tooltip: "A Vector2 to be used as input",
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
blockType: "Boolean",
|
|
289
|
+
namespace: inputsNamespace,
|
|
290
|
+
isInput: true,
|
|
291
|
+
tooltip: "A boolean to be used as input",
|
|
292
|
+
},
|
|
293
|
+
];
|