@minicode-dev/chat 0.1.12 → 0.1.14
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 +112 -5
- package/README.md +401 -309
- package/assets/sounds/effects/avalanche.mp3 +0 -0
- package/assets/sounds/racing/car_boost.mp3 +0 -0
- package/assets/sounds/racing/car_boost.ogg +0 -0
- package/assets/sounds/racing/car_bump.mp3 +0 -0
- package/assets/sounds/racing/car_bump.ogg +0 -0
- package/assets/sounds/racing/car_drift_loop.mp3 +0 -0
- package/assets/sounds/racing/car_drift_loop.ogg +0 -0
- package/assets/sounds/racing/car_engine_loop.mp3 +0 -0
- package/assets/sounds/racing/car_engine_loop.ogg +0 -0
- package/assets/sounds/racing/car_engine_start.mp3 +0 -0
- package/assets/sounds/racing/car_engine_start.ogg +0 -0
- package/assets/sounds/racing/countdown_beep.mp3 +0 -0
- package/assets/sounds/racing/countdown_beep.ogg +0 -0
- package/assets/sounds/racing/countdown_go.mp3 +0 -0
- package/assets/sounds/racing/countdown_go.ogg +0 -0
- package/assets/sounds/racing/final_lap.mp3 +0 -0
- package/assets/sounds/racing/final_lap.ogg +0 -0
- package/assets/sounds/racing/finish_line.mp3 +0 -0
- package/assets/sounds/racing/finish_line.ogg +0 -0
- package/assets/sounds/racing/lap_complete.mp3 +0 -0
- package/assets/sounds/racing/lap_complete.ogg +0 -0
- package/assets/sounds/racing/music_circuit.mp3 +0 -0
- package/assets/sounds/racing/music_circuit.ogg +0 -0
- package/assets/sounds/racing/music_final_lap.mp3 +0 -0
- package/assets/sounds/racing/music_final_lap.ogg +0 -0
- package/assets/sounds/racing/race_defeat.mp3 +0 -0
- package/assets/sounds/racing/race_defeat.ogg +0 -0
- package/assets/sounds/racing/race_victory.mp3 +0 -0
- package/assets/sounds/racing/race_victory.ogg +0 -0
- package/assets/sounds/tanks/barrel_explode.mp3 +0 -0
- package/assets/sounds/tanks/barrel_explode.ogg +0 -0
- package/assets/sounds/tanks/crate_break.mp3 +0 -0
- package/assets/sounds/tanks/crate_break.ogg +0 -0
- package/assets/sounds/tanks/health_pickup.mp3 +0 -0
- package/assets/sounds/tanks/health_pickup.ogg +0 -0
- package/assets/sounds/tanks/last_life.mp3 +0 -0
- package/assets/sounds/tanks/last_life.ogg +0 -0
- package/assets/sounds/tanks/life_lost.mp3 +0 -0
- package/assets/sounds/tanks/life_lost.ogg +0 -0
- package/assets/sounds/tanks/respawn.mp3 +0 -0
- package/assets/sounds/tanks/respawn.ogg +0 -0
- package/assets/sounds/tanks/shield_end.mp3 +0 -0
- package/assets/sounds/tanks/shield_end.ogg +0 -0
- package/assets/sounds/tanks/shield_loop.mp3 +0 -0
- package/assets/sounds/tanks/shield_loop.ogg +0 -0
- package/assets/sounds/tanks/wall_hit.mp3 +0 -0
- package/assets/sounds/tanks/wall_hit.ogg +0 -0
- package/dist/chunks/{BattleshipGameCard-iRk8d4vR.js → BattleshipGameCard-B-B4r7lK.js} +146 -144
- package/dist/chunks/{BattleshipGameCard-iRk8d4vR.js.map → BattleshipGameCard-B-B4r7lK.js.map} +1 -1
- package/dist/chunks/{ChatContext-DjIEifGY.js → ChatContext-DQtKsR6Z.js} +2 -2
- package/dist/chunks/{ChatContext-DjIEifGY.js.map → ChatContext-DQtKsR6Z.js.map} +1 -1
- package/dist/chunks/RacingLiveGameCard-c1G7uoDI.js +1654 -0
- package/dist/chunks/RacingLiveGameCard-c1G7uoDI.js.map +1 -0
- package/dist/chunks/{TanksGameCard-B47ZQcSr.js → TanksGameCard-CvTaF7tu.js} +164 -162
- package/dist/chunks/{TanksGameCard-B47ZQcSr.js.map → TanksGameCard-CvTaF7tu.js.map} +1 -1
- package/dist/chunks/TanksLiveGameCard-COr9Oay5.js +1011 -0
- package/dist/chunks/TanksLiveGameCard-COr9Oay5.js.map +1 -0
- package/dist/chunks/avalancheScene3d-Z5QyZIid.js +1299 -0
- package/dist/chunks/avalancheScene3d-Z5QyZIid.js.map +1 -0
- package/dist/chunks/connect4Sounds-DmD-E9kX.js +235 -0
- package/dist/chunks/connect4Sounds-DmD-E9kX.js.map +1 -0
- package/dist/chunks/connectionStore-DwgIUl30.js +13 -0
- package/dist/chunks/connectionStore-DwgIUl30.js.map +1 -0
- package/dist/chunks/createLiveScene-CWBunxPi.js +367 -0
- package/dist/chunks/createLiveScene-CWBunxPi.js.map +1 -0
- package/dist/chunks/createRaceScene-C7Rw89kj.js +305 -0
- package/dist/chunks/createRaceScene-C7Rw89kj.js.map +1 -0
- package/dist/chunks/{createTankScene-CV7Brxmt.js → createTankScene-yhX6la27.js} +150 -147
- package/dist/chunks/{createTankScene-CV7Brxmt.js.map → createTankScene-yhX6la27.js.map} +1 -1
- package/dist/chunks/decor-CyyCnmct.js +418 -0
- package/dist/chunks/decor-CyyCnmct.js.map +1 -0
- package/dist/chunks/fx-1ZwzmPWj.js +458 -0
- package/dist/chunks/fx-1ZwzmPWj.js.map +1 -0
- package/dist/chunks/fx-UZwhOmdl.js +584 -0
- package/dist/chunks/fx-UZwhOmdl.js.map +1 -0
- package/dist/chunks/gameStatus-BChd29yI.js +62 -0
- package/dist/chunks/gameStatus-BChd29yI.js.map +1 -0
- package/dist/chunks/{connect4Sounds-Cv0q31VW.js → games-BvYTWgaR.js} +814 -951
- package/dist/chunks/games-BvYTWgaR.js.map +1 -0
- package/dist/chunks/rolldown-runtime-CGnMp29N.js +10 -0
- package/dist/chunks/tank-DjEQ4FXF.js +553 -0
- package/dist/chunks/tank-DjEQ4FXF.js.map +1 -0
- package/dist/chunks/tanks-live-BcKmrhnV.js +261 -0
- package/dist/chunks/tanks-live-BcKmrhnV.js.map +1 -0
- package/dist/chunks/{tanksSounds-CUNDIOal.js → tanksSounds-DwjfSp3W.js} +43 -11
- package/dist/chunks/tanksSounds-DwjfSp3W.js.map +1 -0
- package/dist/chunks/track-BcnnpnAm.js +259 -0
- package/dist/chunks/track-BcnnpnAm.js.map +1 -0
- package/dist/chunks/util-DwI9bfS7.js +57 -0
- package/dist/chunks/util-DwI9bfS7.js.map +1 -0
- package/dist/index.js +2176 -1592
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/index.d.ts +4 -2
- package/package.json +1 -1
- package/dist/chunks/TanksLiveGameCard-DGsnMD3j.js +0 -1225
- package/dist/chunks/TanksLiveGameCard-DGsnMD3j.js.map +0 -1
- package/dist/chunks/connect4Sounds-Cv0q31VW.js.map +0 -1
- package/dist/chunks/createLiveScene-BqI7qV4n.js +0 -364
- package/dist/chunks/createLiveScene-BqI7qV4n.js.map +0 -1
- package/dist/chunks/fx-BHsl4S_J.js +0 -1470
- package/dist/chunks/fx-BHsl4S_J.js.map +0 -1
- package/dist/chunks/gameStatus-Cu1Z8un9.js +0 -69
- package/dist/chunks/gameStatus-Cu1Z8un9.js.map +0 -1
- package/dist/chunks/tanksSounds-CUNDIOal.js.map +0 -1
|
@@ -0,0 +1,1299 @@
|
|
|
1
|
+
import { n as e, t } from "./fx-UZwhOmdl.js";
|
|
2
|
+
import { i as n, n as r, o as i, r as a, t as o } from "./tank-DjEQ4FXF.js";
|
|
3
|
+
import { AmbientLight as s, Box3 as c, BoxGeometry as l, BufferAttribute as u, BufferGeometry as d, CanvasTexture as f, CircleGeometry as p, Color as m, CylinderGeometry as h, DirectionalLight as g, DoubleSide as _, DynamicDrawUsage as v, Euler as y, ExtrudeGeometry as b, InstancedMesh as x, Matrix3 as S, Matrix4 as C, MeshBasicMaterial as ee, MeshLambertMaterial as w, MeshStandardMaterial as T, PerspectiveCamera as E, PlaneGeometry as D, PointLight as O, Quaternion as k, Scene as A, Shape as j, Vector3 as M, WebGLRenderer as N } from "three";
|
|
4
|
+
// src/effects/avalanche/models/money.js
|
|
5
|
+
var P = Math.PI * 2, F = {
|
|
6
|
+
length: 1,
|
|
7
|
+
width: .45,
|
|
8
|
+
thickness: .02
|
|
9
|
+
}, te = .35, I = {
|
|
10
|
+
radius: .32,
|
|
11
|
+
thickness: .08
|
|
12
|
+
}, L = "Georgia, \"Times New Roman\", serif", R = "#1f5a32", z = [
|
|
13
|
+
"#d9a93a",
|
|
14
|
+
"#8e5bd1",
|
|
15
|
+
"#d64545",
|
|
16
|
+
"#3b8fd9"
|
|
17
|
+
], B = [.502, 1], V = [0, .49];
|
|
18
|
+
function H(e, t) {
|
|
19
|
+
let n = null;
|
|
20
|
+
return typeof document < "u" ? (n = document.createElement("canvas"), n.width = e, n.height = t) : typeof OffscreenCanvas < "u" && (n = new OffscreenCanvas(e, t)), n?.getContext("2d") || null;
|
|
21
|
+
}
|
|
22
|
+
function U(e, t, n, r) {
|
|
23
|
+
[
|
|
24
|
+
["rgba(90, 55, 0, 0.7)", t],
|
|
25
|
+
["rgba(255, 248, 210, 0.9)", -t],
|
|
26
|
+
[n, 0]
|
|
27
|
+
].forEach(([t, n]) => {
|
|
28
|
+
e.save(), e.translate(n, n), r(t), e.restore();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function ne(e, t, n, r, i) {
|
|
32
|
+
e.beginPath();
|
|
33
|
+
for (let a = 0; a < 10; a += 1) {
|
|
34
|
+
let o = a % 2 ? i : r, s = a / 10 * P - Math.PI / 2;
|
|
35
|
+
e.lineTo(t + Math.cos(s) * o, n + Math.sin(s) * o);
|
|
36
|
+
}
|
|
37
|
+
e.closePath();
|
|
38
|
+
}
|
|
39
|
+
function W(e, t, n, r, i) {
|
|
40
|
+
for (let a = 0; a < 10; a += 1) {
|
|
41
|
+
let o = a / 10 * (P / i);
|
|
42
|
+
e.beginPath();
|
|
43
|
+
for (let a = 0; a <= 120; a += 1) {
|
|
44
|
+
let s = a / 120 * P, c = r * (.7 + .3 * Math.sin(i * s + o));
|
|
45
|
+
e.lineTo(t + Math.cos(s) * c, n + Math.sin(s) * c * .92);
|
|
46
|
+
}
|
|
47
|
+
e.stroke();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function re(e, t, n) {
|
|
51
|
+
let r = t / 2, i = n / 2, a = e.createLinearGradient(0, 0, t, n);
|
|
52
|
+
a.addColorStop(0, "#b2d7a3"), a.addColorStop(.5, "#93c385"), a.addColorStop(1, "#acd39c"), e.fillStyle = a, e.fillRect(0, 0, t, n), e.lineWidth = 1, e.strokeStyle = "rgba(40, 110, 60, 0.28)";
|
|
53
|
+
for (let r = 0; r < 7; r += 1) [28, n - 28].forEach((n) => {
|
|
54
|
+
e.beginPath();
|
|
55
|
+
for (let i = 0; i <= t; i += 4) e.lineTo(i, n + Math.sin(i * .045 + r * .9) * 7);
|
|
56
|
+
e.stroke();
|
|
57
|
+
});
|
|
58
|
+
W(e, t * .2, i, 62, 9), W(e, t * .8, i, 62, 12), e.strokeStyle = R, e.lineWidth = 8, e.strokeRect(7, 7, t - 14, n - 14), e.lineWidth = 2, e.strokeRect(17, 17, t - 34, n - 34), e.save(), e.beginPath(), e.ellipse(r, i, 58, 70, 0, 0, P);
|
|
59
|
+
let o = e.createRadialGradient(r, i - 12, 6, r, i, 74);
|
|
60
|
+
o.addColorStop(0, "#dcefd3"), o.addColorStop(1, "#94c486"), e.fillStyle = o, e.fill(), e.clip(), e.strokeStyle = "rgba(31, 90, 50, 0.22)", e.lineWidth = 1;
|
|
61
|
+
for (let t = r - 60; t <= r + 60; t += 4) e.beginPath(), e.moveTo(t, i - 72), e.lineTo(t, i + 72), e.stroke();
|
|
62
|
+
e.fillStyle = "rgba(31, 90, 50, 0.78)", e.beginPath(), e.arc(r, i - 16, 20, 0, P), e.fill(), e.beginPath(), e.ellipse(r, i + 50, 42, 40, 0, Math.PI, P), e.fill(), e.restore(), e.strokeStyle = R, e.lineWidth = 4, e.beginPath(), e.ellipse(r, i, 58, 70, 0, 0, P), e.stroke(), e.lineWidth = 1.5, e.beginPath(), e.ellipse(r, i, 63, 75, 0, 0, P), e.stroke(), e.textAlign = "center", e.textBaseline = "middle", e.lineJoin = "round", [[
|
|
63
|
+
"$",
|
|
64
|
+
t * .2,
|
|
65
|
+
i + 4,
|
|
66
|
+
120
|
|
67
|
+
], [
|
|
68
|
+
"100",
|
|
69
|
+
t * .8,
|
|
70
|
+
i + 2,
|
|
71
|
+
56
|
|
72
|
+
]].forEach(([t, n, r, i]) => {
|
|
73
|
+
e.font = `bold ${i}px ${L}`, e.lineWidth = 6, e.strokeStyle = "#d6ebcd", e.strokeText(t, n, r), e.fillStyle = R, e.fillText(t, n, r);
|
|
74
|
+
}), e.font = `bold 24px ${L}`, [
|
|
75
|
+
[52, 40],
|
|
76
|
+
[t - 52, 40],
|
|
77
|
+
[52, n - 40],
|
|
78
|
+
[t - 52, n - 40]
|
|
79
|
+
].forEach(([t, n]) => {
|
|
80
|
+
e.beginPath(), e.ellipse(t, n, 31, 16, 0, 0, P), e.fillStyle = "#cfe6c4", e.fill(), e.lineWidth = 1.5, e.strokeStyle = R, e.stroke(), e.fillStyle = R, e.fillText("100", t, n + 1);
|
|
81
|
+
}), e.font = `bold 14px ${L}`, e.fillText("★ AVALANCHA ★", r, 30), e.fillText("CIEN", r, n - 29), e.font = `12px ${L}`, e.fillStyle = "#a8323a", e.textAlign = "left", e.fillText("AV 7000 2026", 90, 44), e.textAlign = "right", e.fillText("AV 7000 2026", t - 90, n - 44);
|
|
82
|
+
}
|
|
83
|
+
function ie(e, t, n) {
|
|
84
|
+
e.fillStyle = "#d9eacf", e.fillRect(0, 0, t, n);
|
|
85
|
+
let r = n / 36;
|
|
86
|
+
for (let n = 0; n < 36; n += 1) e.fillStyle = n % 5 == 2 ? "#76ad69" : n % 2 ? "#b7d5aa" : "#cbe2bf", e.fillRect(0, n * r + r * .55, t, Math.max(1, r * .35));
|
|
87
|
+
}
|
|
88
|
+
function G(e) {
|
|
89
|
+
let t = e ? 256 : 512, n = H(t, t);
|
|
90
|
+
if (!n) return null;
|
|
91
|
+
n.save(), n.scale(t / 512, t / 2 / 230), re(n, 512, 230), n.restore(), n.save(), n.translate(0, t / 2), ie(n, t, t / 2), n.restore();
|
|
92
|
+
let r = new f(n.canvas);
|
|
93
|
+
return r.anisotropy = e ? 1 : 4, r;
|
|
94
|
+
}
|
|
95
|
+
function ae(e) {
|
|
96
|
+
let t = e ? 128 : 256, n = H(t, t);
|
|
97
|
+
if (!n) return null;
|
|
98
|
+
let r = t / 2, i = t / 128;
|
|
99
|
+
for (let e = 0; e < 96; e += 1) {
|
|
100
|
+
let t = e / 96 * P;
|
|
101
|
+
n.fillStyle = e % 2 ? "#f0c24a" : "#9c6c10", n.beginPath(), n.moveTo(r, r), n.arc(r, r, r * 1.5, t, t + P / 96 + .01), n.fill();
|
|
102
|
+
}
|
|
103
|
+
let a = n.createRadialGradient(r * .75, r * .7, r * .05, r, r, r * .9);
|
|
104
|
+
return a.addColorStop(0, "#fff3b8"), a.addColorStop(.5, "#f5c84a"), a.addColorStop(1, "#c08a14"), n.fillStyle = a, n.beginPath(), n.arc(r, r, r * .88, 0, P), n.fill(), U(n, i, "#e9b93c", (e) => {
|
|
105
|
+
n.strokeStyle = e, n.lineWidth = r * .05, n.beginPath(), n.arc(r, r, r * .84, 0, P), n.stroke();
|
|
106
|
+
}), U(n, i * .6, "#efc24a", (e) => {
|
|
107
|
+
n.fillStyle = e, n.beginPath();
|
|
108
|
+
for (let e = 0; e < 30; e += 1) {
|
|
109
|
+
let t = e / 30 * P, i = r + Math.cos(t) * r * .74, a = r + Math.sin(t) * r * .74;
|
|
110
|
+
n.moveTo(i + r * .03, a), n.arc(i, a, r * .03, 0, P);
|
|
111
|
+
}
|
|
112
|
+
n.fill();
|
|
113
|
+
}), U(n, i * 1.5, "#f6cd52", (e) => {
|
|
114
|
+
n.fillStyle = e, ne(n, r, r, r * .62, r * .3), n.fill();
|
|
115
|
+
}), U(n, i, "#c99418", (e) => {
|
|
116
|
+
n.fillStyle = e, n.font = `bold ${Math.round(r * .5)}px ${L}`, n.textAlign = "center", n.textBaseline = "middle", n.fillText("$", r, r * 1.03);
|
|
117
|
+
}), new f(n.canvas);
|
|
118
|
+
}
|
|
119
|
+
function K(e) {
|
|
120
|
+
let t = e.attributes.normal, n = e.attributes.uv;
|
|
121
|
+
for (let e = 0; e < n.count; e += 1) {
|
|
122
|
+
let [r, i] = Math.abs(t.getY(e)) > .5 ? B : V;
|
|
123
|
+
n.setY(e, r + n.getY(e) * (i - r));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function oe(e) {
|
|
127
|
+
let { length: t, width: n, thickness: r } = F, i = new l(t, r, n, e ? 4 : 8, 1, 1);
|
|
128
|
+
K(i);
|
|
129
|
+
let a = i.attributes.position;
|
|
130
|
+
for (let e = 0; e < a.count; e += 1) {
|
|
131
|
+
let n = a.getX(e) / (t / 2);
|
|
132
|
+
a.setY(e, a.getY(e) + n * n * .05);
|
|
133
|
+
}
|
|
134
|
+
return i.computeVertexNormals(), i.center(), i;
|
|
135
|
+
}
|
|
136
|
+
function se() {
|
|
137
|
+
let e = new l(F.length, te, F.width);
|
|
138
|
+
return K(e), e;
|
|
139
|
+
}
|
|
140
|
+
function ce(e) {
|
|
141
|
+
let t = e ? 16 : 24, n = new h(I.radius, I.radius, I.thickness, t, 1), r = n.attributes.position, i = n.attributes.uv;
|
|
142
|
+
for (let e = 0; e < (t + 1) * 2; e += 1) i.setXY(e, .5 + .47 * (r.getZ(e) / I.radius), .5 + .47 * (r.getX(e) / I.radius));
|
|
143
|
+
return n;
|
|
144
|
+
}
|
|
145
|
+
function le({ lowPower: e = !1 } = {}) {
|
|
146
|
+
let t = (t, n = {}) => e ? new w(t) : new T({
|
|
147
|
+
roughness: .8,
|
|
148
|
+
metalness: 0,
|
|
149
|
+
...t,
|
|
150
|
+
...n
|
|
151
|
+
}), n = G(e), r = ae(e), i = () => t({
|
|
152
|
+
color: n ? 12109491 : 9421439,
|
|
153
|
+
map: n
|
|
154
|
+
}), a = t({
|
|
155
|
+
color: r ? 16777215 : 16762941,
|
|
156
|
+
map: r,
|
|
157
|
+
emissive: e ? 5914124 : 9069592,
|
|
158
|
+
emissiveMap: r
|
|
159
|
+
}, {
|
|
160
|
+
metalness: .85,
|
|
161
|
+
roughness: .25
|
|
162
|
+
});
|
|
163
|
+
return [
|
|
164
|
+
{
|
|
165
|
+
kind: "bill",
|
|
166
|
+
parts: [{
|
|
167
|
+
geometry: oe(e),
|
|
168
|
+
material: i()
|
|
169
|
+
}],
|
|
170
|
+
radius: .45,
|
|
171
|
+
mass: .05,
|
|
172
|
+
bounce: .12,
|
|
173
|
+
friction: .6,
|
|
174
|
+
drag: .85,
|
|
175
|
+
count: 60,
|
|
176
|
+
countLow: 30
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
kind: "stack",
|
|
180
|
+
parts: [{
|
|
181
|
+
geometry: se(),
|
|
182
|
+
material: i()
|
|
183
|
+
}, {
|
|
184
|
+
geometry: new l(.2, .362, F.width + .012),
|
|
185
|
+
material: t({ color: 16777215 }, { roughness: .6 }),
|
|
186
|
+
tinted: !0
|
|
187
|
+
}],
|
|
188
|
+
palette: z.map((e) => new m(e)),
|
|
189
|
+
radius: .52,
|
|
190
|
+
mass: .8,
|
|
191
|
+
bounce: .22,
|
|
192
|
+
friction: .7,
|
|
193
|
+
drag: .12,
|
|
194
|
+
count: 12,
|
|
195
|
+
countLow: 6
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
kind: "coin",
|
|
199
|
+
parts: [{
|
|
200
|
+
geometry: ce(e),
|
|
201
|
+
material: a
|
|
202
|
+
}],
|
|
203
|
+
radius: .32,
|
|
204
|
+
mass: .3,
|
|
205
|
+
bounce: .65,
|
|
206
|
+
friction: .35,
|
|
207
|
+
drag: .04,
|
|
208
|
+
count: 50,
|
|
209
|
+
countLow: 24
|
|
210
|
+
}
|
|
211
|
+
];
|
|
212
|
+
}
|
|
213
|
+
// src/effects/avalanche/models/tanks.js
|
|
214
|
+
var ue = ["green", "red"], de = .62, fe = .1, pe = new M(2.95, 1.1, 1.6), me = 1.2, he = .74, ge = new m("#3b3b3e"), _e = new m("#1b1b1d"), ve = (e) => e <= .0031308 ? e * 12.92 : 1.055 * e ** (1 / 2.4) - .055;
|
|
215
|
+
function ye() {
|
|
216
|
+
return {
|
|
217
|
+
p: [],
|
|
218
|
+
n: [],
|
|
219
|
+
c: []
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function q(e, t, n, r, { srgb: i = !0, capY: a = Infinity } = {}) {
|
|
223
|
+
let o = t.attributes.position, s = t.attributes.normal, c = t.attributes.color, l = new S().getNormalMatrix(n), u = new M();
|
|
224
|
+
for (let t = 0; t < o.count; t += 1) {
|
|
225
|
+
u.fromBufferAttribute(o, t);
|
|
226
|
+
let d = u.y <= a;
|
|
227
|
+
if (u.applyMatrix4(n), d && r.expandByPoint(u), e.p.push(u.x, u.y, u.z), u.fromBufferAttribute(s, t).applyMatrix3(l).normalize(), e.n.push(u.x, u.y, u.z), c) {
|
|
228
|
+
let n = c.getX(t), r = c.getY(t), a = c.getZ(t);
|
|
229
|
+
i ? e.c.push(ve(n), ve(r), ve(a)) : e.c.push(n, r, a);
|
|
230
|
+
} else e.c.push(1, 1, 1);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function J(e, t, n) {
|
|
234
|
+
let r = new Float32Array(e.p);
|
|
235
|
+
for (let e = 0; e < r.length; e += 3) r[e] = (r[e] - t.x) * n, r[e + 1] = (r[e + 1] - t.y) * n, r[e + 2] = (r[e + 2] - t.z) * n;
|
|
236
|
+
let i = new d();
|
|
237
|
+
return i.setAttribute("position", new u(r, 3)), i.setAttribute("normal", new u(new Float32Array(e.n), 3)), i.setAttribute("color", new u(new Float32Array(e.c), 3)), i.computeBoundingSphere(), i;
|
|
238
|
+
}
|
|
239
|
+
function be(e) {
|
|
240
|
+
let t = n[0], r = n[5], i = n[6], a = .38, o = [[t.x, 0], [n[4].x, 0]], s = (e, t, n, r, i) => {
|
|
241
|
+
for (let s = 0; s <= i; s += 1) {
|
|
242
|
+
let c = n + (r - n) * s / i;
|
|
243
|
+
o.push([e + Math.cos(c) * a, t + Math.sin(c) * a]);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
s(r.x, r.y, -2, Math.PI / 2, 6), s(i.x, i.y, Math.PI / 2, Math.PI + 2, 6), o.push(o[0]);
|
|
247
|
+
let c = [], l = [], f = [], p = Math.abs(t.z), m = 0;
|
|
248
|
+
for (let t = 0; t < o.length - 1; t += 1) {
|
|
249
|
+
let [n, r] = o[t], [i, a] = o[t + 1], s = Math.hypot(i - n, a - r);
|
|
250
|
+
if (s < 1e-6) continue;
|
|
251
|
+
let u = (a - r) / s, d = -(i - n) / s, h = Math.max(1, Math.round(s / e));
|
|
252
|
+
for (let e = 0; e < h; e += 1, m += 1) {
|
|
253
|
+
let t = e / h, o = (e + 1) / h, s = n + (i - n) * t, g = r + (a - r) * t - .03, _ = n + (i - n) * o, v = r + (a - r) * o - .03, y = m % 2 ? _e : ge;
|
|
254
|
+
for (let e of [-1, 1]) {
|
|
255
|
+
let t = e * p - he / 2, n = e * p + he / 2, r = [
|
|
256
|
+
[
|
|
257
|
+
s,
|
|
258
|
+
g,
|
|
259
|
+
t
|
|
260
|
+
],
|
|
261
|
+
[
|
|
262
|
+
_,
|
|
263
|
+
v,
|
|
264
|
+
t
|
|
265
|
+
],
|
|
266
|
+
[
|
|
267
|
+
_,
|
|
268
|
+
v,
|
|
269
|
+
n
|
|
270
|
+
],
|
|
271
|
+
[
|
|
272
|
+
s,
|
|
273
|
+
g,
|
|
274
|
+
t
|
|
275
|
+
],
|
|
276
|
+
[
|
|
277
|
+
_,
|
|
278
|
+
v,
|
|
279
|
+
n
|
|
280
|
+
],
|
|
281
|
+
[
|
|
282
|
+
s,
|
|
283
|
+
g,
|
|
284
|
+
n
|
|
285
|
+
]
|
|
286
|
+
];
|
|
287
|
+
for (let e of r) c.push(e[0], e[1], e[2]), l.push(u, d, 0), f.push(y.r, y.g, y.b);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
let h = new d();
|
|
292
|
+
return h.setAttribute("position", new u(new Float32Array(c), 3)), h.setAttribute("normal", new u(new Float32Array(l), 3)), h.setAttribute("color", new u(new Float32Array(f), 3)), h;
|
|
293
|
+
}
|
|
294
|
+
function xe(e, t, n) {
|
|
295
|
+
return e ? new w(t) : new T({
|
|
296
|
+
...t,
|
|
297
|
+
...n
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
function Se({ lowPower: e = !1 } = {}) {
|
|
301
|
+
let t = i(), s = be(e ? .2 : .12), l = new c(), u = new C(), d = new C().makeTranslation(a.x, a.y, a.z), f = new C().compose(a.clone().add(o), new k().setFromAxisAngle(new M(0, 0, 1), fe), new M(de, 1, 1)), p = ye();
|
|
302
|
+
q(p, t.hull, u, l), q(p, t.turret, d, l, { capY: me });
|
|
303
|
+
let h = ye();
|
|
304
|
+
q(h, t.hullAccent, u, l), q(h, t.turretAccent, d, l, { capY: me });
|
|
305
|
+
let g = ye();
|
|
306
|
+
q(g, s, u, l, { srgb: !1 });
|
|
307
|
+
let v = new C(), y = new k();
|
|
308
|
+
for (let e of n) {
|
|
309
|
+
let r = e.r / n[0].r;
|
|
310
|
+
v.compose(new M(e.x, e.y, e.z), y, new M(r, r, r)), q(g, t.wheel, v, l);
|
|
311
|
+
}
|
|
312
|
+
let b = ye();
|
|
313
|
+
q(b, t.gun, f, l);
|
|
314
|
+
let x = ye();
|
|
315
|
+
q(x, t.lamps, u, l), t.dispose(), s.dispose();
|
|
316
|
+
let S = l.getSize(new M()), w = l.getCenter(new M()), T = Math.min(pe.x / S.x, pe.y / S.y, pe.z / S.z), E = xe(e, {
|
|
317
|
+
vertexColors: !0,
|
|
318
|
+
color: 16777215
|
|
319
|
+
}, {
|
|
320
|
+
roughness: .62,
|
|
321
|
+
metalness: .18,
|
|
322
|
+
flatShading: !0
|
|
323
|
+
}), D = xe(e, {
|
|
324
|
+
vertexColors: !0,
|
|
325
|
+
side: _
|
|
326
|
+
}, {
|
|
327
|
+
roughness: .8,
|
|
328
|
+
metalness: .2
|
|
329
|
+
}), O = xe(e, {
|
|
330
|
+
vertexColors: !0,
|
|
331
|
+
color: "#7a7f88"
|
|
332
|
+
}, {
|
|
333
|
+
roughness: .4,
|
|
334
|
+
metalness: .45
|
|
335
|
+
}), A = new ee({ color: new m(1.35, 1.35, 1.35) }), j = new ee({ color: "#fff1c2" });
|
|
336
|
+
return [{
|
|
337
|
+
kind: "tank",
|
|
338
|
+
parts: [
|
|
339
|
+
{
|
|
340
|
+
geometry: J(p, w, T),
|
|
341
|
+
material: E,
|
|
342
|
+
tinted: !0
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
geometry: J(h, w, T),
|
|
346
|
+
material: A,
|
|
347
|
+
tinted: !0
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
geometry: J(g, w, T),
|
|
351
|
+
material: D
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
geometry: J(b, w, T),
|
|
355
|
+
material: O
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
geometry: J(x, w, T),
|
|
359
|
+
material: j
|
|
360
|
+
}
|
|
361
|
+
],
|
|
362
|
+
palette: ue.map((e) => r[e].tint.clone().convertLinearToSRGB()),
|
|
363
|
+
radius: .85,
|
|
364
|
+
mass: 5,
|
|
365
|
+
bounce: .2,
|
|
366
|
+
friction: .8,
|
|
367
|
+
drag: .04,
|
|
368
|
+
count: 6,
|
|
369
|
+
countLow: 4
|
|
370
|
+
}];
|
|
371
|
+
}
|
|
372
|
+
// src/effects/avalanche/models/confetti.js
|
|
373
|
+
var Ce = [
|
|
374
|
+
"#ff4d8d",
|
|
375
|
+
"#ffd23f",
|
|
376
|
+
"#3ddc97",
|
|
377
|
+
"#4cc9f0",
|
|
378
|
+
"#9b5de5",
|
|
379
|
+
"#ff7b29",
|
|
380
|
+
"#f15bb5",
|
|
381
|
+
"#ffffff"
|
|
382
|
+
], we = [
|
|
383
|
+
"#ffcf4a",
|
|
384
|
+
"#ffd23f",
|
|
385
|
+
"#ffe08a",
|
|
386
|
+
"#ffb627",
|
|
387
|
+
"#ff4d8d",
|
|
388
|
+
"#4cc9f0"
|
|
389
|
+
], Te = (e) => e.map((e) => new m(e));
|
|
390
|
+
function Ee(e, t, n = {}) {
|
|
391
|
+
return e ? new w(t) : new T({
|
|
392
|
+
roughness: .4,
|
|
393
|
+
metalness: .25,
|
|
394
|
+
...t,
|
|
395
|
+
...n
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
function De() {
|
|
399
|
+
let e = new D(.13, .2, 1, 4), t = e.attributes.position;
|
|
400
|
+
for (let e = 0; e < t.count; e += 1) {
|
|
401
|
+
let n = t.getY(e) / .1;
|
|
402
|
+
t.setZ(e, .035 * n * n);
|
|
403
|
+
}
|
|
404
|
+
return e.computeVertexNormals(), e.center(), e;
|
|
405
|
+
}
|
|
406
|
+
function Oe(e) {
|
|
407
|
+
let t = e ? 48 : 84, n = 1.3, r = new Float32Array((t + 1) * 6), i = new Float32Array((t + 1) * 6), a = [];
|
|
408
|
+
for (let e = 0; e <= t; e += 1) {
|
|
409
|
+
let o = e / t, s = o * 3.5 * Math.PI * 2, c = .14 + .06 * o, l = Math.cos(s), u = Math.sin(s), d = o * n - n / 2, f = .02 * Math.sin(s * .5);
|
|
410
|
+
for (let t = 0; t < 2; t += 1) {
|
|
411
|
+
let n = (e * 2 + t) * 3;
|
|
412
|
+
r[n] = l * c, r[n + 1] = d + (t ? 1 : -1) * .055 * .5 + f, r[n + 2] = u * c, i[n] = l, i[n + 2] = u;
|
|
413
|
+
}
|
|
414
|
+
if (e < t) {
|
|
415
|
+
let t = e * 2;
|
|
416
|
+
a.push(t, t + 1, t + 2, t + 1, t + 3, t + 2);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
let o = new d();
|
|
420
|
+
return o.setAttribute("position", new u(r, 3)), o.setAttribute("normal", new u(i, 3)), o.setIndex(a), o.center(), o;
|
|
421
|
+
}
|
|
422
|
+
function ke() {
|
|
423
|
+
let e = new j();
|
|
424
|
+
for (let t = 0; t < 10; t += 1) {
|
|
425
|
+
let n = t % 2 ? .15 : .35, r = t / 10 * Math.PI * 2 + Math.PI / 2, i = Math.cos(r) * n, a = Math.sin(r) * n;
|
|
426
|
+
t ? e.lineTo(i, a) : e.moveTo(i, a);
|
|
427
|
+
}
|
|
428
|
+
let t = new b(e, {
|
|
429
|
+
depth: .08,
|
|
430
|
+
bevelEnabled: !0,
|
|
431
|
+
bevelThickness: .03,
|
|
432
|
+
bevelSize: .02,
|
|
433
|
+
bevelSegments: 1
|
|
434
|
+
});
|
|
435
|
+
return t.center(), t;
|
|
436
|
+
}
|
|
437
|
+
function Ae({ lowPower: e = !1 } = {}) {
|
|
438
|
+
let t = De(), n = Oe(e), r = ke(), i = new p(.075, e ? 8 : 12);
|
|
439
|
+
return [
|
|
440
|
+
t,
|
|
441
|
+
n,
|
|
442
|
+
r,
|
|
443
|
+
i
|
|
444
|
+
].forEach((e) => e.computeBoundingSphere()), [
|
|
445
|
+
{
|
|
446
|
+
kind: "confetti",
|
|
447
|
+
parts: [{
|
|
448
|
+
geometry: t,
|
|
449
|
+
material: Ee(e, {
|
|
450
|
+
color: 16777215,
|
|
451
|
+
side: _
|
|
452
|
+
}, {
|
|
453
|
+
metalness: .35,
|
|
454
|
+
roughness: .4
|
|
455
|
+
}),
|
|
456
|
+
tinted: !0
|
|
457
|
+
}],
|
|
458
|
+
palette: Te(Ce),
|
|
459
|
+
radius: .12,
|
|
460
|
+
mass: .02,
|
|
461
|
+
bounce: .1,
|
|
462
|
+
friction: .8,
|
|
463
|
+
drag: .92,
|
|
464
|
+
count: 500,
|
|
465
|
+
countLow: 200
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
kind: "streamer",
|
|
469
|
+
parts: [{
|
|
470
|
+
geometry: n,
|
|
471
|
+
material: Ee(e, {
|
|
472
|
+
color: 16777215,
|
|
473
|
+
side: _
|
|
474
|
+
}, {
|
|
475
|
+
metalness: .3,
|
|
476
|
+
roughness: .45
|
|
477
|
+
}),
|
|
478
|
+
tinted: !0
|
|
479
|
+
}],
|
|
480
|
+
palette: Te(Ce),
|
|
481
|
+
radius: .4,
|
|
482
|
+
mass: .03,
|
|
483
|
+
bounce: .12,
|
|
484
|
+
friction: .75,
|
|
485
|
+
drag: .85,
|
|
486
|
+
count: 40,
|
|
487
|
+
countLow: 16
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
kind: "star",
|
|
491
|
+
parts: [{
|
|
492
|
+
geometry: r,
|
|
493
|
+
material: Ee(e, {
|
|
494
|
+
color: 16777215,
|
|
495
|
+
emissive: 2758656
|
|
496
|
+
}, {
|
|
497
|
+
metalness: .6,
|
|
498
|
+
roughness: .25
|
|
499
|
+
}),
|
|
500
|
+
tinted: !0
|
|
501
|
+
}],
|
|
502
|
+
palette: Te(we),
|
|
503
|
+
radius: .35,
|
|
504
|
+
mass: .06,
|
|
505
|
+
bounce: .25,
|
|
506
|
+
friction: .55,
|
|
507
|
+
drag: .5,
|
|
508
|
+
count: 40,
|
|
509
|
+
countLow: 20
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
kind: "spark",
|
|
513
|
+
parts: [{
|
|
514
|
+
geometry: i,
|
|
515
|
+
material: Ee(e, {
|
|
516
|
+
color: 16777215,
|
|
517
|
+
emissive: 3351040,
|
|
518
|
+
side: _
|
|
519
|
+
}, {
|
|
520
|
+
metalness: .5,
|
|
521
|
+
roughness: .25
|
|
522
|
+
}),
|
|
523
|
+
tinted: !0
|
|
524
|
+
}],
|
|
525
|
+
palette: Te(we),
|
|
526
|
+
radius: .08,
|
|
527
|
+
mass: .015,
|
|
528
|
+
bounce: .1,
|
|
529
|
+
friction: .8,
|
|
530
|
+
drag: .9,
|
|
531
|
+
count: 160,
|
|
532
|
+
countLow: 60
|
|
533
|
+
}
|
|
534
|
+
];
|
|
535
|
+
}
|
|
536
|
+
// src/effects/avalanche/physics.js
|
|
537
|
+
var je = 1 / 30, Me = 6, Ne = .1, Pe = 6, Fe = 6, Ie = .3, Le = 7, Re = 10, ze = 60, Y = 1.2, Be = 4, Ve = .15, He = 1.5, Ue = .3, We = .6, Ge = .3, Ke = .03, qe = .1, Je = .01, Ye = .2, Xe = .08, Ze = 3, Qe = .8, $e = .15, et = .4, tt = 14, nt = .3, rt = .35, it = 18, at = 5, ot = .9, st = 2.5, ct = 3, lt = 64, ut = 40;
|
|
538
|
+
Object.freeze({
|
|
539
|
+
DT_MAX: je,
|
|
540
|
+
MAX_SUBSTEPS: Me,
|
|
541
|
+
LIGHT_MASS: Ne,
|
|
542
|
+
DEFAULT_TTL: Pe,
|
|
543
|
+
DRAG_K: Fe,
|
|
544
|
+
AIR_SPIN_DAMP: Ie,
|
|
545
|
+
CONTACT_SPIN_DAMP: Le,
|
|
546
|
+
FLOOR_FRICTION: Re,
|
|
547
|
+
SETTLE_K: ze,
|
|
548
|
+
BOUNCE_MIN: Y,
|
|
549
|
+
IMPACT_SPEED: Be,
|
|
550
|
+
IMPACT_GAP: Ve,
|
|
551
|
+
WAKE_SPEED: He,
|
|
552
|
+
SLEEP_SPEED: Ue,
|
|
553
|
+
SLEEP_SPIN: We,
|
|
554
|
+
SLEEP_TIME: Ge,
|
|
555
|
+
FADE_IN: $e,
|
|
556
|
+
FADE_OUT: et,
|
|
557
|
+
FLUTTER: tt,
|
|
558
|
+
SWEEP_WIND: it,
|
|
559
|
+
SWEEP_LIFT: at,
|
|
560
|
+
WIND_TAU: ot,
|
|
561
|
+
WALL_OPEN_TIME: st,
|
|
562
|
+
OUT_MARGIN: ct
|
|
563
|
+
});
|
|
564
|
+
var X = (e, t) => typeof e == "number" && Number.isFinite(e) ? e : t, Z = (e, t, n) => e < t ? t : e > n ? n : e;
|
|
565
|
+
function dt() {
|
|
566
|
+
return {
|
|
567
|
+
id: 0,
|
|
568
|
+
kind: "",
|
|
569
|
+
x: 0,
|
|
570
|
+
y: 0,
|
|
571
|
+
z: 0,
|
|
572
|
+
vx: 0,
|
|
573
|
+
vy: 0,
|
|
574
|
+
vz: 0,
|
|
575
|
+
qx: 0,
|
|
576
|
+
qy: 0,
|
|
577
|
+
qz: 0,
|
|
578
|
+
qw: 1,
|
|
579
|
+
wx: 0,
|
|
580
|
+
wy: 0,
|
|
581
|
+
wz: 0,
|
|
582
|
+
radius: .5,
|
|
583
|
+
mass: 1,
|
|
584
|
+
age: 0,
|
|
585
|
+
ttl: Pe,
|
|
586
|
+
scale: 0,
|
|
587
|
+
landed: !1,
|
|
588
|
+
alive: !1,
|
|
589
|
+
asleep: !1,
|
|
590
|
+
bounce: .3,
|
|
591
|
+
friction: .5,
|
|
592
|
+
drag: .05,
|
|
593
|
+
hx: 0,
|
|
594
|
+
hy: 0,
|
|
595
|
+
hz: 0,
|
|
596
|
+
variant: 0,
|
|
597
|
+
data: null,
|
|
598
|
+
light: !1,
|
|
599
|
+
invMass: 1,
|
|
600
|
+
cr: .5,
|
|
601
|
+
sup: !1,
|
|
602
|
+
restT: 0,
|
|
603
|
+
impactT: -1e9,
|
|
604
|
+
phase: 0,
|
|
605
|
+
kx: 1,
|
|
606
|
+
ky: 1,
|
|
607
|
+
kz: 1,
|
|
608
|
+
px: 0,
|
|
609
|
+
py: 0,
|
|
610
|
+
pz: 0,
|
|
611
|
+
floor: !1
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
function ft({ gravity: e = -26, floorY: t = -5.5, left: n = -8, right: r = 8, maxBodies: i = 400, zMin: a = -2, zMax: o = 2, impactSpeed: s = Be, lightImpacts: c = !1, random: l = Math.random } = {}) {
|
|
615
|
+
let u = Math.max(1, Math.floor(X(i, 400))), d = X(e, -26), f = Math.min(X(a, -2), X(o, 2)), p = Math.max(X(a, -2), X(o, 2)), m = X(s, Be), h = X(t, -5.5), g = X(n, -8), _ = X(r, 8);
|
|
616
|
+
if (_ < g) {
|
|
617
|
+
let e = g;
|
|
618
|
+
g = _, _ = e;
|
|
619
|
+
}
|
|
620
|
+
let v = [], y = [], b = [], x = new Int32Array(u), S = new Int32Array(u), C = new Int32Array(u), ee = new Int32Array(u), w = /* @__PURE__ */ new Int32Array(4096), T = 1, E = 0, D = 0, O = 0, k = 0, A = 1;
|
|
621
|
+
function j(e) {
|
|
622
|
+
e.asleep = !1, e.restT = 0;
|
|
623
|
+
}
|
|
624
|
+
function M(e, t) {
|
|
625
|
+
if (!(t < m || e.light && !c || !b.length) && !(E - e.impactT < Ve)) {
|
|
626
|
+
e.impactT = E;
|
|
627
|
+
for (let n = 0; n < b.length; n++) try {
|
|
628
|
+
b[n](e, t);
|
|
629
|
+
} catch {}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
function N(e, t) {
|
|
633
|
+
let n = e.vx, r = e.vy + d * t, i = e.vz, a = e.drag, o = e.landed;
|
|
634
|
+
if (a > nt && !o && (n += Math.sin(e.age * 3.3 + e.phase) * tt * a * t), a > 0) {
|
|
635
|
+
let e = a * Fe * t, o = 1 / (1 + e);
|
|
636
|
+
n = (n + e * D) * o, r = (r + e * O) * o, i *= o;
|
|
637
|
+
}
|
|
638
|
+
if (o) {
|
|
639
|
+
let r = 1 / (1 + e.friction * Re * t);
|
|
640
|
+
n *= r, i *= r;
|
|
641
|
+
}
|
|
642
|
+
e.vx = n, e.vy = r, e.vz = i, e.x += n * t, e.y += r * t, e.z += i * t;
|
|
643
|
+
let s = e.wx, c = e.wy, l = e.wz, u = e.qx, f = e.qy, p = e.qz, m = e.qw;
|
|
644
|
+
if (o) {
|
|
645
|
+
let n = 2 * (u * f + m * p), r = 1 - 2 * (u * u + p * p), i = 2 * (f * p - m * u), a = Math.abs(n) * e.kx, o = Math.abs(r) * e.ky, d = Math.abs(i) * e.kz, h, g, _;
|
|
646
|
+
o >= a && o >= d ? (_ = r < 0 ? -1 : 1, h = 2 * (u * f - m * p), g = 2 * (f * p + m * u)) : a >= d ? (_ = n < 0 ? -1 : 1, h = 1 - 2 * (f * f + p * p), g = 2 * (u * p - m * f)) : (_ = i < 0 ? -1 : 1, h = 2 * (u * p + m * f), g = 1 - 2 * (u * u + f * f));
|
|
647
|
+
let v = ze * t * _;
|
|
648
|
+
s -= g * v, l += h * v;
|
|
649
|
+
let y = 1 / (1 + Le * t);
|
|
650
|
+
s *= y, c *= y, l *= y;
|
|
651
|
+
} else if (s !== 0 || c !== 0 || l !== 0) {
|
|
652
|
+
let e = 1 / (1 + Ie * t);
|
|
653
|
+
s *= e, c *= e, l *= e;
|
|
654
|
+
}
|
|
655
|
+
if (e.wx = s, e.wy = c, e.wz = l, s !== 0 || c !== 0 || l !== 0) {
|
|
656
|
+
let n = .5 * t, r = u + n * (s * m + c * p - l * f), i = f + n * (c * m + l * u - s * p), a = p + n * (l * m + s * f - c * u), o = m - n * (s * u + c * f + l * p), d = Math.sqrt(r * r + i * i + a * a + o * o);
|
|
657
|
+
if (d > 1e-9) {
|
|
658
|
+
let t = 1 / d;
|
|
659
|
+
e.qx = r * t, e.qy = i * t, e.qz = a * t, e.qw = o * t;
|
|
660
|
+
} else e.qx = 0, e.qy = 0, e.qz = 0, e.qw = 1;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
function P(e) {
|
|
664
|
+
let t = e.cr, n = t;
|
|
665
|
+
if (e.hx > 0) {
|
|
666
|
+
let r = e.qx, i = e.qy, a = e.qz, o = e.qw, s = 2 * (r * i + o * a), c = 1 - 2 * (r * r + a * a), l = 2 * (i * a - o * r);
|
|
667
|
+
n = (e.hx * Math.abs(s) + e.hy * Math.abs(c) + e.hz * Math.abs(l)) * (t / e.radius);
|
|
668
|
+
}
|
|
669
|
+
if (n += h, e.floor = e.y <= n + Ke, e.floor && (e.sup = !0, e.y < n && (e.y = n, e.vy < 0))) {
|
|
670
|
+
let t = -e.vy;
|
|
671
|
+
if (t > Y) {
|
|
672
|
+
e.vy = t * e.bounce;
|
|
673
|
+
let n = t * rt;
|
|
674
|
+
e.wx += (l() - .5) * n, e.wz += (l() - .5) * n - e.vx * .3 / e.radius;
|
|
675
|
+
} else e.vy = 0;
|
|
676
|
+
t >= m && M(e, t);
|
|
677
|
+
}
|
|
678
|
+
k <= 0 ? e.x - t < g ? (e.x = g + t, e.vx < 0 && (e.vx = e.vx < -1.2 ? -e.vx * (.25 + .5 * e.bounce) : 0)) : e.x + t > _ && (e.x = _ - t, e.vx > 0 && (e.vx = e.vx > Y ? -e.vx * (.25 + .5 * e.bounce) : 0)) : (e.x - t > _ + ct || e.x + t < g - ct) && (e.alive = !1), e.z < f ? (e.z = f, e.vz < 0 && (e.vz *= -.3)) : e.z > p && (e.z = p, e.vz > 0 && (e.vz *= -.3)), (e.y < h - 20 || e.x !== e.x || e.y !== e.y || e.z !== e.z || e.qw !== e.qw) && (e.alive = !1);
|
|
679
|
+
}
|
|
680
|
+
function F(e, t) {
|
|
681
|
+
if (e.asleep) {
|
|
682
|
+
e.sup || j(e);
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
if (!e.sup) {
|
|
686
|
+
e.restT = 0;
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
let n = e.x - e.px, r = e.y - e.py, i = e.z - e.pz, a = (n * n + r * r + i * i) / (t * t), o = e.wx * e.wx + e.wy * e.wy + e.wz * e.wz;
|
|
690
|
+
a < Ue * Ue && o < We * We ? (e.restT += t, e.restT >= Ge && (e.asleep = !0, e.vx = 0, e.vy = 0, e.vz = 0, e.wx = 0, e.wy = 0, e.wz = 0)) : e.restT = 0;
|
|
691
|
+
}
|
|
692
|
+
function te(e, t) {
|
|
693
|
+
let n = t.x - e.x, r = t.y - e.y, i = t.z - e.z, a = e.cr + t.cr, o = a + Ke, s = n * n + r * r + i * i;
|
|
694
|
+
if (s >= o * o) return;
|
|
695
|
+
let c = Math.sqrt(s), u = 0, d = 1, f = 0;
|
|
696
|
+
if (c > 1e-6) {
|
|
697
|
+
let e = 1 / c;
|
|
698
|
+
u = n * e, d = r * e, f = i * e;
|
|
699
|
+
} else c = 0;
|
|
700
|
+
if (d > qe ? t.sup = !0 : d < -.1 && (e.sup = !0), e.asleep && t.asleep) return;
|
|
701
|
+
let p = a - c;
|
|
702
|
+
if (p <= 0) return;
|
|
703
|
+
let h = (t.vx - e.vx) * u + (t.vy - e.vy) * d + (t.vz - e.vz) * f;
|
|
704
|
+
(-h > He || p > Xe * a) && (e.asleep && j(e), t.asleep && j(t));
|
|
705
|
+
let g = e.asleep ? 0 : e.invMass, _ = t.asleep ? 0 : t.invMass;
|
|
706
|
+
if (g + _ <= 0) return;
|
|
707
|
+
let v = g, y = _;
|
|
708
|
+
if (d > qe && e.floor ? v = 0 : d < -.1 && t.floor && (y = 0), v + y <= 0 && (v = g, y = _), h < 0) {
|
|
709
|
+
let n = -h;
|
|
710
|
+
n < Ze && (g = v, _ = y);
|
|
711
|
+
let r = g + _, i = e.vx * e.vx + e.vy * e.vy + e.vz * e.vz > t.vx * t.vx + t.vy * t.vy + t.vz * t.vz ? e : t, a = (1 + (n > Y ? e.bounce < t.bounce ? e.bounce : t.bounce : 0)) * n / r;
|
|
712
|
+
e.vx -= u * a * g, e.vy -= d * a * g, e.vz -= f * a * g, t.vx += u * a * _, t.vy += d * a * _, t.vz += f * a * _;
|
|
713
|
+
let o = t.vx - e.vx, s = t.vy - e.vy, c = t.vz - e.vz, p = o * u + s * d + c * f;
|
|
714
|
+
o -= p * u, s -= p * d, c -= p * f;
|
|
715
|
+
let b = Math.sqrt(o * o + s * s + c * c);
|
|
716
|
+
if (b > 1e-6) {
|
|
717
|
+
let n = (e.friction + t.friction) * .5, i = b / r;
|
|
718
|
+
i > n * a && (i = n * a);
|
|
719
|
+
let l = i / b;
|
|
720
|
+
e.vx += o * l * g, e.vy += s * l * g, e.vz += c * l * g, t.vx -= o * l * _, t.vy -= s * l * _, t.vz -= c * l * _;
|
|
721
|
+
}
|
|
722
|
+
if (n > Y * 2) {
|
|
723
|
+
let e = n * rt * .5;
|
|
724
|
+
i.wx += (l() - .5) * e, i.wz += (l() - .5) * e;
|
|
725
|
+
}
|
|
726
|
+
n >= m && M(i, n);
|
|
727
|
+
}
|
|
728
|
+
if (p > Je) {
|
|
729
|
+
let n = v / (v + y);
|
|
730
|
+
v > 0 && y > 0 && (n = n < Ye ? Ye : n > .8 ? .8 : n);
|
|
731
|
+
let r = (p - Je) * Qe, i = r * n, a = r - i;
|
|
732
|
+
e.x -= u * i, e.y -= d * i, e.z -= f * i, t.x += u * a, t.y += d * a, t.z += f * a;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function I(e, t) {
|
|
736
|
+
let n = 1 / Math.max(2 * t + Ke, .25), r = g - ct - t, i = h - t - 1, a = Z(Math.ceil((_ - g + 2 * (ct + t)) * n), 1, lt), o = Z(Math.ceil(ut * n), 1, lt);
|
|
737
|
+
w.fill(-1, 0, a * o);
|
|
738
|
+
for (let t = 0; t < e; t++) {
|
|
739
|
+
let e = v[x[t]];
|
|
740
|
+
if (!e.alive) {
|
|
741
|
+
C[t] = -1;
|
|
742
|
+
continue;
|
|
743
|
+
}
|
|
744
|
+
let s = Z(Math.floor((e.x - r) * n), 0, a - 1), c = Z(Math.floor((e.y - i) * n), 0, o - 1);
|
|
745
|
+
C[t] = s, ee[t] = c;
|
|
746
|
+
let l = c * a + s;
|
|
747
|
+
S[t] = w[l], w[l] = t;
|
|
748
|
+
}
|
|
749
|
+
for (let t = 0; t < e; t++) {
|
|
750
|
+
let e = C[t];
|
|
751
|
+
if (e < 0) continue;
|
|
752
|
+
let n = v[x[t]], r = ee[t], i = r > 0 ? r - 1 : 0, s = r < o - 1 ? r + 1 : r, c = e > 0 ? e - 1 : 0, l = e < a - 1 ? e + 1 : e;
|
|
753
|
+
for (let e = i; e <= s; e++) for (let r = c; r <= l; r++) for (let i = w[e * a + r]; i !== -1; i = S[i]) i > t && te(n, v[x[i]]);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
function L(e) {
|
|
757
|
+
let t = Number(e);
|
|
758
|
+
if (!(t > 0)) return;
|
|
759
|
+
t > je && (t = je), E += t, k > 0 && (k -= t);
|
|
760
|
+
let n = v.length, r = 0, i = 0, a = Infinity, o = 0;
|
|
761
|
+
for (let e = 0; e < n; e++) {
|
|
762
|
+
let n = v[e];
|
|
763
|
+
if (!n.alive) continue;
|
|
764
|
+
let s = n.age += t, c = n.ttl - s;
|
|
765
|
+
if (c <= 0) {
|
|
766
|
+
n.alive = !1, n.scale = 0;
|
|
767
|
+
continue;
|
|
768
|
+
}
|
|
769
|
+
let l = 1, u = n.radius;
|
|
770
|
+
if (s < $e) {
|
|
771
|
+
let e = 1 - s / $e;
|
|
772
|
+
l = 1 - e * e * e;
|
|
773
|
+
}
|
|
774
|
+
if (c < et) {
|
|
775
|
+
let e = c / et, t = e * e * (3 - 2 * e);
|
|
776
|
+
l *= t, u *= t > .05 ? t : .05;
|
|
777
|
+
}
|
|
778
|
+
if (n.scale = l, n.cr = u, n.light) {
|
|
779
|
+
if (n.asleep && c >= et) continue;
|
|
780
|
+
n.sup = !1, n.px = n.x, n.py = n.y, n.pz = n.z, n.asleep || N(n, t), P(n), F(n, t), n.landed = n.sup;
|
|
781
|
+
} else {
|
|
782
|
+
if (x[r++] = e, !n.asleep) {
|
|
783
|
+
let e = n.vx * n.vx + n.vy * n.vy + n.vz * n.vz;
|
|
784
|
+
e > i && (i = e);
|
|
785
|
+
}
|
|
786
|
+
n.radius < a && (a = n.radius), u > o && (o = u);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
if (r) {
|
|
790
|
+
let e = Math.sqrt(i) + Math.abs(d) * t, n = Z(Math.ceil(e * t / (a * .8)), 1, Me), s = t / n;
|
|
791
|
+
for (let e = 0; e < n; e++) {
|
|
792
|
+
for (let e = 0; e < r; e++) {
|
|
793
|
+
let t = v[x[e]];
|
|
794
|
+
t.alive && (t.sup = !1, t.px = t.x, t.py = t.y, t.pz = t.z, t.asleep || N(t, s));
|
|
795
|
+
}
|
|
796
|
+
r > 1 && I(r, o);
|
|
797
|
+
for (let e = 0; e < r; e++) {
|
|
798
|
+
let t = v[x[e]];
|
|
799
|
+
t.alive && (P(t), F(t, s), t.landed = t.sup);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
if (D !== 0 || O !== 0) {
|
|
804
|
+
let e = Math.exp(-t / ot);
|
|
805
|
+
D *= e, O *= e, Math.abs(D) < .01 && Math.abs(O) < .01 && (D = 0, O = 0);
|
|
806
|
+
}
|
|
807
|
+
let s = 0, c = v.length;
|
|
808
|
+
for (let e = 0; e < c; e++) {
|
|
809
|
+
let t = v[e];
|
|
810
|
+
t.alive ? v[s++] = t : (t.scale = 0, t.data = null, y.push(t));
|
|
811
|
+
}
|
|
812
|
+
v.length = s;
|
|
813
|
+
}
|
|
814
|
+
function R(e, t, n, r) {
|
|
815
|
+
e.id = T++, e.kind = t.kind == null ? "" : t.kind, e.x = X(t.x, 0), e.y = X(t.y, 0), e.z = X(t.z, 0), e.vx = X(t.vx, 0), e.vy = X(t.vy, 0), e.vz = X(t.vz, 0), e.wx = X(t.wx, 0), e.wy = X(t.wy, 0), e.wz = X(t.wz, 0);
|
|
816
|
+
let i = X(t.qx, 0), a = X(t.qy, 0), o = X(t.qz, 0), s = X(t.qw, NaN), c = Number.isFinite(s) ? Math.sqrt(i * i + a * a + o * o + s * s) : 0;
|
|
817
|
+
if (c > 1e-6) e.qx = i / c, e.qy = a / c, e.qz = o / c, e.qw = s / c;
|
|
818
|
+
else {
|
|
819
|
+
let t = l(), n = l() * 6.283185307179586, r = l() * 6.283185307179586, i = Math.sqrt(1 - t), a = Math.sqrt(t);
|
|
820
|
+
e.qx = i * Math.sin(n), e.qy = i * Math.cos(n), e.qz = a * Math.sin(r), e.qw = a * Math.cos(r);
|
|
821
|
+
}
|
|
822
|
+
let u = X(t.radius, .5);
|
|
823
|
+
e.radius = u > .01 ? u : .01, e.mass = n, e.invMass = 1 / n, e.light = r, e.bounce = Z(X(t.bounce, .3), 0, 1), e.friction = Z(X(t.friction, .5), 0, 1), e.drag = Z(X(t.drag, .05), 0, 2);
|
|
824
|
+
let d = X(t.ttl, Pe);
|
|
825
|
+
e.ttl = d > .05 ? d : .05, e.age = 0, e.scale = 0, e.cr = e.radius, e.landed = !1, e.alive = !0, e.asleep = !1, e.sup = !1, e.restT = 0, e.impactT = -1e9, e.phase = l() * 6.283185307179586;
|
|
826
|
+
let f = X(t.hx, 0), p = X(t.hy, 0), m = X(t.hz, 0);
|
|
827
|
+
if (f > 0 && p > 0 && m > 0) {
|
|
828
|
+
let t = Math.max(f, p, m), n = .5 * t, r = n / (f + n), i = n / (p + n), a = n / (m + n);
|
|
829
|
+
r *= r, i *= i, a *= a, t > 1.5 * (f + p + m - t - Math.min(f, p, m)) && (f === t ? r = 0 : p === t ? i = 0 : a = 0), e.hx = f, e.hy = p, e.hz = m, e.kx = r, e.ky = i, e.kz = a;
|
|
830
|
+
} else e.hx = 0, e.hy = 0, e.hz = 0, e.kx = 1, e.ky = 1, e.kz = 1;
|
|
831
|
+
return e.variant = t.variant == null ? 0 : t.variant, e.data = t.data == null ? null : t.data, e;
|
|
832
|
+
}
|
|
833
|
+
function z() {
|
|
834
|
+
let e = null;
|
|
835
|
+
for (let t = 0; t < v.length; t++) {
|
|
836
|
+
let n = v[t];
|
|
837
|
+
n.light && n.alive && (!e || n.age > e.age) && (e = n);
|
|
838
|
+
}
|
|
839
|
+
return e;
|
|
840
|
+
}
|
|
841
|
+
function B(e) {
|
|
842
|
+
if (!e || typeof e != "object") return null;
|
|
843
|
+
let t = X(e.mass, 1), n = t > .001 ? t : .001, r = n < Ne, i;
|
|
844
|
+
if (v.length >= u) {
|
|
845
|
+
if (r || (i = z(), !i)) return null;
|
|
846
|
+
} else i = y.pop() || dt(), v.push(i);
|
|
847
|
+
return R(i, e, n, r);
|
|
848
|
+
}
|
|
849
|
+
function V(e = {}) {
|
|
850
|
+
if (h = X(e.floorY, h), g = X(e.left, g), _ = X(e.right, _), _ < g) {
|
|
851
|
+
let e = g;
|
|
852
|
+
g = _, _ = e;
|
|
853
|
+
}
|
|
854
|
+
for (let e = 0; e < v.length; e++) j(v[e]);
|
|
855
|
+
}
|
|
856
|
+
function H(e = 1, t) {
|
|
857
|
+
let n = Z(X(e, 1), 0, 3), r = A;
|
|
858
|
+
t > 0 ? r = 1 : t < 0 ? r = -1 : A = -A, D = r * n * it, O = n * at, k = st;
|
|
859
|
+
for (let e = 0; e < v.length; e++) {
|
|
860
|
+
let t = v[e];
|
|
861
|
+
if (!t.alive) continue;
|
|
862
|
+
j(t), t.landed = !1;
|
|
863
|
+
let i = n / (1 + .35 * t.mass);
|
|
864
|
+
t.vx += r * i * (10 + l() * 8), t.vy += i * (7 + l() * 6), t.wx += (l() - .5) * 12 * n, t.wy += (l() - .5) * 8 * n, t.wz -= r * (4 + l() * 6) * n;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
function U() {
|
|
868
|
+
for (let e = 0; e < v.length; e++) {
|
|
869
|
+
let t = v[e];
|
|
870
|
+
t.alive = !1, t.scale = 0, t.data = null, y.push(t);
|
|
871
|
+
}
|
|
872
|
+
v.length = 0, D = 0, O = 0, k = 0, A = 1;
|
|
873
|
+
}
|
|
874
|
+
function ne(e) {
|
|
875
|
+
return typeof e == "function" ? (b.push(e), () => {
|
|
876
|
+
let t = b.indexOf(e);
|
|
877
|
+
t >= 0 && b.splice(t, 1);
|
|
878
|
+
}) : () => {};
|
|
879
|
+
}
|
|
880
|
+
return {
|
|
881
|
+
bodies: v,
|
|
882
|
+
spawn: B,
|
|
883
|
+
step: L,
|
|
884
|
+
setBounds: V,
|
|
885
|
+
sweep: H,
|
|
886
|
+
clear: U,
|
|
887
|
+
onImpact: ne,
|
|
888
|
+
get time() {
|
|
889
|
+
return E;
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
// src/effects/avalanche/avalancheScene3d.js
|
|
894
|
+
var pt = 12, mt = -26, ht = .05, gt = -2.5, _t = 1, vt = /* @__PURE__ */ new Set([
|
|
895
|
+
"car",
|
|
896
|
+
"tank",
|
|
897
|
+
"stack"
|
|
898
|
+
]), yt = [
|
|
899
|
+
"#ff4d8d",
|
|
900
|
+
"#ffd23f",
|
|
901
|
+
"#3ddc97",
|
|
902
|
+
"#4cc9f0",
|
|
903
|
+
"#9b5de5",
|
|
904
|
+
"#ff7b29"
|
|
905
|
+
].map((e) => new m(e)), bt = 12, Q = (e, t) => e + Math.random() * (t - e), xt = (e) => e[Math.floor(Math.random() * e.length)], $ = (e, t, n) => Math.min(n, Math.max(t, e)), St = (e) => String(e).split("-")[0], Ct = () => typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches || (navigator.hardwareConcurrency || 8) <= 4;
|
|
906
|
+
function wt(e = 64) {
|
|
907
|
+
let t = document.createElement("canvas");
|
|
908
|
+
t.width = e, t.height = e;
|
|
909
|
+
let n = t.getContext("2d"), r = n.createRadialGradient(e / 2, e / 2, 0, e / 2, e / 2, e / 2);
|
|
910
|
+
return r.addColorStop(0, "rgba(0,0,0,.55)"), r.addColorStop(.6, "rgba(0,0,0,.25)"), r.addColorStop(1, "rgba(0,0,0,0)"), n.fillStyle = r, n.fillRect(0, 0, e, e), new f(t);
|
|
911
|
+
}
|
|
912
|
+
function Tt(e) {
|
|
913
|
+
let t = new c();
|
|
914
|
+
return e.forEach(({ geometry: e }) => {
|
|
915
|
+
e.boundingBox || e.computeBoundingBox(), t.union(e.boundingBox);
|
|
916
|
+
}), {
|
|
917
|
+
x: Math.max(Math.abs(t.min.x), Math.abs(t.max.x)),
|
|
918
|
+
y: Math.max(Math.abs(t.min.y), Math.abs(t.max.y)),
|
|
919
|
+
z: Math.max(Math.abs(t.min.z), Math.abs(t.max.z))
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
function Et(e, t, n) {
|
|
923
|
+
let r = St(t.kind), i = Math.round(n ? t.countLow ?? t.count : t.count) || 1, a = Math.max(1, i + (r === "bill" ? n ? 30 : 70 : 0)), o = t.palette?.length ? t.palette : yt, s = t.parts.map(({ geometry: t, material: n, tinted: r }) => {
|
|
924
|
+
let i = new x(t, n, a);
|
|
925
|
+
if (i.instanceMatrix.setUsage(v), i.frustumCulled = !1, r) {
|
|
926
|
+
for (let e = 0; e < a; e += 1) i.setColorAt(e, o[0]);
|
|
927
|
+
i.instanceColor.setUsage(v);
|
|
928
|
+
}
|
|
929
|
+
return i.count = 0, i.visible = !1, e.add(i), {
|
|
930
|
+
mesh: i,
|
|
931
|
+
tinted: !!r
|
|
932
|
+
};
|
|
933
|
+
}), c = Tt(t.parts);
|
|
934
|
+
return {
|
|
935
|
+
kind: t.kind,
|
|
936
|
+
family: r,
|
|
937
|
+
model: t,
|
|
938
|
+
parts: s,
|
|
939
|
+
palette: o,
|
|
940
|
+
capacity: a,
|
|
941
|
+
used: 0,
|
|
942
|
+
pending: 0,
|
|
943
|
+
big: vt.has(r),
|
|
944
|
+
half: c,
|
|
945
|
+
blobRadius: (t.radius + Math.max(c.x, c.z)) / 2
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
function Dt(e, { lowPower: t } = {}) {
|
|
949
|
+
let n = !!(t ?? Ct()), r = new N({
|
|
950
|
+
canvas: e,
|
|
951
|
+
alpha: !0,
|
|
952
|
+
antialias: !n,
|
|
953
|
+
powerPreference: "high-performance"
|
|
954
|
+
});
|
|
955
|
+
try {
|
|
956
|
+
return Ot(r, n);
|
|
957
|
+
} catch (e) {
|
|
958
|
+
throw r.dispose(), r.forceContextLoss?.(), e;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
function Ot(n, r) {
|
|
962
|
+
n.setPixelRatio(Math.min(r ? 1.5 : 2, window.devicePixelRatio || 1)), n.setClearColor(0, 0);
|
|
963
|
+
let i = new A(), a = new E(50, 1, .1, 80);
|
|
964
|
+
a.position.set(0, 0, pt);
|
|
965
|
+
let o = r ? .8 : 1, c = new g(16769200, 1.25 * o);
|
|
966
|
+
c.position.set(5, 7, 9);
|
|
967
|
+
let l = new g(10275071, .55 * o);
|
|
968
|
+
l.position.set(-7, 1, 5);
|
|
969
|
+
let u = new O(16773570, 0, 40, 1.4);
|
|
970
|
+
u.position.set(0, 1, 5), i.add(new s(16777215, .5 * o), c, l, u);
|
|
971
|
+
let d = [
|
|
972
|
+
le,
|
|
973
|
+
e,
|
|
974
|
+
Se,
|
|
975
|
+
Ae
|
|
976
|
+
].flatMap((e) => e({ lowPower: r }) || []), f = d.map((e) => Et(i, e, r)), p = Object.create(null);
|
|
977
|
+
f.forEach((e) => {
|
|
978
|
+
p[e.family] || (p[e.family] = []), p[e.family].push(e);
|
|
979
|
+
});
|
|
980
|
+
let m = f.reduce((e, t) => e + t.capacity, 0), h = {
|
|
981
|
+
left: -9.9,
|
|
982
|
+
right: 9.9,
|
|
983
|
+
top: 5.6,
|
|
984
|
+
floorY: -5.55,
|
|
985
|
+
room: 1
|
|
986
|
+
}, _ = ft({
|
|
987
|
+
gravity: mt,
|
|
988
|
+
floorY: h.floorY,
|
|
989
|
+
left: h.left,
|
|
990
|
+
right: h.right,
|
|
991
|
+
zMin: gt,
|
|
992
|
+
zMax: _t,
|
|
993
|
+
maxBodies: Math.min(m, r ? 320 : 640)
|
|
994
|
+
}), b = t(i, { lowPower: r }), S = r ? 0 : 32, w = S ? wt() : null, T = S ? new x(new D(1, 1).rotateX(-Math.PI / 2), new ee({
|
|
995
|
+
map: w,
|
|
996
|
+
transparent: !0,
|
|
997
|
+
depthWrite: !1,
|
|
998
|
+
opacity: .6
|
|
999
|
+
}), S) : null;
|
|
1000
|
+
T && (T.instanceMatrix.setUsage(v), T.frustumCulled = !1, T.count = 0, T.visible = !1, T.renderOrder = -1, i.add(T));
|
|
1001
|
+
let j = r ? 16 : 26, N = j, P = 0, F = 0, te = r ? 3 : 6, I = te, L = r ? .55 : 1, R = 0, z = 0, B = 0, V = new C(), H = new M(), U = new k(), ne = new k(), W = new M(), re = new y();
|
|
1002
|
+
_.onImpact((e, t) => {
|
|
1003
|
+
let n = e.data;
|
|
1004
|
+
if (!n || I <= 0 || R - n.fxAt < .3) return;
|
|
1005
|
+
let r = $(t / 20, .2, 1), i = e.y - e.radius * .6;
|
|
1006
|
+
switch (n.pool.family) {
|
|
1007
|
+
case "car":
|
|
1008
|
+
b.puff(e.x, i, e.z, r);
|
|
1009
|
+
break;
|
|
1010
|
+
case "tank":
|
|
1011
|
+
b.puff(e.x, i, e.z, r), t > bt && (b.blast(e.x, i, e.z, r), z = Math.min(.7, z + .3 * r), B = Math.max(B, .4 * r));
|
|
1012
|
+
break;
|
|
1013
|
+
case "coin":
|
|
1014
|
+
case "stack":
|
|
1015
|
+
b.sparkle(e.x, e.y, e.z, r * .8);
|
|
1016
|
+
break;
|
|
1017
|
+
default: return;
|
|
1018
|
+
}
|
|
1019
|
+
n.fxAt = R, --I;
|
|
1020
|
+
});
|
|
1021
|
+
function ie(e) {
|
|
1022
|
+
let t = p[e];
|
|
1023
|
+
if (!t) return null;
|
|
1024
|
+
let n = Math.floor(Math.random() * t.length);
|
|
1025
|
+
for (let e = 0; e < t.length; e += 1) {
|
|
1026
|
+
let r = t[(n + e) % t.length];
|
|
1027
|
+
if (!(r.used + r.pending >= r.capacity)) return r.big && P + F >= N ? null : r;
|
|
1028
|
+
}
|
|
1029
|
+
return null;
|
|
1030
|
+
}
|
|
1031
|
+
function G(e, t) {
|
|
1032
|
+
let n = ie(e);
|
|
1033
|
+
if (!n) return null;
|
|
1034
|
+
let { model: r, half: i } = n, a = t.size ?? Q(.9, 1.1);
|
|
1035
|
+
if (t.yaw != null) {
|
|
1036
|
+
let e = t.tilt ?? .25;
|
|
1037
|
+
re.set(Q(-e, e), t.yaw, Q(-e, e));
|
|
1038
|
+
} else re.set(Q(0, 6.3), Q(0, 6.3), Q(0, 6.3));
|
|
1039
|
+
U.setFromEuler(re);
|
|
1040
|
+
let o = _.spawn({
|
|
1041
|
+
kind: r.kind,
|
|
1042
|
+
x: t.x,
|
|
1043
|
+
y: t.y,
|
|
1044
|
+
z: $(t.z ?? 0, gt, _t),
|
|
1045
|
+
vx: t.vx ?? 0,
|
|
1046
|
+
vy: t.vy ?? 0,
|
|
1047
|
+
vz: t.vz ?? 0,
|
|
1048
|
+
wx: t.wx ?? 0,
|
|
1049
|
+
wy: t.wy ?? 0,
|
|
1050
|
+
wz: t.wz ?? 0,
|
|
1051
|
+
qx: U.x,
|
|
1052
|
+
qy: U.y,
|
|
1053
|
+
qz: U.z,
|
|
1054
|
+
qw: U.w,
|
|
1055
|
+
hx: i.x * a,
|
|
1056
|
+
hy: i.y * a,
|
|
1057
|
+
hz: i.z * a,
|
|
1058
|
+
radius: r.radius * a,
|
|
1059
|
+
mass: r.mass * a,
|
|
1060
|
+
bounce: r.bounce,
|
|
1061
|
+
friction: r.friction,
|
|
1062
|
+
drag: r.drag * (t.dragScale ?? 1),
|
|
1063
|
+
ttl: t.ttl ?? 6,
|
|
1064
|
+
data: {
|
|
1065
|
+
pool: n,
|
|
1066
|
+
size: a,
|
|
1067
|
+
tint: xt(n.palette),
|
|
1068
|
+
fxAt: -1
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
return o ? (n.pending += 1, n.big && (F += 1), o) : null;
|
|
1072
|
+
}
|
|
1073
|
+
let ae = () => {
|
|
1074
|
+
let e = Math.random();
|
|
1075
|
+
return e < .07 && p.streamer ? "streamer" : e < .14 && p.star ? "star" : e < .3 && p.spark ? "spark" : "confetti";
|
|
1076
|
+
};
|
|
1077
|
+
function K(e, t) {
|
|
1078
|
+
let n = e < 0 ? h.left + .5 : h.right - .5, r = Math.round(80 * t * L);
|
|
1079
|
+
for (let t = 0; t < r; t += 1) G(ae(), {
|
|
1080
|
+
x: n + Q(-.3, .3),
|
|
1081
|
+
y: h.floorY + Q(.3, .9),
|
|
1082
|
+
z: Q(gt, _t),
|
|
1083
|
+
vx: -e * Q(3, 9),
|
|
1084
|
+
vy: Q(24, 38),
|
|
1085
|
+
vz: Q(-1.5, 1.5),
|
|
1086
|
+
wx: Q(-14, 14),
|
|
1087
|
+
wy: Q(-14, 14),
|
|
1088
|
+
wz: Q(-14, 14),
|
|
1089
|
+
ttl: Q(3.5, 5.2),
|
|
1090
|
+
size: Q(.8, 1.25),
|
|
1091
|
+
dragScale: .4
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
function oe(e) {
|
|
1095
|
+
let t = Math.round(42 * e * L);
|
|
1096
|
+
for (let e = 0; e < t; e += 1) G("bill", {
|
|
1097
|
+
x: Q(h.left + .6, h.right - .6),
|
|
1098
|
+
y: h.top + Q(.3, 3.5),
|
|
1099
|
+
z: Q(gt, _t),
|
|
1100
|
+
vx: Q(-1.5, 1.5),
|
|
1101
|
+
vy: Q(-3, 0),
|
|
1102
|
+
vz: Q(-.5, .5),
|
|
1103
|
+
wx: Q(-7, 7),
|
|
1104
|
+
wy: Q(-3, 3),
|
|
1105
|
+
wz: Q(-7, 7),
|
|
1106
|
+
ttl: Q(5, 6.5),
|
|
1107
|
+
size: Q(.9, 1.15)
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
function se(e) {
|
|
1111
|
+
for (let t = 0; t < e; t += 1) G("stack", {
|
|
1112
|
+
x: Q(h.left, h.right) * .75,
|
|
1113
|
+
y: h.top + Q(.6, 2.2),
|
|
1114
|
+
z: Q(-1.5, .5),
|
|
1115
|
+
vx: Q(-2, 2),
|
|
1116
|
+
vy: Q(-4, -1),
|
|
1117
|
+
wx: Q(-3, 3),
|
|
1118
|
+
wy: Q(-2, 2),
|
|
1119
|
+
wz: Q(-3, 3),
|
|
1120
|
+
ttl: Q(6.5, 7.5)
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
function ce(e) {
|
|
1124
|
+
let t = Math.round(48 * e * L);
|
|
1125
|
+
for (let e = 0; e < t; e += 1) G("coin", {
|
|
1126
|
+
x: Q(h.left + .5, h.right - .5) * .85,
|
|
1127
|
+
y: h.top + Q(.3, 3),
|
|
1128
|
+
z: Q(-2, .8),
|
|
1129
|
+
vx: Q(-2, 2),
|
|
1130
|
+
vy: Q(-7, -1),
|
|
1131
|
+
wx: Q(-12, 12),
|
|
1132
|
+
wy: Q(-4, 4),
|
|
1133
|
+
wz: Q(-12, 12),
|
|
1134
|
+
ttl: Q(5, 6.5),
|
|
1135
|
+
size: Q(.9, 1.15)
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
function ue(e) {
|
|
1139
|
+
let t = Math.random() < .5 ? -1 : 1;
|
|
1140
|
+
for (let n = 0; n < e; n += 1) {
|
|
1141
|
+
let e = n % 2 ? -t : t;
|
|
1142
|
+
G("car", {
|
|
1143
|
+
x: e < 0 ? h.left + Q(1.3, 3) : h.right - Q(1.3, 3),
|
|
1144
|
+
y: h.top + Q(.8, 2.4) + n * .4,
|
|
1145
|
+
z: Q(-1.8, .4),
|
|
1146
|
+
vx: -e * Q(3, 7.5),
|
|
1147
|
+
vy: Q(-1, 3),
|
|
1148
|
+
vz: Q(-1, .6),
|
|
1149
|
+
wx: Q(-2.5, 2.5),
|
|
1150
|
+
wy: Q(-2, 2),
|
|
1151
|
+
wz: Q(-5, 5),
|
|
1152
|
+
yaw: e < 0 ? 0 : Math.PI,
|
|
1153
|
+
tilt: .4,
|
|
1154
|
+
ttl: Q(6.5, 7.5),
|
|
1155
|
+
size: Q(.92, 1.08)
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
function de(e) {
|
|
1160
|
+
let t = Math.max(0, h.right - h.left - 4);
|
|
1161
|
+
for (let n = 0; n < e; n += 1) G("tank", {
|
|
1162
|
+
x: h.left + 2 + t * ((n + .5 + Q(-.25, .25)) / e),
|
|
1163
|
+
y: h.top + Q(1, 3),
|
|
1164
|
+
z: Q(-1.6, .3),
|
|
1165
|
+
vx: Q(-1, 1),
|
|
1166
|
+
vy: Q(-9, -5),
|
|
1167
|
+
wx: Q(-.6, .6),
|
|
1168
|
+
wy: Q(-1.5, 1.5),
|
|
1169
|
+
wz: Q(-.6, .6),
|
|
1170
|
+
yaw: (Math.random() < .5 ? 0 : Math.PI) + Q(-.5, .5),
|
|
1171
|
+
tilt: .15,
|
|
1172
|
+
ttl: Q(6.5, 7.5),
|
|
1173
|
+
size: Q(.95, 1.06)
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
let fe = (e, t, n) => $(Math.round(e * h.room * (r ? .75 : 1)), t, n), pe = {
|
|
1177
|
+
confetti(e) {
|
|
1178
|
+
K(-1, e), K(1, e);
|
|
1179
|
+
},
|
|
1180
|
+
money(e) {
|
|
1181
|
+
oe(e), se(Math.round((2 + 2 * e) * (r ? .6 : 1))), ce(e * .15);
|
|
1182
|
+
},
|
|
1183
|
+
cars(e) {
|
|
1184
|
+
ue(fe(3 + 2 * e, 2, 5));
|
|
1185
|
+
},
|
|
1186
|
+
tanks(e) {
|
|
1187
|
+
de(fe(2 + 2 * e, r ? 1 : 2, 4));
|
|
1188
|
+
},
|
|
1189
|
+
coins(e) {
|
|
1190
|
+
ce(e), se(1);
|
|
1191
|
+
},
|
|
1192
|
+
mix(e) {
|
|
1193
|
+
K(-1, e * .5), K(1, e * .5), oe(e * .55), ce(e * .45), se(r ? 1 : 2), ue(fe(2 + e, 1, 3)), de(fe(1 + e, 1, 2));
|
|
1194
|
+
},
|
|
1195
|
+
finale(e) {
|
|
1196
|
+
let { bodies: t } = _;
|
|
1197
|
+
for (let e = 0; e < t.length; e += 1) {
|
|
1198
|
+
let n = t[e];
|
|
1199
|
+
n.alive && (n.ttl = Math.min(n.ttl, n.age + Q(.9, 1.4)));
|
|
1200
|
+
}
|
|
1201
|
+
_.sweep(e, 1);
|
|
1202
|
+
let n = Math.round(80 * e * L);
|
|
1203
|
+
for (let e = 0; e < n; e += 1) G("bill", {
|
|
1204
|
+
x: h.left - Q(.3, 2.5),
|
|
1205
|
+
y: Q(h.floorY + 1, h.top + .5),
|
|
1206
|
+
z: Q(gt, _t),
|
|
1207
|
+
vx: Q(20, 32),
|
|
1208
|
+
vy: Q(2, 7),
|
|
1209
|
+
vz: Q(-1, 1),
|
|
1210
|
+
wx: Q(-9, 9),
|
|
1211
|
+
wy: Q(-4, 4),
|
|
1212
|
+
wz: Q(-9, 9),
|
|
1213
|
+
ttl: Q(1.2, 1.5),
|
|
1214
|
+
size: Q(.9, 1.2),
|
|
1215
|
+
dragScale: .3
|
|
1216
|
+
});
|
|
1217
|
+
for (let e = 0; e < 3; e += 1) b.sparkle(Q(h.left, h.right) * .6, Q(-1, 2), 0, 1);
|
|
1218
|
+
z = Math.max(z, .45);
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
function me() {
|
|
1222
|
+
for (let e = 0; e < f.length; e += 1) f[e].used = 0, f[e].pending = 0;
|
|
1223
|
+
let e = 0, t = 0, { bodies: n } = _;
|
|
1224
|
+
for (let r = 0; r < n.length; r += 1) {
|
|
1225
|
+
let i = n[r], a = i.data;
|
|
1226
|
+
if (!i.alive || !a) continue;
|
|
1227
|
+
let { pool: o } = a;
|
|
1228
|
+
if (o.used >= o.capacity) continue;
|
|
1229
|
+
let s = a.size * i.scale;
|
|
1230
|
+
H.set(i.x, i.y, i.z), U.set(i.qx, i.qy, i.qz, i.qw), W.set(s, s, s), V.compose(H, U, W);
|
|
1231
|
+
let c = o.used;
|
|
1232
|
+
o.used += 1;
|
|
1233
|
+
let { parts: l } = o;
|
|
1234
|
+
for (let e = 0; e < l.length; e += 1) {
|
|
1235
|
+
let t = l[e];
|
|
1236
|
+
t.mesh.setMatrixAt(c, V), t.tinted && t.mesh.setColorAt(c, a.tint);
|
|
1237
|
+
}
|
|
1238
|
+
if (!o.big || (e += 1, t >= S)) continue;
|
|
1239
|
+
let u = i.y - h.floorY - o.half.y * a.size, d = o.blobRadius * s * $(1 - u / 6, .15, 1);
|
|
1240
|
+
H.set(i.x, h.floorY + .02, i.z), W.set(d * 2.4, 1, d * 1.5), V.compose(H, ne, W), T.setMatrixAt(t, V), t += 1;
|
|
1241
|
+
}
|
|
1242
|
+
for (let e = 0; e < f.length; e += 1) {
|
|
1243
|
+
let { parts: t, used: n } = f[e];
|
|
1244
|
+
for (let e = 0; e < t.length; e += 1) {
|
|
1245
|
+
let { mesh: r, tinted: i } = t[e];
|
|
1246
|
+
r.count = n, r.visible = n > 0, n && (r.instanceMatrix.needsUpdate = !0, i && (r.instanceColor.needsUpdate = !0));
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
P = e, F = 0, T && (T.count = t, T.visible = t > 0, T.instanceMatrix.needsUpdate = !0);
|
|
1250
|
+
}
|
|
1251
|
+
return {
|
|
1252
|
+
lowPower: r,
|
|
1253
|
+
stats() {
|
|
1254
|
+
let e = Object.create(null), t = 0;
|
|
1255
|
+
return f.forEach(({ family: n, used: r }) => {
|
|
1256
|
+
e[n] = (e[n] || 0) + r, t += r;
|
|
1257
|
+
}), {
|
|
1258
|
+
bodies: t,
|
|
1259
|
+
big: P,
|
|
1260
|
+
bigCap: N,
|
|
1261
|
+
live: e,
|
|
1262
|
+
calls: n.info.render.calls,
|
|
1263
|
+
triangles: n.info.render.triangles
|
|
1264
|
+
};
|
|
1265
|
+
},
|
|
1266
|
+
burst(e, t = 1) {
|
|
1267
|
+
pe[e]?.(t), B = Math.max(B, e === "finale" ? 1 : t * .3);
|
|
1268
|
+
},
|
|
1269
|
+
render(e) {
|
|
1270
|
+
let t = Math.min(e, .05);
|
|
1271
|
+
R += t, I = te, _.step(t), b.update(t), me(), z = Math.max(0, z - t * 2.2), B = Math.max(0, B - t * 2.5), u.intensity = B * 4 * o, a.position.x = (Math.random() - .5) * z * .4, a.position.y = (Math.random() - .5) * z * .4, n.render(i, a);
|
|
1272
|
+
},
|
|
1273
|
+
resize(e, t) {
|
|
1274
|
+
n.setSize(e, t, !1), a.aspect = e / t, a.fov = a.aspect < 1 ? $(50 / Math.max(a.aspect, .55) * .8, 50, 85) : 50, a.updateProjectionMatrix();
|
|
1275
|
+
let r = Math.tan(a.fov * Math.PI / 360) * pt, i = r * a.aspect;
|
|
1276
|
+
h.top = r, h.floorY = -r + ht, h.left = -i, h.right = i, h.room = $(i * 2 / 16, .5, 1), N = Math.max(8, Math.round(j * h.room)), _.setBounds({
|
|
1277
|
+
floorY: h.floorY,
|
|
1278
|
+
left: h.left,
|
|
1279
|
+
right: h.right
|
|
1280
|
+
});
|
|
1281
|
+
},
|
|
1282
|
+
dispose() {
|
|
1283
|
+
b.dispose(), _.clear();
|
|
1284
|
+
let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
1285
|
+
f.forEach(({ parts: e }) => e.forEach(({ mesh: e }) => {
|
|
1286
|
+
e.dispose(), i.remove(e);
|
|
1287
|
+
})), d.forEach(({ parts: n }) => n.forEach(({ geometry: n, material: r }) => {
|
|
1288
|
+
e.add(n), [].concat(r).forEach((e) => t.add(e));
|
|
1289
|
+
})), T && (T.dispose(), i.remove(T), e.add(T.geometry), t.add(T.material)), t.forEach((e) => {
|
|
1290
|
+
Object.keys(e).forEach((t) => {
|
|
1291
|
+
e[t]?.isTexture && r.add(e[t]);
|
|
1292
|
+
}), e.dispose();
|
|
1293
|
+
}), r.forEach((e) => e.dispose()), e.forEach((e) => e.dispose()), n.dispose(), n.forceContextLoss?.();
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
export { Dt as createAvalancheScene };
|
|
1298
|
+
|
|
1299
|
+
//# sourceMappingURL=avalancheScene3d-Z5QyZIid.js.map
|