@zylem/behaviors 0.5.2 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{behavior-system-CldqNUgr.d.ts → behavior-system-HEt67el5.d.ts} +14 -1
- package/dist/{chunk-EIWQM6U3.js → chunk-2HKY6WF7.js} +0 -1
- package/dist/{chunk-IZJFUAXB.js → chunk-2HLZBWGD.js} +0 -1
- package/dist/{chunk-LL4FLHIY.js → chunk-2YF7J3H4.js} +0 -1
- package/dist/{chunk-SGHIGTVZ.js → chunk-3X3CL24Z.js} +0 -1
- package/dist/{chunk-HZMY3TT4.js → chunk-4DVDFCVY.js} +0 -1
- package/dist/{chunk-QVCMJ4Q2.js → chunk-4EWASZHB.js} +0 -1
- package/dist/{chunk-4LLK2FJI.js → chunk-55CFXXZH.js} +3 -4
- package/dist/{chunk-4MZ57HPD.js → chunk-57GLKGEX.js} +3 -4
- package/dist/{chunk-QS3VXWVO.js → chunk-7GGR26YA.js} +3 -4
- package/dist/{chunk-Y4PHT2HG.js → chunk-7LHXAEOZ.js} +4 -5
- package/dist/{chunk-PLIXVF7B.js → chunk-7TIIRJKF.js} +3 -4
- package/dist/{chunk-LZIHSJZR.js → chunk-CB3C7CRD.js} +4 -5
- package/dist/{chunk-G2KUXVU6.js → chunk-CTSYM56P.js} +30 -12
- package/dist/{chunk-2PAHQZZD.js → chunk-CVRN7YAI.js} +3 -4
- package/dist/{chunk-NW4SE5XW.js → chunk-DD4U42FG.js} +2 -3
- package/dist/{chunk-BAXJ7XHJ.js → chunk-E2MOFIDH.js} +3 -4
- package/dist/{chunk-WOMHL23C.js → chunk-ERS6SNA5.js} +1 -2
- package/dist/{chunk-4WH2ZN7P.js → chunk-F7E23E26.js} +0 -1
- package/dist/{chunk-DZ4LLQON.js → chunk-GZ3DQIIZ.js} +23 -2
- package/dist/{chunk-5WRI5ZAA.js → chunk-JSBRDJBE.js} +0 -1
- package/dist/{chunk-5A5AYP2C.js → chunk-K6CWKFHL.js} +0 -1
- package/dist/{chunk-52FJIDGL.js → chunk-LAN7U3AK.js} +1 -2
- package/dist/{chunk-WU6XXL3D.js → chunk-LLDLVVG4.js} +4 -5
- package/dist/{chunk-M3QDKKDF.js → chunk-LWM346FW.js} +0 -1
- package/dist/{chunk-7DGXUAPV.js → chunk-M25QJBDN.js} +4 -5
- package/dist/{chunk-7JLWZXPA.js → chunk-NDJO56BB.js} +3 -4
- package/dist/{chunk-AS3HR7AS.js → chunk-OBF6BIA2.js} +1 -2
- package/dist/{chunk-KIYUUSPK.js → chunk-OSPQFWQF.js} +2 -3
- package/dist/{chunk-4CEW64HO.js → chunk-OU2SW4U5.js} +3 -4
- package/dist/{chunk-H4TJ7X4O.js → chunk-QU6GQ657.js} +2 -3
- package/dist/{chunk-KFFETUAL.js → chunk-RR3XNDKG.js} +2 -3
- package/dist/{chunk-JVADRLWX.js → chunk-SHZZ2QRV.js} +2 -3
- package/dist/{chunk-7W3KY55G.js → chunk-TK3AXXXI.js} +3 -4
- package/dist/{chunk-OPZ2LVS2.js → chunk-TZQQYJYK.js} +0 -1
- package/dist/{chunk-7JJEIADR.js → chunk-UF7QPYUX.js} +299 -157
- package/dist/{chunk-NQPYMUDF.js → chunk-UKGBQTHL.js} +3 -4
- package/dist/{chunk-5XPPLTC7.js → chunk-UUMH3DC3.js} +1 -2
- package/dist/{chunk-TBUKJKY6.js → chunk-VJ3UA6OD.js} +1 -2
- package/dist/{chunk-OHCPV2NT.js → chunk-WHKPWIQO.js} +0 -1
- package/dist/{chunk-EZNCCO4L.js → chunk-YDLO5M7S.js} +0 -1
- package/dist/{components-BmievOxF.d.ts → components-JZQoO2sU.d.ts} +1 -1
- package/dist/cooldown.d.ts +1 -1
- package/dist/cooldown.js +3 -4
- package/dist/coordinators/boundary-ricochet-3d.d.ts +2 -2
- package/dist/coordinators/boundary-ricochet-3d.js +4 -5
- package/dist/coordinators/boundary-ricochet.d.ts +2 -2
- package/dist/coordinators/boundary-ricochet.js +4 -5
- package/dist/coordinators/first-person-shooter.js +4 -5
- package/dist/coordinators/multidirectional-space-shooter.d.ts +1 -1
- package/dist/coordinators/multidirectional-space-shooter.js +6 -7
- package/dist/coordinators/top-down-shooter.d.ts +1 -1
- package/dist/coordinators/top-down-shooter.js +6 -7
- package/dist/core.d.ts +21 -6
- package/dist/core.js +29 -7
- package/dist/destructible-3d.d.ts +1 -1
- package/dist/destructible-3d.js +4 -5
- package/dist/destructible-prebake.js +2 -3
- package/dist/{first-person-perspective-C9Mptl0-.d.ts → first-person-perspective-BxFHgFln.d.ts} +2 -0
- package/dist/first-person.d.ts +12 -3
- package/dist/first-person.js +7 -8
- package/dist/index.d.ts +5 -5
- package/dist/index.js +40 -41
- package/dist/jumper-2d.d.ts +1 -1
- package/dist/jumper-2d.js +5 -6
- package/dist/jumper-3d.d.ts +1 -1
- package/dist/jumper-3d.js +6 -7
- package/dist/{moveable-rdIvWiak.d.ts → moveable-BdFmI3s1.d.ts} +1 -1
- package/dist/particle-emitter/presets.d.ts +1 -1
- package/dist/particle-emitter/presets.js +2 -3
- package/dist/particle-emitter.d.ts +3 -3
- package/dist/particle-emitter.js +5 -6
- package/dist/platformer-2d.d.ts +1 -1
- package/dist/platformer-2d.js +5 -6
- package/dist/platformer-3d.d.ts +1 -1
- package/dist/platformer-3d.js +5 -6
- package/dist/ricochet-2d.d.ts +1 -1
- package/dist/ricochet-2d.js +5 -6
- package/dist/ricochet-3d.d.ts +1 -1
- package/dist/ricochet-3d.js +5 -6
- package/dist/runtime-2d.d.ts +1 -1
- package/dist/runtime-2d.js +2 -3
- package/dist/screen-visibility.d.ts +1 -1
- package/dist/screen-visibility.js +3 -4
- package/dist/screen-wrap.d.ts +1 -1
- package/dist/screen-wrap.js +5 -6
- package/dist/shooter-2d.d.ts +1 -1
- package/dist/shooter-2d.js +5 -6
- package/dist/{spark-Dx3cJbTW.d.ts → spark-C4Tp-52_.d.ts} +4 -2
- package/dist/thruster.d.ts +1 -1
- package/dist/thruster.js +5 -6
- package/dist/top-down-movement.d.ts +1 -1
- package/dist/top-down-movement.js +7 -8
- package/dist/world-boundary-2d.d.ts +1 -1
- package/dist/world-boundary-2d.js +6 -7
- package/dist/world-boundary-3d.d.ts +1 -1
- package/dist/world-boundary-3d.js +6 -7
- package/package.json +159 -161
- package/dist/chunk-2PAHQZZD.js.map +0 -1
- package/dist/chunk-4CEW64HO.js.map +0 -1
- package/dist/chunk-4LLK2FJI.js.map +0 -1
- package/dist/chunk-4MZ57HPD.js.map +0 -1
- package/dist/chunk-4WH2ZN7P.js.map +0 -1
- package/dist/chunk-52FJIDGL.js.map +0 -1
- package/dist/chunk-5A5AYP2C.js.map +0 -1
- package/dist/chunk-5WRI5ZAA.js.map +0 -1
- package/dist/chunk-5XPPLTC7.js.map +0 -1
- package/dist/chunk-7DGXUAPV.js.map +0 -1
- package/dist/chunk-7JJEIADR.js.map +0 -1
- package/dist/chunk-7JLWZXPA.js.map +0 -1
- package/dist/chunk-7W3KY55G.js.map +0 -1
- package/dist/chunk-AS3HR7AS.js.map +0 -1
- package/dist/chunk-BAXJ7XHJ.js.map +0 -1
- package/dist/chunk-DZ4LLQON.js.map +0 -1
- package/dist/chunk-EIWQM6U3.js.map +0 -1
- package/dist/chunk-EZNCCO4L.js.map +0 -1
- package/dist/chunk-G2KUXVU6.js.map +0 -1
- package/dist/chunk-H4TJ7X4O.js.map +0 -1
- package/dist/chunk-HZMY3TT4.js.map +0 -1
- package/dist/chunk-IZJFUAXB.js.map +0 -1
- package/dist/chunk-JVADRLWX.js.map +0 -1
- package/dist/chunk-KFFETUAL.js.map +0 -1
- package/dist/chunk-KIYUUSPK.js.map +0 -1
- package/dist/chunk-LL4FLHIY.js.map +0 -1
- package/dist/chunk-LZIHSJZR.js.map +0 -1
- package/dist/chunk-M3QDKKDF.js.map +0 -1
- package/dist/chunk-NQPYMUDF.js.map +0 -1
- package/dist/chunk-NW4SE5XW.js.map +0 -1
- package/dist/chunk-OHCPV2NT.js.map +0 -1
- package/dist/chunk-OPZ2LVS2.js.map +0 -1
- package/dist/chunk-PLIXVF7B.js.map +0 -1
- package/dist/chunk-QS3VXWVO.js.map +0 -1
- package/dist/chunk-QVCMJ4Q2.js.map +0 -1
- package/dist/chunk-SGHIGTVZ.js.map +0 -1
- package/dist/chunk-TBUKJKY6.js.map +0 -1
- package/dist/chunk-WOMHL23C.js.map +0 -1
- package/dist/chunk-WU6XXL3D.js.map +0 -1
- package/dist/chunk-Y4PHT2HG.js.map +0 -1
- package/dist/cooldown.js.map +0 -1
- package/dist/coordinators/boundary-ricochet-3d.js.map +0 -1
- package/dist/coordinators/boundary-ricochet.js.map +0 -1
- package/dist/coordinators/first-person-shooter.js.map +0 -1
- package/dist/coordinators/multidirectional-space-shooter.js.map +0 -1
- package/dist/coordinators/top-down-shooter.js.map +0 -1
- package/dist/core.js.map +0 -1
- package/dist/destructible-3d.js.map +0 -1
- package/dist/destructible-prebake.js.map +0 -1
- package/dist/first-person.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/jumper-2d.js.map +0 -1
- package/dist/jumper-3d.js.map +0 -1
- package/dist/particle-emitter/presets.js.map +0 -1
- package/dist/particle-emitter.js.map +0 -1
- package/dist/platformer-2d.js.map +0 -1
- package/dist/platformer-3d.js.map +0 -1
- package/dist/ricochet-2d.js.map +0 -1
- package/dist/ricochet-3d.js.map +0 -1
- package/dist/runtime-2d.js.map +0 -1
- package/dist/screen-visibility.js.map +0 -1
- package/dist/screen-wrap.js.map +0 -1
- package/dist/shooter-2d.js.map +0 -1
- package/dist/thruster.js.map +0 -1
- package/dist/top-down-movement.js.map +0 -1
- package/dist/world-boundary-2d.js.map +0 -1
- package/dist/world-boundary-3d.js.map +0 -1
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
|
|
7
7
|
// src/lib/behaviors/particle-emitter/gpu/particles.ts
|
|
8
8
|
import * as THREE3 from "three/webgpu";
|
|
9
|
-
import { texture as texture2, uniform
|
|
9
|
+
import { instancedArray, texture as texture2, uniform } from "three/tsl";
|
|
10
10
|
|
|
11
11
|
// src/lib/behaviors/particle-emitter/gpu/types.ts
|
|
12
12
|
var EASE_FUNCTIONS = [
|
|
@@ -128,7 +128,8 @@ import * as THREE2 from "three/webgpu";
|
|
|
128
128
|
import {
|
|
129
129
|
normalize,
|
|
130
130
|
max,
|
|
131
|
-
|
|
131
|
+
min,
|
|
132
|
+
varyingProperty,
|
|
132
133
|
If as If2,
|
|
133
134
|
distance,
|
|
134
135
|
Discard,
|
|
@@ -138,6 +139,7 @@ import {
|
|
|
138
139
|
instanceIndex,
|
|
139
140
|
vec3,
|
|
140
141
|
float as float2,
|
|
142
|
+
int,
|
|
141
143
|
mix,
|
|
142
144
|
vec4,
|
|
143
145
|
Fn as Fn2,
|
|
@@ -383,8 +385,89 @@ var easeInOutBack = /* @__PURE__ */ Fn(
|
|
|
383
385
|
);
|
|
384
386
|
var applyEasing = /* @__PURE__ */ Fn(
|
|
385
387
|
([t, easingId]) => {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
+
const result = t.toVar();
|
|
389
|
+
Switch(easingId).Case(0, () => {
|
|
390
|
+
result.assign(easeLinear(t));
|
|
391
|
+
}).Case(1, () => {
|
|
392
|
+
result.assign(easeInPower1(t));
|
|
393
|
+
}).Case(2, () => {
|
|
394
|
+
result.assign(easeOutPower1(t));
|
|
395
|
+
}).Case(3, () => {
|
|
396
|
+
result.assign(easeInOutPower1(t));
|
|
397
|
+
}).Case(4, () => {
|
|
398
|
+
result.assign(easeInPower2(t));
|
|
399
|
+
}).Case(5, () => {
|
|
400
|
+
result.assign(easeOutPower2(t));
|
|
401
|
+
}).Case(6, () => {
|
|
402
|
+
result.assign(easeInOutPower2(t));
|
|
403
|
+
}).Case(7, () => {
|
|
404
|
+
result.assign(easeInPower3(t));
|
|
405
|
+
}).Case(8, () => {
|
|
406
|
+
result.assign(easeOutPower3(t));
|
|
407
|
+
}).Case(9, () => {
|
|
408
|
+
result.assign(easeInOutPower3(t));
|
|
409
|
+
}).Case(10, () => {
|
|
410
|
+
result.assign(easeInPower4(t));
|
|
411
|
+
}).Case(11, () => {
|
|
412
|
+
result.assign(easeOutPower4(t));
|
|
413
|
+
}).Case(12, () => {
|
|
414
|
+
result.assign(easeInOutPower4(t));
|
|
415
|
+
}).Case(13, () => {
|
|
416
|
+
result.assign(easeInQuad(t));
|
|
417
|
+
}).Case(14, () => {
|
|
418
|
+
result.assign(easeOutQuad(t));
|
|
419
|
+
}).Case(15, () => {
|
|
420
|
+
result.assign(easeInOutQuad(t));
|
|
421
|
+
}).Case(16, () => {
|
|
422
|
+
result.assign(easeInCubic(t));
|
|
423
|
+
}).Case(17, () => {
|
|
424
|
+
result.assign(easeOutCubic(t));
|
|
425
|
+
}).Case(18, () => {
|
|
426
|
+
result.assign(easeInOutCubic(t));
|
|
427
|
+
}).Case(19, () => {
|
|
428
|
+
result.assign(easeInQuart(t));
|
|
429
|
+
}).Case(20, () => {
|
|
430
|
+
result.assign(easeOutQuart(t));
|
|
431
|
+
}).Case(21, () => {
|
|
432
|
+
result.assign(easeInOutQuart(t));
|
|
433
|
+
}).Case(22, () => {
|
|
434
|
+
result.assign(easeInQuint(t));
|
|
435
|
+
}).Case(23, () => {
|
|
436
|
+
result.assign(easeOutQuint(t));
|
|
437
|
+
}).Case(24, () => {
|
|
438
|
+
result.assign(easeInOutQuint(t));
|
|
439
|
+
}).Case(25, () => {
|
|
440
|
+
result.assign(easeInSine(t));
|
|
441
|
+
}).Case(26, () => {
|
|
442
|
+
result.assign(easeOutSine(t));
|
|
443
|
+
}).Case(27, () => {
|
|
444
|
+
result.assign(easeInOutSine(t));
|
|
445
|
+
}).Case(28, () => {
|
|
446
|
+
result.assign(easeInExpo(t));
|
|
447
|
+
}).Case(29, () => {
|
|
448
|
+
result.assign(easeOutExpo(t));
|
|
449
|
+
}).Case(30, () => {
|
|
450
|
+
result.assign(easeInOutExpo(t));
|
|
451
|
+
}).Case(31, () => {
|
|
452
|
+
result.assign(easeInCirc(t));
|
|
453
|
+
}).Case(32, () => {
|
|
454
|
+
result.assign(easeOutCirc(t));
|
|
455
|
+
}).Case(33, () => {
|
|
456
|
+
result.assign(easeInOutCirc(t));
|
|
457
|
+
}).Case(34, () => {
|
|
458
|
+
result.assign(easeInElastic(t));
|
|
459
|
+
}).Case(35, () => {
|
|
460
|
+
result.assign(easeOutElastic(t));
|
|
461
|
+
}).Case(36, () => {
|
|
462
|
+
result.assign(easeInOutElastic(t));
|
|
463
|
+
}).Case(37, () => {
|
|
464
|
+
result.assign(easeInBack(t));
|
|
465
|
+
}).Case(38, () => {
|
|
466
|
+
result.assign(easeOutBack(t));
|
|
467
|
+
}).Case(39, () => {
|
|
468
|
+
result.assign(easeInOutBack(t));
|
|
469
|
+
});
|
|
470
|
+
return result;
|
|
388
471
|
},
|
|
389
472
|
{ t: "float", easingId: "int", return: "float" }
|
|
390
473
|
);
|
|
@@ -393,26 +476,25 @@ var applyEasing = /* @__PURE__ */ Fn(
|
|
|
393
476
|
var idx7 = instanceIndex.mul(7);
|
|
394
477
|
var idx3 = instanceIndex.mul(3);
|
|
395
478
|
var idx2 = instanceIndex.mul(2);
|
|
396
|
-
var vProgress = varying(float2(0), "vProgress");
|
|
397
479
|
var positionNode = /* @__PURE__ */ Fn2(
|
|
398
|
-
([pos, age, duration,
|
|
480
|
+
([pos, age, duration, vProgress, uGravity, dir, speed, worldUpRight, easingIndex]) => {
|
|
399
481
|
const progress = age.div(duration);
|
|
400
482
|
const _pos = vec3(pos);
|
|
401
483
|
If2(progress.lessThan(0).or(progress.greaterThan(1)), () => {
|
|
402
|
-
|
|
484
|
+
vProgress.assign(1);
|
|
403
485
|
_pos.assign(vec3(0, 9999, 0));
|
|
404
486
|
}).Else(() => {
|
|
405
|
-
|
|
487
|
+
vProgress.assign(applyEasing(progress, easingIndex));
|
|
406
488
|
const normalizedDirection = select2(length(dir).greaterThan(0), normalize(dir), vec3(0));
|
|
407
489
|
const gravityForce = uGravity.mul(0.5).mul(age.mul(age));
|
|
408
|
-
const easedAge =
|
|
490
|
+
const easedAge = vProgress.mul(duration);
|
|
409
491
|
const offset = normalizedDirection.mul(easedAge).mul(speed).add(gravityForce);
|
|
410
492
|
If2(worldUpRight, () => {
|
|
411
493
|
const m = mat3(modelWorldMatrix);
|
|
412
494
|
const rot = mat3(normalize(m[0]), normalize(m[1]), normalize(m[2]));
|
|
413
495
|
const inverseRotation = transpose(rot);
|
|
414
496
|
const worldOffset = inverseRotation.mul(offset);
|
|
415
|
-
const blendedOffset = mix(offset, worldOffset,
|
|
497
|
+
const blendedOffset = mix(offset, worldOffset, vProgress);
|
|
416
498
|
_pos.addAssign(blendedOffset);
|
|
417
499
|
}).Else(() => {
|
|
418
500
|
_pos.addAssign(offset);
|
|
@@ -428,9 +510,13 @@ var rotationNode = /* @__PURE__ */ Fn2(([rot, rotSpeed, age]) => {
|
|
|
428
510
|
const wrapped = angle.mod(tau);
|
|
429
511
|
return wrapped.add(tau).mod(tau);
|
|
430
512
|
});
|
|
431
|
-
var scaleNode = /* @__PURE__ */ Fn2(([fadeSize, scale,
|
|
513
|
+
var scaleNode = /* @__PURE__ */ Fn2(([fadeSize, scale, vProgress]) => {
|
|
432
514
|
const uFadeSize = vec2(fadeSize[0], fadeSize[1]).toVar();
|
|
433
|
-
|
|
515
|
+
const fadeInEnd = min(max(uFadeSize.x, 1e-4), 0.9999);
|
|
516
|
+
const fadeOutStart = min(max(uFadeSize.y, 1e-4), 0.9999);
|
|
517
|
+
const fadeIn = smoothstep(0, fadeInEnd, vProgress);
|
|
518
|
+
const fadeOut = float2(1).sub(smoothstep(fadeOutStart, 1, vProgress));
|
|
519
|
+
return fadeIn.mul(fadeOut).mul(scale);
|
|
434
520
|
});
|
|
435
521
|
var colorNode = /* @__PURE__ */ Fn2(
|
|
436
522
|
([
|
|
@@ -438,7 +524,7 @@ var colorNode = /* @__PURE__ */ Fn2(
|
|
|
438
524
|
intensity,
|
|
439
525
|
fadeAlpha,
|
|
440
526
|
fadeAlphaMap,
|
|
441
|
-
|
|
527
|
+
vProgress,
|
|
442
528
|
uColorGradient,
|
|
443
529
|
uAlphaMapCount,
|
|
444
530
|
vAlphaMapUVOffsetX,
|
|
@@ -450,13 +536,15 @@ var colorNode = /* @__PURE__ */ Fn2(
|
|
|
450
536
|
const uIntensity = float2(intensity).toVar();
|
|
451
537
|
const uFadeAlpha = vec2(fadeAlpha[0], fadeAlpha[1]).toVar();
|
|
452
538
|
const uFadeAlphaMap = vec2(fadeAlphaMap[0], fadeAlphaMap[1]).toVar();
|
|
453
|
-
const u =
|
|
539
|
+
const u = vProgress;
|
|
454
540
|
const v = vColorGradientRow.add(0.5).div(max(uColorGradientRows, 1));
|
|
455
541
|
const finalColor = uColorGradient.sample(vec2(u, v)).rgb;
|
|
456
542
|
finalColor.mulAssign(uIntensity);
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
);
|
|
543
|
+
const fadeInEnd = min(max(uFadeAlpha.x, 1e-4), 0.9999);
|
|
544
|
+
const fadeOutStart = min(max(uFadeAlpha.y, 1e-4), 0.9999);
|
|
545
|
+
const fadeIn = smoothstep(0, fadeInEnd, vProgress);
|
|
546
|
+
const fadeOut = float2(1).sub(smoothstep(fadeOutStart, 1, vProgress));
|
|
547
|
+
const alpha = fadeIn.mul(fadeOut);
|
|
460
548
|
const vUv = uv();
|
|
461
549
|
If2(uAlphaMapCount.equal(0), () => {
|
|
462
550
|
const center = vec2(0.5).toVar();
|
|
@@ -474,7 +562,7 @@ var colorNode = /* @__PURE__ */ Fn2(
|
|
|
474
562
|
const endU = vAlphaMapUVOffsetY.add(vUv.x).div(uAlphaMapCount);
|
|
475
563
|
const endUV = vec2(endU, vUv.y);
|
|
476
564
|
const endAlpha = alphaMap.sample(endUV).a;
|
|
477
|
-
const morphProgress = smoothstep(uFadeAlphaMap.x, uFadeAlphaMap.y,
|
|
565
|
+
const morphProgress = smoothstep(uFadeAlphaMap.x, uFadeAlphaMap.y, vProgress);
|
|
478
566
|
const morphedAlpha = mix(startAlpha, endAlpha, morphProgress);
|
|
479
567
|
alpha.assign(morphedAlpha.mul(alpha));
|
|
480
568
|
}).Else(() => {
|
|
@@ -484,115 +572,158 @@ var colorNode = /* @__PURE__ */ Fn2(
|
|
|
484
572
|
return vec4(finalColor, alpha);
|
|
485
573
|
}
|
|
486
574
|
);
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
function
|
|
575
|
+
function createInstancePositionNode(ctx, vProgress) {
|
|
576
|
+
return new class extends THREE2.Node {
|
|
577
|
+
constructor() {
|
|
578
|
+
super("vec3");
|
|
579
|
+
this.updateType = THREE2.NodeUpdateType.NONE;
|
|
580
|
+
}
|
|
581
|
+
setup() {
|
|
582
|
+
const { attributes, uniforms, config, easingIndex } = ctx;
|
|
583
|
+
const uPosition = uniforms.uPosition;
|
|
584
|
+
const _static = float2(config.emitter.static).toVar();
|
|
585
|
+
const pos = vec3(
|
|
586
|
+
attributes.instance.element(idx7.add(0)),
|
|
587
|
+
attributes.instance.element(idx7.add(1)),
|
|
588
|
+
attributes.instance.element(idx7.add(2))
|
|
589
|
+
).add(uPosition.mul(_static));
|
|
590
|
+
const dir = vec3(
|
|
591
|
+
attributes.instanceDirection.element(idx3.add(0)),
|
|
592
|
+
attributes.instanceDirection.element(idx3.add(1)),
|
|
593
|
+
attributes.instanceDirection.element(idx3.add(2))
|
|
594
|
+
);
|
|
595
|
+
const time = uniforms.uTime;
|
|
596
|
+
const uGravity = vec3(...config.particles.gravity);
|
|
597
|
+
const worldUpRight = bool(config.emitter.worldUpRight);
|
|
598
|
+
const startTime = attributes.instanceLifetime.element(idx2.add(0));
|
|
599
|
+
const duration = attributes.instanceLifetime.element(idx2.add(1));
|
|
600
|
+
const speed = attributes.instanceSpeed.element(instanceIndex).toVar();
|
|
601
|
+
const age = select2(
|
|
602
|
+
speed.lessThan(0),
|
|
603
|
+
duration.sub(time.sub(startTime)),
|
|
604
|
+
time.sub(startTime)
|
|
605
|
+
);
|
|
606
|
+
return positionNode(
|
|
607
|
+
pos,
|
|
608
|
+
age,
|
|
609
|
+
duration,
|
|
610
|
+
vProgress,
|
|
611
|
+
uGravity,
|
|
612
|
+
dir,
|
|
613
|
+
speed,
|
|
614
|
+
worldUpRight,
|
|
615
|
+
int(easingIndex)
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
}();
|
|
619
|
+
}
|
|
620
|
+
function createInstanceRotationNode(ctx) {
|
|
621
|
+
return new class extends THREE2.Node {
|
|
622
|
+
constructor() {
|
|
623
|
+
super("float");
|
|
624
|
+
this.updateType = THREE2.NodeUpdateType.NONE;
|
|
625
|
+
}
|
|
626
|
+
setup() {
|
|
627
|
+
const { attributes, uniforms } = ctx;
|
|
628
|
+
const rot = vec3(
|
|
629
|
+
attributes.instance.element(idx7.add(3)),
|
|
630
|
+
attributes.instance.element(idx7.add(4)),
|
|
631
|
+
attributes.instance.element(idx7.add(5))
|
|
632
|
+
);
|
|
633
|
+
const rotSpeed = vec3(
|
|
634
|
+
attributes.instanceRotationSpeed.element(idx3.add(0)),
|
|
635
|
+
attributes.instanceRotationSpeed.element(idx3.add(1)),
|
|
636
|
+
attributes.instanceRotationSpeed.element(idx3.add(2))
|
|
637
|
+
);
|
|
638
|
+
const time = uniforms.uTime;
|
|
639
|
+
const startTime = attributes.instanceLifetime.element(idx2.add(0));
|
|
640
|
+
const duration = attributes.instanceLifetime.element(idx2.add(1));
|
|
641
|
+
const speed = attributes.instanceSpeed.element(instanceIndex).toVar();
|
|
642
|
+
const age = select2(
|
|
643
|
+
speed.lessThan(0),
|
|
644
|
+
duration.sub(time.sub(startTime)),
|
|
645
|
+
time.sub(startTime)
|
|
646
|
+
);
|
|
647
|
+
return rotationNode(rot, rotSpeed, age);
|
|
648
|
+
}
|
|
649
|
+
}();
|
|
650
|
+
}
|
|
651
|
+
function createInstanceScaleNode(ctx, vProgress) {
|
|
652
|
+
return new class extends THREE2.Node {
|
|
653
|
+
constructor() {
|
|
654
|
+
super("float");
|
|
655
|
+
this.updateType = THREE2.NodeUpdateType.NONE;
|
|
656
|
+
}
|
|
657
|
+
setup() {
|
|
658
|
+
const { attributes, config } = ctx;
|
|
659
|
+
const scale = attributes.instance.element(idx7.add(6));
|
|
660
|
+
return scaleNode(config.particles.fadeSize, scale, vProgress);
|
|
661
|
+
}
|
|
662
|
+
}();
|
|
663
|
+
}
|
|
664
|
+
function createInstanceColorNode(ctx, vProgress) {
|
|
665
|
+
return new class extends THREE2.Node {
|
|
666
|
+
constructor() {
|
|
667
|
+
super("vec4");
|
|
668
|
+
this.updateType = THREE2.NodeUpdateType.NONE;
|
|
669
|
+
}
|
|
670
|
+
setup() {
|
|
671
|
+
const { attributes, uniforms, config, alphaMapCount } = ctx;
|
|
672
|
+
const uAlphaMapCount = uint(alphaMapCount).toVar();
|
|
673
|
+
return colorNode(
|
|
674
|
+
config.particles.colors,
|
|
675
|
+
config.particles.intensity,
|
|
676
|
+
config.particles.fadeAlpha,
|
|
677
|
+
config.particles.fadeAlphaMap,
|
|
678
|
+
vProgress,
|
|
679
|
+
uniforms.uColorGradient,
|
|
680
|
+
uAlphaMapCount,
|
|
681
|
+
attributes.instanceAlphaMapUVOffset.element(idx2.add(0)),
|
|
682
|
+
attributes.instanceAlphaMapUVOffset.element(idx2.add(1)),
|
|
683
|
+
uniforms.alphaMap
|
|
684
|
+
);
|
|
685
|
+
}
|
|
686
|
+
}();
|
|
687
|
+
}
|
|
688
|
+
var particleMaterialCounter = 0;
|
|
689
|
+
function createParticleMaterialTemplate(ctx) {
|
|
690
|
+
const materialId = particleMaterialCounter++;
|
|
691
|
+
const vProgress = varyingProperty("float", `vProgress_${materialId}`);
|
|
577
692
|
const mat = new THREE2.SpriteNodeMaterial();
|
|
578
|
-
mat.positionNode =
|
|
579
|
-
mat.rotationNode =
|
|
580
|
-
mat.scaleNode =
|
|
581
|
-
mat.colorNode =
|
|
693
|
+
mat.positionNode = createInstancePositionNode(ctx, vProgress);
|
|
694
|
+
mat.rotationNode = createInstanceRotationNode(ctx);
|
|
695
|
+
mat.scaleNode = createInstanceScaleNode(ctx, vProgress);
|
|
696
|
+
mat.colorNode = createInstanceColorNode(ctx, vProgress);
|
|
582
697
|
return mat;
|
|
583
698
|
}
|
|
584
699
|
|
|
585
700
|
// src/lib/behaviors/particle-emitter/gpu/utils.ts
|
|
586
|
-
function randFloat(
|
|
587
|
-
return Math.random() * (max2 -
|
|
701
|
+
function randFloat(min2, max2) {
|
|
702
|
+
return Math.random() * (max2 - min2) + min2;
|
|
588
703
|
}
|
|
589
|
-
function randInt(
|
|
590
|
-
return Math.floor(Math.random() * (max2 -
|
|
704
|
+
function randInt(min2, max2) {
|
|
705
|
+
return Math.floor(Math.random() * (max2 - min2 + 1)) + min2;
|
|
591
706
|
}
|
|
592
707
|
|
|
593
708
|
// src/lib/behaviors/particle-emitter/gpu/particles.ts
|
|
709
|
+
function markStorageDirty(node) {
|
|
710
|
+
if (node.value) {
|
|
711
|
+
node.value.needsUpdate = true;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
function createWhiteCanvasTexture() {
|
|
715
|
+
const canvas = document.createElement("canvas");
|
|
716
|
+
canvas.width = 1;
|
|
717
|
+
canvas.height = 1;
|
|
718
|
+
const ctx = canvas.getContext("2d");
|
|
719
|
+
ctx.fillStyle = "#ffffff";
|
|
720
|
+
ctx.fillRect(0, 0, 1, 1);
|
|
721
|
+
const tex = new THREE3.CanvasTexture(canvas);
|
|
722
|
+
tex.needsUpdate = true;
|
|
723
|
+
return tex;
|
|
724
|
+
}
|
|
594
725
|
var Particles = class extends THREE3.Object3D {
|
|
595
|
-
|
|
726
|
+
sprite;
|
|
596
727
|
/** Base object for positioning the emitter. */
|
|
597
728
|
base;
|
|
598
729
|
debugMesh;
|
|
@@ -607,10 +738,11 @@ var Particles = class extends THREE3.Object3D {
|
|
|
607
738
|
cursor = 0;
|
|
608
739
|
/** Whether the particle system is currently running. */
|
|
609
740
|
running = false;
|
|
610
|
-
constructor(config,
|
|
741
|
+
constructor(config, _geometry) {
|
|
611
742
|
super();
|
|
612
743
|
this.name = "Particles";
|
|
613
744
|
this.type = "Particles";
|
|
745
|
+
this.frustumCulled = false;
|
|
614
746
|
this.base = new THREE3.Object3D();
|
|
615
747
|
this.base.name = "Base";
|
|
616
748
|
this.add(this.base);
|
|
@@ -640,7 +772,7 @@ var Particles = class extends THREE3.Object3D {
|
|
|
640
772
|
render: {
|
|
641
773
|
alphaMapSize: r.alphaMapSize ?? 256,
|
|
642
774
|
alphaMapFilter: r.alphaMapFilter ?? THREE3.LinearFilter,
|
|
643
|
-
frustumCulled: r.frustumCulled ??
|
|
775
|
+
frustumCulled: r.frustumCulled ?? false,
|
|
644
776
|
blendingMode: r.blendingMode ?? THREE3.AdditiveBlending,
|
|
645
777
|
side: r.side ?? THREE3.FrontSide,
|
|
646
778
|
depthTest: r.depthTest ?? true
|
|
@@ -684,8 +816,7 @@ var Particles = class extends THREE3.Object3D {
|
|
|
684
816
|
this.config.render.alphaMapFilter
|
|
685
817
|
);
|
|
686
818
|
} else {
|
|
687
|
-
|
|
688
|
-
atlas = new THREE3.CanvasTexture(canvas);
|
|
819
|
+
atlas = createWhiteCanvasTexture();
|
|
689
820
|
}
|
|
690
821
|
const colorGradientTexture = createColorGradientTexture(this.config.particles.colors, 128);
|
|
691
822
|
this.uniforms = {
|
|
@@ -696,7 +827,6 @@ var Particles = class extends THREE3.Object3D {
|
|
|
696
827
|
alphaMap: texture2(atlas),
|
|
697
828
|
uColorGradient: texture2(colorGradientTexture)
|
|
698
829
|
};
|
|
699
|
-
const defaultGeometry = geometry ?? new THREE3.PlaneGeometry(0.5, 0.5);
|
|
700
830
|
const count = this.config.particles.count;
|
|
701
831
|
this.buffers = {
|
|
702
832
|
instanceLifetime: new Float32Array(count * 2),
|
|
@@ -715,19 +845,20 @@ var Particles = class extends THREE3.Object3D {
|
|
|
715
845
|
instanceSpeed: instancedArray(this.buffers.instanceSpeed, "float")
|
|
716
846
|
};
|
|
717
847
|
this.material = this.createMaterial();
|
|
718
|
-
this.
|
|
719
|
-
this.
|
|
848
|
+
this.sprite = new THREE3.Sprite(this.material);
|
|
849
|
+
this.sprite.count = count;
|
|
850
|
+
this.sprite.renderOrder = 10;
|
|
851
|
+
this.add(this.sprite);
|
|
852
|
+
this.sprite.frustumCulled = this.config.render.frustumCulled ?? false;
|
|
853
|
+
}
|
|
854
|
+
createMaterial() {
|
|
855
|
+
const _mat = createParticleMaterialTemplate({
|
|
720
856
|
attributes: this.attributes,
|
|
721
857
|
uniforms: this.uniforms,
|
|
722
858
|
config: this.config,
|
|
723
859
|
alphaMapCount: this.alphaMapCount,
|
|
724
860
|
easingIndex: this.easingIndex
|
|
725
|
-
};
|
|
726
|
-
this.add(this.mesh);
|
|
727
|
-
this.mesh.frustumCulled = this.config.render.frustumCulled ?? false;
|
|
728
|
-
}
|
|
729
|
-
createMaterial() {
|
|
730
|
-
const _mat = createParticleMaterialTemplate();
|
|
861
|
+
});
|
|
731
862
|
_mat.blending = this.config.render.blendingMode;
|
|
732
863
|
_mat.premultipliedAlpha = this.config.render.blendingMode === THREE3.SubtractiveBlending || this.config.render.blendingMode === THREE3.MultiplyBlending;
|
|
733
864
|
_mat.depthWrite = false;
|
|
@@ -743,8 +874,21 @@ var Particles = class extends THREE3.Object3D {
|
|
|
743
874
|
this.cursor = 0;
|
|
744
875
|
this.emitted = 0;
|
|
745
876
|
this.visible = true;
|
|
746
|
-
this.
|
|
747
|
-
this.
|
|
877
|
+
this.sprite.visible = true;
|
|
878
|
+
this.resetDeadSlots();
|
|
879
|
+
this.markAllStorageDirty();
|
|
880
|
+
this._update();
|
|
881
|
+
}
|
|
882
|
+
resetDeadSlots() {
|
|
883
|
+
const count = this.config.particles.count;
|
|
884
|
+
const lifetime = this.buffers.instanceLifetime;
|
|
885
|
+
const speed = this.buffers.instanceSpeed;
|
|
886
|
+
for (let i = 0; i < count; i++) {
|
|
887
|
+
const i2 = i * 2;
|
|
888
|
+
lifetime[i2] = 0;
|
|
889
|
+
lifetime[i2 + 1] = 1e-4;
|
|
890
|
+
speed[i] = -1;
|
|
891
|
+
}
|
|
748
892
|
}
|
|
749
893
|
/** Restarts (alias for start). */
|
|
750
894
|
restart() {
|
|
@@ -758,13 +902,13 @@ var Particles = class extends THREE3.Object3D {
|
|
|
758
902
|
resume() {
|
|
759
903
|
this.running = true;
|
|
760
904
|
this.visible = true;
|
|
761
|
-
this.
|
|
905
|
+
this.sprite.visible = true;
|
|
762
906
|
}
|
|
763
907
|
/** Stops the particle system and hides it. */
|
|
764
908
|
stop() {
|
|
765
909
|
this.running = false;
|
|
766
910
|
this.visible = false;
|
|
767
|
-
this.
|
|
911
|
+
this.sprite.visible = false;
|
|
768
912
|
}
|
|
769
913
|
/** Whether emission loops continuously. */
|
|
770
914
|
get looping() {
|
|
@@ -783,16 +927,21 @@ var Particles = class extends THREE3.Object3D {
|
|
|
783
927
|
}
|
|
784
928
|
/** Updates the particle system. Call each frame. */
|
|
785
929
|
update(delta) {
|
|
786
|
-
this.
|
|
930
|
+
this.sprite.visible = this.visible;
|
|
787
931
|
if (!this.running) return;
|
|
788
932
|
this._update();
|
|
789
933
|
this.uniforms.uTime.value += delta;
|
|
790
934
|
}
|
|
935
|
+
markAllStorageDirty() {
|
|
936
|
+
for (const attr of Object.values(this.attributes)) {
|
|
937
|
+
markStorageDirty(attr);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
791
940
|
_compute(i) {
|
|
792
941
|
const { emitter } = this.config;
|
|
793
942
|
const pos = this.uniforms.uPosition.value;
|
|
794
943
|
const dynamicFactor = 1 - emitter.static;
|
|
795
|
-
const inst = this.
|
|
944
|
+
const inst = this.buffers.instance;
|
|
796
945
|
const i7 = i * 7;
|
|
797
946
|
inst[i7 + 0] = randFloat(emitter.startPositionMin[0], emitter.startPositionMax[0]) + pos.x * dynamicFactor;
|
|
798
947
|
inst[i7 + 1] = randFloat(emitter.startPositionMin[1], emitter.startPositionMax[1]) + pos.y * dynamicFactor;
|
|
@@ -802,16 +951,16 @@ var Particles = class extends THREE3.Object3D {
|
|
|
802
951
|
inst[i7 + 5] = randFloat(emitter.startRotationMin[2], emitter.startRotationMax[2]);
|
|
803
952
|
inst[i7 + 6] = randFloat(emitter.size[0], emitter.size[1]);
|
|
804
953
|
const i3 = i * 3;
|
|
805
|
-
const dir = this.
|
|
954
|
+
const dir = this.buffers.instanceDirection;
|
|
806
955
|
dir[i3 + 0] = randFloat(emitter.directionMin[0], emitter.directionMax[0]);
|
|
807
956
|
dir[i3 + 1] = randFloat(emitter.directionMin[1], emitter.directionMax[1]);
|
|
808
957
|
dir[i3 + 2] = randFloat(emitter.directionMin[2], emitter.directionMax[2]);
|
|
809
|
-
const rotSpeed = this.
|
|
958
|
+
const rotSpeed = this.buffers.instanceRotationSpeed;
|
|
810
959
|
rotSpeed[i3 + 0] = randFloat(emitter.rotationSpeedMin[0], emitter.rotationSpeedMax[0]);
|
|
811
960
|
rotSpeed[i3 + 1] = randFloat(emitter.rotationSpeedMin[1], emitter.rotationSpeedMax[1]);
|
|
812
961
|
rotSpeed[i3 + 2] = randFloat(emitter.rotationSpeedMin[2], emitter.rotationSpeedMax[2]);
|
|
813
962
|
const i2 = i * 2;
|
|
814
|
-
const lifetime = this.
|
|
963
|
+
const lifetime = this.buffers.instanceLifetime;
|
|
815
964
|
lifetime[i2 + 0] = this.uniforms.uTime.value;
|
|
816
965
|
lifetime[i2 + 1] = randFloat(emitter.lifetime[0], emitter.lifetime[1]);
|
|
817
966
|
const startCount = this.config.particles.alphaMapsStart?.length ?? 0;
|
|
@@ -823,10 +972,10 @@ var Particles = class extends THREE3.Object3D {
|
|
|
823
972
|
} else if (startCount > 0) {
|
|
824
973
|
endIdx = randInt(0, startCount - 1);
|
|
825
974
|
}
|
|
826
|
-
const alphaOffset = this.
|
|
975
|
+
const alphaOffset = this.buffers.instanceAlphaMapUVOffset;
|
|
827
976
|
alphaOffset[i2 + 0] = startIdx;
|
|
828
977
|
alphaOffset[i2 + 1] = endIdx;
|
|
829
|
-
this.
|
|
978
|
+
this.buffers.instanceSpeed[i] = randFloat(emitter.speed[0], emitter.speed[1]);
|
|
830
979
|
}
|
|
831
980
|
_update() {
|
|
832
981
|
const loop = this.config.emitter.loop;
|
|
@@ -849,12 +998,7 @@ var Particles = class extends THREE3.Object3D {
|
|
|
849
998
|
for (let _i = this.cursor; _i < this.cursor + rate; _i++) {
|
|
850
999
|
this._compute(_i % maxParticlesTotal);
|
|
851
1000
|
}
|
|
852
|
-
this.
|
|
853
|
-
this.attributes.instanceDirection.value.needsUpdate = true;
|
|
854
|
-
this.attributes.instanceRotationSpeed.value.needsUpdate = true;
|
|
855
|
-
this.attributes.instanceLifetime.value.needsUpdate = true;
|
|
856
|
-
this.attributes.instanceAlphaMapUVOffset.value.needsUpdate = true;
|
|
857
|
-
this.attributes.instanceSpeed.value.needsUpdate = true;
|
|
1001
|
+
this.markAllStorageDirty();
|
|
858
1002
|
if (spawnMode === "time") {
|
|
859
1003
|
this.cursor += rate;
|
|
860
1004
|
this.cursor = this.cursor % maxParticlesTotal;
|
|
@@ -870,7 +1014,6 @@ var Particles = class extends THREE3.Object3D {
|
|
|
870
1014
|
/** Disposes of all resources used by the particle system. */
|
|
871
1015
|
dispose() {
|
|
872
1016
|
this.stop();
|
|
873
|
-
this.mesh.geometry.dispose();
|
|
874
1017
|
this.material.dispose();
|
|
875
1018
|
}
|
|
876
1019
|
};
|
|
@@ -1055,8 +1198,8 @@ function deriveFadeFromSizeCurve(points) {
|
|
|
1055
1198
|
function forceToGravity(force) {
|
|
1056
1199
|
const mid = (range2) => {
|
|
1057
1200
|
if (range2 === void 0) return 0;
|
|
1058
|
-
const [
|
|
1059
|
-
return (
|
|
1201
|
+
const [min2, max2] = toRange(range2);
|
|
1202
|
+
return (min2 + max2) * 0.5;
|
|
1060
1203
|
};
|
|
1061
1204
|
return [mid(force.x), mid(force.y), mid(force.z)];
|
|
1062
1205
|
}
|
|
@@ -1089,13 +1232,13 @@ function rotationToStart(rotation) {
|
|
|
1089
1232
|
if (rotation === void 0) {
|
|
1090
1233
|
return { min: [0, 0, 0], max: [0, 0, 0] };
|
|
1091
1234
|
}
|
|
1092
|
-
const [
|
|
1235
|
+
const [min2, max2] = toRange(rotation);
|
|
1093
1236
|
const norm = (theta) => theta / Math.PI - 1;
|
|
1094
|
-
return { min: [0, 0, norm(
|
|
1237
|
+
return { min: [0, 0, norm(min2)], max: [0, 0, norm(max2)] };
|
|
1095
1238
|
}
|
|
1096
1239
|
function rangeToRotationSpeedZ(rotation) {
|
|
1097
|
-
const [
|
|
1098
|
-
return { min: [0, 0,
|
|
1240
|
+
const [min2, max2] = toRange(rotation);
|
|
1241
|
+
return { min: [0, 0, min2], max: [0, 0, max2] };
|
|
1099
1242
|
}
|
|
1100
1243
|
function toGpuColorStop(color, stop) {
|
|
1101
1244
|
return { color: toHexColor(color), stop };
|
|
@@ -1297,8 +1440,8 @@ function mixColors(base, overlay, amount) {
|
|
|
1297
1440
|
color.lerp(new Color(overlay), clamp(amount, 0, 1));
|
|
1298
1441
|
return `#${color.getHexString()}`;
|
|
1299
1442
|
}
|
|
1300
|
-
function clamp(value,
|
|
1301
|
-
return Math.min(Math.max(value,
|
|
1443
|
+
function clamp(value, min2, max2) {
|
|
1444
|
+
return Math.min(Math.max(value, min2), max2);
|
|
1302
1445
|
}
|
|
1303
1446
|
|
|
1304
1447
|
// src/lib/behaviors/particle-emitter/presets/electricity/arc.ts
|
|
@@ -2628,4 +2771,3 @@ export {
|
|
|
2628
2771
|
magicPresets,
|
|
2629
2772
|
waterPresets
|
|
2630
2773
|
};
|
|
2631
|
-
//# sourceMappingURL=chunk-7JJEIADR.js.map
|