@silentstatestudio/perseon 0.1.0 → 0.1.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/CHANGELOG.md +31 -4
- package/LICENSE.md +61 -18
- package/README.md +9 -8
- package/dist/authoring/index.cjs +7 -2
- package/dist/authoring/index.d.cts +102 -4
- package/dist/authoring/index.d.ts +102 -4
- package/dist/authoring/index.js +6 -1
- package/dist/authoring/index.js.map +1 -1
- package/dist/{chunk-PT7F7TTB.cjs → chunk-443SQYAB.cjs} +216 -179
- package/dist/{chunk-ON4JV4BI.js → chunk-AVYXWDFD.js} +39 -2
- package/dist/chunk-AVYXWDFD.js.map +1 -0
- package/dist/{chunk-GDXCMDJ6.js → chunk-BEDH7OYG.js} +25 -3
- package/dist/chunk-BEDH7OYG.js.map +1 -0
- package/dist/{chunk-Q2HLLGJ7.cjs → chunk-WEQPSGPS.cjs} +23 -2
- package/dist/chunk-ZIMCQTYK.cjs +5 -0
- package/dist/chunk-ZTG42LPX.js +6 -0
- package/dist/{colors-CUEeQ78V.d.cts → colors-CCeWL9q4.d.cts} +362 -12
- package/dist/{colors-pshUJaKB.d.ts → colors-CGWrMf4V.d.ts} +362 -12
- package/dist/core/index.cjs +8 -3
- package/dist/core/index.d.cts +4 -3
- package/dist/core/index.d.ts +4 -3
- package/dist/core/index.js +8 -3
- package/dist/index.cjs +8 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -3
- package/dist/pixi-v7/index.cjs +79 -5
- package/dist/pixi-v7/index.d.cts +106 -7
- package/dist/pixi-v7/index.d.ts +106 -7
- package/dist/pixi-v7/index.js +77 -3
- package/dist/pixi-v7/index.js.map +1 -1
- package/dist/pixi-v8/index.cjs +78 -7
- package/dist/pixi-v8/index.d.cts +81 -9
- package/dist/pixi-v8/index.d.ts +81 -9
- package/dist/pixi-v8/index.js +76 -5
- package/dist/pixi-v8/index.js.map +1 -1
- package/dist/{rendering-DeUo1BsK.d.cts → rendering-dYQXmGTV.d.cts} +29 -2
- package/dist/{rendering-DeUo1BsK.d.ts → rendering-dYQXmGTV.d.ts} +29 -2
- package/dist/testing/index.cjs +23 -0
- package/dist/testing/index.d.cts +19 -1
- package/dist/testing/index.d.ts +19 -1
- package/dist/testing/index.js +24 -0
- package/dist/testing/index.js.map +1 -1
- package/package.json +145 -148
- package/dist/chunk-GDXCMDJ6.js.map +0 -1
- package/dist/chunk-ON4JV4BI.js.map +0 -1
- package/dist/chunk-SVI6WUOB.js +0 -1
- /package/dist/{chunk-SVI6WUOB.js.map → chunk-ZTG42LPX.js.map} +0 -0
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @silentstatestudio/perseon v0.1.1
|
|
3
|
+
* Required Notice: Copyright 2026 Jesús Pérez de Miguel, trading as Silent State Studio (https://perseon.dev)
|
|
4
|
+
* PolyForm Perimeter License 1.0.1 <https://polyformproject.org/licenses/perimeter/1.0.1>
|
|
5
|
+
*/
|
|
1
6
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17; var _class18; var _class19; var _class20; var _class21; var _class22; var _class23;
|
|
2
7
|
|
|
3
8
|
|
|
@@ -53,7 +58,7 @@
|
|
|
53
58
|
|
|
54
59
|
|
|
55
60
|
|
|
56
|
-
var
|
|
61
|
+
var _chunkWEQPSGPScjs = require('./chunk-WEQPSGPS.cjs');
|
|
57
62
|
|
|
58
63
|
// src/core/events/EventBus.ts
|
|
59
64
|
var EventListeners = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
|
|
@@ -126,7 +131,7 @@ var EventBus = (_class2 = class {constructor() { _class2.prototype.__init3.call(
|
|
|
126
131
|
* is an identity and every blank one would be the same identity.
|
|
127
132
|
*/
|
|
128
133
|
add(eventName) {
|
|
129
|
-
if (!
|
|
134
|
+
if (!_chunkWEQPSGPScjs.isValidEventName.call(void 0, eventName)) return;
|
|
130
135
|
(this._names ??= /* @__PURE__ */ new Set()).add(eventName);
|
|
131
136
|
}
|
|
132
137
|
/**
|
|
@@ -181,14 +186,14 @@ var checkSetShape = (target, config, domain) => {
|
|
|
181
186
|
const copy = normalizedCopy(config, path);
|
|
182
187
|
if (scope === "local") {
|
|
183
188
|
if (typeof copy === "string" || domain === void 0) return copy;
|
|
184
|
-
const sanitize =
|
|
189
|
+
const sanitize = _chunkWEQPSGPScjs.spawnNumber.call(void 0, domain);
|
|
185
190
|
validating(path, () => {
|
|
186
|
-
|
|
187
|
-
|
|
191
|
+
_chunkWEQPSGPScjs.assertFiniteNumbers.call(void 0, path, copy);
|
|
192
|
+
_chunkWEQPSGPScjs.assertPlainSpawnNumber.call(void 0, path, sanitize(copy), domain, [path]);
|
|
188
193
|
});
|
|
189
194
|
return copy;
|
|
190
195
|
}
|
|
191
|
-
const entry =
|
|
196
|
+
const entry = _chunkWEQPSGPScjs.findOptionPathEntry.call(void 0, scope, path);
|
|
192
197
|
if (entry !== void 0) validating(path, () => entry.validate(copy, path));
|
|
193
198
|
return copy;
|
|
194
199
|
};
|
|
@@ -196,8 +201,8 @@ var preparePlainValue = (entry, path, value, clipKey, diagnostics) => {
|
|
|
196
201
|
try {
|
|
197
202
|
entry.validate(value, path);
|
|
198
203
|
} catch (error) {
|
|
199
|
-
if (error instanceof
|
|
200
|
-
throw new (0,
|
|
204
|
+
if (error instanceof _chunkWEQPSGPScjs.PerseonConfigError) throw error;
|
|
205
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${path}: not a value this option takes`, path, { cause: error });
|
|
201
206
|
}
|
|
202
207
|
const sanitized = entry.sanitize(value);
|
|
203
208
|
if (!sameData(value, sanitized)) reportClip(clipKey, path, path, diagnostics);
|
|
@@ -214,17 +219,17 @@ var DEFAULT_SOURCE = {
|
|
|
214
219
|
layer: "lifeProgress"
|
|
215
220
|
};
|
|
216
221
|
var prepareNode = (scope, path, copy, context, owner) => {
|
|
217
|
-
const entry =
|
|
222
|
+
const entry = _chunkWEQPSGPScjs.findOptionPathEntry.call(void 0, scope, path);
|
|
218
223
|
if (entry === void 0) {
|
|
219
|
-
const paths =
|
|
220
|
-
throw new (0,
|
|
224
|
+
const paths = _chunkWEQPSGPScjs.OPTION_PATH_CATALOG[scope].map((candidate) => candidate.path);
|
|
225
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${path}: the ${scope} has no such option. Its options: ${paths.join(", ")}`, path);
|
|
221
226
|
}
|
|
222
227
|
const { options } = context;
|
|
223
228
|
const openId = assertOpenSegment(entry, path, options);
|
|
224
229
|
validating(path, () => entry.validate(copy, path));
|
|
225
230
|
if (openId !== void 0 && isWholeRecord(entry)) assertRecordId(path, copy, openId);
|
|
226
231
|
assertReferences(entry.path, path, copy, options);
|
|
227
|
-
for (const sourceId of
|
|
232
|
+
for (const sourceId of _chunkWEQPSGPScjs.linkedSourcesOf.call(void 0, copy, DEFAULT_SOURCE[scope])) {
|
|
228
233
|
assertSource(
|
|
229
234
|
path,
|
|
230
235
|
sourceId,
|
|
@@ -258,7 +263,7 @@ var assertOpenSegment = (entry, path, options) => {
|
|
|
258
263
|
const { noun, idsOf } = OPEN_SEGMENTS[prefix];
|
|
259
264
|
const declared = idsOf(options);
|
|
260
265
|
if (!declared.includes(id)) {
|
|
261
|
-
throw new (0,
|
|
266
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${path}: the animation declares no ${noun} '${id}'. ${listed(declared)}`, path);
|
|
262
267
|
}
|
|
263
268
|
return id;
|
|
264
269
|
};
|
|
@@ -266,7 +271,7 @@ var isWholeRecord = (entry) => entry.kind === "record" && entry.path.endsWith(ID
|
|
|
266
271
|
var assertRecordId = (path, config, id) => {
|
|
267
272
|
const own = config.id;
|
|
268
273
|
if (own !== id) {
|
|
269
|
-
throw new (0,
|
|
274
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
270
275
|
`${path}: the config's id (${JSON.stringify(own)}) must be '${id}', the one in the path`,
|
|
271
276
|
`${path}.id`
|
|
272
277
|
);
|
|
@@ -277,7 +282,7 @@ var assertReferences = (catalogPath, path, config, options) => {
|
|
|
277
282
|
const regionId = config.regionId;
|
|
278
283
|
const declared = regionIdsOf(options);
|
|
279
284
|
if (!declared.includes(regionId)) {
|
|
280
|
-
throw new (0,
|
|
285
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
281
286
|
`${path}.regionId: the animation declares no region '${regionId}'. ${listed(declared)}`,
|
|
282
287
|
`${path}.regionId`
|
|
283
288
|
);
|
|
@@ -286,7 +291,7 @@ var assertReferences = (catalogPath, path, config, options) => {
|
|
|
286
291
|
const declared = _nullishCoalesce(options.events, () => ( []));
|
|
287
292
|
for (const eventName of Object.keys(config)) {
|
|
288
293
|
if (declared.includes(eventName)) continue;
|
|
289
|
-
throw new (0,
|
|
294
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
290
295
|
`${path}['${eventName}']: the animation declares no event '${eventName}'. ${listed(declared)}`,
|
|
291
296
|
`${path}['${eventName}']`
|
|
292
297
|
);
|
|
@@ -295,7 +300,7 @@ var assertReferences = (catalogPath, path, config, options) => {
|
|
|
295
300
|
const declared = pointForceIdsOf(options);
|
|
296
301
|
for (const id of Object.keys(config)) {
|
|
297
302
|
if (declared.includes(id)) continue;
|
|
298
|
-
throw new (0,
|
|
303
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
299
304
|
`${path}.${id}: the animation declares no point force '${id}'. ${listed(declared)}`,
|
|
300
305
|
`${path}.${id}`
|
|
301
306
|
);
|
|
@@ -312,24 +317,24 @@ var prepareLocal = (id, copy, context) => {
|
|
|
312
317
|
(parameter) => parameter.id === id ? { ...parameter, value: copy } : parameter
|
|
313
318
|
);
|
|
314
319
|
try {
|
|
315
|
-
|
|
320
|
+
_chunkWEQPSGPScjs.assertNoGlobalParameterCycles.call(void 0, replaced);
|
|
316
321
|
} catch (error) {
|
|
317
|
-
if (!(error instanceof
|
|
318
|
-
throw new (0,
|
|
322
|
+
if (!(error instanceof _chunkWEQPSGPScjs.PerseonConfigError)) throw error;
|
|
323
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${label}: ${error.message}`, id, { cause: error });
|
|
319
324
|
}
|
|
320
325
|
const domain = localDomainOf(declaration);
|
|
321
|
-
const sanitize =
|
|
326
|
+
const sanitize = _chunkWEQPSGPScjs.spawnNumber.call(void 0, domain);
|
|
322
327
|
validating(id, () => {
|
|
323
|
-
|
|
324
|
-
|
|
328
|
+
_chunkWEQPSGPScjs.assertFiniteNumbers.call(void 0, id, copy);
|
|
329
|
+
_chunkWEQPSGPScjs.assertPlainSpawnNumber.call(void 0, id, sanitize(copy), domain, [id]);
|
|
325
330
|
});
|
|
326
331
|
const scope = _nullishCoalesce(declaration.sampleScope, () => ( "playback"));
|
|
327
|
-
for (const sourceId of
|
|
332
|
+
for (const sourceId of _chunkWEQPSGPScjs.linkedSourcesOf.call(void 0, copy, "spawnRate")) {
|
|
328
333
|
assertSource(label, sourceId, scope, `a '${scope}' local`, options, id);
|
|
329
334
|
}
|
|
330
335
|
const withLocal = { ...options, localParameters: replaced };
|
|
331
336
|
for (const emitter of _nullishCoalesce(options.emitters, () => ( []))) {
|
|
332
|
-
for (const layer of
|
|
337
|
+
for (const layer of _chunkWEQPSGPScjs.ParameterCompiler.extractParticleOptionsList(emitter.particles)) {
|
|
333
338
|
assertLayerOrder(layer, withLocal, label, id);
|
|
334
339
|
}
|
|
335
340
|
}
|
|
@@ -344,13 +349,13 @@ var localDeclarationOf = (id, options) => {
|
|
|
344
349
|
const declared = listed(locals.map((parameter) => parameter.id));
|
|
345
350
|
const global = (_nullishCoalesce(options.globalParameters, () => ( []))).some((parameter) => parameter.id === id);
|
|
346
351
|
const what = global ? `'${id}' is a global, which the game sets (setGlobalParameter)` : "the animation declares no such local";
|
|
347
|
-
throw new (0,
|
|
352
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`param('${id}'): ${what}. ${declared}`, id);
|
|
348
353
|
};
|
|
349
354
|
var reportLocalClip = (id, diagnostics) => reportClip(`local:${id}`, `param('${id}')`, id, diagnostics);
|
|
350
355
|
var localDomainOf = (declaration) => {
|
|
351
356
|
if (!Array.isArray(declaration.domain)) return declaration.domain;
|
|
352
|
-
const { min } =
|
|
353
|
-
return { ...
|
|
357
|
+
const { min } = _chunkWEQPSGPScjs.CUSTOM_PARAMETER_DOMAINS.labelIndex;
|
|
358
|
+
return { ..._chunkWEQPSGPScjs.CUSTOM_PARAMETER_DOMAINS.labelIndex, max: Math.max(min, declaration.domain.length - 1) };
|
|
354
359
|
};
|
|
355
360
|
var labelIndexOf = (declaration, value) => {
|
|
356
361
|
prepareLabel(`param('${declaration.id}')`, declaration.id, value, declaration);
|
|
@@ -358,13 +363,13 @@ var labelIndexOf = (declaration, value) => {
|
|
|
358
363
|
};
|
|
359
364
|
var prepareLabel = (label, id, value, declaration) => {
|
|
360
365
|
if (!Array.isArray(declaration.domain)) {
|
|
361
|
-
throw new (0,
|
|
366
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
362
367
|
`${label}: a label fixes a 'label' local, and '${id}' is '${declaration.type}'`,
|
|
363
368
|
id
|
|
364
369
|
);
|
|
365
370
|
}
|
|
366
371
|
if (!declaration.domain.includes(value)) {
|
|
367
|
-
throw new (0,
|
|
372
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
368
373
|
`${label}: '${value}' is not one of its labels. Labels: ${declaration.domain.join(", ")}`,
|
|
369
374
|
id
|
|
370
375
|
);
|
|
@@ -373,25 +378,25 @@ var prepareLabel = (label, id, value, declaration) => {
|
|
|
373
378
|
};
|
|
374
379
|
var SCOPE_ORDER = ["playback", "emitter", "particle"];
|
|
375
380
|
var assertSource = (label, sourceId, readerScope, reader, options, path = label) => {
|
|
376
|
-
const declared =
|
|
377
|
-
if (
|
|
381
|
+
const declared = _chunkWEQPSGPScjs.declaredScopesOf.call(void 0, options);
|
|
382
|
+
if (_chunkWEQPSGPScjs.assertSourceScope.call(void 0, label, sourceId, readerScope, reader, declared, path) !== void 0) return;
|
|
378
383
|
const fields = SCOPE_ORDER.slice(0, SCOPE_ORDER.indexOf(readerScope) + 1).flatMap(
|
|
379
|
-
(scope) =>
|
|
384
|
+
(scope) => _chunkWEQPSGPScjs.LINKED_SOURCE_CATALOG[scope]
|
|
380
385
|
);
|
|
381
|
-
throw new (0,
|
|
386
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
382
387
|
`${label}: Linked source '${sourceId}' is neither a declared parameter nor a source field. ${listed([...declared.keys()])} Fields: ${fields.join(", ")}`,
|
|
383
388
|
path
|
|
384
389
|
);
|
|
385
390
|
};
|
|
386
391
|
var assertLayerOrder = (layer, options, label, path) => {
|
|
387
392
|
const locals = _nullishCoalesce(options.localParameters, () => ( []));
|
|
388
|
-
const read = new Set(
|
|
393
|
+
const read = new Set(_chunkWEQPSGPScjs.localsReadBy.call(void 0, locals, layer).map((local) => local.id));
|
|
389
394
|
const particleLocals = locals.filter((local) => local.sampleScope === "particle" && read.has(local.id));
|
|
390
395
|
try {
|
|
391
|
-
|
|
396
|
+
_chunkWEQPSGPScjs.buildProgramOrder.call(void 0, layer, _chunkWEQPSGPScjs.declaredParameterNames.call(void 0, options), particleLocals);
|
|
392
397
|
} catch (error) {
|
|
393
|
-
if (!(error instanceof
|
|
394
|
-
throw new (0,
|
|
398
|
+
if (!(error instanceof _chunkWEQPSGPScjs.PerseonConfigError)) throw error;
|
|
399
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${label}: ${error.message}`, path, { cause: error });
|
|
395
400
|
}
|
|
396
401
|
};
|
|
397
402
|
var withNode = (root, segments, value) => {
|
|
@@ -410,8 +415,8 @@ var validating = (path, run) => {
|
|
|
410
415
|
try {
|
|
411
416
|
run();
|
|
412
417
|
} catch (error) {
|
|
413
|
-
if (error instanceof
|
|
414
|
-
throw new (0,
|
|
418
|
+
if (error instanceof _chunkWEQPSGPScjs.PerseonConfigError) throw error;
|
|
419
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${path}: not a value this option takes`, path, { cause: error });
|
|
415
420
|
}
|
|
416
421
|
};
|
|
417
422
|
var reportClip = (key, label, path, diagnostics) => diagnostics.warnOnce(`set-clip:${key}`, `${label}: a number out of its domain was clipped to it`, path);
|
|
@@ -421,7 +426,7 @@ var isPlainObject = (value) => {
|
|
|
421
426
|
};
|
|
422
427
|
var normalizedCopy = (value, path, ancestors = /* @__PURE__ */ new Set()) => {
|
|
423
428
|
if (typeof value !== "object" || value === null) return value;
|
|
424
|
-
if (ancestors.has(value)) throw new (0,
|
|
429
|
+
if (ancestors.has(value)) throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${path}: the config contains itself`, path);
|
|
425
430
|
ancestors.add(value);
|
|
426
431
|
let copy;
|
|
427
432
|
if (Array.isArray(value)) {
|
|
@@ -432,7 +437,7 @@ var normalizedCopy = (value, path, ancestors = /* @__PURE__ */ new Set()) => {
|
|
|
432
437
|
const fields = {};
|
|
433
438
|
for (const key of Object.keys(source)) {
|
|
434
439
|
if (key === "__proto__") {
|
|
435
|
-
throw new (0,
|
|
440
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${path}: the key "__proto__" is not allowed in a config`, path);
|
|
436
441
|
}
|
|
437
442
|
fields[key] = normalizedCopy(source[key], path, ancestors);
|
|
438
443
|
}
|
|
@@ -467,7 +472,7 @@ var followsLinksOutsideData = (data, programs) => programs.emitters.some(
|
|
|
467
472
|
(emitter, emitterIndex) => emitter.layers.some((layer, layerIndex) => {
|
|
468
473
|
const dataLayer = data.emitters[emitterIndex].layers[layerIndex];
|
|
469
474
|
if (layer === dataLayer || layer.particleLinks.size === 0 || emitter.marksAlive === void 0) return false;
|
|
470
|
-
const ofData = new Set([...dataLayer.particleLinks.values()].flat().map(
|
|
475
|
+
const ofData = new Set([...dataLayer.particleLinks.values()].flat().map(_chunkWEQPSGPScjs.linkedMarkOf));
|
|
471
476
|
return [...emitter.marksAlive(layerIndex)].some((mark) => !ofData.has(mark));
|
|
472
477
|
})
|
|
473
478
|
);
|
|
@@ -554,10 +559,10 @@ var slotAllocator = (dataRanges, keptRanges) => {
|
|
|
554
559
|
};
|
|
555
560
|
};
|
|
556
561
|
var rebuildLayerProgram = (data, current, options, sourceOf, context) => {
|
|
557
|
-
const layout =
|
|
558
|
-
const program =
|
|
559
|
-
program.particleLinks =
|
|
560
|
-
const sources =
|
|
562
|
+
const layout = _chunkWEQPSGPScjs.buildProgramLayout.call(void 0, options, context.localParameters);
|
|
563
|
+
const program = _chunkWEQPSGPScjs.createLayerProgram.call(void 0, options, layout, data.sources);
|
|
564
|
+
program.particleLinks = _chunkWEQPSGPScjs.particleLinksOf.call(void 0, context.localParameters);
|
|
565
|
+
const sources = _chunkWEQPSGPScjs.LAYER_SEGMENTS.map((segment) => sourceOf(segment.unit));
|
|
561
566
|
const fits = (step) => step.memorySlots.every(({ node, role, index }) => layout.slotOf(node, role) === index);
|
|
562
567
|
const takenSteps = sources.map(
|
|
563
568
|
(source, index) => source === "compile" ? void 0 : (source === "data" ? data : current).segments[index]
|
|
@@ -583,31 +588,31 @@ var rebuildLayerProgram = (data, current, options, sourceOf, context) => {
|
|
|
583
588
|
const { from: start, to } = step.clockModulatorSlots;
|
|
584
589
|
for (let slot = start; slot < to; slot++) program.clockModulators[slot] = from.clockModulators[slot];
|
|
585
590
|
});
|
|
586
|
-
program.segments =
|
|
591
|
+
program.segments = _chunkWEQPSGPScjs.LAYER_SEGMENTS.map((segment, index) => {
|
|
587
592
|
const keptStep = keptSteps[index];
|
|
588
593
|
if (keptStep !== void 0) {
|
|
589
|
-
|
|
594
|
+
_chunkWEQPSGPScjs.appendLayerSegment.call(void 0, program, keptStep);
|
|
590
595
|
return keptStep;
|
|
591
596
|
}
|
|
592
597
|
const relaidStep = relaidSteps[index];
|
|
593
598
|
if (relaidStep !== void 0) {
|
|
594
599
|
program.listStateSlotCount = lists.end;
|
|
595
|
-
return
|
|
600
|
+
return _chunkWEQPSGPScjs.compileLayerSegment.call(void 0, segment, options, program, context, {
|
|
596
601
|
listStates: relaidStep.listStateSlots.from,
|
|
597
602
|
clockModulators: relaidStep.clockModulatorSlots.from
|
|
598
603
|
});
|
|
599
604
|
}
|
|
600
|
-
const counted =
|
|
605
|
+
const counted = _chunkWEQPSGPScjs.compileLayerSegment.call(void 0,
|
|
601
606
|
segment,
|
|
602
607
|
options,
|
|
603
|
-
|
|
608
|
+
_chunkWEQPSGPScjs.createLayerProgram.call(void 0, options, layout, data.sources),
|
|
604
609
|
context
|
|
605
610
|
);
|
|
606
611
|
const replaced = [current.segments[index], data.segments[index]];
|
|
607
612
|
const listCount = counted.listStateSlots.to - counted.listStateSlots.from;
|
|
608
613
|
const clockCount = counted.clockModulatorSlots.to - counted.clockModulatorSlots.from;
|
|
609
614
|
program.listStateSlotCount = lists.end;
|
|
610
|
-
const step =
|
|
615
|
+
const step = _chunkWEQPSGPScjs.compileLayerSegment.call(void 0, segment, options, program, context, {
|
|
611
616
|
listStates: lists.place(
|
|
612
617
|
index,
|
|
613
618
|
listCount,
|
|
@@ -632,7 +637,7 @@ var rebuildLayerProgram = (data, current, options, sourceOf, context) => {
|
|
|
632
637
|
)
|
|
633
638
|
);
|
|
634
639
|
const units = /* @__PURE__ */ new Map();
|
|
635
|
-
for (const [unit, own] of
|
|
640
|
+
for (const [unit, own] of _chunkWEQPSGPScjs.layerUnitsOf.call(void 0, program.segments)) {
|
|
636
641
|
const same = (other) => {
|
|
637
642
|
const unitProgram = other.units.get(unit);
|
|
638
643
|
const shared = _optionalChain([unitProgram, 'optionalAccess', _32 => _32.segments, 'access', _33 => _33.every, 'call', _34 => _34((step, index) => step === own.segments[index])]);
|
|
@@ -641,24 +646,24 @@ var rebuildLayerProgram = (data, current, options, sourceOf, context) => {
|
|
|
641
646
|
units.set(unit, _nullishCoalesce(_nullishCoalesce(same(data), () => ( same(current))), () => ( own)));
|
|
642
647
|
}
|
|
643
648
|
program.units = units;
|
|
644
|
-
|
|
649
|
+
_chunkWEQPSGPScjs.putLiveNodesInOrder.call(void 0, options, program, context.localParameters);
|
|
645
650
|
return Object.freeze(program);
|
|
646
651
|
};
|
|
647
652
|
var rebuildEmitterParameters = (emitter, options) => {
|
|
648
653
|
const slots = { listStateSlotCount: 0 };
|
|
649
|
-
const parameters = Object.freeze(
|
|
654
|
+
const parameters = Object.freeze(_chunkWEQPSGPScjs.compileEmitterParameters.call(void 0, options, slots, emitter.sources));
|
|
650
655
|
return { parameters, listStateSlotCount: slots.listStateSlotCount };
|
|
651
656
|
};
|
|
652
657
|
var rebuildStoreLayout = (base, scope, locals, substitutes, held) => {
|
|
653
658
|
const compiled = base.locals.map((local) => _nullishCoalesce(substitutes.get(local.id), () => ( local)));
|
|
654
|
-
const order =
|
|
659
|
+
const order = _chunkWEQPSGPScjs.topologicalOrder.call(void 0, locals.filter((local) => scopeOf(local) === scope)).map(
|
|
655
660
|
(local) => base.slots.get(local.id)
|
|
656
661
|
);
|
|
657
662
|
const heldIds = _nullishCoalesce(held, () => ( new Set(base.locals.filter((_, slot) => base.held[slot]).map((local) => local.id))));
|
|
658
|
-
return Object.freeze(
|
|
663
|
+
return Object.freeze(_chunkWEQPSGPScjs.buildStoreLayout.call(void 0, compiled, base.slots, heldIds, order));
|
|
659
664
|
};
|
|
660
665
|
var scopeOf = (local) => _nullishCoalesce(local.sampleScope, () => ( "playback"));
|
|
661
|
-
var readsOf = (locals, scope, nodes) =>
|
|
666
|
+
var readsOf = (locals, scope, nodes) => _chunkWEQPSGPScjs.topologicalOrder.call(void 0, _chunkWEQPSGPScjs.localsReadBy.call(void 0, locals, nodes).filter((local) => scopeOf(local) === scope));
|
|
662
667
|
var NO_RETIRED_LINKS = /* @__PURE__ */ new Map();
|
|
663
668
|
var retiredLinksOf = (before, locals, layer, marksAlive) => {
|
|
664
669
|
if (before.particleLinks.size === 0 || marksAlive === void 0) return NO_RETIRED_LINKS;
|
|
@@ -669,7 +674,7 @@ var retiredLinksOf = (before, locals, layer, marksAlive) => {
|
|
|
669
674
|
for (const [id, links] of before.particleLinks) {
|
|
670
675
|
if (!reads.some((local) => local.id === id)) continue;
|
|
671
676
|
const now = _optionalChain([locals, 'access', _35 => _35.find, 'call', _36 => _36((local) => local.id === id), 'optionalAccess', _37 => _37.value]);
|
|
672
|
-
const kept = links.filter((link) => link !== now && alive.has(
|
|
677
|
+
const kept = links.filter((link) => link !== now && alive.has(_chunkWEQPSGPScjs.linkedMarkOf.call(void 0, link)));
|
|
673
678
|
if (kept.length > 0) retired.set(id, kept);
|
|
674
679
|
}
|
|
675
680
|
return retired.size > 0 ? retired : NO_RETIRED_LINKS;
|
|
@@ -724,7 +729,7 @@ var sortHolders = (data, overlay) => {
|
|
|
724
729
|
};
|
|
725
730
|
var sameHolders = (a, b) => a.length === b.length && a.every((holder, index) => holder === b[index]);
|
|
726
731
|
var unitHolders = (holders, unit) => holders.filter((holder) => isUnitPath(holder.path) && layerUnitOf(holder.path) === unit);
|
|
727
|
-
var buildInstancePrograms = (data, overlay, previous, pointForceIndexOf =
|
|
732
|
+
var buildInstancePrograms = (data, overlay, previous, pointForceIndexOf = _chunkWEQPSGPScjs.pointForceIndexer.call(void 0, data.options.pointForces)) => {
|
|
728
733
|
const holders = sortHolders(data, overlay);
|
|
729
734
|
const programs = dataProgramsOf(data);
|
|
730
735
|
const running = _nullishCoalesce(_optionalChain([previous, 'optionalAccess', _38 => _38.programs]), () => ( programs));
|
|
@@ -757,7 +762,7 @@ var buildInstancePrograms = (data, overlay, previous, pointForceIndexOf = _chunk
|
|
|
757
762
|
const holder = lastHolderOf(holders.localHolders, local.id);
|
|
758
763
|
const unchanged = previous !== void 0 && lastHolderOf(before.localHolders, local.id) === holder;
|
|
759
764
|
const kept = unchanged ? runningLocalOf(scope, local.id) : void 0;
|
|
760
|
-
compiledSubstitutes.set(local.id, _nullishCoalesce(kept, () => (
|
|
765
|
+
compiledSubstitutes.set(local.id, _nullishCoalesce(kept, () => ( _chunkWEQPSGPScjs.compileLocal.call(void 0, local, sources))));
|
|
761
766
|
}
|
|
762
767
|
}
|
|
763
768
|
const particleSubstituted = substituted("particle").length > 0;
|
|
@@ -802,7 +807,7 @@ var buildInstancePrograms = (data, overlay, previous, pointForceIndexOf = _chunk
|
|
|
802
807
|
if (keepsOwn && emitter.layers.every((_, layerIndex) => keepsLayer(layerIndex))) {
|
|
803
808
|
emitterLocals = runningPrograms.localParameters;
|
|
804
809
|
} else if (touched || emitterSubstituted || particleSubstituted || retiredLinks.length > 0) {
|
|
805
|
-
const nodes = [
|
|
810
|
+
const nodes = [_chunkWEQPSGPScjs.emitterOwnNodes.call(void 0, emitterOptions), ...layerOptions, retiredLinks];
|
|
806
811
|
const read = readsOf(locals, "emitter", nodes).map((local) => local.id);
|
|
807
812
|
const held = data.locals.emitterReads(emitter.options);
|
|
808
813
|
if (!sameIds(read, held) || read.some((id) => holders.locals.has(id))) {
|
|
@@ -835,7 +840,7 @@ var buildInstancePrograms = (data, overlay, previous, pointForceIndexOf = _chunk
|
|
|
835
840
|
if (previous === void 0) return "compile";
|
|
836
841
|
const optionsBefore = ownBefore.length > 0 ? withHolders(emitter.particleOptions[layerIndex], ownBefore) : emitter.particleOptions[layerIndex];
|
|
837
842
|
const readsBefore = readsOf(localsBefore, "particle", optionsBefore);
|
|
838
|
-
const same2 = sameLinks(current.particleLinks,
|
|
843
|
+
const same2 = sameLinks(current.particleLinks, _chunkWEQPSGPScjs.particleLinksOf.call(void 0, reads)) && sameIds(
|
|
839
844
|
readsBefore.map((local) => local.id),
|
|
840
845
|
reads.map((local) => local.id)
|
|
841
846
|
) && reads.every(
|
|
@@ -863,7 +868,7 @@ var buildInstancePrograms = (data, overlay, previous, pointForceIndexOf = _chunk
|
|
|
863
868
|
});
|
|
864
869
|
return { localParameters, emitters };
|
|
865
870
|
};
|
|
866
|
-
var LAYER_UNITS = [...new Set(
|
|
871
|
+
var LAYER_UNITS = [...new Set(_chunkWEQPSGPScjs.LAYER_SEGMENTS.map((segment) => segment.unit))];
|
|
867
872
|
|
|
868
873
|
// src/core/simulation/FrameGate.ts
|
|
869
874
|
var FrameGate = (_class3 = class {constructor() { _class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this); }
|
|
@@ -877,8 +882,8 @@ var FrameGate = (_class3 = class {constructor() { _class3.prototype.__init5.call
|
|
|
877
882
|
return 1 / this._minInterval;
|
|
878
883
|
}
|
|
879
884
|
set maxUpdateRate(value) {
|
|
880
|
-
if (
|
|
881
|
-
this._minInterval = 1 /
|
|
885
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isPositiveNumber(value)) {
|
|
886
|
+
this._minInterval = 1 / _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "maxUpdateRate", value);
|
|
882
887
|
}
|
|
883
888
|
}
|
|
884
889
|
/**
|
|
@@ -943,7 +948,7 @@ var copyOf = (value) => {
|
|
|
943
948
|
var playbackRootOf = (entry, keys) => {
|
|
944
949
|
const rootKeys = entry.path.includes(ID_SEGMENT2) ? keys.slice(0, 2) : keys;
|
|
945
950
|
const path = rootKeys.join(".");
|
|
946
|
-
return { path, entry:
|
|
951
|
+
return { path, entry: _chunkWEQPSGPScjs.findOptionPathEntry.call(void 0, "playback", path), keys: rootKeys };
|
|
947
952
|
};
|
|
948
953
|
var REMOVED = null;
|
|
949
954
|
var DEFAULT_MAX_UPDATE_RATE = new FrameGate().maxUpdateRate;
|
|
@@ -966,7 +971,7 @@ var playbackDataOf = (playback, root) => {
|
|
|
966
971
|
const regions = options.regions === void 0 ? [] : [options.regions].flat();
|
|
967
972
|
return regions.find((region) => region.id === id);
|
|
968
973
|
};
|
|
969
|
-
var unknownId = (path, noun, id, declared) => new (0,
|
|
974
|
+
var unknownId = (path, noun, id, declared) => new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
970
975
|
`${path}: the instance has no ${noun} '${id}'. Declared: ${declared.length > 0 ? declared.join(", ") : "none"}.`,
|
|
971
976
|
path
|
|
972
977
|
);
|
|
@@ -1035,7 +1040,7 @@ var playbackHoldersByRoot = (holders) => {
|
|
|
1035
1040
|
const byRoot = /* @__PURE__ */ new Map();
|
|
1036
1041
|
for (const holder of holders) {
|
|
1037
1042
|
if (!isPlaybackHolder(holder)) continue;
|
|
1038
|
-
const entry =
|
|
1043
|
+
const entry = _chunkWEQPSGPScjs.findOptionPathEntry.call(void 0, "playback", holder.path);
|
|
1039
1044
|
const root = playbackRootOf(entry, keysOf(entry, holder.path));
|
|
1040
1045
|
const group = byRoot.get(root.path);
|
|
1041
1046
|
if (group) group.holders.push(holder);
|
|
@@ -1082,7 +1087,7 @@ var applyInstanceNodes = (playback, previous, next) => {
|
|
|
1082
1087
|
const root = _optionalChain([(_nullishCoalesce(now, () => ( was))), 'optionalAccess', _61 => _61.root]);
|
|
1083
1088
|
let value = playbackDataOf(playback, root);
|
|
1084
1089
|
for (const holder of _nullishCoalesce(_optionalChain([now, 'optionalAccess', _62 => _62.holders]), () => ( []))) {
|
|
1085
|
-
const entry =
|
|
1090
|
+
const entry = _chunkWEQPSGPScjs.findOptionPathEntry.call(void 0, "playback", holder.path);
|
|
1086
1091
|
value = withValueAt(value, keysOf(entry, holder.path).slice(root.keys.length), holder.config);
|
|
1087
1092
|
}
|
|
1088
1093
|
writePlaybackRoot(playback, root, value);
|
|
@@ -1098,7 +1103,7 @@ var applyInstanceNodes = (playback, previous, next) => {
|
|
|
1098
1103
|
};
|
|
1099
1104
|
|
|
1100
1105
|
// src/core/simulation/ParameterHandle.ts
|
|
1101
|
-
var NO_ANIMATION_DIAGNOSTICS =
|
|
1106
|
+
var NO_ANIMATION_DIAGNOSTICS = _chunkWEQPSGPScjs.createDiagnostics.call(void 0, );
|
|
1102
1107
|
var UNGUARDED = -1;
|
|
1103
1108
|
var serials = /* @__PURE__ */ new WeakMap();
|
|
1104
1109
|
var instanceCount = 0;
|
|
@@ -1142,11 +1147,11 @@ var ParameterHandle = (_class4 = class _ParameterHandle {
|
|
|
1142
1147
|
/** Built by the engine; a host gets it from `option(path)` of a playback, an emitter or a layer. */
|
|
1143
1148
|
// eslint-disable-next-line no-restricted-syntax -- the engine builds these; a private constructor keeps `new` out of the published declarations, where `create` is stripped
|
|
1144
1149
|
constructor(playback, owner, path, generation = UNGUARDED) {;_class4.prototype.__init7.call(this);_class4.prototype.__init8.call(this);_class4.prototype.__init9.call(this);
|
|
1145
|
-
const entry =
|
|
1150
|
+
const entry = _chunkWEQPSGPScjs.findOptionPathEntry.call(void 0, owner.scope, path);
|
|
1146
1151
|
if (entry === void 0) {
|
|
1147
|
-
const paths =
|
|
1152
|
+
const paths = _chunkWEQPSGPScjs.OPTION_PATH_CATALOG[owner.scope].map((candidate) => candidate.path);
|
|
1148
1153
|
const hint = /^(pointForces|regions)\.[^.]+\./.test(path) ? " The id of a region or a point force takes no dot." : "";
|
|
1149
|
-
throw new (0,
|
|
1154
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
1150
1155
|
`option('${path}'): the ${owner.scope} has no such option.${hint} Its options: ${paths.join(", ")}`,
|
|
1151
1156
|
path
|
|
1152
1157
|
);
|
|
@@ -1451,7 +1456,7 @@ var ParameterHandle = (_class4 = class _ParameterHandle {
|
|
|
1451
1456
|
*/
|
|
1452
1457
|
_plainNumber(value, domain, path) {
|
|
1453
1458
|
if (!Number.isFinite(value)) {
|
|
1454
|
-
throw new (0,
|
|
1459
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`Parameter ${path}: Value must be a finite number (got ${value})`, path);
|
|
1455
1460
|
}
|
|
1456
1461
|
const clipped = value < domain.min ? domain.min : value > domain.max ? domain.max : value;
|
|
1457
1462
|
if (clipped !== value) {
|
|
@@ -1528,7 +1533,7 @@ var ParameterHandle = (_class4 = class _ParameterHandle {
|
|
|
1528
1533
|
_prepare(config, options) {
|
|
1529
1534
|
const { path, _entry: entry, _owner: owner, _playback: playback } = this;
|
|
1530
1535
|
if (entry.stage === "construction") {
|
|
1531
|
-
throw new (0,
|
|
1536
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
1532
1537
|
`${path}: read when the instance is built, a set on an instance cannot change it. ` + CONSTRUCTION_HINTS[entry.path],
|
|
1533
1538
|
path
|
|
1534
1539
|
);
|
|
@@ -1558,10 +1563,10 @@ var ParameterHandle = (_class4 = class _ParameterHandle {
|
|
|
1558
1563
|
if (keys.length < 2) return void 0;
|
|
1559
1564
|
const parentKeys = keys.slice(0, -1);
|
|
1560
1565
|
const parentPath = parentKeys.join(".");
|
|
1561
|
-
if (_optionalChain([
|
|
1566
|
+
if (_optionalChain([_chunkWEQPSGPScjs.findOptionPathEntry.call(void 0, this._owner.scope, parentPath), 'optionalAccess', _73 => _73.kind]) !== "composite") return void 0;
|
|
1562
1567
|
const parent = valueAt(this._ownerOptions(), parentKeys);
|
|
1563
1568
|
const key = keys[keys.length - 1];
|
|
1564
|
-
if (isRecord(parent) && !
|
|
1569
|
+
if (isRecord(parent) && !_chunkWEQPSGPScjs.ParameterTypeChecker.isRandomValueList(parent) && key in parent) return void 0;
|
|
1565
1570
|
return { parent: parentPath, mode: _nullishCoalesce(modeOf(parent), () => ( "undeclared")) };
|
|
1566
1571
|
}
|
|
1567
1572
|
/** @internal */
|
|
@@ -1569,7 +1574,7 @@ var ParameterHandle = (_class4 = class _ParameterHandle {
|
|
|
1569
1574
|
const absence = this._absence();
|
|
1570
1575
|
if (absence === void 0) return;
|
|
1571
1576
|
const why = absence.mode === "undeclared" ? `${absence.parent} is not declared` : `${absence.parent} is in the '${absence.mode}' mode, which has no '${this._keys[this._keys.length - 1]}'`;
|
|
1572
|
-
throw new (0,
|
|
1577
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${this.path}: the node does not exist now: ${why}`, this.path);
|
|
1573
1578
|
}
|
|
1574
1579
|
/** @internal The config in force at this node. */
|
|
1575
1580
|
_effective() {
|
|
@@ -1644,7 +1649,7 @@ var ParameterHandle = (_class4 = class _ParameterHandle {
|
|
|
1644
1649
|
}
|
|
1645
1650
|
/** @internal */
|
|
1646
1651
|
_keysOf(path) {
|
|
1647
|
-
const entry =
|
|
1652
|
+
const entry = _chunkWEQPSGPScjs.findOptionPathEntry.call(void 0, this._owner.scope, path);
|
|
1648
1653
|
return entry === void 0 ? path.split(".") : keysOf(entry, path);
|
|
1649
1654
|
}
|
|
1650
1655
|
/** @internal The record of a playback node (a point force, a region), or the node itself. */
|
|
@@ -1672,7 +1677,7 @@ var ParameterHandle = (_class4 = class _ParameterHandle {
|
|
|
1672
1677
|
if (!isRecord(config)) return void 0;
|
|
1673
1678
|
const stages = {};
|
|
1674
1679
|
for (const [key, value] of Object.entries(config)) {
|
|
1675
|
-
const entry =
|
|
1680
|
+
const entry = _chunkWEQPSGPScjs.findOptionPathEntry.call(void 0, this._owner.scope, `${this.path}.${key}`);
|
|
1676
1681
|
if (entry === void 0) continue;
|
|
1677
1682
|
const strategy = entry.kind === "value" || entry.kind === "composite" ? strategyOf(value) : void 0;
|
|
1678
1683
|
stages[key] = stageOf(entry, strategy);
|
|
@@ -1754,21 +1759,21 @@ var instanceView = (playback) => {
|
|
|
1754
1759
|
var ownerKeyOf = (serial, owner) => [serial, owner.emitter, owner.layer].filter((index) => index !== void 0).join("/");
|
|
1755
1760
|
var strategyOf = (config) => {
|
|
1756
1761
|
if (typeof config === "number") return "fixed";
|
|
1757
|
-
if (
|
|
1758
|
-
if (
|
|
1759
|
-
if (
|
|
1760
|
-
return
|
|
1762
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isModulatedValue(config)) return "modulated";
|
|
1763
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isParameterLinkRelation(config)) return "linked";
|
|
1764
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isColorGradientDefinition(config)) {
|
|
1765
|
+
return _chunkWEQPSGPScjs.ParameterTypeChecker.isColorRandomRange(config) ? "range" : "linked";
|
|
1761
1766
|
}
|
|
1762
|
-
if (
|
|
1763
|
-
if (
|
|
1767
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isRandomValueList(config)) return "list";
|
|
1768
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isRandomValueRange(config)) return "range";
|
|
1764
1769
|
return void 0;
|
|
1765
1770
|
};
|
|
1766
|
-
var isArea = (config) =>
|
|
1771
|
+
var isArea = (config) => _chunkWEQPSGPScjs.ParameterTypeChecker.isRectangleArea(config) || _chunkWEQPSGPScjs.ParameterTypeChecker.isCircleArea(config) || _chunkWEQPSGPScjs.ParameterTypeChecker.isRingArea(config) || _chunkWEQPSGPScjs.ParameterTypeChecker.isCapsuleArea(config) || _chunkWEQPSGPScjs.ParameterTypeChecker.isPolygonArea(config);
|
|
1767
1772
|
var modeOf = (config) => {
|
|
1768
1773
|
if (config === void 0) return void 0;
|
|
1769
|
-
if (
|
|
1770
|
-
if (
|
|
1771
|
-
if (
|
|
1774
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isRandomValueList(config)) return "list";
|
|
1775
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isColorGradientDefinition(config)) return "gradient";
|
|
1776
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isSpawnNumber(config)) return "uniform";
|
|
1772
1777
|
if (isRecord(config) && "angle" in config && "magnitude" in config) return "polar";
|
|
1773
1778
|
if (isRecord(config) && "x" in config && "y" in config) return "axes";
|
|
1774
1779
|
if (isArea(config)) return "area";
|
|
@@ -1777,16 +1782,16 @@ var modeOf = (config) => {
|
|
|
1777
1782
|
var stageOf = (entry, strategy) => _nullishCoalesce((strategy !== void 0 ? _optionalChain([entry, 'access', _84 => _84.stageByStrategy, 'optionalAccess', _85 => _85[strategy]]) : void 0), () => ( entry.stage));
|
|
1778
1783
|
|
|
1779
1784
|
// src/core/simulation/LocalParameterHandle.ts
|
|
1780
|
-
var NO_ANIMATION_DIAGNOSTICS2 =
|
|
1785
|
+
var NO_ANIMATION_DIAGNOSTICS2 = _chunkWEQPSGPScjs.createDiagnostics.call(void 0, );
|
|
1781
1786
|
var localValueOf = (declaration, domain, value, diagnostics) => {
|
|
1782
1787
|
if (typeof value === "string") return labelIndexOf(declaration, value);
|
|
1783
1788
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
1784
|
-
throw new (0,
|
|
1789
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
1785
1790
|
`param('${declaration.id}'): a value is a finite number or a label, not ${String(value)}`,
|
|
1786
1791
|
declaration.id
|
|
1787
1792
|
);
|
|
1788
1793
|
}
|
|
1789
|
-
const clipped =
|
|
1794
|
+
const clipped = _chunkWEQPSGPScjs.sanitizeRuntimeValue.call(void 0, value, domain);
|
|
1790
1795
|
if (clipped !== value) reportLocalClip(declaration.id, diagnostics);
|
|
1791
1796
|
return clipped;
|
|
1792
1797
|
};
|
|
@@ -1971,7 +1976,7 @@ var LocalParameterHandle = (_class5 = class _LocalParameterHandle {
|
|
|
1971
1976
|
}, _class5);
|
|
1972
1977
|
|
|
1973
1978
|
// src/core/simulation/LocalDefaultHandle.ts
|
|
1974
|
-
var NO_ANIMATION_DIAGNOSTICS3 =
|
|
1979
|
+
var NO_ANIMATION_DIAGNOSTICS3 = _chunkWEQPSGPScjs.createDiagnostics.call(void 0, );
|
|
1975
1980
|
var LocalDefaultHandle = class _LocalDefaultHandle {
|
|
1976
1981
|
/** The local's id, as `param` was given it. */
|
|
1977
1982
|
|
|
@@ -2005,7 +2010,7 @@ var LocalDefaultHandle = class _LocalDefaultHandle {
|
|
|
2005
2010
|
*/
|
|
2006
2011
|
set(value) {
|
|
2007
2012
|
if (typeof value !== "number" && typeof value !== "string") {
|
|
2008
|
-
throw new (0,
|
|
2013
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
2009
2014
|
`param('${this.id}'): a default is a number or a label. A strategy is set on an instance: playback.param('${this.id}').set(config)`,
|
|
2010
2015
|
this.id
|
|
2011
2016
|
);
|
|
@@ -2049,7 +2054,7 @@ var TransformFacade = class {
|
|
|
2049
2054
|
};
|
|
2050
2055
|
var finiteOffset = (value, what) => {
|
|
2051
2056
|
if (Number.isFinite(value)) return value;
|
|
2052
|
-
throw new (0,
|
|
2057
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${what}: Value must be a finite number (got ${String(value)})`, what);
|
|
2053
2058
|
};
|
|
2054
2059
|
|
|
2055
2060
|
// src/core/simulation/ParticleLayerView.ts
|
|
@@ -2083,6 +2088,7 @@ var ParticleLayerView = (_class6 = class _ParticleLayerView {
|
|
|
2083
2088
|
get zIndex() {
|
|
2084
2089
|
return this._layer.zIndex;
|
|
2085
2090
|
}
|
|
2091
|
+
/** Set the draw order among the layers of its emitter. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2086
2092
|
set zIndex(value) {
|
|
2087
2093
|
if (this._playback.checkAlive("layer.zIndex")) this._layer.zIndex = value;
|
|
2088
2094
|
}
|
|
@@ -2094,6 +2100,7 @@ var ParticleLayerView = (_class6 = class _ParticleLayerView {
|
|
|
2094
2100
|
get visible() {
|
|
2095
2101
|
return this._layer.visible;
|
|
2096
2102
|
}
|
|
2103
|
+
/** Show or hide this layer; a hidden layer still spawns and simulates. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2097
2104
|
set visible(value) {
|
|
2098
2105
|
if (this._playback.checkAlive("layer.visible")) this._layer.visible = value;
|
|
2099
2106
|
}
|
|
@@ -2158,6 +2165,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2158
2165
|
get spawn() {
|
|
2159
2166
|
return this._emitter.spawn;
|
|
2160
2167
|
}
|
|
2168
|
+
/** Open or close the emission. Called from inside an update, it takes effect when that tick ends. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2161
2169
|
set spawn(value) {
|
|
2162
2170
|
if (!this._playback.checkAlive("emitter.spawn")) return;
|
|
2163
2171
|
const instance = this._playback.instance;
|
|
@@ -2171,6 +2179,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2171
2179
|
get spawnCount() {
|
|
2172
2180
|
return this._emitter.spawnCount;
|
|
2173
2181
|
}
|
|
2182
|
+
/** Set the number of particles of a burst. Read at the next cycle. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2174
2183
|
set spawnCount(value) {
|
|
2175
2184
|
if (this._playback.checkAlive("emitter.spawnCount")) this._emitter.spawnCount = value;
|
|
2176
2185
|
}
|
|
@@ -2178,6 +2187,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2178
2187
|
get spawnRate() {
|
|
2179
2188
|
return this._emitter.spawnRate;
|
|
2180
2189
|
}
|
|
2190
|
+
/** Set the particles per second of a rate emission; 0 means no rate emission. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2181
2191
|
set spawnRate(value) {
|
|
2182
2192
|
if (this._playback.checkAlive("emitter.spawnRate")) this._emitter.spawnRate = value;
|
|
2183
2193
|
}
|
|
@@ -2185,6 +2195,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2185
2195
|
get spawnDuration() {
|
|
2186
2196
|
return this._emitter.spawnDuration;
|
|
2187
2197
|
}
|
|
2198
|
+
/** Set the seconds a rate emission lasts per cycle; 0 means it never ends. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2188
2199
|
set spawnDuration(value) {
|
|
2189
2200
|
if (this._playback.checkAlive("emitter.spawnDuration")) this._emitter.spawnDuration = value;
|
|
2190
2201
|
}
|
|
@@ -2192,6 +2203,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2192
2203
|
get startDelay() {
|
|
2193
2204
|
return this._emitter.startDelay;
|
|
2194
2205
|
}
|
|
2206
|
+
/** Set the seconds the emitter waits after a session starts before it begins to emit. Read when the next session starts. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2195
2207
|
set startDelay(value) {
|
|
2196
2208
|
if (this._playback.checkAlive("emitter.startDelay")) this._emitter.startDelay = value;
|
|
2197
2209
|
}
|
|
@@ -2199,6 +2211,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2199
2211
|
get repeat() {
|
|
2200
2212
|
return this._emitter.repeat;
|
|
2201
2213
|
}
|
|
2214
|
+
/** Set how many times the emission cycle repeats after the first; the highest value allowed means forever. Read when the next session starts. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2202
2215
|
set repeat(value) {
|
|
2203
2216
|
if (this._playback.checkAlive("emitter.repeat")) this._emitter.repeat = value;
|
|
2204
2217
|
}
|
|
@@ -2206,6 +2219,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2206
2219
|
get repeatInterval() {
|
|
2207
2220
|
return this._emitter.repeatInterval;
|
|
2208
2221
|
}
|
|
2222
|
+
/** Set the seconds between the end of one emission cycle and the start of the next. Read when the next cycle is armed. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2209
2223
|
set repeatInterval(value) {
|
|
2210
2224
|
if (this._playback.checkAlive("emitter.repeatInterval")) this._emitter.repeatInterval = value;
|
|
2211
2225
|
}
|
|
@@ -2213,6 +2227,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2213
2227
|
get simulateTime() {
|
|
2214
2228
|
return this._emitter.simulateTime;
|
|
2215
2229
|
}
|
|
2230
|
+
/** Set the seconds of simulation run as warm-up when a session starts. Read when the next session starts. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2216
2231
|
set simulateTime(value) {
|
|
2217
2232
|
if (this._playback.checkAlive("emitter.simulateTime")) this._emitter.simulateTime = value;
|
|
2218
2233
|
}
|
|
@@ -2220,6 +2235,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2220
2235
|
get ensureAliveCount() {
|
|
2221
2236
|
return this._emitter.ensureAliveCount;
|
|
2222
2237
|
}
|
|
2238
|
+
/** Set the minimum number of live particles the emitter spawns up to once the warm-up ends. Read when the next session starts. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2223
2239
|
set ensureAliveCount(value) {
|
|
2224
2240
|
if (this._playback.checkAlive("emitter.ensureAliveCount")) this._emitter.ensureAliveCount = value;
|
|
2225
2241
|
}
|
|
@@ -2227,6 +2243,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2227
2243
|
get maxPoolSize() {
|
|
2228
2244
|
return this._emitter.maxPoolSize;
|
|
2229
2245
|
}
|
|
2246
|
+
/** Set the maximum number of live particles of the emitter; read at the next birth. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2230
2247
|
set maxPoolSize(value) {
|
|
2231
2248
|
if (this._playback.checkAlive("emitter.maxPoolSize")) this._emitter.maxPoolSize = value;
|
|
2232
2249
|
}
|
|
@@ -2234,6 +2251,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2234
2251
|
get particleLimitStrategy() {
|
|
2235
2252
|
return this._emitter.particleLimitStrategy;
|
|
2236
2253
|
}
|
|
2254
|
+
/** Set what happens when the emitter is at its particle limit; read at the next birth. A value that is not one of the strategies throws a `PerseonConfigError`. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2237
2255
|
set particleLimitStrategy(value) {
|
|
2238
2256
|
if (this._playback.checkAlive("emitter.particleLimitStrategy")) this._emitter.particleLimitStrategy = value;
|
|
2239
2257
|
}
|
|
@@ -2241,6 +2259,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2241
2259
|
get particleSpawnStrategy() {
|
|
2242
2260
|
return this._emitter.particleSpawnStrategy;
|
|
2243
2261
|
}
|
|
2262
|
+
/** Set where a new particle is drawn among the live ones of its layer; read at the next birth. A value that is not one of the strategies throws a `PerseonConfigError`. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2244
2263
|
set particleSpawnStrategy(value) {
|
|
2245
2264
|
if (this._playback.checkAlive("emitter.particleSpawnStrategy")) this._emitter.particleSpawnStrategy = value;
|
|
2246
2265
|
}
|
|
@@ -2256,6 +2275,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2256
2275
|
get effectiveWarmUpMaxTicks() {
|
|
2257
2276
|
return this._emitter.effectiveWarmUpMaxTicks;
|
|
2258
2277
|
}
|
|
2278
|
+
/** Set this emitter's warm-up tick budget, capped by the animation's. `undefined` inherits the animation's; any other value that is not a positive number is not applied and is reported by the diagnostics policy. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2259
2279
|
set warmUpMaxTicks(value) {
|
|
2260
2280
|
if (this._playback.checkAlive("emitter.warmUpMaxTicks")) this._emitter.warmUpMaxTicks = value;
|
|
2261
2281
|
}
|
|
@@ -2267,6 +2287,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2267
2287
|
get effectiveMaxUpdateRate() {
|
|
2268
2288
|
return this._emitter.effectiveMaxUpdateRate;
|
|
2269
2289
|
}
|
|
2290
|
+
/** Set this emitter's simulation rate in steps per second, capped by the animation's. `undefined` inherits the animation's; any other value that is not a positive number is not applied and is reported by the diagnostics policy. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2270
2291
|
set maxUpdateRate(value) {
|
|
2271
2292
|
if (this._playback.checkAlive("emitter.maxUpdateRate")) this._emitter.maxUpdateRate = value;
|
|
2272
2293
|
}
|
|
@@ -2320,6 +2341,7 @@ var EmitterView = (_class7 = class _EmitterView {
|
|
|
2320
2341
|
get visible() {
|
|
2321
2342
|
return this._emitter.visible;
|
|
2322
2343
|
}
|
|
2344
|
+
/** Show or hide this emitter and its layers. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
2323
2345
|
set visible(value) {
|
|
2324
2346
|
if (this._playback.checkAlive("emitter.visible")) this._emitter.visible = value;
|
|
2325
2347
|
}
|
|
@@ -2495,7 +2517,9 @@ var ParticleItem = (_class9 = class {constructor() { _class9.prototype.__init19.
|
|
|
2495
2517
|
* context at it without going through the layer.
|
|
2496
2518
|
*/
|
|
2497
2519
|
__init33() {this._listState = []}
|
|
2520
|
+
/** The random value drawn at birth; read through `seed`. */
|
|
2498
2521
|
__init34() {this._seed = 0}
|
|
2522
|
+
/** The state of the particle's texture-frame animation, or `null` when it has none or it has ended. */
|
|
2499
2523
|
__init35() {this._spriteAnimation = null}
|
|
2500
2524
|
/**
|
|
2501
2525
|
* The state the layer's program keeps per particle: frozen
|
|
@@ -2598,7 +2622,7 @@ var ParticleItem = (_class9 = class {constructor() { _class9.prototype.__init19.
|
|
|
2598
2622
|
* (shared by every particle of the type) or at the shared empty one.
|
|
2599
2623
|
* Written by the engine at birth and when the particle goes back to its pool.
|
|
2600
2624
|
*/
|
|
2601
|
-
__init67() {this.events =
|
|
2625
|
+
__init67() {this.events = _chunkWEQPSGPScjs.EMPTY_PARTICLE_EVENTS}
|
|
2602
2626
|
/**
|
|
2603
2627
|
* Time elapsed since the particle was born, in seconds. Alias of currentLife.
|
|
2604
2628
|
* When used as a linked-parameter source, particles with no configured lifetime
|
|
@@ -2653,7 +2677,7 @@ var ParticleItem = (_class9 = class {constructor() { _class9.prototype.__init19.
|
|
|
2653
2677
|
for (const entry of layout.entries) {
|
|
2654
2678
|
if (entry.role !== "pointForceFactor") continue;
|
|
2655
2679
|
const factor = this.mem[entry.index];
|
|
2656
|
-
if (factor) factors.set(
|
|
2680
|
+
if (factor) factors.set(_chunkWEQPSGPScjs.pointForceIdOf.call(void 0, entry.node), factor);
|
|
2657
2681
|
}
|
|
2658
2682
|
return factors;
|
|
2659
2683
|
}
|
|
@@ -2663,13 +2687,13 @@ var ParticleItem = (_class9 = class {constructor() { _class9.prototype.__init19.
|
|
|
2663
2687
|
* update loop only indexes into the resolved array — no per-frame lookups.
|
|
2664
2688
|
*/
|
|
2665
2689
|
setSpriteAnimation(options, renderer, rng) {
|
|
2666
|
-
if (!
|
|
2690
|
+
if (!_chunkWEQPSGPScjs.ParameterTypeChecker.isSpriteAnimationOptions(options)) return;
|
|
2667
2691
|
const numTextures = options.textures.length;
|
|
2668
2692
|
if (numTextures === 0) {
|
|
2669
2693
|
throw new Error("SpriteAnimationOptions must contain at least one texture.");
|
|
2670
2694
|
}
|
|
2671
|
-
const animationFPS = options.animationFPS === void 0 ? 12 :
|
|
2672
|
-
let startFrame = options.startFrame === void 0 ? 0 :
|
|
2695
|
+
const animationFPS = options.animationFPS === void 0 ? 12 : _chunkWEQPSGPScjs.clamp.call(void 0, options.animationFPS, 0.01, 1e3);
|
|
2696
|
+
let startFrame = options.startFrame === void 0 ? 0 : _chunkWEQPSGPScjs.clamp.call(void 0, options.startFrame, -1, numTextures - 1);
|
|
2673
2697
|
const resolved = new Array(numTextures);
|
|
2674
2698
|
for (let i = 0; i < numTextures; i++) {
|
|
2675
2699
|
resolved[i] = renderer.resolveTexture(options.textures[i]);
|
|
@@ -2765,7 +2789,7 @@ var ParticleItem = (_class9 = class {constructor() { _class9.prototype.__init19.
|
|
|
2765
2789
|
const dampingCoef = env.dampingCoefficient;
|
|
2766
2790
|
if (dampingCoef && this.dampingFactor) {
|
|
2767
2791
|
const speedSq = this.velocityX * this.velocityX + this.velocityY * this.velocityY;
|
|
2768
|
-
const minSpeedSq =
|
|
2792
|
+
const minSpeedSq = _chunkWEQPSGPScjs.DAMPING_CONFIG.minSpeed * _chunkWEQPSGPScjs.DAMPING_CONFIG.minSpeed;
|
|
2769
2793
|
if (speedSq > minSpeedSq) {
|
|
2770
2794
|
const speed = Math.sqrt(speedSq);
|
|
2771
2795
|
const factor = Math.exp(-dampingCoef * this.dampingFactor * speed * elapsedSec);
|
|
@@ -2842,7 +2866,7 @@ var ParticleItem = (_class9 = class {constructor() { _class9.prototype.__init19.
|
|
|
2842
2866
|
this.regionBehavior = null;
|
|
2843
2867
|
this.regionId = null;
|
|
2844
2868
|
this.wasInsideRegion = false;
|
|
2845
|
-
this.events =
|
|
2869
|
+
this.events = _chunkWEQPSGPScjs.EMPTY_PARTICLE_EVENTS;
|
|
2846
2870
|
this._spriteAnimation = null;
|
|
2847
2871
|
this.sourceParticleId = void 0;
|
|
2848
2872
|
this.layer = null;
|
|
@@ -2918,7 +2942,7 @@ var snapshotValue = (value, role, copies, path) => {
|
|
|
2918
2942
|
const keyRoles = role && OBJECT_ROLES[role];
|
|
2919
2943
|
for (const [key, item] of Object.entries(value)) {
|
|
2920
2944
|
if (key === "__proto__") {
|
|
2921
|
-
throw new (0,
|
|
2945
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${path}: the key "__proto__" is not allowed in a config`, `${path}.__proto__`);
|
|
2922
2946
|
}
|
|
2923
2947
|
copy[key] = snapshotValue(item, _optionalChain([keyRoles, 'optionalAccess', _109 => _109[key]]), copies, `${path}.${key}`);
|
|
2924
2948
|
}
|
|
@@ -2930,9 +2954,9 @@ var loading = (path, owner, run) => {
|
|
|
2930
2954
|
try {
|
|
2931
2955
|
return run();
|
|
2932
2956
|
} catch (error) {
|
|
2933
|
-
if (error instanceof
|
|
2957
|
+
if (error instanceof _chunkWEQPSGPScjs.PerseonConfigError) throw error;
|
|
2934
2958
|
const reason = error instanceof Error ? error.message : String(error);
|
|
2935
|
-
throw new (0,
|
|
2959
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
2936
2960
|
`${owner} - ${path}: the configuration has a shape the format does not take (${reason})`,
|
|
2937
2961
|
path,
|
|
2938
2962
|
{ cause: error }
|
|
@@ -2943,34 +2967,34 @@ var assertEmitterId = (id, index, seen) => {
|
|
|
2943
2967
|
if (id === void 0) return;
|
|
2944
2968
|
const path = `emitters[${index}].id`;
|
|
2945
2969
|
if (typeof id !== "string" || id.length === 0) {
|
|
2946
|
-
throw new (0,
|
|
2970
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${path} must be a non-empty string when it is given`, path);
|
|
2947
2971
|
}
|
|
2948
2972
|
if (seen.has(id)) {
|
|
2949
|
-
throw new (0,
|
|
2973
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(`${path}: the id '${id}' is used by another emitter`, path);
|
|
2950
2974
|
}
|
|
2951
2975
|
seen.add(id);
|
|
2952
2976
|
};
|
|
2953
2977
|
function createAnimationData(config, owner, diagnostics) {
|
|
2954
2978
|
const options = loading("ParticleAnimationOptions", owner, () => {
|
|
2955
2979
|
const copy = snapshotAnimationOptions(config);
|
|
2956
|
-
const declaredRegionIds =
|
|
2980
|
+
const declaredRegionIds = _chunkWEQPSGPScjs.assertParticleAnimationOptions.call(void 0, copy);
|
|
2957
2981
|
if (!Array.isArray(copy.emitters) || copy.emitters.length === 0) {
|
|
2958
|
-
throw new (0,
|
|
2982
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
2959
2983
|
`${owner} - \`emitters\` must declare at least one EmitterOptions entry`,
|
|
2960
2984
|
"ParticleAnimationOptions.emitters"
|
|
2961
2985
|
);
|
|
2962
2986
|
}
|
|
2963
|
-
const declared =
|
|
2987
|
+
const declared = _chunkWEQPSGPScjs.declaredReferencesOf.call(void 0, copy);
|
|
2964
2988
|
const emitterIds = /* @__PURE__ */ new Set();
|
|
2965
2989
|
copy.emitters.forEach(
|
|
2966
2990
|
(emitter, index) => loading(`emitters[${index}]`, owner, () => {
|
|
2967
2991
|
assertEmitterId(emitter.id, index, emitterIds);
|
|
2968
|
-
|
|
2992
|
+
_chunkWEQPSGPScjs.assertEmitterOptions.call(void 0, emitter, declaredRegionIds, declared, `emitters[${index}]`);
|
|
2969
2993
|
})
|
|
2970
2994
|
);
|
|
2971
2995
|
return copy;
|
|
2972
2996
|
});
|
|
2973
|
-
const compiled =
|
|
2997
|
+
const compiled = _chunkWEQPSGPScjs.ParameterCompiler.compileAnimation(options, diagnostics);
|
|
2974
2998
|
const data = Object.freeze({
|
|
2975
2999
|
options: compiled.options,
|
|
2976
3000
|
emitters: Object.freeze(compiled.emitters.map(freezeEmitter)),
|
|
@@ -3130,7 +3154,7 @@ var POLAR_OF_NODE = {
|
|
|
3130
3154
|
"kinetics.acceleration.angle": { vector: "acceleration", angle: true },
|
|
3131
3155
|
"kinetics.acceleration.magnitude": { vector: "acceleration", angle: false }
|
|
3132
3156
|
};
|
|
3133
|
-
var POINT_FORCE_FACTOR_PREFIX2 =
|
|
3157
|
+
var POINT_FORCE_FACTOR_PREFIX2 = _chunkWEQPSGPScjs.pointForceFactorNode.call(void 0, "");
|
|
3134
3158
|
function migrateLayerParticles(particles, layer, from, to, context, memorySize) {
|
|
3135
3159
|
const previous = from.layout;
|
|
3136
3160
|
const next = to.layout;
|
|
@@ -3162,7 +3186,7 @@ function migrateLayerParticles(particles, layer, from, to, context, memorySize)
|
|
|
3162
3186
|
index,
|
|
3163
3187
|
...polar,
|
|
3164
3188
|
accumulatorX: kept(vectorNode, "accumulator"),
|
|
3165
|
-
accumulatorY: kept(
|
|
3189
|
+
accumulatorY: kept(_chunkWEQPSGPScjs.accumulatorNodeY.call(void 0, vectorNode), "accumulator")
|
|
3166
3190
|
});
|
|
3167
3191
|
} else if (node.startsWith(POINT_FORCE_FACTOR_PREFIX2)) {
|
|
3168
3192
|
sources.push({ kind: "factor", index, from: _nullishCoalesce(previous.slotOf(node, "pointForceFactor"), () => ( -1)) });
|
|
@@ -3281,7 +3305,7 @@ var ParticleLayer = (_class11 = class _ParticleLayer {
|
|
|
3281
3305
|
}
|
|
3282
3306
|
/** Which vertex buffers the renderer has to refresh for this layer's particles. */
|
|
3283
3307
|
static dynamicPropertiesFor(options) {
|
|
3284
|
-
return
|
|
3308
|
+
return _chunkWEQPSGPScjs.layerDynamicProperties.call(void 0, options);
|
|
3285
3309
|
}
|
|
3286
3310
|
/**
|
|
3287
3311
|
* The handle of one of this layer's nodes in this instance, by its path from
|
|
@@ -3450,7 +3474,7 @@ var ParticlePool = (_class12 = class {
|
|
|
3450
3474
|
* @param diagnostics - The channel a capacity cut is reported through
|
|
3451
3475
|
* @param owner - Who owns the pool (`emitter 1`): a cut is told once per owner
|
|
3452
3476
|
*/
|
|
3453
|
-
constructor(ClassType, initialSize, maxPoolSize, diagnostics =
|
|
3477
|
+
constructor(ClassType, initialSize, maxPoolSize, diagnostics = _chunkWEQPSGPScjs.createDiagnostics.call(void 0, ), owner = "") {;_class12.prototype.__init78.call(this);_class12.prototype.__init79.call(this);
|
|
3454
3478
|
this._constructor = ClassType;
|
|
3455
3479
|
this._diagnostics = diagnostics;
|
|
3456
3480
|
this._owner = owner;
|
|
@@ -3629,38 +3653,38 @@ var EmissionScheduler = (_class13 = class {
|
|
|
3629
3653
|
this._hooks = hooks;
|
|
3630
3654
|
}
|
|
3631
3655
|
set spawnRate(value) {
|
|
3632
|
-
const rate =
|
|
3656
|
+
const rate = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "spawnRate", value);
|
|
3633
3657
|
this._spawnInterval = rate > 0 ? 1 / rate : Number.POSITIVE_INFINITY;
|
|
3634
3658
|
}
|
|
3635
3659
|
get spawnRate() {
|
|
3636
3660
|
return this._spawnInterval > 0 ? 1 / this._spawnInterval : 0;
|
|
3637
3661
|
}
|
|
3638
3662
|
set spawnCount(value) {
|
|
3639
|
-
this._spawnCount =
|
|
3663
|
+
this._spawnCount = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "spawnCount", value);
|
|
3640
3664
|
}
|
|
3641
3665
|
get spawnCount() {
|
|
3642
3666
|
return this._spawnCount;
|
|
3643
3667
|
}
|
|
3644
3668
|
set spawnDuration(value) {
|
|
3645
|
-
this._spawnDuration =
|
|
3669
|
+
this._spawnDuration = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "spawnDuration", value);
|
|
3646
3670
|
}
|
|
3647
3671
|
get spawnDuration() {
|
|
3648
3672
|
return this._spawnDuration;
|
|
3649
3673
|
}
|
|
3650
3674
|
set startDelay(value) {
|
|
3651
|
-
this._startDelay =
|
|
3675
|
+
this._startDelay = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "startDelay", value);
|
|
3652
3676
|
}
|
|
3653
3677
|
get startDelay() {
|
|
3654
3678
|
return this._startDelay;
|
|
3655
3679
|
}
|
|
3656
3680
|
set repeat(value) {
|
|
3657
|
-
this._repeat =
|
|
3681
|
+
this._repeat = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "repeat", value);
|
|
3658
3682
|
}
|
|
3659
3683
|
get repeat() {
|
|
3660
3684
|
return this._repeat;
|
|
3661
3685
|
}
|
|
3662
3686
|
set repeatInterval(value) {
|
|
3663
|
-
this._repeatInterval =
|
|
3687
|
+
this._repeatInterval = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "repeatInterval", value);
|
|
3664
3688
|
}
|
|
3665
3689
|
get repeatInterval() {
|
|
3666
3690
|
return this._repeatInterval;
|
|
@@ -3766,7 +3790,7 @@ var EmissionScheduler = (_class13 = class {
|
|
|
3766
3790
|
if (!this.spawn && this._closedByCycle && this.hasFiniteEmissionCycle && this._repeatsRemaining > 0) {
|
|
3767
3791
|
this._repeatIntervalElapsed += elapsedSec;
|
|
3768
3792
|
if (this._repeatIntervalElapsed >= this._repeatInterval) {
|
|
3769
|
-
if (this._repeat <
|
|
3793
|
+
if (this._repeat < _chunkWEQPSGPScjs.MAX_PARAMETER_VALUE) this._repeatsRemaining -= 1;
|
|
3770
3794
|
this._repeatIntervalElapsed = 0;
|
|
3771
3795
|
this._openCycle();
|
|
3772
3796
|
}
|
|
@@ -4009,7 +4033,7 @@ var Capsule = class {
|
|
|
4009
4033
|
|
|
4010
4034
|
// src/core/shapes/shapeFromArea.ts
|
|
4011
4035
|
var shapeFromArea = (areaShape) => {
|
|
4012
|
-
if (
|
|
4036
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isRectangleArea(areaShape)) {
|
|
4013
4037
|
const r = areaShape;
|
|
4014
4038
|
if (r.rotation === 0) {
|
|
4015
4039
|
return new Rectangle(r.center.x - r.width / 2, r.center.y - r.height / 2, r.width, r.height);
|
|
@@ -4024,24 +4048,24 @@ var shapeFromArea = (areaShape) => {
|
|
|
4024
4048
|
];
|
|
4025
4049
|
return new Polygon(
|
|
4026
4050
|
basePoints.map((p) => {
|
|
4027
|
-
const rotated =
|
|
4051
|
+
const rotated = _chunkWEQPSGPScjs.rotatePoint.call(void 0, p, _nullishCoalesce(r.rotation, () => ( 0)));
|
|
4028
4052
|
return { x: r.center.x + rotated.x, y: r.center.y + rotated.y };
|
|
4029
4053
|
})
|
|
4030
4054
|
);
|
|
4031
4055
|
}
|
|
4032
|
-
if (
|
|
4056
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isCapsuleArea(areaShape)) {
|
|
4033
4057
|
const c = areaShape;
|
|
4034
4058
|
return new Capsule(c.center.x, c.center.y, c.radius, c.length, c.rotation);
|
|
4035
4059
|
}
|
|
4036
|
-
if (
|
|
4060
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isCircleArea(areaShape)) {
|
|
4037
4061
|
const c = areaShape;
|
|
4038
4062
|
return new Circle(c.center.x, c.center.y, c.radius);
|
|
4039
4063
|
}
|
|
4040
|
-
if (
|
|
4064
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isRingArea(areaShape)) {
|
|
4041
4065
|
const r = areaShape;
|
|
4042
4066
|
return new Ring(r.center.x, r.center.y, r.innerRadius, r.outerRadius);
|
|
4043
4067
|
}
|
|
4044
|
-
if (
|
|
4068
|
+
if (_chunkWEQPSGPScjs.ParameterTypeChecker.isPolygonArea(areaShape)) {
|
|
4045
4069
|
const p = areaShape;
|
|
4046
4070
|
return new Polygon(p.points);
|
|
4047
4071
|
}
|
|
@@ -4267,8 +4291,8 @@ var Emitter = (_class15 = class {
|
|
|
4267
4291
|
onEmissionStarted: () => this.emitEmitterEvents(this._compiledParameters.events.onEmitStart, "onEmitStart"),
|
|
4268
4292
|
onEmissionStopped: () => this.emitEmitterEvents(this._compiledParameters.events.onEmitStop, "onEmitStop")
|
|
4269
4293
|
});
|
|
4270
|
-
const initialPoolSize =
|
|
4271
|
-
const maxAlive =
|
|
4294
|
+
const initialPoolSize = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "initialPoolSize", _nullishCoalesce(_optionalChain([options, 'access', _141 => _141.capacity, 'optionalAccess', _142 => _142.initialPoolSize]), () => ( 0)));
|
|
4295
|
+
const maxAlive = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "maxAlive", _nullishCoalesce(_optionalChain([options, 'access', _143 => _143.capacity, 'optionalAccess', _144 => _144.maxAlive]), () => ( Number.POSITIVE_INFINITY)));
|
|
4272
4296
|
this._pool = new ParticlePool(
|
|
4273
4297
|
_nullishCoalesce(options.ParticleClass, () => ( ParticleItem)),
|
|
4274
4298
|
initialPoolSize,
|
|
@@ -4301,10 +4325,10 @@ var Emitter = (_class15 = class {
|
|
|
4301
4325
|
this._randomness = options.randomness;
|
|
4302
4326
|
this._derivationKey = _nullishCoalesce(options.id, () => ( String(playback.emitters.length)));
|
|
4303
4327
|
const seedMode = _optionalChain([options, 'access', _153 => _153.randomness, 'optionalAccess', _154 => _154.seedMode]);
|
|
4304
|
-
this._initialRngSeed = seedMode === "fixed" ?
|
|
4305
|
-
this._rng = this._initialRngSeed !== void 0 ? new (0,
|
|
4328
|
+
this._initialRngSeed = seedMode === "fixed" ? _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "seed", _nullishCoalesce(_optionalChain([options, 'access', _155 => _155.randomness, 'optionalAccess', _156 => _156.seed]), () => ( 0))) : seedMode === "auto" ? void 0 : playback.deriveEmitterSeed(this._derivationKey);
|
|
4329
|
+
this._rng = this._initialRngSeed !== void 0 ? new (0, _chunkWEQPSGPScjs.SeededRNG)(this._initialRngSeed) : new (0, _chunkWEQPSGPScjs.SeededRNG)();
|
|
4306
4330
|
this._particleContext = createParticleProgramContext(this, this._rng);
|
|
4307
|
-
this._localParameters = new (0,
|
|
4331
|
+
this._localParameters = new (0, _chunkWEQPSGPScjs.ParameterStore)(compiled.localLayout);
|
|
4308
4332
|
this.emitterLocalValues = this._localParameters.values;
|
|
4309
4333
|
this.playbackLocalValues = playback.playbackLocalValues;
|
|
4310
4334
|
this.globalValues = playback.globalValues;
|
|
@@ -4385,10 +4409,10 @@ var Emitter = (_class15 = class {
|
|
|
4385
4409
|
scheduler.repeat = value;
|
|
4386
4410
|
return;
|
|
4387
4411
|
case "simulateTime":
|
|
4388
|
-
this._simulateTime =
|
|
4412
|
+
this._simulateTime = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "simulateTime", value);
|
|
4389
4413
|
return;
|
|
4390
4414
|
case "ensureAliveCount":
|
|
4391
|
-
this._ensureAliveCount =
|
|
4415
|
+
this._ensureAliveCount = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "ensureAliveCount", value);
|
|
4392
4416
|
return;
|
|
4393
4417
|
case "maxPoolSize":
|
|
4394
4418
|
this._pool.maxPoolSize = value;
|
|
@@ -4536,7 +4560,7 @@ var Emitter = (_class15 = class {
|
|
|
4536
4560
|
* @internal For the instance's nodes (`instanceNodes`).
|
|
4537
4561
|
*/
|
|
4538
4562
|
writeWarmUpMaxTicks(value) {
|
|
4539
|
-
this._warmUpMaxTicksOverride = value !== void 0 &&
|
|
4563
|
+
this._warmUpMaxTicksOverride = value !== void 0 && _chunkWEQPSGPScjs.ParameterTypeChecker.isPositiveNumber(value) ? _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "warmUpMaxTicks", value) : void 0;
|
|
4540
4564
|
}
|
|
4541
4565
|
/**
|
|
4542
4566
|
* Simulation rate, under the same inherit-or-lower rule as
|
|
@@ -4562,7 +4586,7 @@ var Emitter = (_class15 = class {
|
|
|
4562
4586
|
* @internal For the instance's nodes (`instanceNodes`).
|
|
4563
4587
|
*/
|
|
4564
4588
|
writeMaxUpdateRate(value) {
|
|
4565
|
-
this._maxUpdateRateOverride = value !== void 0 &&
|
|
4589
|
+
this._maxUpdateRateOverride = value !== void 0 && _chunkWEQPSGPScjs.ParameterTypeChecker.isPositiveNumber(value) ? _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "maxUpdateRate", value) : void 0;
|
|
4566
4590
|
this.refreshInheritedPerformance();
|
|
4567
4591
|
}
|
|
4568
4592
|
/**
|
|
@@ -4574,12 +4598,12 @@ var Emitter = (_class15 = class {
|
|
|
4574
4598
|
*/
|
|
4575
4599
|
_setPerformance(path, name, value) {
|
|
4576
4600
|
const playback = this.playback;
|
|
4577
|
-
if (value !== void 0 && !
|
|
4601
|
+
if (value !== void 0 && !_chunkWEQPSGPScjs.ParameterTypeChecker.isPositiveNumber(value)) {
|
|
4578
4602
|
return playback.reportPerformanceRefused(name, value);
|
|
4579
4603
|
}
|
|
4580
4604
|
if (playback.inTick) return playback.defer(`emitter.${name}`, () => this._setPerformance(path, name, value));
|
|
4581
4605
|
if (value !== void 0) {
|
|
4582
|
-
this._shortcut(path).set(
|
|
4606
|
+
this._shortcut(path).set(_chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, name, value));
|
|
4583
4607
|
return;
|
|
4584
4608
|
}
|
|
4585
4609
|
const emitter = playback.emitters.indexOf(this);
|
|
@@ -4870,7 +4894,7 @@ var Emitter = (_class15 = class {
|
|
|
4870
4894
|
}
|
|
4871
4895
|
/** Clear a removed point force's factor from every live particle of this emitter. */
|
|
4872
4896
|
forgetPointForce(id) {
|
|
4873
|
-
const node =
|
|
4897
|
+
const node = _chunkWEQPSGPScjs.pointForceFactorNode.call(void 0, id);
|
|
4874
4898
|
for (const particle of this._liveParticles) {
|
|
4875
4899
|
const slot = _optionalChain([particle, 'access', _162 => _162["layer"], 'optionalAccess', _163 => _163.compiledParameters, 'access', _164 => _164.layout, 'access', _165 => _165.slotOf, 'call', _166 => _166(node, "pointForceFactor")]);
|
|
4876
4900
|
if (slot !== void 0) particle["mem"][slot] = 0;
|
|
@@ -5100,7 +5124,7 @@ var Emitter = (_class15 = class {
|
|
|
5100
5124
|
reseedFromAnimation() {
|
|
5101
5125
|
if (_optionalChain([this, 'access', _175 => _175._randomness, 'optionalAccess', _176 => _176.seedMode]) === "fixed" || _optionalChain([this, 'access', _177 => _177._randomness, 'optionalAccess', _178 => _178.seedMode]) === "auto") return;
|
|
5102
5126
|
this._initialRngSeed = this.playback.deriveEmitterSeed(this._derivationKey);
|
|
5103
|
-
this._rng = this._initialRngSeed !== void 0 ? new (0,
|
|
5127
|
+
this._rng = this._initialRngSeed !== void 0 ? new (0, _chunkWEQPSGPScjs.SeededRNG)(this._initialRngSeed) : new (0, _chunkWEQPSGPScjs.SeededRNG)();
|
|
5104
5128
|
this._particleContext.rng = this._rng;
|
|
5105
5129
|
}
|
|
5106
5130
|
/**
|
|
@@ -5250,10 +5274,10 @@ var GlobalParameterTable = class {
|
|
|
5250
5274
|
this._defaults = declarations.map((global) => global.value);
|
|
5251
5275
|
this._labels = declarations.map((global) => Array.isArray(global.domain) ? global.domain : null);
|
|
5252
5276
|
this._min = declarations.map(
|
|
5253
|
-
(global) => Array.isArray(global.domain) ?
|
|
5277
|
+
(global) => Array.isArray(global.domain) ? _chunkWEQPSGPScjs.CUSTOM_PARAMETER_DOMAINS.labelIndex.min : global.domain.min
|
|
5254
5278
|
);
|
|
5255
5279
|
this._max = declarations.map(
|
|
5256
|
-
(global) => Array.isArray(global.domain) ? Math.max(
|
|
5280
|
+
(global) => Array.isArray(global.domain) ? Math.max(_chunkWEQPSGPScjs.CUSTOM_PARAMETER_DOMAINS.labelIndex.min, global.domain.length - 1) : global.domain.max
|
|
5257
5281
|
);
|
|
5258
5282
|
this.values = this._defaults.slice();
|
|
5259
5283
|
this._diagnostics = diagnostics;
|
|
@@ -5318,7 +5342,7 @@ var GlobalParameterRegistry = (_class16 = class {constructor() { _class16.protot
|
|
|
5318
5342
|
*/
|
|
5319
5343
|
set(id, value) {
|
|
5320
5344
|
if (typeof value === "number" ? !Number.isFinite(value) : typeof value !== "string") {
|
|
5321
|
-
throw new (0,
|
|
5345
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
5322
5346
|
`setGlobalParameter('${id}'): a value is a finite number or a label, not ${String(value)}`,
|
|
5323
5347
|
id
|
|
5324
5348
|
);
|
|
@@ -5512,15 +5536,15 @@ var ExternalForces = (_class18 = class {constructor() { _class18.prototype.__ini
|
|
|
5512
5536
|
return this._gravity;
|
|
5513
5537
|
}
|
|
5514
5538
|
set gravity(value) {
|
|
5515
|
-
this._gravity =
|
|
5539
|
+
this._gravity = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "gravity", value);
|
|
5516
5540
|
}
|
|
5517
5541
|
get damping() {
|
|
5518
5542
|
return this._damping;
|
|
5519
5543
|
}
|
|
5520
5544
|
set damping(value) {
|
|
5521
|
-
const sanitized =
|
|
5545
|
+
const sanitized = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "damping", value);
|
|
5522
5546
|
this._damping = sanitized;
|
|
5523
|
-
this._dampingCoefficient = sanitized *
|
|
5547
|
+
this._dampingCoefficient = sanitized * _chunkWEQPSGPScjs.DAMPING_CONFIG.coefficientScale;
|
|
5524
5548
|
}
|
|
5525
5549
|
/** Damping scaled to the integration constant used by the physics step. */
|
|
5526
5550
|
get dampingCoefficient() {
|
|
@@ -5567,8 +5591,8 @@ var ExternalForces = (_class18 = class {constructor() { _class18.prototype.__ini
|
|
|
5567
5591
|
*/
|
|
5568
5592
|
_setWind(x, y) {
|
|
5569
5593
|
const wind = this._wind;
|
|
5570
|
-
wind.x =
|
|
5571
|
-
wind.y =
|
|
5594
|
+
wind.x = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "windX", x);
|
|
5595
|
+
wind.y = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "windY", y);
|
|
5572
5596
|
this._windVector.angle = Math.atan2(wind.y, wind.x);
|
|
5573
5597
|
this._windVector.magnitude = Math.sqrt(wind.x * wind.x + wind.y * wind.y);
|
|
5574
5598
|
}
|
|
@@ -5580,7 +5604,7 @@ var PointForce = class {
|
|
|
5580
5604
|
|
|
5581
5605
|
|
|
5582
5606
|
constructor(config) {
|
|
5583
|
-
this._config =
|
|
5607
|
+
this._config = _chunkWEQPSGPScjs.sanitizePointForce.call(void 0, config);
|
|
5584
5608
|
this.id = this._config.id;
|
|
5585
5609
|
this._compile();
|
|
5586
5610
|
}
|
|
@@ -5597,11 +5621,11 @@ var PointForce = class {
|
|
|
5597
5621
|
}
|
|
5598
5622
|
/** Merge a partial config and recompile. The `id` is immutable. */
|
|
5599
5623
|
update(patch) {
|
|
5600
|
-
this._config =
|
|
5624
|
+
this._config = _chunkWEQPSGPScjs.sanitizePointForce.call(void 0, { ...this._config, ...patch, id: this.id });
|
|
5601
5625
|
this._compile();
|
|
5602
5626
|
}
|
|
5603
5627
|
_compile() {
|
|
5604
|
-
this._compiled = this._config.enabled ?
|
|
5628
|
+
this._compiled = this._config.enabled ? _chunkWEQPSGPScjs.ParameterCompiler.compilePointForce(this._config) : void 0;
|
|
5605
5629
|
}
|
|
5606
5630
|
};
|
|
5607
5631
|
|
|
@@ -5684,21 +5708,21 @@ var PointForceRegistry = (_class19 = class {constructor() { _class19.prototype._
|
|
|
5684
5708
|
// src/core/simulation/PlaybackInstance.ts
|
|
5685
5709
|
var validTimeScale = (value) => {
|
|
5686
5710
|
if (Number.isFinite(value) && value >= 0) return value;
|
|
5687
|
-
throw new (0,
|
|
5711
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
5688
5712
|
`timeScale: Value must be a finite number of 0 or more (got ${String(value)})`,
|
|
5689
5713
|
"timeScale"
|
|
5690
5714
|
);
|
|
5691
5715
|
};
|
|
5692
5716
|
var idWithoutDot = (what, path, id) => {
|
|
5693
5717
|
if (!id.includes(".")) return id;
|
|
5694
|
-
throw new (0,
|
|
5718
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
5695
5719
|
`${what}('${id}'): The id of a region or a point force takes no dot: it is one segment of an option() path.`,
|
|
5696
5720
|
path
|
|
5697
5721
|
);
|
|
5698
5722
|
};
|
|
5699
5723
|
var NO_LISTENERS = new EventListeners();
|
|
5700
5724
|
var NO_PARTICLE_PINS = Object.freeze([]);
|
|
5701
|
-
var NO_ANIMATION_DIAGNOSTICS4 =
|
|
5725
|
+
var NO_ANIMATION_DIAGNOSTICS4 = _chunkWEQPSGPScjs.createDiagnostics.call(void 0, );
|
|
5702
5726
|
var FINISHED = Object.freeze({
|
|
5703
5727
|
completed: Object.freeze({ reason: "completed" }),
|
|
5704
5728
|
stopped: Object.freeze({ reason: "stopped" }),
|
|
@@ -5895,8 +5919,8 @@ var PlaybackInstance = (_class20 = class {
|
|
|
5895
5919
|
this._clock.maxUpdateRate = _nullishCoalesce(_optionalChain([options, 'access', _230 => _230.performance, 'optionalAccess', _231 => _231.maxUpdateRate]), () => ( this._clock.maxUpdateRate));
|
|
5896
5920
|
this.writeWarmUpMaxTicks(_nullishCoalesce(_optionalChain([options, 'access', _232 => _232.performance, 'optionalAccess', _233 => _233.warmUpMaxTicks]), () => ( this._warmUpMaxTicks)));
|
|
5897
5921
|
const declaredSeed = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _234 => _234.seed]), () => ( _optionalChain([options, 'access', _235 => _235.randomness, 'optionalAccess', _236 => _236.seed])));
|
|
5898
|
-
this._initialRngSeed = declaredSeed !== void 0 ?
|
|
5899
|
-
this._rng = this._initialRngSeed !== void 0 ? new (0,
|
|
5922
|
+
this._initialRngSeed = declaredSeed !== void 0 ? _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "seed", declaredSeed) : void 0;
|
|
5923
|
+
this._rng = this._initialRngSeed !== void 0 ? new (0, _chunkWEQPSGPScjs.SeededRNG)(this._initialRngSeed) : new (0, _chunkWEQPSGPScjs.SeededRNG)();
|
|
5900
5924
|
this._playbackLocals = data.locals.createStore("playback");
|
|
5901
5925
|
this._globalRegistry = _optionalChain([source, 'optionalAccess', _237 => _237.globals]) === void 0 ? _nullishCoalesce(_optionalChain([source, 'optionalAccess', _238 => _238.globalRegistry]), () => ( null)) : null;
|
|
5902
5926
|
this._globals = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _239 => _239.globals]), () => ( new GlobalParameterTable(_nullishCoalesce(options.globalParameters, () => ( [])), data.sources.diagnostics)));
|
|
@@ -6197,7 +6221,7 @@ var PlaybackInstance = (_class20 = class {
|
|
|
6197
6221
|
*/
|
|
6198
6222
|
deriveEmitterSeed(key) {
|
|
6199
6223
|
if (this._initialRngSeed === void 0) return void 0;
|
|
6200
|
-
return
|
|
6224
|
+
return _chunkWEQPSGPScjs.SeededRNG.deriveSeed(this._initialRngSeed, key);
|
|
6201
6225
|
}
|
|
6202
6226
|
/**
|
|
6203
6227
|
* Total simulated time in seconds. The shared clock that time-driven
|
|
@@ -6217,11 +6241,11 @@ var PlaybackInstance = (_class20 = class {
|
|
|
6217
6241
|
* limit. The value is sanitized as the clock does it.
|
|
6218
6242
|
*/
|
|
6219
6243
|
set maxUpdateRate(value) {
|
|
6220
|
-
if (!
|
|
6244
|
+
if (!_chunkWEQPSGPScjs.ParameterTypeChecker.isPositiveNumber(value)) {
|
|
6221
6245
|
this.reportPerformanceRefused("maxUpdateRate", value);
|
|
6222
6246
|
return;
|
|
6223
6247
|
}
|
|
6224
|
-
this._shortcut("performance.maxUpdateRate").set(
|
|
6248
|
+
this._shortcut("performance.maxUpdateRate").set(_chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "maxUpdateRate", value));
|
|
6225
6249
|
}
|
|
6226
6250
|
get maxUpdateRate() {
|
|
6227
6251
|
return this._clock.maxUpdateRate;
|
|
@@ -6241,11 +6265,11 @@ var PlaybackInstance = (_class20 = class {
|
|
|
6241
6265
|
* `performance.warmUpMaxTicks`, like `maxUpdateRate`.
|
|
6242
6266
|
*/
|
|
6243
6267
|
set warmUpMaxTicks(value) {
|
|
6244
|
-
if (!
|
|
6268
|
+
if (!_chunkWEQPSGPScjs.ParameterTypeChecker.isPositiveNumber(value)) {
|
|
6245
6269
|
this.reportPerformanceRefused("warmUpMaxTicks", value);
|
|
6246
6270
|
return;
|
|
6247
6271
|
}
|
|
6248
|
-
this._shortcut("performance.warmUpMaxTicks").set(
|
|
6272
|
+
this._shortcut("performance.warmUpMaxTicks").set(_chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "warmUpMaxTicks", value));
|
|
6249
6273
|
}
|
|
6250
6274
|
get warmUpMaxTicks() {
|
|
6251
6275
|
return this._warmUpMaxTicks;
|
|
@@ -6257,7 +6281,7 @@ var PlaybackInstance = (_class20 = class {
|
|
|
6257
6281
|
*/
|
|
6258
6282
|
writeWarmUpMaxTicks(value) {
|
|
6259
6283
|
if (value > 0) {
|
|
6260
|
-
this._warmUpMaxTicks =
|
|
6284
|
+
this._warmUpMaxTicks = _chunkWEQPSGPScjs.sanitizeEmitterParameter.call(void 0, "warmUpMaxTicks", value);
|
|
6261
6285
|
}
|
|
6262
6286
|
}
|
|
6263
6287
|
get isRunning() {
|
|
@@ -6289,7 +6313,7 @@ var PlaybackInstance = (_class20 = class {
|
|
|
6289
6313
|
*/
|
|
6290
6314
|
reseed(seed2) {
|
|
6291
6315
|
this._initialRngSeed = seed2;
|
|
6292
|
-
this._rng = seed2 !== void 0 ? new (0,
|
|
6316
|
+
this._rng = seed2 !== void 0 ? new (0, _chunkWEQPSGPScjs.SeededRNG)(seed2) : new (0, _chunkWEQPSGPScjs.SeededRNG)();
|
|
6293
6317
|
this._emitters.forEach((emitter) => emitter.reseedFromAnimation());
|
|
6294
6318
|
}
|
|
6295
6319
|
/** Position of the whole animation within its parent. */
|
|
@@ -6687,7 +6711,7 @@ var PlaybackInstance = (_class20 = class {
|
|
|
6687
6711
|
/** The wind as a point: the overlay holds it as the format does, `{angle, magnitude}`. */
|
|
6688
6712
|
set wind(value) {
|
|
6689
6713
|
const point = { x: value.x, y: value.y };
|
|
6690
|
-
const vector =
|
|
6714
|
+
const vector = _chunkWEQPSGPScjs.ParameterSampler.vectorFromPoint(point);
|
|
6691
6715
|
const handle = this._shortcut("externalForces.wind");
|
|
6692
6716
|
handle.set(vector);
|
|
6693
6717
|
if (this._tickDepth > 0) {
|
|
@@ -7305,7 +7329,7 @@ var PlaybackInstance = (_class20 = class {
|
|
|
7305
7329
|
targetTime = Math.max(targetTime, emitter.warmUpTime);
|
|
7306
7330
|
}
|
|
7307
7331
|
if (targetTime > 0) {
|
|
7308
|
-
const simulationStepSec = Math.max(this._clock.minInterval,
|
|
7332
|
+
const simulationStepSec = Math.max(this._clock.minInterval, _chunkWEQPSGPScjs.WARM_UP_MIN_STEP_SECONDS);
|
|
7309
7333
|
let elapsedSimulated = 0;
|
|
7310
7334
|
while (elapsedSimulated < targetTime && this._emitters.some((emitter) => emitter.hasWarmUpBudget)) {
|
|
7311
7335
|
const deltaSec = Math.min(simulationStepSec, targetTime - elapsedSimulated);
|
|
@@ -7520,6 +7544,7 @@ var PerseonPlayback = (_class21 = class {
|
|
|
7520
7544
|
get maxUpdateRate() {
|
|
7521
7545
|
return this.instance.maxUpdateRate;
|
|
7522
7546
|
}
|
|
7547
|
+
/** Set the animation's simulation rate, in steps per second. A value that is not a positive number is not applied and is reported by the diagnostics policy; use `Infinity` for no limit. Positive values are clipped to 1–1,000,000, so `Infinity` reads back as 1,000,000. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
7523
7548
|
set maxUpdateRate(value) {
|
|
7524
7549
|
if (this.checkAlive("maxUpdateRate")) this.instance.maxUpdateRate = value;
|
|
7525
7550
|
}
|
|
@@ -7532,6 +7557,7 @@ var PerseonPlayback = (_class21 = class {
|
|
|
7532
7557
|
get timeScale() {
|
|
7533
7558
|
return this.instance.timeScale;
|
|
7534
7559
|
}
|
|
7560
|
+
/** Set the factor of the simulated step: 1 is real time, 0 freezes the simulation without pausing it. Throws a `PerseonConfigError` for a negative or non-finite value. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
7535
7561
|
set timeScale(value) {
|
|
7536
7562
|
if (this.checkAlive("timeScale")) this.instance.timeScale = value;
|
|
7537
7563
|
}
|
|
@@ -7539,6 +7565,7 @@ var PerseonPlayback = (_class21 = class {
|
|
|
7539
7565
|
get warmUpMaxTicks() {
|
|
7540
7566
|
return this.instance.warmUpMaxTicks;
|
|
7541
7567
|
}
|
|
7568
|
+
/** Set the animation's warm-up tick budget. A value that is not a positive number is not applied and is reported by the diagnostics policy. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
7542
7569
|
set warmUpMaxTicks(value) {
|
|
7543
7570
|
if (this.checkAlive("warmUpMaxTicks")) this.instance.warmUpMaxTicks = value;
|
|
7544
7571
|
}
|
|
@@ -7555,6 +7582,7 @@ var PerseonPlayback = (_class21 = class {
|
|
|
7555
7582
|
get autoRelease() {
|
|
7556
7583
|
return this.instance.autoRelease;
|
|
7557
7584
|
}
|
|
7585
|
+
/** Choose whether the instance goes back to the pool at its natural end. Setting `true` on a playback already stopped at its natural end gives it back immediately. A playback with no pool (built with `new PerseonPlayback`) has nowhere to go back to. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
7558
7586
|
set autoRelease(value) {
|
|
7559
7587
|
if (this.checkAlive("autoRelease")) this.instance.autoRelease = value;
|
|
7560
7588
|
}
|
|
@@ -7590,6 +7618,7 @@ var PerseonPlayback = (_class21 = class {
|
|
|
7590
7618
|
get x() {
|
|
7591
7619
|
return this.instance.x;
|
|
7592
7620
|
}
|
|
7621
|
+
/** Move the whole animation horizontally within its parent. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
7593
7622
|
set x(value) {
|
|
7594
7623
|
if (this.checkAlive("x")) this.instance.x = value;
|
|
7595
7624
|
}
|
|
@@ -7597,6 +7626,7 @@ var PerseonPlayback = (_class21 = class {
|
|
|
7597
7626
|
get y() {
|
|
7598
7627
|
return this.instance.y;
|
|
7599
7628
|
}
|
|
7629
|
+
/** Move the whole animation vertically within its parent. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
7600
7630
|
set y(value) {
|
|
7601
7631
|
if (this.checkAlive("y")) this.instance.y = value;
|
|
7602
7632
|
}
|
|
@@ -7614,6 +7644,7 @@ var PerseonPlayback = (_class21 = class {
|
|
|
7614
7644
|
get visible() {
|
|
7615
7645
|
return this.instance.visible;
|
|
7616
7646
|
}
|
|
7647
|
+
/** Hide or show the whole animation; hiding does not pause the simulation. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
7617
7648
|
set visible(value) {
|
|
7618
7649
|
if (this.checkAlive("visible")) this.instance.visible = value;
|
|
7619
7650
|
}
|
|
@@ -7666,6 +7697,7 @@ var PerseonPlayback = (_class21 = class {
|
|
|
7666
7697
|
get gravity() {
|
|
7667
7698
|
return this.instance.gravity;
|
|
7668
7699
|
}
|
|
7700
|
+
/** Set the gravitational acceleration; a shortcut of `option('externalForces.gravity').set`. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
7669
7701
|
set gravity(value) {
|
|
7670
7702
|
if (this.checkAlive("gravity")) this.instance.gravity = value;
|
|
7671
7703
|
}
|
|
@@ -7673,6 +7705,7 @@ var PerseonPlayback = (_class21 = class {
|
|
|
7673
7705
|
get damping() {
|
|
7674
7706
|
return this.instance.damping;
|
|
7675
7707
|
}
|
|
7708
|
+
/** Set the movement damping; a shortcut of `option('externalForces.damping').set`. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
7676
7709
|
set damping(value) {
|
|
7677
7710
|
if (this.checkAlive("damping")) this.instance.damping = value;
|
|
7678
7711
|
}
|
|
@@ -7684,6 +7717,7 @@ var PerseonPlayback = (_class21 = class {
|
|
|
7684
7717
|
get wind() {
|
|
7685
7718
|
return this.instance.wind;
|
|
7686
7719
|
}
|
|
7720
|
+
/** Set the wind from a point; a shortcut of `option('externalForces.wind').set`. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
7687
7721
|
set wind(value) {
|
|
7688
7722
|
if (this.checkAlive("wind")) this.instance.wind = value;
|
|
7689
7723
|
}
|
|
@@ -7691,6 +7725,7 @@ var PerseonPlayback = (_class21 = class {
|
|
|
7691
7725
|
get windVector() {
|
|
7692
7726
|
return this.instance.windVector;
|
|
7693
7727
|
}
|
|
7728
|
+
/** Set the wind from a vector (angle and magnitude); a shortcut of `option('externalForces.wind').set`. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
|
|
7694
7729
|
set windVector(value) {
|
|
7695
7730
|
if (this.checkAlive("windVector")) this.instance.windVector = value;
|
|
7696
7731
|
}
|
|
@@ -7878,7 +7913,7 @@ var describeAnimation = (data, defaultOf) => {
|
|
|
7878
7913
|
};
|
|
7879
7914
|
|
|
7880
7915
|
// src/core/simulation/PerseonAnimation.ts
|
|
7881
|
-
var NO_ANIMATION_DIAGNOSTICS5 =
|
|
7916
|
+
var NO_ANIMATION_DIAGNOSTICS5 = _chunkWEQPSGPScjs.createDiagnostics.call(void 0, );
|
|
7882
7917
|
var PerseonAnimation = (_class22 = class {
|
|
7883
7918
|
/** @internal Built once. Every playback reads it; none writes to it. */
|
|
7884
7919
|
|
|
@@ -8147,7 +8182,7 @@ var PerseonAnimation = (_class22 = class {
|
|
|
8147
8182
|
const seed2 = _optionalChain([this, 'access', _321 => _321._data, 'access', _322 => _322.options, 'access', _323 => _323.randomness, 'optionalAccess', _324 => _324.seed]);
|
|
8148
8183
|
const ordinal = this._played++;
|
|
8149
8184
|
if (seed2 === void 0) return void 0;
|
|
8150
|
-
return
|
|
8185
|
+
return _chunkWEQPSGPScjs.SeededRNG.deriveSeed(seed2, String(ordinal));
|
|
8151
8186
|
}
|
|
8152
8187
|
/**
|
|
8153
8188
|
* Throw a `PerseonConfigError` for an id of `params` that is not a local, or a value it rejects.
|
|
@@ -8231,6 +8266,8 @@ var PerseonIntegration = (_class23 = class {
|
|
|
8231
8266
|
/** @internal */
|
|
8232
8267
|
__init170() {this._destroyed = false}
|
|
8233
8268
|
/**
|
|
8269
|
+
* Build an integration over a renderer. Backends call this from their own constructor; a host rarely does.
|
|
8270
|
+
*
|
|
8234
8271
|
* @param renderer the backend, built by the integration from its host's own
|
|
8235
8272
|
* objects.
|
|
8236
8273
|
* @param ticker the host's frame source. Optional because the renderer
|
|
@@ -8290,7 +8327,7 @@ var PerseonIntegration = (_class23 = class {
|
|
|
8290
8327
|
this.renderer,
|
|
8291
8328
|
this._ticker,
|
|
8292
8329
|
(destroyed) => this._forget(destroyed),
|
|
8293
|
-
|
|
8330
|
+
_chunkWEQPSGPScjs.createDiagnostics.call(void 0, this._diagnostics),
|
|
8294
8331
|
this._listeners,
|
|
8295
8332
|
this._globals
|
|
8296
8333
|
);
|
|
@@ -8373,30 +8410,30 @@ var PerseonIntegration = (_class23 = class {
|
|
|
8373
8410
|
var parseAnimationOptions = (input) => {
|
|
8374
8411
|
const payload = typeof input === "string" ? parseJsonPayload(input) : input;
|
|
8375
8412
|
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
|
|
8376
|
-
throw new (0,
|
|
8413
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
8377
8414
|
"parseAnimationOptions - the animation file must contain a JSON object",
|
|
8378
8415
|
"parseAnimationOptions"
|
|
8379
8416
|
);
|
|
8380
8417
|
}
|
|
8381
8418
|
const candidate = payload;
|
|
8382
|
-
|
|
8419
|
+
_chunkWEQPSGPScjs.assertFormatVersion.call(void 0, candidate);
|
|
8383
8420
|
for (const hostMember of ["renderer", "ticker"]) {
|
|
8384
8421
|
if (candidate[hostMember] !== void 0) {
|
|
8385
|
-
throw new (0,
|
|
8422
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
8386
8423
|
`parseAnimationOptions - the animation file must not contain \`${hostMember}\`; the host passes it to the constructor`,
|
|
8387
8424
|
hostMember
|
|
8388
8425
|
);
|
|
8389
8426
|
}
|
|
8390
8427
|
}
|
|
8391
8428
|
if (!Array.isArray(candidate.emitters) || candidate.emitters.length === 0) {
|
|
8392
|
-
throw new (0,
|
|
8429
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
8393
8430
|
"parseAnimationOptions - the animation file must declare at least one entry in `emitters`",
|
|
8394
8431
|
"emitters"
|
|
8395
8432
|
);
|
|
8396
8433
|
}
|
|
8397
8434
|
candidate.emitters.forEach((emitter, index) => {
|
|
8398
8435
|
if (typeof emitter === "object" && emitter !== null && emitter.ParticleClass !== void 0) {
|
|
8399
|
-
throw new (0,
|
|
8436
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
8400
8437
|
`parseAnimationOptions - the animation file must not contain \`emitters[${index}].ParticleClass\`; a host supplies it in code`,
|
|
8401
8438
|
`emitters[${index}].ParticleClass`
|
|
8402
8439
|
);
|
|
@@ -8409,7 +8446,7 @@ var parseJsonPayload = (input) => {
|
|
|
8409
8446
|
return JSON.parse(input);
|
|
8410
8447
|
} catch (error) {
|
|
8411
8448
|
const detail = error instanceof Error ? error.message : String(error);
|
|
8412
|
-
throw new (0,
|
|
8449
|
+
throw new (0, _chunkWEQPSGPScjs.PerseonConfigError)(
|
|
8413
8450
|
`parseAnimationOptions - the animation file is not valid JSON: ${detail}`,
|
|
8414
8451
|
"parseAnimationOptions",
|
|
8415
8452
|
{ cause: error }
|