agentglow 0.4.3 → 0.4.5
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/README.md +5 -0
- package/dist/chunks/{KitScene-DsZmpTf7.js → KitScene-DNk9wirq.js} +3146 -2915
- package/dist/chunks/{index-DlvN9YSt.js → index-B7hfNEXI.js} +284 -284
- package/dist/chunks/{index-DATZHNA0.js → index-B8MtKKcW.js} +42 -42
- package/dist/chunks/{index-nw9i304P.js → index-BXBnv8GE.js} +1 -1
- package/dist/chunks/{index-B6EboYGn.js → index-CHIG9x__.js} +30 -30
- package/dist/chunks/{index-CW8fTJn1.js → index-CXhdtTJn.js} +7 -7
- package/dist/chunks/{index-s99mYaJ9.js → index-DOXpqUvk.js} +352 -345
- package/dist/chunks/{index-avfwD6eP.js → index-Mp_16YlZ.js} +1 -1
- package/dist/chunks/{index-CoeLwySn.js → index-n6GWpbis.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/world.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var le = Object.defineProperty;
|
|
2
2
|
var he = (g, e, c) => e in g ? le(g, e, { enumerable: !0, configurable: !0, writable: !0, value: c }) : g[e] = c;
|
|
3
|
-
var
|
|
3
|
+
var d = (g, e, c) => he(g, typeof e != "symbol" ? e + "" : e, c);
|
|
4
4
|
import { jsxs as dt, jsx as O, Fragment as fe } from "react/jsx-runtime";
|
|
5
5
|
import { useFrame as gt, useThree as ue } from "@react-three/fiber";
|
|
6
6
|
import { EffectComposer as de, Bloom as pe, Vignette as ge, Noise as me } from "@react-three/postprocessing";
|
|
7
7
|
import { useMemo as Me, useRef as st, useEffect as At } from "react";
|
|
8
8
|
import * as w from "three";
|
|
9
|
-
import { g as ye, K as Ae, F as be, f as et, A as Z, w as q, H as ne, I as ie, R as xe, k as $t, p as we, e as Re, q as zt, o as Se, n as Ge, d as Tt, J as ze, M as ve, T as oe, i as
|
|
9
|
+
import { g as ye, K as Ae, F as be, f as et, A as Z, w as q, H as ne, I as ie, R as xe, k as $t, p as we, e as Re, q as zt, o as Se, n as Ge, d as Tt, J as ze, M as ve, N as Ie, T as oe, i as Ce, x as Pe, G as Fe, u as Be, L as vt, t as Jt, v as Qt, S as Oe, O as Te, P as Ee, j as ke, r as _e } from "./KitScene-DNk9wirq.js";
|
|
10
10
|
var se;
|
|
11
|
-
const pt = typeof window < "u" && !!((se = window.matchMedia) != null && se.call(window, "(prefers-reduced-motion: reduce)").matches), nt = pt ? 0.3 : 1, W = pt ? 9e3 : 24e3, it = pt ? 3500 : 8e3, F = 12, $ = pt ? 450 : 1100, Et = 9e3, Y = 64, kt = 31,
|
|
11
|
+
const pt = typeof window < "u" && !!((se = window.matchMedia) != null && se.call(window, "(prefers-reduced-motion: reduce)").matches), nt = pt ? 0.3 : 1, W = pt ? 9e3 : 24e3, it = pt ? 3500 : 8e3, F = 12, $ = pt ? 450 : 1100, Et = 9e3, Y = 64, kt = 31, Le = 4.6, ot = 28, _t = 64, Rt = 18, Lt = 16, ht = 8, X = Math.PI * 2, re = 200, tt = re + Ie, Dt = 5.4, Gt = 3.2, De = ["planner", "researcher", "writer"], yt = Object.fromEntries(Object.entries(oe).map(([g, e]) => [g, new w.Color(e)])), Ue = Ce, je = () => ({ used: !1, id: "", inst: null, seen: 0, x: 0, y: 0, z: 0, r: 1, g: 1, b: 1, omega: 0, bright: 0, swirl: 0, rscale: 1, tiltA: 0, tiltB: 0, count: 0, want: 0, rank: 0, ka: null, released: !1, p: 0, e: 0, waitMcp: 0 }), St = tt * 3, Ne = (g) => {
|
|
12
12
|
let e = 7;
|
|
13
13
|
for (let c = 0; c < g.length; c++) e = e * 31 + g.charCodeAt(c) >>> 0;
|
|
14
14
|
return e % 100003;
|
|
@@ -59,127 +59,127 @@ function te() {
|
|
|
59
59
|
blending: w.AdditiveBlending
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
const S = new w.Vector3(), N = new w.Vector3(), T = new w.Vector3(), G = new w.Color(), J = new w.Color(), Q = new w.Object3D(), V = new w.Color(1, 1, 1), ee = new w.Color("#fbbf24"),
|
|
63
|
-
class
|
|
62
|
+
const S = new w.Vector3(), N = new w.Vector3(), T = new w.Vector3(), G = new w.Color(), J = new w.Color(), Q = new w.Object3D(), V = new w.Color(1, 1, 1), ee = new w.Color("#fbbf24"), We = new w.Color("#ef4444"), Xe = new w.Color("#ef4444");
|
|
63
|
+
class qe {
|
|
64
64
|
constructor() {
|
|
65
|
-
|
|
65
|
+
d(this, "material", te());
|
|
66
66
|
/** nebula points live in the (scaled) side graph group: their sprite size follows kit.graph.scale */
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
d(this, "nebMaterial", te());
|
|
68
|
+
d(this, "frame", 0);
|
|
69
|
+
d(this, "selectedId", null);
|
|
70
70
|
/** field radius (grows with the kit core so the murmuration always surrounds the agents + periphery) */
|
|
71
|
-
|
|
71
|
+
d(this, "fieldR", kt);
|
|
72
72
|
// ---- field
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
73
|
+
d(this, "fieldGeo", ft(W));
|
|
74
|
+
d(this, "fP", j(this.fieldGeo, "position"));
|
|
75
|
+
d(this, "fC", j(this.fieldGeo, "acol"));
|
|
76
|
+
d(this, "fS", j(this.fieldGeo, "size"));
|
|
77
|
+
d(this, "fYb", new Float32Array(W));
|
|
78
|
+
d(this, "fIvx", new Float32Array(W));
|
|
79
|
+
d(this, "fIvz", new Float32Array(W));
|
|
80
|
+
d(this, "fHeat", new Float32Array(W));
|
|
81
|
+
d(this, "fT", new Float32Array(W * 3));
|
|
82
|
+
d(this, "fOwner", new Int16Array(W).fill(-1));
|
|
83
|
+
d(this, "fAng", new Float32Array(W));
|
|
84
|
+
d(this, "fOrb", new Float32Array(W));
|
|
85
|
+
d(this, "fRnd", new Float32Array(W));
|
|
86
86
|
// ---- slots (agent eddies, one per drawn kit agent)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
d(this, "slots", Array.from({ length: Y }, je));
|
|
88
|
+
d(this, "idToSlot", /* @__PURE__ */ new Map());
|
|
89
|
+
d(this, "pendingByInst", /* @__PURE__ */ new Map());
|
|
90
90
|
// ---- runs (pooled vortices, one per drawn kit run; a vortex fades out after its run leaves the kit)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
d(this, "runRef", new Array(F).fill(null));
|
|
92
|
+
d(this, "runKit", new Array(F).fill(null));
|
|
93
|
+
d(this, "runId", new Array(F).fill(""));
|
|
94
|
+
d(this, "runPool", /* @__PURE__ */ new Map());
|
|
95
|
+
d(this, "rPresent", new Uint8Array(F));
|
|
96
|
+
d(this, "rSteps", new Uint8Array(F));
|
|
97
|
+
d(this, "rX", new Float32Array(F));
|
|
98
|
+
d(this, "rZ", new Float32Array(F));
|
|
99
99
|
/** vortex loop radius per run (around its agents) */
|
|
100
|
-
|
|
100
|
+
d(this, "rR", new Float32Array(F).fill(Le));
|
|
101
101
|
/** step attractors (x, z) per run: at the kit's role slots (plan | research | write) */
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
d(this, "rAt", new Float32Array(F * 6));
|
|
103
|
+
d(this, "rAlpha", new Float32Array(F));
|
|
104
|
+
d(this, "rCol", Array.from({ length: F }, () => new w.Color()));
|
|
105
|
+
d(this, "rColStr", new Array(F).fill(""));
|
|
106
|
+
d(this, "runGeo", ft(F * $));
|
|
107
|
+
d(this, "rTh", new Float32Array(F * $));
|
|
108
|
+
d(this, "rSp", new Float32Array(F * $));
|
|
109
|
+
d(this, "rRr", new Float32Array(F * $));
|
|
110
|
+
d(this, "rY", new Float32Array(F * $));
|
|
111
111
|
// ---- nebula (FalkorDB side current; local frame of the kit side graph)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
112
|
+
d(this, "nebGeo", ft(it));
|
|
113
|
+
d(this, "anchorGeo", ft(tt));
|
|
114
|
+
d(this, "nA", new Uint16Array(it));
|
|
115
|
+
d(this, "nO", new Float32Array(it * 3));
|
|
116
|
+
d(this, "nSpin", new Float32Array(it));
|
|
117
|
+
d(this, "nB", new Float32Array(it));
|
|
118
|
+
d(this, "aLocal", new Float32Array(tt * 3));
|
|
119
|
+
d(this, "aCol", new Float32Array(tt * 3));
|
|
120
|
+
d(this, "aNamed", new Uint8Array(tt));
|
|
121
|
+
d(this, "burst", new Float32Array(tt));
|
|
122
|
+
d(this, "burstW", new Float32Array(tt));
|
|
123
|
+
d(this, "flareCol", new Float32Array(tt * 3));
|
|
124
|
+
d(this, "nameIdx", /* @__PURE__ */ new Map());
|
|
125
|
+
d(this, "nebAngle", 0.4);
|
|
126
|
+
d(this, "nAnchors", 0);
|
|
127
|
+
d(this, "edgeGeo", new w.BufferGeometry());
|
|
128
|
+
d(this, "edgeA", new Uint16Array(St * 2));
|
|
129
|
+
d(this, "nEdge", 0);
|
|
130
|
+
d(this, "lastFlareId", 0);
|
|
131
|
+
d(this, "lastFlare", null);
|
|
132
132
|
// ---- streams + lines
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
d(this, "streamGeo", ft(Et));
|
|
134
|
+
d(this, "beamGeo");
|
|
135
|
+
d(this, "glowGeo", ft(Y + F * 3 + ht));
|
|
136
136
|
// ---- meshes
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
137
|
+
d(this, "cores");
|
|
138
|
+
d(this, "attractors");
|
|
139
|
+
d(this, "stepRings");
|
|
140
|
+
d(this, "rings");
|
|
141
|
+
d(this, "pulsars");
|
|
142
|
+
d(this, "pulsarBeams");
|
|
143
|
+
d(this, "selRing");
|
|
144
|
+
d(this, "ringStart", new Float32Array(ot).fill(-1e9));
|
|
145
|
+
d(this, "ringDur", new Float32Array(ot).fill(1));
|
|
146
|
+
d(this, "ringMax", new Float32Array(ot));
|
|
147
|
+
d(this, "ringPos", new Float32Array(ot * 3));
|
|
148
|
+
d(this, "ringCol", new Float32Array(ot * 3));
|
|
149
|
+
d(this, "ringNext", 0);
|
|
150
|
+
d(this, "mcpSpin", new Float32Array(ht));
|
|
151
151
|
// ------------------------------------------------------------------ frame
|
|
152
152
|
/** kit fit size multiplier for eddies, sampled once per frame */
|
|
153
|
-
|
|
153
|
+
d(this, "lodK", 1);
|
|
154
154
|
// active runs / swirls packed for the hot loop
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
155
|
+
d(this, "aX", new Float32Array(F));
|
|
156
|
+
d(this, "aZ", new Float32Array(F));
|
|
157
|
+
d(this, "aA", new Float32Array(F));
|
|
158
|
+
d(this, "aRR", new Float32Array(F));
|
|
159
|
+
d(this, "aR", new Float32Array(F * 3));
|
|
160
|
+
d(this, "sX", new Float32Array(Y));
|
|
161
|
+
d(this, "sZ", new Float32Array(Y));
|
|
162
|
+
d(this, "sS", new Float32Array(Y));
|
|
163
|
+
d(this, "stTh", new Float32Array(3));
|
|
164
|
+
d(this, "stB", new Float32Array(3));
|
|
165
165
|
for (let t = 0; t < W; t++) {
|
|
166
|
-
const
|
|
167
|
-
this.fP[t * 3] = Math.cos(p) *
|
|
166
|
+
const i = Math.sqrt(Math.random()) * kt, p = Math.random() * X;
|
|
167
|
+
this.fP[t * 3] = Math.cos(p) * i, this.fP[t * 3 + 2] = Math.sin(p) * i, this.fYb[t] = (Math.random() - 0.5) * (0.6 + i * 0.05), this.fP[t * 3 + 1] = this.fYb[t], this.fRnd[t] = Math.random(), this.fOrb[t] = 0.16 + 1.35 * Math.pow(Math.random(), 1.5), this.fAng[t] = Math.random() * X;
|
|
168
168
|
}
|
|
169
169
|
for (let t = 0; t < F * $; t++) {
|
|
170
170
|
this.rTh[t] = Math.random() * X, this.rSp[t] = 0.2 + Math.random() * 0.14;
|
|
171
|
-
const
|
|
172
|
-
this.rRr[t] =
|
|
171
|
+
const i = (Math.random() + Math.random() + Math.random() - 1.5) * 0.55;
|
|
172
|
+
this.rRr[t] = i, this.rY[t] = (Math.random() - 0.5) * 0.35;
|
|
173
173
|
}
|
|
174
174
|
for (let t = 0; t < it; t++) {
|
|
175
|
-
const
|
|
176
|
-
this.nO[t * 3] = Math.cos(p) * b, this.nO[t * 3 + 1] = (Math.random() - 0.5) *
|
|
175
|
+
const i = 0.18 + 0.55 * Math.pow(Math.random(), 3), p = Math.random() * X, b = i * Math.sqrt(-2 * Math.log(1 - Math.random() * 0.98));
|
|
176
|
+
this.nO[t * 3] = Math.cos(p) * b, this.nO[t * 3 + 1] = (Math.random() - 0.5) * i * 0.8, this.nO[t * 3 + 2] = Math.sin(p) * b, this.nSpin[t] = (0.15 + Math.random() * 0.5) * (Math.random() < 0.5 ? 1 : 0.6), this.nB[t] = 0.5 + Math.random() * 0.7;
|
|
177
177
|
}
|
|
178
178
|
this.anchorGeo.setDrawRange(0, 0), this.edgeGeo.setAttribute("position", new w.BufferAttribute(new Float32Array(St * 2 * 3), 3)), this.edgeGeo.setAttribute("color", new w.BufferAttribute(new Float32Array(St * 2 * 3), 3).setUsage(w.DynamicDrawUsage)), this.edgeGeo.setDrawRange(0, 0), this.edgeGeo.boundingSphere = new w.Sphere(new w.Vector3(), 50);
|
|
179
179
|
const e = _t + Lt * Rt;
|
|
180
180
|
this.beamGeo = new w.BufferGeometry(), this.beamGeo.setAttribute("position", new w.BufferAttribute(new Float32Array(e * 6), 3).setUsage(w.DynamicDrawUsage)), this.beamGeo.setAttribute("color", new w.BufferAttribute(new Float32Array(e * 6), 3).setUsage(w.DynamicDrawUsage));
|
|
181
|
-
const c = new w.Sphere(new w.Vector3(), 400),
|
|
182
|
-
this.cores = new w.InstancedMesh(new w.IcosahedronGeometry(0.26, 3),
|
|
181
|
+
const c = new w.Sphere(new w.Vector3(), 400), o = new w.MeshBasicMaterial({ toneMapped: !1 });
|
|
182
|
+
this.cores = new w.InstancedMesh(new w.IcosahedronGeometry(0.26, 3), o, Y), this.attractors = new w.InstancedMesh(new w.IcosahedronGeometry(0.3, 3), new w.MeshBasicMaterial({ toneMapped: !1 }), F * 3);
|
|
183
183
|
const s = new w.RingGeometry(0.9, 1, 96);
|
|
184
184
|
s.rotateX(-Math.PI / 2);
|
|
185
185
|
const n = () => new w.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: w.AdditiveBlending, depthWrite: !1, side: w.DoubleSide });
|
|
@@ -188,16 +188,16 @@ class Xe {
|
|
|
188
188
|
f.translate(0, 1.6, 0);
|
|
189
189
|
const l = f.clone().rotateX(Math.PI), r = new w.BufferGeometry();
|
|
190
190
|
{
|
|
191
|
-
const t = f.getAttribute("position").array,
|
|
192
|
-
R.set(t), R.set(
|
|
191
|
+
const t = f.getAttribute("position").array, i = l.getAttribute("position").array, p = f.getIndex().array, b = l.getIndex().array, R = new Float32Array(t.length + i.length);
|
|
192
|
+
R.set(t), R.set(i, t.length);
|
|
193
193
|
const z = [...p, ...Array.from(b, (v) => v + t.length / 3)];
|
|
194
194
|
r.setAttribute("position", new w.BufferAttribute(R, 3)), r.setIndex(z);
|
|
195
195
|
}
|
|
196
196
|
this.pulsarBeams = new w.InstancedMesh(r, n(), ht);
|
|
197
197
|
for (const t of [this.cores, this.attractors, this.stepRings, this.rings, this.pulsars, this.pulsarBeams]) {
|
|
198
198
|
t.boundingSphere = c, t.frustumCulled = !1, t.instanceMatrix.setUsage(w.DynamicDrawUsage), t.setColorAt(0, G.setRGB(0, 0, 0));
|
|
199
|
-
for (let
|
|
200
|
-
Q.position.set(0, -999, 0), Q.scale.setScalar(1e-4), Q.updateMatrix(), t.setMatrixAt(
|
|
199
|
+
for (let i = 0; i < t.count; i++)
|
|
200
|
+
Q.position.set(0, -999, 0), Q.scale.setScalar(1e-4), Q.updateMatrix(), t.setMatrixAt(i, Q.matrix), t.setColorAt(i, G.setRGB(0, 0, 0));
|
|
201
201
|
}
|
|
202
202
|
this.selRing = new w.Mesh(new w.RingGeometry(1.25, 1.33, 64).rotateX(-Math.PI / 2), n()), this.selRing.visible = !1;
|
|
203
203
|
}
|
|
@@ -206,40 +206,40 @@ class Xe {
|
|
|
206
206
|
* a node never moves when others arrive), new anchors take over a share of the nebula particles. No reset.
|
|
207
207
|
*/
|
|
208
208
|
setGalaxy(e) {
|
|
209
|
-
const c = ye(e, re),
|
|
210
|
-
this.nAnchors =
|
|
209
|
+
const c = ye(e, re), o = Math.min(tt, c.nodes.length), s = this.nAnchors;
|
|
210
|
+
this.nAnchors = o, this.nameIdx.clear();
|
|
211
211
|
const n = /* @__PURE__ */ new Map();
|
|
212
|
-
for (let p = 0; p <
|
|
212
|
+
for (let p = 0; p < o; p++) {
|
|
213
213
|
const b = c.nodes[p];
|
|
214
214
|
this.nameIdx.set(b.name.toLowerCase(), p), n.set(b.id, p);
|
|
215
|
-
const R =
|
|
215
|
+
const R = Ne(b.id), z = K(R), v = 0.5 + (Dt - 0.9) * Math.sqrt(z) + (K(R + 1) - 0.5) * 0.45, h = R % 3 / 3 * X + v * 1.15 + (K(R + 2) - 0.5) * 0.5;
|
|
216
216
|
this.aLocal[p * 3] = Math.cos(h) * v, this.aLocal[p * 3 + 1] = (K(R + 3) - 0.5) * 0.7 * (1.3 - z) + 0.4, this.aLocal[p * 3 + 2] = Math.sin(h) * v, G.set(Ae[b.kind] ?? "#94a3b8"), this.aCol[p * 3] = G.r, this.aCol[p * 3 + 1] = G.g, this.aCol[p * 3 + 2] = G.b, this.aNamed[p] = p < 22 ? 1 : 0;
|
|
217
217
|
}
|
|
218
|
-
if (
|
|
219
|
-
const p = s > 0 &&
|
|
218
|
+
if (o > 0) {
|
|
219
|
+
const p = s > 0 && o > s ? (o - s) / o : s > 0 ? 0 : 1;
|
|
220
220
|
for (let b = 0; b < it; b++)
|
|
221
|
-
this.nA[b] >=
|
|
221
|
+
this.nA[b] >= o ? this.nA[b] = Math.floor(Math.random() * o) : p > 0 && Math.random() < p && (this.nA[b] = s > 0 ? s + Math.floor(Math.random() * (o - s)) : Math.random() < 0.2 ? Math.floor(Math.random() * Math.min(22, o)) : Math.floor(Math.random() * o));
|
|
222
222
|
}
|
|
223
|
-
this.anchorGeo.setDrawRange(0,
|
|
223
|
+
this.anchorGeo.setDrawRange(0, o);
|
|
224
224
|
const f = this.edgeA;
|
|
225
225
|
let l = 0;
|
|
226
226
|
const r = /* @__PURE__ */ new Set(), t = (p, b) => {
|
|
227
227
|
if (p === b || l >= St) return;
|
|
228
228
|
const R = p < b ? p * 4096 + b : b * 4096 + p;
|
|
229
229
|
r.has(R) || (r.add(R), f[l * 2] = p, f[l * 2 + 1] = b, l++);
|
|
230
|
-
},
|
|
230
|
+
}, i = this.aLocal;
|
|
231
231
|
for (const p of c.links) {
|
|
232
232
|
const b = n.get(p.source), R = n.get(p.target);
|
|
233
233
|
if (b !== void 0 && R !== void 0) {
|
|
234
|
-
const z =
|
|
234
|
+
const z = i[b * 3] - i[R * 3], v = i[b * 3 + 2] - i[R * 3 + 2];
|
|
235
235
|
z * z + v * v < 9 && t(b, R);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
for (let p = 0; p <
|
|
238
|
+
for (let p = 0; p < o; p++) {
|
|
239
239
|
let b = -1, R = 1e9, z = -1, v = 1e9;
|
|
240
|
-
for (let h = 0; h <
|
|
240
|
+
for (let h = 0; h < o; h++) {
|
|
241
241
|
if (h === p) continue;
|
|
242
|
-
const A =
|
|
242
|
+
const A = i[p * 3] - i[h * 3], I = i[p * 3 + 1] - i[h * 3 + 1], a = i[p * 3 + 2] - i[h * 3 + 2], M = A * A + I * I + a * a;
|
|
243
243
|
M < R ? (z = b, v = R, b = h, R = M) : M < v && (z = h, v = M);
|
|
244
244
|
}
|
|
245
245
|
b >= 0 && t(p, b), z >= 0 && p % 2 === 0 && t(p, z);
|
|
@@ -255,18 +255,18 @@ class Xe {
|
|
|
255
255
|
// ------------------------------------------------------------------ helpers
|
|
256
256
|
anchorIdx(e) {
|
|
257
257
|
const c = e.toLowerCase();
|
|
258
|
-
let
|
|
259
|
-
if (
|
|
258
|
+
let o = this.nameIdx.get(c);
|
|
259
|
+
if (o === void 0) {
|
|
260
260
|
let s = 7;
|
|
261
261
|
for (let n = 0; n < c.length; n++) s = s * 31 + c.charCodeAt(n) >>> 0;
|
|
262
|
-
|
|
262
|
+
o = s % Math.max(1, this.nAnchors), this.nameIdx.set(c, o);
|
|
263
263
|
}
|
|
264
|
-
return
|
|
264
|
+
return o;
|
|
265
265
|
}
|
|
266
266
|
/** anchor in the nebula's local frame (rotated by the slow spin) */
|
|
267
267
|
anchorLocal(e, c) {
|
|
268
|
-
const
|
|
269
|
-
return c.set(n *
|
|
268
|
+
const o = Math.cos(this.nebAngle), s = Math.sin(this.nebAngle), n = this.aLocal[e * 3], f = this.aLocal[e * 3 + 2];
|
|
269
|
+
return c.set(n * o - f * s, this.aLocal[e * 3 + 1], n * s + f * o);
|
|
270
270
|
}
|
|
271
271
|
/** anchor on stage (the kit places + scales the side graph) */
|
|
272
272
|
anchorWorld(e, c) {
|
|
@@ -277,46 +277,46 @@ class Xe {
|
|
|
277
277
|
return c === void 0 ? null : this.slots[c];
|
|
278
278
|
}
|
|
279
279
|
/** stage position of a run's step attractor k (pool slot s) */
|
|
280
|
-
attractor(e, c,
|
|
281
|
-
return
|
|
280
|
+
attractor(e, c, o) {
|
|
281
|
+
return o.set(this.rAt[e * 6 + c * 2], 0.35, this.rAt[e * 6 + c * 2 + 1]);
|
|
282
282
|
}
|
|
283
|
-
emitRing(e, c,
|
|
283
|
+
emitRing(e, c, o, s, n, f, l, r = 1) {
|
|
284
284
|
const t = this.ringNext++ % ot;
|
|
285
|
-
this.ringStart[t] = l, this.ringDur[t] = f, this.ringMax[t] = n, this.ringPos[t * 3] = e, this.ringPos[t * 3 + 1] = c, this.ringPos[t * 3 + 2] =
|
|
285
|
+
this.ringStart[t] = l, this.ringDur[t] = f, this.ringMax[t] = n, this.ringPos[t * 3] = e, this.ringPos[t * 3 + 1] = c, this.ringPos[t * 3 + 2] = o, this.ringCol[t * 3] = s.r * r, this.ringCol[t * 3 + 1] = s.g * r, this.ringCol[t * 3 + 2] = s.b * r;
|
|
286
286
|
}
|
|
287
287
|
alloc(e, c) {
|
|
288
|
-
const
|
|
288
|
+
const o = e.inst, s = this.slots.findIndex((r) => !r.used);
|
|
289
289
|
if (s < 0) return -1;
|
|
290
|
-
const n = this.slots[s], f = yt[
|
|
291
|
-
Object.assign(n, { used: !0, id:
|
|
292
|
-
const l =
|
|
293
|
-
if (l ? (n.x = l.x, n.y = l.y, n.z = l.z) : (n.x = e.pos.x, n.y = 0.9, n.z = e.pos.z), this.idToSlot.set(
|
|
294
|
-
const r = this.idToSlot.get(
|
|
290
|
+
const n = this.slots[s], f = yt[o.type];
|
|
291
|
+
Object.assign(n, { used: !0, id: o.id, inst: o, ka: e, count: 0, released: !1, r: f.r, g: f.g, b: f.b, omega: 2, bright: 0.6, swirl: 0, p: 0, e: 0 }), n.tiltA = (K(s + c) - 0.5) * 0.7, n.tiltB = (K(s * 3.1 + c) - 0.5) * 0.7, n.rscale = Ue(o.type) || e.depth > 0 ? 0.72 : 1, n.want = Math.round((n.rscale < 1 ? 380 : 620) * (pt ? 0.5 : 1));
|
|
292
|
+
const l = o.parent ? this.slotOf(o.parent) : null;
|
|
293
|
+
if (l ? (n.x = l.x, n.y = l.y, n.z = l.z) : (n.x = e.pos.x, n.y = e.pos.y + 0.9, n.z = e.pos.z), this.idToSlot.set(o.id, s), this.emitRing(n.x, n.y, n.z, f, 2.4 * et.scale, 0.9, c, 2.2), l) {
|
|
294
|
+
const r = this.idToSlot.get(o.parent);
|
|
295
295
|
let t = Math.floor(l.count * 0.28);
|
|
296
|
-
for (let
|
|
297
|
-
this.fOwner[
|
|
296
|
+
for (let i = 0; i < W && t > 0; i++)
|
|
297
|
+
this.fOwner[i] === r && i & 1 && (this.fOwner[i] = s, l.count--, n.count++, t--);
|
|
298
298
|
}
|
|
299
299
|
return s;
|
|
300
300
|
}
|
|
301
301
|
release(e, c) {
|
|
302
|
-
const
|
|
302
|
+
const o = this.slots[e], s = this.fP;
|
|
303
303
|
for (let n = 0; n < W; n++) {
|
|
304
304
|
if (this.fOwner[n] !== e) continue;
|
|
305
305
|
this.fOwner[n] = -1;
|
|
306
|
-
const f = s[n * 3] -
|
|
307
|
-
this.fIvx[n] = f / r * t - l / r *
|
|
306
|
+
const f = s[n * 3] - o.x, l = s[n * 3 + 2] - o.z, r = Math.sqrt(f * f + l * l) + 1e-3, t = (2.4 + this.fRnd[n] * 3.6) * (pt ? 0.5 : 1);
|
|
307
|
+
this.fIvx[n] = f / r * t - l / r * o.omega * 0.5, this.fIvz[n] = l / r * t + f / r * o.omega * 0.5, this.fHeat[n] = 1, this.fT[n * 3] = o.r, this.fT[n * 3 + 1] = o.g, this.fT[n * 3 + 2] = o.b;
|
|
308
308
|
}
|
|
309
|
-
|
|
309
|
+
o.count = 0, G.setRGB(o.r, o.g, o.b).lerp(V, 0.5), this.emitRing(o.x, o.y, o.z, G, 3.2 * et.scale, 1.1, c, 2.6);
|
|
310
310
|
}
|
|
311
311
|
/** Once per frame, after the kit's ticker (world tick -> lodTick -> kitTick). */
|
|
312
|
-
update(e, c,
|
|
312
|
+
update(e, c, o) {
|
|
313
313
|
const s = Math.min(0.05, e);
|
|
314
314
|
this.lodK = et.scale, this.frame++;
|
|
315
315
|
const n = Math.max(kt, Z.core.r + 20);
|
|
316
|
-
this.fieldR += (n - this.fieldR) * Math.min(1, s * 0.8), this.nebAngle += s * 0.04 * nt, this.syncRuns(c, s), this.syncSlots(c, s,
|
|
316
|
+
this.fieldR += (n - this.fieldR) * Math.min(1, s * 0.8), this.nebAngle += s * 0.04 * nt, this.syncRuns(c, s), this.syncSlots(c, s, o), this.recruit(c), this.updateField(s, o), this.updateFlares(c), this.updateNebula(o), this.updateRunCurrents(c, o), this.updateStreams(c, o), this.updateMeshes(c, o, s);
|
|
317
317
|
}
|
|
318
318
|
syncRuns(e, c) {
|
|
319
|
-
var
|
|
319
|
+
var o;
|
|
320
320
|
this.rPresent.fill(0);
|
|
321
321
|
for (const s of Z.runs.values()) {
|
|
322
322
|
let n = this.runPool.get(s.id);
|
|
@@ -334,8 +334,8 @@ class Xe {
|
|
|
334
334
|
}
|
|
335
335
|
this.rPresent[n] = 1, this.runKit[n] = s, this.runRef[n] = s.run ?? q.runs.get(s.id) ?? null, this.rX[n] = s.origin.x, this.rZ[n] = s.origin.z, this.rR[n] = Math.max(2.6, Math.min(11, Math.hypot(s.hu, s.hv) * 0.92 + 0.6));
|
|
336
336
|
for (let f = 0; f < 3; f++)
|
|
337
|
-
ne(s, ie(
|
|
338
|
-
this.rSteps[n] = (
|
|
337
|
+
ne(s, ie(De[f]), 0, S), this.rAt[n * 6 + f * 2] = S.x, this.rAt[n * 6 + f * 2 + 1] = S.z;
|
|
338
|
+
this.rSteps[n] = (o = this.runRef[n]) != null && o.hasSteps ? 1 : 0;
|
|
339
339
|
}
|
|
340
340
|
for (let s = 0; s < F; s++) {
|
|
341
341
|
this.rPresent[s] || this.runId[s] && this.rAlpha[s] < 0.01 && (this.runPool.get(this.runId[s]) === s && this.runPool.delete(this.runId[s]), this.runId[s] = "", this.runRef[s] = null, this.runKit[s] = null);
|
|
@@ -344,7 +344,7 @@ class Xe {
|
|
|
344
344
|
n && this.rPresent[s] && (f = Math.min(1, (e - n.startedAt) / 1800), n.endedAt && (f *= Math.max(0, 1 - (e - n.endedAt - (xe - 3e3)) / 3e3))), n && n.color !== this.rColStr[s] && (this.rColStr[s] = n.color, this.rCol[s].set(n.color)), this.rAlpha[s] += (f - this.rAlpha[s]) * Math.min(1, c * 3);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
syncSlots(e, c,
|
|
347
|
+
syncSlots(e, c, o) {
|
|
348
348
|
const s = this.frame;
|
|
349
349
|
for (const l of Z.agents.values()) {
|
|
350
350
|
let r = this.idToSlot.get(l.id);
|
|
@@ -361,45 +361,45 @@ class Xe {
|
|
|
361
361
|
r.count > 0 && this.release(l, e), r.used = !1, r.inst = null, r.ka = null, this.idToSlot.delete(r.id);
|
|
362
362
|
continue;
|
|
363
363
|
}
|
|
364
|
-
const
|
|
365
|
-
t.exitAt || (r.x += (p - r.x) * n, r.y += (R - r.y) * n, r.z += (b - r.z) * n),
|
|
364
|
+
const i = r.ka, p = i.pos.x, b = i.pos.z, R = i.pos.y + 0.9 + Math.sin(o * 0.9 + l) * 0.18;
|
|
365
|
+
t.exitAt || (r.x += (p - r.x) * n, r.y += (R - r.y) * n, r.z += (b - r.z) * n), i.live.set(r.x, r.y, r.z), r.p = we(t, e), r.e = Re(t, e), r.waitMcp = this.pendingByInst.get(t.id) ?? -1;
|
|
366
366
|
const z = t.status === "thinking", v = t.status === "waiting";
|
|
367
367
|
let h = z ? 3.6 : v ? 0.7 : 2.2, A = z ? 1 : v ? 0.3 : 0.7;
|
|
368
|
-
r.waitMcp >= 0 && (h = 1, A = 0.45 + 0.3 * (0.5 + 0.5 * Math.sin(
|
|
368
|
+
r.waitMcp >= 0 && (h = 1, A = 0.45 + 0.3 * (0.5 + 0.5 * Math.sin(o * 3.2))), t.exitAt && (h = 0, A = 0), r.omega += (h * (1 + r.e * 0.7) * nt - r.omega) * f, r.bright += (A + r.e * 1.2 - r.bright) * f, r.swirl = t.exitAt ? 0 : (z ? 1.6 : 0.6) * r.p * nt, t.exitAt && !r.released && (r.released = !0, this.release(l, e));
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
recruit(e) {
|
|
372
372
|
const c = this.fP;
|
|
373
|
-
for (let
|
|
374
|
-
const s = this.slots[
|
|
373
|
+
for (let o = 0; o < Y; o++) {
|
|
374
|
+
const s = this.slots[o];
|
|
375
375
|
if (!s.used || !s.inst || s.inst.exitAt) continue;
|
|
376
376
|
const n = (e - s.inst.bornAt) / 1e3, f = s.want * Math.min(1, n / 1.6);
|
|
377
377
|
for (let l = 0; l < 140 && s.count < f; l++) {
|
|
378
378
|
const r = Math.random() * W | 0;
|
|
379
379
|
if (this.fOwner[r] !== -1) continue;
|
|
380
|
-
const t = c[r * 3] - s.x,
|
|
381
|
-
t * t +
|
|
380
|
+
const t = c[r * 3] - s.x, i = c[r * 3 + 2] - s.z;
|
|
381
|
+
t * t + i * i > 120 || (this.fOwner[r] = o, this.fAng[r] = Math.atan2(i, t), s.count++);
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
updateField(e, c) {
|
|
386
|
-
const
|
|
386
|
+
const o = this.fP, s = this.fC, n = this.fS, f = this.fOwner, l = this.slots, r = this.fRnd, t = e * nt, i = c * nt, p = 1 - Math.exp(-e * 2.8), b = Math.exp(-e * 0.5), R = Math.exp(-e * 1.3), z = 0.23 * i, v = 0.17 * i, h = 0.11 * i;
|
|
387
387
|
let A = 0;
|
|
388
|
-
for (let
|
|
389
|
-
this.rAlpha[
|
|
388
|
+
for (let u = 0; u < F; u++)
|
|
389
|
+
this.rAlpha[u] < 0.01 || (this.aX[A] = this.rX[u], this.aZ[A] = this.rZ[u], this.aRR[A] = this.rR[u], this.aA[A] = this.rAlpha[u], this.aR[A * 3] = this.rCol[u].r, this.aR[A * 3 + 1] = this.rCol[u].g, this.aR[A * 3 + 2] = this.rCol[u].b, A++);
|
|
390
390
|
let I = 0;
|
|
391
|
-
for (const
|
|
392
|
-
!
|
|
391
|
+
for (const u of l)
|
|
392
|
+
!u.used || u.swirl <= 0.01 || (this.sX[I] = u.x, this.sZ[I] = u.z, this.sS[I] = u.swirl, I++);
|
|
393
393
|
const a = this.fieldR, M = a * a;
|
|
394
|
-
for (let
|
|
395
|
-
const x =
|
|
396
|
-
let y =
|
|
397
|
-
const _ = f[
|
|
394
|
+
for (let u = 0; u < W; u++) {
|
|
395
|
+
const x = u * 3;
|
|
396
|
+
let y = o[x], m = o[x + 1], P = o[x + 2];
|
|
397
|
+
const _ = f[u];
|
|
398
398
|
if (_ >= 0) {
|
|
399
|
-
const B = l[_], E = this.fOrb[
|
|
399
|
+
const B = l[_], E = this.fOrb[u] * B.rscale * (0.35 + 0.65 * B.p) * this.lodK, k = this.fAng[u] += B.omega * e / (0.3 + E), D = Math.cos(k), C = Math.sin(k), L = B.x + D * E, bt = B.z + C * E, It = B.y + (C * B.tiltA + D * B.tiltB) * E + (r[u] - 0.5) * 0.14;
|
|
400
400
|
y += (L - y) * p, m += (It - m) * p, P += (bt - P) * p;
|
|
401
|
-
const mt = B.bright * (1.5 - E * 0.55) * (0.6 + 0.4 * r[
|
|
402
|
-
s[x] = B.r * mt + 0.05, s[x + 1] = B.g * mt + 0.05, s[x + 2] = B.b * mt + 0.05, n[
|
|
401
|
+
const mt = B.bright * (1.5 - E * 0.55) * (0.6 + 0.4 * r[u]);
|
|
402
|
+
s[x] = B.r * mt + 0.05, s[x + 1] = B.g * mt + 0.05, s[x + 2] = B.b * mt + 0.05, n[u] = 0.5 + 0.35 * r[u];
|
|
403
403
|
} else {
|
|
404
404
|
const B = y * y + P * P, E = Math.sqrt(B) + 1e-4, k = E / 11, D = 1.25 * k / (1 + k * k);
|
|
405
405
|
let C = -P / E * D, L = y / E * D;
|
|
@@ -421,70 +421,70 @@ class Xe {
|
|
|
421
421
|
const ct = this.sS[U] / (1 + Mt * 0.9);
|
|
422
422
|
C -= at * ct, L += H * ct;
|
|
423
423
|
}
|
|
424
|
-
C += this.fIvx[
|
|
425
|
-
const xt = this.fHeat[
|
|
426
|
-
if (s[x] = (0.05 + 0.05 * Ft) * Pt + Yt * 0.42 + this.fT[x] * xt * 1.8, s[x + 1] = (0.08 + 0.03 * Ft) * Pt + Kt * 0.42 + this.fT[x + 1] * xt * 1.8, s[x + 2] = (0.2 - 0.04 * Ft) * Pt + Zt * 0.42 + this.fT[x + 2] * xt * 1.8, n[
|
|
424
|
+
C += this.fIvx[u], L += this.fIvz[u], this.fIvx[u] *= R, this.fIvz[u] *= R, y += C * t, P += L * t, m += (this.fYb[u] - m) * e * 1.2;
|
|
425
|
+
const xt = this.fHeat[u] *= b, ce = C * C + L * L, Pt = (0.14 + qt * 2.8) * (0.6 + Math.min(1.2, ce * 0.3)) * (0.45 + 0.75 * r[u]), Ft = 0.5 + 0.5 * Math.sin(Xt * 1.3 + 1);
|
|
426
|
+
if (s[x] = (0.05 + 0.05 * Ft) * Pt + Yt * 0.42 + this.fT[x] * xt * 1.8, s[x + 1] = (0.08 + 0.03 * Ft) * Pt + Kt * 0.42 + this.fT[x + 1] * xt * 1.8, s[x + 2] = (0.2 - 0.04 * Ft) * Pt + Zt * 0.42 + this.fT[x + 2] * xt * 1.8, n[u] = 0.26 + 0.2 * r[u] + qt * 0.12 + xt * 0.35, B > M) {
|
|
427
427
|
const U = Math.sqrt(Math.random()) * a * 0.97, H = Math.random() * X;
|
|
428
|
-
y = Math.cos(H) * U, P = Math.sin(H) * U, this.fHeat[
|
|
428
|
+
y = Math.cos(H) * U, P = Math.sin(H) * U, this.fHeat[u] = 0, this.fIvx[u] = this.fIvz[u] = 0;
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
|
|
431
|
+
o[x] = y, o[x + 1] = m, o[x + 2] = P;
|
|
432
432
|
}
|
|
433
433
|
ut(this.fieldGeo);
|
|
434
434
|
}
|
|
435
435
|
updateFlares(e) {
|
|
436
436
|
if (this.burst.fill(0), this.burstW.fill(0), !this.nAnchors || !Z.graphWanted) return;
|
|
437
437
|
const c = Z.graph.scale;
|
|
438
|
-
for (const
|
|
439
|
-
const s = this.anchorIdx(
|
|
440
|
-
if (
|
|
441
|
-
if (this.lastFlareId =
|
|
438
|
+
for (const o of q.flares) {
|
|
439
|
+
const s = this.anchorIdx(o.node), n = (e - o.start) / 1e3, f = (1 - Math.exp(-n * 9)) * Math.exp(-n * 1.3);
|
|
440
|
+
if (o.id > this.lastFlareId) {
|
|
441
|
+
if (this.lastFlareId = o.id, this.anchorWorld(s, S), o.op === "write")
|
|
442
442
|
this.emitRing(S.x, S.y, S.z, V, 4.2 * c, 1.7, e, 2.4), this.emitRing(S.x, S.y, S.z, V, 2.2 * c, 1, e, 1.6);
|
|
443
443
|
else {
|
|
444
|
-
const l = q.instances.get(
|
|
444
|
+
const l = q.instances.get(o.instance);
|
|
445
445
|
this.emitRing(S.x, S.y, S.z, l ? yt[l.type] : V, 1.1 * c, 0.7, e, 1.6);
|
|
446
446
|
}
|
|
447
|
-
|
|
447
|
+
o.area || (this.lastFlare = { name: o.node, op: o.op, at: e, idx: s });
|
|
448
448
|
}
|
|
449
449
|
if (f > this.burst[s]) {
|
|
450
450
|
this.burst[s] = f;
|
|
451
|
-
const l = q.instances.get(
|
|
452
|
-
this.flareCol[s * 3] = r.r, this.flareCol[s * 3 + 1] = r.g, this.flareCol[s * 3 + 2] = r.b,
|
|
451
|
+
const l = q.instances.get(o.instance), r = o.op === "write" ? V : l ? yt[l.type] : V;
|
|
452
|
+
this.flareCol[s * 3] = r.r, this.flareCol[s * 3 + 1] = r.g, this.flareCol[s * 3 + 2] = r.b, o.op === "write" && (this.burstW[s] = 1);
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
456
|
updateNebula(e) {
|
|
457
457
|
if (!this.nAnchors || !Z.graphWanted) return;
|
|
458
|
-
const c = j(this.nebGeo, "position"),
|
|
458
|
+
const c = j(this.nebGeo, "position"), o = j(this.nebGeo, "acol"), s = j(this.nebGeo, "size"), n = Math.cos(this.nebAngle), f = Math.sin(this.nebAngle), l = e * nt, r = this.aLocal, t = this.aCol, i = this.flareCol;
|
|
459
459
|
for (let a = 0; a < it; a++) {
|
|
460
|
-
const M = this.nA[a],
|
|
460
|
+
const M = this.nA[a], u = this.burst[M], x = l * this.nSpin[a], y = Math.cos(x), m = Math.sin(x), P = this.nO[a * 3], _ = this.nO[a * 3 + 2], B = 1 + u * (2.2 + this.burstW[M] * 4.5), E = r[M * 3] + (P * y - _ * m) * B, k = r[M * 3 + 2] + (P * m + _ * y) * B, D = r[M * 3 + 1] + this.nO[a * 3 + 1] * B;
|
|
461
461
|
c[a * 3] = E * n - k * f, c[a * 3 + 1] = D, c[a * 3 + 2] = E * f + k * n;
|
|
462
462
|
const C = this.nB[a] * 0.3;
|
|
463
|
-
|
|
463
|
+
o[a * 3] = t[M * 3] * C + 0.05 + i[M * 3] * u * 2.4, o[a * 3 + 1] = t[M * 3 + 1] * C + 0.06 + i[M * 3 + 1] * u * 2.4, o[a * 3 + 2] = t[M * 3 + 2] * C + 0.12 + i[M * 3 + 2] * u * 2.4, s[a] = 0.3 + this.nB[a] * 0.2 + u * 0.5;
|
|
464
464
|
}
|
|
465
465
|
ut(this.nebGeo);
|
|
466
466
|
const p = j(this.anchorGeo, "position"), b = j(this.anchorGeo, "acol"), R = j(this.anchorGeo, "size"), z = this.nAnchors;
|
|
467
467
|
for (let a = 0; a < z; a++) {
|
|
468
|
-
const M = r[a * 3],
|
|
469
|
-
p[a * 3] = M * n -
|
|
468
|
+
const M = r[a * 3], u = r[a * 3 + 2];
|
|
469
|
+
p[a * 3] = M * n - u * f, p[a * 3 + 1] = r[a * 3 + 1], p[a * 3 + 2] = M * f + u * n;
|
|
470
470
|
const x = this.burst[a], y = this.aNamed[a] ? 2.2 : 1.1;
|
|
471
|
-
b[a * 3] = t[a * 3] * y +
|
|
471
|
+
b[a * 3] = t[a * 3] * y + i[a * 3] * x * 7, b[a * 3 + 1] = t[a * 3 + 1] * y + i[a * 3 + 1] * x * 7, b[a * 3 + 2] = t[a * 3 + 2] * y + i[a * 3 + 2] * x * 7, R[a] = (this.aNamed[a] ? 1.25 : 0.75) * (1 + x * 3.5);
|
|
472
472
|
}
|
|
473
473
|
ut(this.anchorGeo);
|
|
474
474
|
const v = this.edgeGeo.getAttribute("position").array, h = this.edgeGeo.getAttribute("color").array, A = this.edgeA, I = this.nEdge * 2;
|
|
475
475
|
for (let a = 0; a < I; a++) {
|
|
476
|
-
const M = A[a],
|
|
476
|
+
const M = A[a], u = A[a ^ 1], x = r[M * 3], y = r[M * 3 + 2];
|
|
477
477
|
v[a * 3] = x * n - y * f, v[a * 3 + 1] = r[M * 3 + 1], v[a * 3 + 2] = x * f + y * n;
|
|
478
|
-
const m = Math.max(this.burst[M], this.burst[
|
|
479
|
-
h[a * 3] = t[M * 3] * 0.32 + 0.05 +
|
|
478
|
+
const m = Math.max(this.burst[M], this.burst[u] * 0.6);
|
|
479
|
+
h[a * 3] = t[M * 3] * 0.32 + 0.05 + i[M * 3] * m * 3, h[a * 3 + 1] = t[M * 3 + 1] * 0.32 + 0.06 + i[M * 3 + 1] * m * 3, h[a * 3 + 2] = t[M * 3 + 2] * 0.32 + 0.1 + i[M * 3 + 2] * m * 3;
|
|
480
480
|
}
|
|
481
481
|
this.edgeGeo.getAttribute("color").needsUpdate = !0, this.edgeGeo.getAttribute("position").needsUpdate = !0;
|
|
482
482
|
}
|
|
483
483
|
updateRunCurrents(e, c) {
|
|
484
|
-
const
|
|
484
|
+
const o = j(this.runGeo, "position"), s = j(this.runGeo, "acol"), n = j(this.runGeo, "size"), f = c * nt, l = this.stTh, r = this.stB;
|
|
485
485
|
for (let t = 0; t < F; t++) {
|
|
486
|
-
const
|
|
487
|
-
if (!
|
|
486
|
+
const i = this.runRef[t], p = this.rAlpha[t], b = t * $;
|
|
487
|
+
if (!i || p < 0.01) {
|
|
488
488
|
for (let y = 0; y < $; y++) n[b + y] = 0;
|
|
489
489
|
continue;
|
|
490
490
|
}
|
|
@@ -492,16 +492,16 @@ class Xe {
|
|
|
492
492
|
for (let y = 0; y < 3; y++) {
|
|
493
493
|
const m = this.rAt[t * 6 + y * 2] - R, P = this.rAt[t * 6 + y * 2 + 1] - z;
|
|
494
494
|
l[y] = m * m + P * P < 0.6 ? -Math.PI / 2 : Math.atan2(P, m);
|
|
495
|
-
const _ = zt(
|
|
495
|
+
const _ = zt(i, y);
|
|
496
496
|
r[y] = this.rSteps[t] ? _ === "running" ? 2.2 : _ === "done" ? 0.5 : 0 : 0;
|
|
497
497
|
}
|
|
498
|
-
const h = (e -
|
|
499
|
-
let a = (l[
|
|
498
|
+
const h = (e - i.handoffAt) / 1e3, A = this.rSteps[t] === 1 && i.handoffAt > 0 && h < 2.4, I = l[i.handoffFrom];
|
|
499
|
+
let a = (l[i.handoffTo] - I) % X;
|
|
500
500
|
a < 0 && (a += X);
|
|
501
|
-
const M = a * Math.min(1, 1 - Math.pow(1 - Math.min(1, h / 1.4), 3)),
|
|
501
|
+
const M = a * Math.min(1, 1 - Math.pow(1 - Math.min(1, h / 1.4), 3)), u = A ? 3.2 * (1 - h / 2.4) : 0, x = this.rCol[t];
|
|
502
502
|
for (let y = 0; y < $; y++) {
|
|
503
503
|
const m = b + y, P = this.rTh[m] + f * this.rSp[m], _ = v + this.rRr[m] + 0.16 * Math.sin(3 * P + f * 0.6 + m);
|
|
504
|
-
|
|
504
|
+
o[m * 3] = R + Math.cos(P) * _, o[m * 3 + 1] = 0.25 + this.rY[m], o[m * 3 + 2] = z + Math.sin(P) * _;
|
|
505
505
|
let B = 0;
|
|
506
506
|
for (let C = 0; C < 3; C++) {
|
|
507
507
|
if (r[C] === 0) continue;
|
|
@@ -513,7 +513,7 @@ class Xe {
|
|
|
513
513
|
let C = (P - I) % X;
|
|
514
514
|
if (C < 0 && (C += X), C <= M && C <= a + 0.1) {
|
|
515
515
|
const L = Math.exp(-(M - C) * 2.2);
|
|
516
|
-
B +=
|
|
516
|
+
B += u * (0.4 + L), E = 0.6 * L;
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
519
|
const k = Math.exp(-this.rRr[m] * this.rRr[m] * 4), D = p * (0.32 + 0.5 * k + B);
|
|
@@ -523,13 +523,13 @@ class Xe {
|
|
|
523
523
|
ut(this.runGeo);
|
|
524
524
|
}
|
|
525
525
|
updateStreams(e, c) {
|
|
526
|
-
const
|
|
526
|
+
const o = j(this.streamGeo, "position"), s = j(this.streamGeo, "acol"), n = j(this.streamGeo, "size");
|
|
527
527
|
let f = 0;
|
|
528
|
-
const l = (h, A, I, a, M,
|
|
529
|
-
f >= Et || (
|
|
528
|
+
const l = (h, A, I, a, M, u, x) => {
|
|
529
|
+
f >= Et || (o[f * 3] = h, o[f * 3 + 1] = A, o[f * 3 + 2] = I, s[f * 3] = a, s[f * 3 + 1] = M, s[f * 3 + 2] = u, n[f] = x, f++);
|
|
530
530
|
}, r = (h, A, I, a, M) => {
|
|
531
|
-
const
|
|
532
|
-
return M.set(m * m * h.x + 2 * m * a *
|
|
531
|
+
const u = (h.x + A.x) / 2, x = (h.y + A.y) / 2 + I, y = (h.z + A.z) / 2, m = 1 - a;
|
|
532
|
+
return M.set(m * m * h.x + 2 * m * a * u + a * a * A.x, m * m * h.y + 2 * m * a * x + a * a * A.y, m * m * h.z + 2 * m * a * y + a * a * A.z);
|
|
533
533
|
};
|
|
534
534
|
for (let h = 0; h < F; h++) {
|
|
535
535
|
const A = this.runRef[h];
|
|
@@ -538,12 +538,12 @@ class Xe {
|
|
|
538
538
|
if (I > 2.4 || !this.rSteps[h] || this.rAlpha[h] < 0.01) continue;
|
|
539
539
|
this.attractor(h, A.handoffFrom, S), this.attractor(h, A.handoffTo, N);
|
|
540
540
|
const a = this.rCol[h], M = 220;
|
|
541
|
-
for (let
|
|
542
|
-
const x = (I -
|
|
541
|
+
for (let u = 0; u < M; u++) {
|
|
542
|
+
const x = (I - u / M * 1.4) / 0.9;
|
|
543
543
|
if (x < 0 || x > 1) continue;
|
|
544
544
|
r(S, N, 2.2, x, T);
|
|
545
545
|
const y = Math.sin(x * Math.PI) * 0.35, m = (1 - x * 0.4) * 2.4;
|
|
546
|
-
l(T.x + (K(
|
|
546
|
+
l(T.x + (K(u) - 0.5) * y, T.y + (K(u + 7) - 0.5) * y, T.z + (K(u + 13) - 0.5) * y, (a.r * 0.6 + 0.4) * m, (a.g * 0.6 + 0.4) * m, (a.b * 0.6 + 0.4) * m, 0.7 + (u % 9 === 0 ? 0.8 : 0));
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
for (const h of q.comets) {
|
|
@@ -551,19 +551,19 @@ class Xe {
|
|
|
551
551
|
if (!A || !I || h.failed && !Se(h, e)) continue;
|
|
552
552
|
const a = Ge(h, e), M = a < 0.5 ? 2 * a * a : 1 - Math.pow(-2 * a + 2, 2) / 2;
|
|
553
553
|
S.set(A.x, A.y, A.z), N.set(I.x, I.y, I.z);
|
|
554
|
-
const
|
|
554
|
+
const u = S.distanceTo(N), x = A.inst ? yt[A.inst.type] : V, y = h.failed ? 1 : a >= 1 ? Math.max(0, 1 - (e - h.start - h.dur) / 250) : 1;
|
|
555
555
|
for (let m = 0; m < 90; m++) {
|
|
556
556
|
const P = M - m * 55e-4;
|
|
557
557
|
if (P < 0) break;
|
|
558
|
-
r(S, N, 1.2 +
|
|
558
|
+
r(S, N, 1.2 + u * 0.16, P, T);
|
|
559
559
|
const _ = m * 6e-3, B = (m === 0 ? 7 : 3.2 * Math.pow(1 - m / 90, 1.6)) * y;
|
|
560
560
|
l(T.x + (K(h.id + m) - 0.5) * _, T.y + (K(h.id * 3 + m) - 0.5) * _, T.z + (K(h.id * 7 + m) - 0.5) * _, (x.r * 0.7 + 0.3) * B, (x.g * 0.7 + 0.3) * B, (x.b * 0.7 + 0.3) * B, m === 0 ? 2.6 : 0.85 - m * 6e-3);
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
const t = this.beamGeo.getAttribute("position").array,
|
|
563
|
+
const t = this.beamGeo.getAttribute("position").array, i = this.beamGeo.getAttribute("color").array;
|
|
564
564
|
let p = 0;
|
|
565
|
-
const b = (h, A, I, a, M,
|
|
566
|
-
t.set([h, A, I, a, M,
|
|
565
|
+
const b = (h, A, I, a, M, u, x, y, m, P, _, B) => {
|
|
566
|
+
t.set([h, A, I, a, M, u], p * 6), i.set([x, y, m, P, _, B], p * 6), p++;
|
|
567
567
|
}, R = this.nAnchors > 0 && Z.graphWanted && Z.graph.mix > 0.05;
|
|
568
568
|
for (const h of q.flares) {
|
|
569
569
|
if (!R || p >= _t) break;
|
|
@@ -572,12 +572,12 @@ class Xe {
|
|
|
572
572
|
const I = (e - h.start) / 2600;
|
|
573
573
|
if (I >= 1) continue;
|
|
574
574
|
this.anchorWorld(this.anchorIdx(h.node), N), S.set(A.x, A.y, A.z);
|
|
575
|
-
const a = h.op === "write", M = a ? V : A.inst ? yt[A.inst.type] : V,
|
|
576
|
-
b(S.x, S.y, S.z, N.x, N.y, N.z, M.r *
|
|
575
|
+
const a = h.op === "write", M = a ? V : A.inst ? yt[A.inst.type] : V, u = (1 - I) * (a ? 1.6 : 1);
|
|
576
|
+
b(S.x, S.y, S.z, N.x, N.y, N.z, M.r * u * 0.6, M.g * u * 0.6, M.b * u * 0.6, M.r * u * 1.4, M.g * u * 1.4, M.b * u * 1.4);
|
|
577
577
|
for (let x = 0; x < 22; x++) {
|
|
578
578
|
let y = ((e - h.start) / 1e3 * 0.75 + x / 22) % 1;
|
|
579
579
|
a || (y = 1 - y), r(S, N, 1.2, y, T);
|
|
580
|
-
const m = 2.4 *
|
|
580
|
+
const m = 2.4 * u * Math.sin(y * Math.PI);
|
|
581
581
|
l(T.x, T.y, T.z, M.r * m, M.g * m, M.b * m, 0.55);
|
|
582
582
|
}
|
|
583
583
|
}
|
|
@@ -587,13 +587,13 @@ class Xe {
|
|
|
587
587
|
const M = (e - h.start) / h.dur;
|
|
588
588
|
if (M > 1) continue;
|
|
589
589
|
S.set(A.x, A.y, A.z), N.copy(a).setY(Gt);
|
|
590
|
-
const
|
|
590
|
+
const u = h.phase === "call" ? S : N, x = h.phase === "call" ? N : S;
|
|
591
591
|
G.set(I.color);
|
|
592
592
|
const y = 1 - Math.pow(1 - M, 2);
|
|
593
593
|
for (let m = 0; m < 60; m++) {
|
|
594
594
|
const P = y - m * 8e-3;
|
|
595
595
|
if (P < 0) break;
|
|
596
|
-
r(
|
|
596
|
+
r(u, x, 3, P, T);
|
|
597
597
|
const _ = (m === 0 ? 6 : 2.6 * (1 - m / 60)) * (h.phase === "result" ? 1.2 : 1);
|
|
598
598
|
l(T.x, T.y, T.z, (G.r * 0.75 + 0.25) * _, (G.g * 0.75 + 0.25) * _, (G.b * 0.75 + 0.25) * _, m === 0 ? 2.2 : 0.7);
|
|
599
599
|
}
|
|
@@ -601,9 +601,9 @@ class Xe {
|
|
|
601
601
|
let z = 0;
|
|
602
602
|
const v = (h, A, I, a) => {
|
|
603
603
|
if (z >= Lt) return;
|
|
604
|
-
const M = this.slotOf(h),
|
|
605
|
-
if (!M || !
|
|
606
|
-
z++, S.set(M.x, M.y, M.z), N.copy(x).setY(Gt), G.set(
|
|
604
|
+
const M = this.slotOf(h), u = q.mcpServers.get(A), x = Tt(A);
|
|
605
|
+
if (!M || !u || !x) return;
|
|
606
|
+
z++, S.set(M.x, M.y, M.z), N.copy(x).setY(Gt), G.set(u.color), I < 2 ? G.lerp(ee, Math.min(1, I / 2)) : G.copy(ee).lerp(We, Math.min(1, I - 2));
|
|
607
607
|
const y = a >= 0 ? (1 - a) * 1.2 : 0.5 + Math.min(1.8, I * 0.6), m = c * 2.2;
|
|
608
608
|
let P = S.x, _ = S.y, B = S.z;
|
|
609
609
|
for (let E = 1; E <= Rt; E++) {
|
|
@@ -637,70 +637,70 @@ class Xe {
|
|
|
637
637
|
n[h] = 0;
|
|
638
638
|
this.streamGeo.setDrawRange(0, Math.max(f, 1)), ut(this.streamGeo), this.beamGeo.setDrawRange(0, p * 2), this.beamGeo.getAttribute("position").needsUpdate = !0, this.beamGeo.getAttribute("color").needsUpdate = !0;
|
|
639
639
|
}
|
|
640
|
-
setInst(e, c,
|
|
641
|
-
Q.position.set(
|
|
640
|
+
setInst(e, c, o, s, n, f, l, r = 0, t = 0, i = 0) {
|
|
641
|
+
Q.position.set(o, s, n), Q.rotation.set(r, t, i), Q.scale.setScalar(Math.max(1e-4, f)), Q.updateMatrix(), e.setMatrixAt(c, Q.matrix), e.setColorAt(c, l);
|
|
642
642
|
}
|
|
643
|
-
updateMeshes(e, c,
|
|
644
|
-
const s = j(this.glowGeo, "position"), n = j(this.glowGeo, "acol"), f = j(this.glowGeo, "size"), l = (t,
|
|
645
|
-
s[t * 3] =
|
|
643
|
+
updateMeshes(e, c, o) {
|
|
644
|
+
const s = j(this.glowGeo, "position"), n = j(this.glowGeo, "acol"), f = j(this.glowGeo, "size"), l = (t, i, p, b, R, z, v) => {
|
|
645
|
+
s[t * 3] = i, s[t * 3 + 1] = p, s[t * 3 + 2] = b, n[t * 3] = R.r * z, n[t * 3 + 1] = R.g * z, n[t * 3 + 2] = R.b * z, f[t] = v;
|
|
646
646
|
};
|
|
647
647
|
let r = null;
|
|
648
648
|
for (let t = 0; t < Y; t++) {
|
|
649
|
-
const
|
|
650
|
-
if (!
|
|
649
|
+
const i = this.slots[t];
|
|
650
|
+
if (!i.used || !i.inst) {
|
|
651
651
|
this.setInst(this.cores, t, 0, -999, 0, 0, G.setRGB(0, 0, 0)), f[t] = 0;
|
|
652
652
|
continue;
|
|
653
653
|
}
|
|
654
|
-
|
|
655
|
-
const p =
|
|
656
|
-
G.setRGB(
|
|
654
|
+
i.id === this.selectedId && (r = i);
|
|
655
|
+
const p = i.inst, b = (e - p.bornAt) / 1e3, R = Math.exp(-b * 3.5), z = p.exitAt ? (e - p.exitAt) / 1e3 : -1, v = z >= 0 ? Math.exp(-z * 5) : 0, A = p.status === "thinking" && !p.exitAt ? 0.1 * Math.sin(c * 9 + t) : 0, I = z >= 0 ? Math.pow(i.p, 1.6) : i.p, a = et.scale, M = (I * (1 + i.e * 0.45 + A) + v * 0.9 + R * 0.6) * a, u = 1 - 0.75 * ze(i.id);
|
|
656
|
+
G.setRGB(i.r, i.g, i.b).multiplyScalar((1.3 + i.bright * 1.5 + i.e * 1.1) * u), G.lerp(J.setRGB(4, 4, 4), Math.min(1, R + v)), this.setInst(this.cores, t, i.x, i.y, i.z, M, G, c * i.omega * 0.3, c * i.omega, 0), G.setRGB(i.r, i.g, i.b).multiplyScalar(u), l(t, i.x, i.y, i.z, G, (0.3 + i.bright * 0.4 + i.e * 0.5 + R * 2 + v * 2.5) * i.p + v, (5 + i.e * 4 + R * 10 + v * 14) * Math.max(i.p, v) * a);
|
|
657
657
|
}
|
|
658
658
|
r ? (this.selRing.visible = !0, this.selRing.position.set(r.x, r.y, r.z), this.selRing.rotation.y = c * 1.5, this.selRing.scale.setScalar(1 + 0.08 * Math.sin(c * 4)), this.selRing.material.color.setRGB(r.r * 3, r.g * 3, r.b * 3)) : this.selRing.visible = !1;
|
|
659
659
|
for (let t = 0; t < F; t++) {
|
|
660
|
-
const
|
|
660
|
+
const i = this.runRef[t], p = this.rAlpha[t];
|
|
661
661
|
for (let b = 0; b < 3; b++) {
|
|
662
662
|
const R = t * 3 + b, z = Y + R;
|
|
663
|
-
if (!
|
|
663
|
+
if (!i || p < 0.01 || !this.rSteps[t]) {
|
|
664
664
|
this.setInst(this.attractors, R, 0, -999, 0, 0, G.setRGB(0, 0, 0)), this.setInst(this.stepRings, R, 0, -999, 0, 0, G), f[z] = 0;
|
|
665
665
|
continue;
|
|
666
666
|
}
|
|
667
667
|
this.attractor(t, b, S);
|
|
668
|
-
const v = zt(
|
|
669
|
-
let A = 0.6, I = 0.5, a = 0.25, M = 0.9,
|
|
668
|
+
const v = zt(i, b), h = this.rCol[t];
|
|
669
|
+
let A = 0.6, I = 0.5, a = 0.25, M = 0.9, u = 0.12, x = 4;
|
|
670
670
|
if (G.copy(h), v === "running") {
|
|
671
671
|
const y = 0.5 + 0.5 * Math.sin(c * 5);
|
|
672
|
-
A = 1.15 + y * 0.2, G.lerp(V, 0.45), I = 3 + y * 1.5, a = 1.4 + y, M = 1.15 + y * 0.25,
|
|
673
|
-
} else v === "done" ? (A = 0.85, I = 1.8, a = 0.7, M = 0.95,
|
|
674
|
-
if (
|
|
675
|
-
const y = (e -
|
|
672
|
+
A = 1.15 + y * 0.2, G.lerp(V, 0.45), I = 3 + y * 1.5, a = 1.4 + y, M = 1.15 + y * 0.25, u = 1.1 + y * 0.6, x = 12;
|
|
673
|
+
} else v === "done" ? (A = 0.85, I = 1.8, a = 0.7, M = 0.95, u = 0.4, x = 6) : v === "failed" && G.copy(Xe);
|
|
674
|
+
if (i.handoffAt && b === i.handoffTo) {
|
|
675
|
+
const y = (e - i.handoffAt) / 1e3 - 1.2;
|
|
676
676
|
if (y > 0 && y < 1) {
|
|
677
677
|
const m = Math.exp(-y * 4);
|
|
678
|
-
A += m * 0.8,
|
|
678
|
+
A += m * 0.8, u += m * 2, x += m * 10;
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
|
-
J.copy(G).multiplyScalar(I * p), this.setInst(this.attractors, R, S.x, S.y, S.z, A, J, 0, c * 0.6, 0), J.copy(G).multiplyScalar(a * p), this.setInst(this.stepRings, R, S.x, S.y, S.z, M, J, 0, v === "running" ? c * 1.6 : 0.3, 0), l(z, S.x, S.y, S.z, G,
|
|
681
|
+
J.copy(G).multiplyScalar(I * p), this.setInst(this.attractors, R, S.x, S.y, S.z, A, J, 0, c * 0.6, 0), J.copy(G).multiplyScalar(a * p), this.setInst(this.stepRings, R, S.x, S.y, S.z, M, J, 0, v === "running" ? c * 1.6 : 0.3, 0), l(z, S.x, S.y, S.z, G, u * p, x);
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
684
|
for (let t = 0; t < ht; t++) {
|
|
685
|
-
const
|
|
686
|
-
this.setInst(this.pulsars, t, 0, -999, 0, 0, G.setRGB(0, 0, 0)), this.setInst(this.pulsarBeams, t, 0, -999, 0, 0, G), f[
|
|
685
|
+
const i = Y + F * 3 + t;
|
|
686
|
+
this.setInst(this.pulsars, t, 0, -999, 0, 0, G.setRGB(0, 0, 0)), this.setInst(this.pulsarBeams, t, 0, -999, 0, 0, G), f[i] = 0;
|
|
687
687
|
}
|
|
688
688
|
for (const t of q.mcpServers.values()) {
|
|
689
|
-
const
|
|
689
|
+
const i = t.slot % ht, p = Y + F * 3 + i, b = Tt(t.name);
|
|
690
690
|
if (!b) continue;
|
|
691
691
|
S.copy(b).setY(Gt);
|
|
692
|
-
const R =
|
|
693
|
-
this.mcpSpin[
|
|
694
|
-
const v = 0.5 + 0.5 * Math.sin(c * (z ? 9 : 2.2) +
|
|
695
|
-
G.set(t.color), J.copy(G).multiplyScalar(1.6 + z * 1.6 + R * 3 + v * 0.6), this.setInst(this.pulsars,
|
|
692
|
+
const R = ve(t.activeAt, e, 2.5), z = t.inflight > 0 ? 1 : 0;
|
|
693
|
+
this.mcpSpin[i] += o * (0.4 + z * 3.5) * nt;
|
|
694
|
+
const v = 0.5 + 0.5 * Math.sin(c * (z ? 9 : 2.2) + i);
|
|
695
|
+
G.set(t.color), J.copy(G).multiplyScalar(1.6 + z * 1.6 + R * 3 + v * 0.6), this.setInst(this.pulsars, i, S.x, S.y, S.z, 1 + R * 0.6 + z * 0.2 * v, J, 0, this.mcpSpin[i], 0), J.copy(G).multiplyScalar(0.25 + z * 0.9 * v + R * 0.8), this.setInst(this.pulsarBeams, i, S.x, S.y, S.z, 1 + z * 0.3, J, 0.5 * Math.sin(this.mcpSpin[i] * 0.5), this.mcpSpin[i], 0.35 + 0.3 * Math.cos(this.mcpSpin[i])), l(p, S.x, S.y, S.z, G, 0.2 + z * 0.25 * v + R * 0.35, 5 + R * 3 + z * 2);
|
|
696
696
|
}
|
|
697
697
|
for (let t = 0; t < ot; t++) {
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
698
|
+
const i = (e - this.ringStart[t]) / (this.ringDur[t] * 1e3);
|
|
699
|
+
if (i < 0 || i >= 1) {
|
|
700
700
|
this.setInst(this.rings, t, 0, -999, 0, 0, G.setRGB(0, 0, 0));
|
|
701
701
|
continue;
|
|
702
702
|
}
|
|
703
|
-
const p = 1 - Math.pow(1 -
|
|
703
|
+
const p = 1 - Math.pow(1 - i, 3), b = (1 - i) * (1 - i);
|
|
704
704
|
G.setRGB(this.ringCol[t * 3] * b, this.ringCol[t * 3 + 1] * b, this.ringCol[t * 3 + 2] * b), this.setInst(this.rings, t, this.ringPos[t * 3], this.ringPos[t * 3 + 1], this.ringPos[t * 3 + 2], 0.15 + this.ringMax[t] * p, G);
|
|
705
705
|
}
|
|
706
706
|
for (const t of [this.cores, this.attractors, this.stepRings, this.rings, this.pulsars, this.pulsarBeams])
|
|
@@ -708,9 +708,9 @@ class Xe {
|
|
|
708
708
|
ut(this.glowGeo);
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
|
-
const
|
|
712
|
-
function
|
|
713
|
-
const g = Ut(), e = ue((
|
|
711
|
+
const Ye = { tint: "#a5b4fc", tintAmt: 0.2, gain: 0.6, halo: 0.25, lift: Gt }, lt = new w.Vector3(), Ke = ["planner", "researcher", "writer"], rt = { engine: null }, Ut = () => rt.engine ?? (rt.engine = new qe());
|
|
712
|
+
function Ze() {
|
|
713
|
+
const g = Ut(), e = ue((o) => o.gl), c = Ee();
|
|
714
714
|
return At(() => {
|
|
715
715
|
g.setGalaxy(c);
|
|
716
716
|
}, [g, c]), At(() => {
|
|
@@ -720,8 +720,8 @@ function Ke() {
|
|
|
720
720
|
g.dispose(), rt.engine === g && (rt.engine = null);
|
|
721
721
|
},
|
|
722
722
|
[g]
|
|
723
|
-
), gt((
|
|
724
|
-
g.update(s, performance.now(),
|
|
723
|
+
), gt((o, s) => {
|
|
724
|
+
g.update(s, performance.now(), o.clock.elapsedTime);
|
|
725
725
|
}), /* @__PURE__ */ dt("group", { children: [
|
|
726
726
|
/* @__PURE__ */ O("points", { geometry: g.fieldGeo, material: g.material, frustumCulled: !1 }),
|
|
727
727
|
/* @__PURE__ */ O("points", { geometry: g.runGeo, material: g.material, frustumCulled: !1 }),
|
|
@@ -736,8 +736,8 @@ function Ke() {
|
|
|
736
736
|
/* @__PURE__ */ O("primitive", { object: g.selRing })
|
|
737
737
|
] });
|
|
738
738
|
}
|
|
739
|
-
function
|
|
740
|
-
const
|
|
739
|
+
function He({ agent: g, selected: e, onSelect: c }) {
|
|
740
|
+
const o = st(null);
|
|
741
741
|
return At(() => {
|
|
742
742
|
const s = Ut();
|
|
743
743
|
e ? s.selectedId = g.id : s.selectedId === g.id && (s.selectedId = null);
|
|
@@ -748,12 +748,12 @@ function Ze({ agent: g, selected: e, onSelect: c }) {
|
|
|
748
748
|
},
|
|
749
749
|
[g.id]
|
|
750
750
|
), gt(() => {
|
|
751
|
-
const s =
|
|
751
|
+
const s = o.current;
|
|
752
752
|
s && (s.position.copy(g.live), s.scale.setScalar(Math.max(0.6, et.scale) * (g.depth ? 0.8 : 1)), s.visible = !g.inst.exitAt);
|
|
753
753
|
}), /* @__PURE__ */ dt(
|
|
754
754
|
"mesh",
|
|
755
755
|
{
|
|
756
|
-
ref:
|
|
756
|
+
ref: o,
|
|
757
757
|
onClick: (s) => (s.stopPropagation(), c(g.id)),
|
|
758
758
|
onPointerOver: () => document.body.style.cursor = "pointer",
|
|
759
759
|
onPointerOut: () => document.body.style.cursor = "",
|
|
@@ -764,19 +764,19 @@ function Ze({ agent: g, selected: e, onSelect: c }) {
|
|
|
764
764
|
}
|
|
765
765
|
);
|
|
766
766
|
}
|
|
767
|
-
function
|
|
768
|
-
|
|
769
|
-
const e = g.run ?? q.runs.get(g.id), c = st(null),
|
|
767
|
+
function Ve({ run: g }) {
|
|
768
|
+
Be();
|
|
769
|
+
const e = g.run ?? q.runs.get(g.id), c = st(null), o = st([]);
|
|
770
770
|
if (gt(() => {
|
|
771
771
|
var l;
|
|
772
772
|
(l = c.current) == null || l.position.set(g.origin.x, 0.6, g.origin.z - Math.min(11, Math.hypot(g.hu, g.hv) * 0.92 + 0.6) - 1.3);
|
|
773
773
|
for (let r = 0; r < 3; r++) {
|
|
774
|
-
const t =
|
|
775
|
-
t && (ne(g, ie(
|
|
774
|
+
const t = o.current[r];
|
|
775
|
+
t && (ne(g, ie(Ke[r]), 0, lt), t.position.set(lt.x, 1.45 * Math.max(0.85, et.scale), lt.z + 0.9 * et.spread));
|
|
776
776
|
}
|
|
777
777
|
}), !e) return null;
|
|
778
778
|
const s = et.w < 900, n = (l) => l === "running" ? e.color : l === "done" ? "#cbd5e1" : l === "failed" ? "#fecaca" : "#64748b", f = () => {
|
|
779
|
-
const { shown: l, more: r } =
|
|
779
|
+
const { shown: l, more: r } = _e(e), t = l.map((i, p) => ({ text: `${p ? " " : ""}${i.toUpperCase()}`, color: n(e.steps[i]) }));
|
|
780
780
|
return r && t.push({ text: ` +${r}`, color: n("queued") }), e.status === "started" && Jt(e) && t.push({ text: ` ${Qt(e)}`, color: n("queued") }), t;
|
|
781
781
|
};
|
|
782
782
|
return /* @__PURE__ */ dt(fe, { children: [
|
|
@@ -793,10 +793,10 @@ function He({ run: g }) {
|
|
|
793
793
|
pxRange: [10, 14]
|
|
794
794
|
}
|
|
795
795
|
) }),
|
|
796
|
-
e.hasSteps && !s &&
|
|
796
|
+
e.hasSteps && !s && Oe.map((l) => /* @__PURE__ */ O("group", { ref: (r) => void (o.current[l] = r), children: /* @__PURE__ */ O(
|
|
797
797
|
vt,
|
|
798
798
|
{
|
|
799
|
-
text:
|
|
799
|
+
text: Te(e, l),
|
|
800
800
|
font: "mono",
|
|
801
801
|
plate: "none",
|
|
802
802
|
uppercase: !0,
|
|
@@ -810,7 +810,7 @@ function He({ run: g }) {
|
|
|
810
810
|
) }, l))
|
|
811
811
|
] });
|
|
812
812
|
}
|
|
813
|
-
function
|
|
813
|
+
function $e(g) {
|
|
814
814
|
const e = Ut();
|
|
815
815
|
return gt(() => {
|
|
816
816
|
e.nebMaterial.uniforms.uScale.value = e.material.uniforms.uScale.value * Z.graph.scale;
|
|
@@ -818,35 +818,35 @@ function Ve(g) {
|
|
|
818
818
|
/* @__PURE__ */ O("points", { geometry: e.nebGeo, material: e.nebMaterial, frustumCulled: !1 }),
|
|
819
819
|
/* @__PURE__ */ O("points", { geometry: e.anchorGeo, material: e.nebMaterial, frustumCulled: !1 }),
|
|
820
820
|
/* @__PURE__ */ O("lineSegments", { geometry: e.edgeGeo, frustumCulled: !1, children: /* @__PURE__ */ O("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: w.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
|
|
821
|
-
/* @__PURE__ */ O(
|
|
821
|
+
/* @__PURE__ */ O(Fe, { position: [0, -0.6, Dt + 0.9], color: "#a5b4fc", size: 0.34, pxRange: [9.5, 13] })
|
|
822
822
|
] });
|
|
823
823
|
}
|
|
824
|
-
function
|
|
824
|
+
function Je() {
|
|
825
825
|
const g = st(null), e = st(null), c = st("");
|
|
826
826
|
return gt(() => {
|
|
827
827
|
var r;
|
|
828
|
-
const
|
|
829
|
-
if (!
|
|
830
|
-
const s =
|
|
828
|
+
const o = rt.engine;
|
|
829
|
+
if (!o) return;
|
|
830
|
+
const s = o.selectedId ?? q.focus, n = s ? o.slotOf(s) : null, f = !!n && !!n.inst && !n.inst.exitAt;
|
|
831
831
|
if ((r = e.current) == null || r.setOpacity(f ? 1 : 0), !n || !n.inst || !g.current || !e.current) return;
|
|
832
832
|
g.current.position.set(n.x, n.y + 1.25 * Math.max(0.85, et.scale), n.z);
|
|
833
|
-
const l = (n.inst.job ?
|
|
833
|
+
const l = (n.inst.job ? ke(n.inst) : n.inst.name) + " · " + n.inst.status;
|
|
834
834
|
l !== c.current && (c.current = l, e.current.setText(l), e.current.setColor(oe[n.inst.type]));
|
|
835
835
|
}), /* @__PURE__ */ O("group", { ref: g, children: /* @__PURE__ */ O(vt, { ref: e, text: "", size: 0.3, opacity: 0, fadeMs: 300, pxRange: [9, 13], renderOrder: 24 }) });
|
|
836
836
|
}
|
|
837
|
-
function
|
|
837
|
+
function Qe() {
|
|
838
838
|
const g = st(null), e = st(null), c = st("");
|
|
839
839
|
return gt(() => {
|
|
840
|
-
const
|
|
841
|
-
if (!
|
|
840
|
+
const o = rt.engine, s = o == null ? void 0 : o.lastFlare;
|
|
841
|
+
if (!o || !s || !g.current || !e.current) return;
|
|
842
842
|
const n = (performance.now() - s.at) / 1e3;
|
|
843
|
-
e.current.setOpacity(n < 2.2 && Z.graphWanted ? 1 : 0),
|
|
843
|
+
e.current.setOpacity(n < 2.2 && Z.graphWanted ? 1 : 0), o.anchorWorld(s.idx, lt), g.current.position.set(lt.x, lt.y + 0.9, lt.z), c.current !== s.name + s.op && (c.current = s.name + s.op, e.current.setText((s.op === "write" ? "wrote · " : "read · ") + s.name), e.current.setColor(s.op === "write" ? "#ffffff" : "#a5b4fc"));
|
|
844
844
|
}), /* @__PURE__ */ O("group", { ref: g, children: /* @__PURE__ */ O(vt, { ref: e, text: "", size: 0.28, opacity: 0, fadeMs: 400, pxRange: [8.5, 12], renderOrder: 24 }) });
|
|
845
845
|
}
|
|
846
|
-
function
|
|
846
|
+
function rs() {
|
|
847
847
|
const g = Me(() => ({ nRef: 4, min: 0.62, max: 1.45, minRadius: 7 }), []);
|
|
848
848
|
return /* @__PURE__ */ dt(
|
|
849
|
-
|
|
849
|
+
Pe,
|
|
850
850
|
{
|
|
851
851
|
title: "flow · murmuration",
|
|
852
852
|
subtitle: "agents are eddies condensing out of the current · hatchet runs are vortices · the knowledge graph is a nebula current on the side",
|
|
@@ -860,10 +860,10 @@ function os() {
|
|
|
860
860
|
agentRadius: 1.6,
|
|
861
861
|
graph: { natural: Dt, radius: 3.6 },
|
|
862
862
|
peripheryGap: 4.5,
|
|
863
|
-
Agent:
|
|
864
|
-
RunMarker:
|
|
865
|
-
mcpStyle:
|
|
866
|
-
GraphResource:
|
|
863
|
+
Agent: He,
|
|
864
|
+
RunMarker: Ve,
|
|
865
|
+
mcpStyle: Ye,
|
|
866
|
+
GraphResource: $e,
|
|
867
867
|
cluster: { radius: 1.7, variant: "swarm", pointSize: 1.1 },
|
|
868
868
|
clusterOffset: [0, 1.8, 0],
|
|
869
869
|
PostFX: /* @__PURE__ */ dt(de, { multisampling: 0, children: [
|
|
@@ -872,13 +872,13 @@ function os() {
|
|
|
872
872
|
/* @__PURE__ */ O(me, { opacity: 0.03 })
|
|
873
873
|
] }),
|
|
874
874
|
children: [
|
|
875
|
-
/* @__PURE__ */ O(
|
|
876
|
-
/* @__PURE__ */ O(
|
|
877
|
-
/* @__PURE__ */ O(
|
|
875
|
+
/* @__PURE__ */ O(Ze, {}),
|
|
876
|
+
/* @__PURE__ */ O(Je, {}),
|
|
877
|
+
/* @__PURE__ */ O(Qe, {})
|
|
878
878
|
]
|
|
879
879
|
}
|
|
880
880
|
);
|
|
881
881
|
}
|
|
882
882
|
export {
|
|
883
|
-
|
|
883
|
+
rs as default
|
|
884
884
|
};
|