@algorisys/tinyfly 0.112.0 → 0.114.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,20 @@
1
1
  import { M as _t, b as Bt, c as Vt, a as Zt, e as Gt, g as Jt, l as Kt, m as Ut, p as Qt, d as qt, f as jt, r as tn, s as nn, h as on, t as en, i as sn, v as rn } from "./load-scene-oWNsYYC1.js";
2
- import { mat4 as C, ribbon as at, ribbonHeadCap as ct, vec3 as A, quat as X, trailSamples as lt } from "@algorisys/tinyfly";
2
+ import { mat4 as C, ribbon as at, ribbonHeadCap as ct, vec3 as A, quat as R, trailSamples as lt } from "@algorisys/tinyfly";
3
3
  import { l as dt, r as ht, p as Z } from "./shots-DR_ViiAC.js";
4
4
  import { c as cn, a as ln, b as dn, d as hn, e as gn, f as fn, o as un, s as pn, g as yn, h as mn, i as kn, t as wn, w as Mn } from "./shots-DR_ViiAC.js";
5
5
  import { p as F, f as gt, s as U, i as Q } from "./shading-0lPgnXmD.js";
6
6
  import { l as vn } from "./shading-0lPgnXmD.js";
7
7
  function ft(t, n, o, i) {
8
- const { camera: r } = i, l = r.near, s = t.map((g) => C.transformPoint(r.view, g)), c = r.projection[5] * i.height / 2, a = (g, d) => o.width * (1 - o.taper * g) * c / (r.orthographic ? 1 : Math.max(d, l)), y = F(o.color), p = [];
8
+ const { camera: r } = i, l = r.near, s = t.map((g) => C.transformPoint(r.view, g)), c = r.projection[5] * i.height / 2, a = (g, d) => o.width * (1 - o.taper * g) * c / (r.orthographic ? 1 : Math.max(d, l)), u = F(o.color), y = [];
9
9
  let m = [];
10
10
  const M = (g) => -g[2] >= l;
11
11
  for (let g = 0; g < s.length; g++) {
12
12
  const d = s[g];
13
- M(d) ? (m.length === 0 && g > 0 && !M(s[g - 1]) && m.push(G(s[g - 1], d, n[g - 1], n[g], l)), m.push({ view: d, age: n[g] })) : m.length > 0 && (m.push(G(s[g - 1], d, n[g - 1], n[g], l)), p.push(m), m = []);
13
+ M(d) ? (m.length === 0 && g > 0 && !M(s[g - 1]) && m.push(G(s[g - 1], d, n[g - 1], n[g], l)), m.push({ view: d, age: n[g] })) : m.length > 0 && (m.push(G(s[g - 1], d, n[g - 1], n[g], l)), y.push(m), m = []);
14
14
  }
15
- m.length > 0 && p.push(m);
15
+ m.length > 0 && y.push(m);
16
16
  const I = [];
17
- for (const g of p) {
17
+ for (const g of y) {
18
18
  if (g.length < 2) continue;
19
19
  const d = g.map((h) => -h.view[2]), b = g.map((h) => i.toScreen(h.view)).map((h, k) => ({ x: h.x, y: h.y, width: a(g[k].age, d[k]) })), e = at(b), f = g[g.length - 1].age === 0 ? ct(b) : null;
20
20
  for (let h = 0; h + 1 < g.length; h++) {
@@ -22,19 +22,19 @@ function ft(t, n, o, i) {
22
22
  if (k > r.far) continue;
23
23
  let v = o.opacity * (1 - o.fade * ((g[h].age + g[h + 1].age) / 2));
24
24
  const x = A.lerp(g[h].view, g[h + 1].view, 0.5), P = gt(i.fog, A.length(x));
25
- let T = y;
25
+ let $ = u;
26
26
  if (i.fog && P > 0)
27
27
  if (o.additive) v *= 1 - P;
28
28
  else {
29
- const u = F(i.fog.color);
30
- T = [y[0] + (u[0] - y[0]) * P, y[1] + (u[1] - y[1]) * P, y[2] + (u[2] - y[2]) * P];
29
+ const p = F(i.fog.color);
30
+ $ = [u[0] + (p[0] - u[0]) * P, u[1] + (p[1] - u[1]) * P, u[2] + (p[2] - u[2]) * P];
31
31
  }
32
32
  if (v <= 0) continue;
33
- const D = `rgb(${T.map((u) => Math.round(Math.min(1, Math.max(0, u)) * 255)).join(", ")})`, S = [e.left[h], e.left[h + 1], e.right[h + 1], e.right[h]], $ = h + 2 === g.length ? f : null;
33
+ const D = `rgb(${$.map((p) => Math.round(Math.min(1, Math.max(0, p)) * 255)).join(", ")})`, S = [e.left[h], e.left[h + 1], e.right[h + 1], e.right[h]], E = h + 2 === g.length ? f : null;
34
34
  I.push({
35
35
  depth: k,
36
- draw(u) {
37
- o.additive && (u.globalCompositeOperation = "lighter"), u.globalAlpha = Math.min(1, v), u.fillStyle = D, u.beginPath(), u.moveTo(S[0].x, S[0].y), u.lineTo(S[1].x, S[1].y), $ && u.arc($.x, $.y, $.radius, $.start, $.start - Math.PI, !0), u.lineTo(S[2].x, S[2].y), u.lineTo(S[3].x, S[3].y), u.closePath(), u.fill(), !o.additive && v >= 1 && (u.strokeStyle = D, u.lineWidth = 0.75, u.stroke());
36
+ draw(p) {
37
+ o.additive && (p.globalCompositeOperation = "lighter"), p.globalAlpha = Math.min(1, v), p.fillStyle = D, p.beginPath(), p.moveTo(S[0].x, S[0].y), p.lineTo(S[1].x, S[1].y), E && p.arc(E.x, E.y, E.radius, E.start, E.start - Math.PI, !0), p.lineTo(S[2].x, S[2].y), p.lineTo(S[3].x, S[3].y), p.closePath(), p.fill(), !o.additive && v >= 1 && (p.strokeStyle = D, p.lineWidth = 0.75, p.stroke());
38
38
  }
39
39
  });
40
40
  }
@@ -45,39 +45,41 @@ function G(t, n, o, i, r) {
45
45
  const l = (-r - t[2]) / (n[2] - t[2]);
46
46
  return { view: A.lerp(t, n, l), age: o + (i - o) * l };
47
47
  }
48
- const ut = Math.cos(30 * Math.PI / 180), q = /* @__PURE__ */ new Map(), E = (t) => typeof t == "number" ? t : void 0, W = (t, n) => Array.isArray(t) && t.length === n ? t : void 0;
48
+ const ut = Math.cos(30 * Math.PI / 180), q = /* @__PURE__ */ new Map(), T = (t) => typeof t == "number" ? t : void 0, W = (t, n) => Array.isArray(t) && t.length === n ? t : void 0;
49
49
  function j(t, n) {
50
50
  const o = t.position ?? [0, 0, 0], i = W(n.get("position"), 3) ?? [
51
- E(n.get("x")) ?? o[0],
52
- E(n.get("y")) ?? o[1],
53
- E(n.get("z")) ?? o[2]
51
+ T(n.get("x")) ?? o[0],
52
+ T(n.get("y")) ?? o[1],
53
+ T(n.get("z")) ?? o[2]
54
54
  ];
55
55
  let r;
56
- const l = W(n.get("quaternion"), 4), s = ["rotateX", "rotateY", "rotateZ"].map((p) => E(n.get(p)));
57
- if (l) r = X.normalize(l);
58
- else if (s.some((p) => p !== void 0)) {
59
- const p = t.rotation ?? [0, 0, 0];
60
- r = X.fromEuler(s[0] ?? p[0], s[1] ?? p[1], s[2] ?? p[2]);
61
- } else t.quaternion ? r = X.normalize(t.quaternion) : r = t.rotation ? X.fromEuler(...t.rotation) : X.identity();
62
- const c = typeof t.scale == "number" ? [t.scale, t.scale, t.scale] : t.scale ?? [1, 1, 1], a = E(n.get("scale")), y = [
63
- E(n.get("scaleX")) ?? a ?? c[0],
64
- E(n.get("scaleY")) ?? a ?? c[1],
65
- E(n.get("scaleZ")) ?? a ?? c[2]
56
+ const l = W(n.get("quaternion"), 4), s = ["rotateX", "rotateY", "rotateZ"].map((y) => T(n.get(y)));
57
+ if (l) r = R.normalize(l);
58
+ else if (s.some((y) => y !== void 0)) {
59
+ const y = t.rotation ?? [0, 0, 0];
60
+ r = R.fromEuler(s[0] ?? y[0], s[1] ?? y[1], s[2] ?? y[2]);
61
+ } else t.quaternion ? r = R.normalize(t.quaternion) : r = t.rotation ? R.fromEuler(...t.rotation) : R.identity();
62
+ const c = typeof t.scale == "number" ? [t.scale, t.scale, t.scale] : t.scale ?? [1, 1, 1], a = T(n.get("scale")), u = [
63
+ T(n.get("scaleX")) ?? a ?? c[0],
64
+ T(n.get("scaleY")) ?? a ?? c[1],
65
+ T(n.get("scaleZ")) ?? a ?? c[2]
66
66
  ];
67
- return C.compose(i, r, y);
67
+ return C.compose(i, r, u);
68
68
  }
69
69
  const B = (t) => [t[12], t[13], t[14]];
70
70
  function pt(t, n, o, i) {
71
- const r = B(n), l = W(o.get("lookAt"), 3) ?? t.lookAt, s = E(o.get("roll")) ?? t.roll ?? 0, c = l ? dt(r, l, { up: t.up, roll: s }) : ht(C.invert(n) ?? C.identity(), s), a = t.projection === "perspective" ? Z({ ...t, fov: E(o.get("fov")) ?? t.fov }, i) : Z({ ...t, height: E(o.get("height")) ?? t.height }, i);
71
+ const r = B(n), l = W(o.get("lookAt"), 3) ?? t.lookAt, s = T(o.get("roll")) ?? t.roll ?? 0, c = l ? dt(r, l, { up: t.up, roll: s }) : ht(C.invert(n) ?? C.identity(), s), a = T(o.get("far")) ?? t.far;
72
+ if (!Number.isFinite(a) || a <= t.near) throw new Error("resolveScene3D: camera far must be finite and greater than near");
73
+ const u = t.projection === "perspective" ? Z({ ...t, far: a, fov: T(o.get("fov")) ?? t.fov }, i) : Z({ ...t, far: a, height: T(o.get("height")) ?? t.height }, i);
72
74
  return {
73
75
  id: t.id,
74
76
  view: c,
75
- projection: a,
77
+ projection: u,
76
78
  position: r,
77
79
  forward: A.normalize([-c[2], -c[6], -c[10]]),
78
80
  orthographic: t.projection === "orthographic",
79
81
  near: t.near,
80
- far: t.far
82
+ far: a
81
83
  };
82
84
  }
83
85
  function J(t) {
@@ -100,15 +102,15 @@ function mt(t, n) {
100
102
  function kt(t, n, o, i = 16) {
101
103
  const r = [t[0], t[1], t[2]], l = [0, 1, 0], s = [];
102
104
  for (let a = 0; a < i; a++) {
103
- const y = a / i * Math.PI * 2;
104
- r.push(t[0] + Math.cos(y) * n, t[1], t[2] + Math.sin(y) * o), l.push(0, 1, 0);
105
+ const u = a / i * Math.PI * 2;
106
+ r.push(t[0] + Math.cos(u) * n, t[1], t[2] + Math.sin(u) * o), l.push(0, 1, 0);
105
107
  }
106
108
  for (let a = 0; a < i; a++) s.push(0, 1 + (a + 1) % i, 1 + a);
107
109
  const c = Array.from({ length: i }, () => []);
108
110
  return { positions: r, normals: l, indices: s, faceEdges: c };
109
111
  }
110
112
  function wt(t, n) {
111
- const o = E(n.get("outlineWidth")) ?? t.outline?.width, i = n.get("outlineColor"), r = (typeof i == "string" ? i : void 0) ?? t.outline?.color ?? "#000000";
113
+ const o = T(n.get("outlineWidth")) ?? t.outline?.width, i = n.get("outlineColor"), r = (typeof i == "string" ? i : void 0) ?? t.outline?.color ?? "#000000";
112
114
  return o !== void 0 && o > 0 ? { width: o, color: r } : void 0;
113
115
  }
114
116
  function Mt(t, n) {
@@ -119,10 +121,10 @@ function tt(t, n = /* @__PURE__ */ new Map(), o) {
119
121
  for (const e of i.objects) {
120
122
  const f = r(e.id), h = j(e, f), k = e.parent ? s.get(e.parent) : void 0;
121
123
  s.set(e.id, k ? C.multiply(k, h) : h);
122
- const v = E(f.get("visible")) !== void 0 ? E(f.get("visible")) > 0.5 : e.visible !== !1;
124
+ const v = T(f.get("visible")) !== void 0 ? T(f.get("visible")) > 0.5 : e.visible !== !1;
123
125
  c.set(e.id, v && (e.parent ? c.get(e.parent) !== !1 : !0));
124
126
  }
125
- const a = n.get(i.id)?.get("activeCamera"), y = typeof a == "string" && i.objects.some((e) => e.id === a && e.kind === "camera") ? a : i.camera, p = i.objects.find((e) => e.id === y), m = pt(p, s.get(y), r(y), o.width / o.height), M = (e) => {
127
+ const a = n.get(i.id)?.get("activeCamera"), u = typeof a == "string" && i.objects.some((e) => e.id === a && e.kind === "camera") ? a : i.camera, y = i.objects.find((e) => e.id === u), m = pt(y, s.get(u), r(u), o.width / o.height), M = (e) => {
126
128
  const f = C.transformPoint(m.projection, e);
127
129
  return { x: (f[0] + 1) / 2 * o.width, y: (1 - f[1]) / 2 * o.height };
128
130
  }, I = [];
@@ -133,7 +135,7 @@ function tt(t, n = /* @__PURE__ */ new Map(), o) {
133
135
  id: e.id,
134
136
  light: e.light,
135
137
  color: typeof v == "string" ? v : e.color,
136
- intensity: E(f.get("intensity")) ?? e.intensity,
138
+ intensity: T(f.get("intensity")) ?? e.intensity,
137
139
  position: h,
138
140
  direction: A.normalize(A.subtract(k, h)),
139
141
  range: e.range,
@@ -145,14 +147,14 @@ function tt(t, n = /* @__PURE__ */ new Map(), o) {
145
147
  if (e.kind !== "mesh" || !c.get(e.id)) return;
146
148
  const h = t.meshes.get(e.id), k = i.materials?.[e.material];
147
149
  if (!h || !k) return;
148
- const v = r(e.id), x = s.get(e.id), P = J(x), T = v.get("color"), D = (E(v.get("opacity")) ?? 1) * (k.opacity ?? 1);
150
+ const v = r(e.id), x = s.get(e.id), P = J(x), $ = v.get("color"), D = (T(v.get("opacity")) ?? 1) * (k.opacity ?? 1);
149
151
  if (D <= 0) return;
150
- const S = wt(k, v), $ = S === k.outline || S && k.outline && S.width === k.outline.width && S.color === k.outline.color ? k : { ...k, outline: S };
151
- d.push({ objectId: e.id, objectIndex: f, mesh: h, world: x, material: $, color: typeof T == "string" ? T : void 0, opacity: D }), g.push(...L(h, x, P, m, M, $, {
152
+ const S = wt(k, v), E = S === k.outline || S && k.outline && S.width === k.outline.width && S.color === k.outline.color ? k : { ...k, outline: S };
153
+ d.push({ objectId: e.id, objectIndex: f, mesh: h, world: x, material: E, color: typeof $ == "string" ? $ : void 0, opacity: D }), g.push(...L(h, x, P, m, M, E, {
152
154
  objectId: e.id,
153
155
  objectIndex: f,
154
156
  layer: e.layer ?? 0,
155
- color: typeof T == "string" ? T : void 0,
157
+ color: typeof $ == "string" ? $ : void 0,
156
158
  opacity: D,
157
159
  ink: S,
158
160
  nearFade: l
@@ -162,18 +164,18 @@ function tt(t, n = /* @__PURE__ */ new Map(), o) {
162
164
  const h = t.meshes.get(e.id);
163
165
  if (!h) return;
164
166
  const k = r(e.id);
165
- if ((E(k.get("opacity")) ?? 1) <= 0) return;
167
+ if ((T(k.get("opacity")) ?? 1) <= 0) return;
166
168
  const v = s.get(e.id), x = e.shadow === !0 ? {} : e.shadow, P = x.ground ?? i.ground ?? 0;
167
- let T = 1 / 0, D = -1 / 0, S = 1 / 0, $ = 1 / 0, u = -1 / 0;
168
- for (let O = 0; O < h.positions.length; O += 3) {
169
- const R = C.transformPoint(v, [h.positions[O], h.positions[O + 1], h.positions[O + 2]]);
170
- T = Math.min(T, R[0]), D = Math.max(D, R[0]), S = Math.min(S, R[1]), $ = Math.min($, R[2]), u = Math.max(u, R[2]);
169
+ let $ = 1 / 0, D = -1 / 0, S = 1 / 0, E = 1 / 0, p = -1 / 0;
170
+ for (let N = 0; N < h.positions.length; N += 3) {
171
+ const O = C.transformPoint(v, [h.positions[N], h.positions[N + 1], h.positions[N + 2]]);
172
+ $ = Math.min($, O[0]), D = Math.max(D, O[0]), S = Math.min(S, O[1]), E = Math.min(E, O[2]), p = Math.max(p, O[2]);
171
173
  }
172
- const z = Math.max(D - T, u - $);
174
+ const z = Math.max(D - $, p - E);
173
175
  if (!(z > 0)) return;
174
- const Y = Math.max(0, S - P), N = Math.min(1, Y / (2 * z)), H = (x.opacity ?? 0.22) * (1 - N * 0.8);
176
+ const X = Math.max(0, S - P), Y = Math.min(1, X / (2 * z)), H = (x.opacity ?? 0.22) * (1 - Y * 0.8);
175
177
  if (H <= 0.01) return;
176
- const V = 1.1 + N * 0.4, st = kt([(T + D) / 2, P + 2e-3, ($ + u) / 2], (D - T) / 2 * V, (u - $) / 2 * V), rt = { color: "#000000", shading: "unlit", opacity: H };
178
+ const V = 1.1 + Y * 0.4, st = kt([($ + D) / 2, P + 2e-3, (E + p) / 2], (D - $) / 2 * V, (p - E) / 2 * V), rt = { color: "#000000", shading: "unlit", opacity: H };
177
179
  g.push(...L(st, C.identity(), C.identity(), m, M, rt, {
178
180
  objectId: `${e.id}:shadow`,
179
181
  objectIndex: f - 0.5,
@@ -239,10 +241,10 @@ function bt(t, n) {
239
241
  const o = n.get("color"), i = t.kind === "trail";
240
242
  return {
241
243
  color: typeof o == "string" ? o : t.color,
242
- width: E(n.get("width")) ?? t.width ?? 0.05,
244
+ width: T(n.get("width")) ?? t.width ?? 0.05,
243
245
  taper: t.taper ?? (i ? 1 : 0),
244
246
  fade: t.fade ?? (i ? 1 : 0),
245
- opacity: (E(n.get("opacity")) ?? 1) * (t.opacity ?? 1),
247
+ opacity: (T(n.get("opacity")) ?? 1) * (t.opacity ?? 1),
246
248
  additive: t.blend === "add"
247
249
  };
248
250
  }
@@ -252,7 +254,7 @@ function vt(t, n) {
252
254
  }
253
255
  function xt(t, n, o, i) {
254
256
  if (!i.valuesAt) return null;
255
- const r = i.time ?? 0, l = E(o.get(`${n.id}/${t.id}`)?.get("length")) ?? t.length, s = lt(
257
+ const r = i.time ?? 0, l = T(o.get(`${n.id}/${t.id}`)?.get("length")) ?? t.length, s = lt(
256
258
  (c) => B(nt(n, t.follow, c === r ? o : i.valuesAt(c))),
257
259
  r,
258
260
  { length: l, samples: t.samples ?? 32, period: t.period ?? i.period }
@@ -266,53 +268,53 @@ function nt(t, n, o) {
266
268
  return i.parent ? C.multiply(nt(t, i.parent, o), r) : r;
267
269
  }
268
270
  function L(t, n, o, i, r, l, s) {
269
- const c = t.positions.length / 3, a = [], y = [];
271
+ const c = t.positions.length / 3, a = [], u = [];
270
272
  for (let d = 0; d < c; d++) {
271
273
  const w = C.transformPoint(n, [t.positions[d * 3], t.positions[d * 3 + 1], t.positions[d * 3 + 2]]);
272
- a.push(w), y.push(C.transformPoint(i.view, w));
274
+ a.push(w), u.push(C.transformPoint(i.view, w));
273
275
  }
274
- const p = t.indices.length / 3, m = [], M = [];
275
- for (let d = 0; d < p; d++) {
276
+ const y = t.indices.length / 3, m = [], M = [];
277
+ for (let d = 0; d < y; d++) {
276
278
  const [w, b, e] = [0, 1, 2].map((k) => a[t.indices[d * 3 + k]]), f = A.normalize(A.cross(A.subtract(b, w), A.subtract(e, w)));
277
279
  m.push(f);
278
280
  const h = i.orthographic ? A.scale(i.forward, -1) : A.subtract(i.position, w);
279
281
  M.push(A.dot(f, h) > 0);
280
282
  }
281
- const I = (d) => -y[d][2] >= i.near, g = [];
282
- for (let d = 0; d < p; d++) {
283
+ const I = (d) => -u[d][2] >= i.near, g = [];
284
+ for (let d = 0; d < y; d++) {
283
285
  const w = M[d];
284
286
  if (!w && !l.doubleSided) continue;
285
- const b = [t.indices[d * 3], t.indices[d * 3 + 1], t.indices[d * 3 + 2]], e = b.map((u) => y[u]);
286
- if (e.every((u) => -u[2] > i.far)) continue;
287
+ const b = [t.indices[d * 3], t.indices[d * 3 + 1], t.indices[d * 3 + 2]], e = b.map((p) => u[p]);
288
+ if (e.every((p) => -p[2] > i.far)) continue;
287
289
  const f = mt(e, i.near);
288
290
  if (f.length < 3) continue;
289
- const h = w ? 1 : -1, k = A.scale(m[d], h), v = b.map((u) => A.scale(yt(o, t.normals[u * 3], t.normals[u * 3 + 1], t.normals[u * 3 + 2]), h)), x = A.scale(A.add(A.add(a[b[0]], a[b[1]]), a[b[2]]), 1 / 3), P = -(e[0][2] + e[1][2] + e[2][2]) / 3, T = [], D = [];
291
+ const h = w ? 1 : -1, k = A.scale(m[d], h), v = b.map((p) => A.scale(yt(o, t.normals[p * 3], t.normals[p * 3 + 1], t.normals[p * 3 + 2]), h)), x = A.scale(A.add(A.add(a[b[0]], a[b[1]]), a[b[2]]), 1 / 3), P = -(e[0][2] + e[1][2] + e[2][2]) / 3, $ = [], D = [];
290
292
  if (s.ink && w)
291
- for (const u of t.faceEdges[d]) {
292
- const z = u.across, Y = z === -1 || !M[z], N = l.creases !== !1 && !Y && d < z && A.dot(m[d], m[z]) < ut;
293
- (Y || N) && I(u.a) && I(u.b) && (T.push([r(y[u.a]), r(y[u.b])]), D.push([-y[u.a][2], -y[u.b][2]]));
293
+ for (const p of t.faceEdges[d]) {
294
+ const z = p.across, X = z === -1 || !M[z], Y = l.creases !== !1 && !X && d < z && A.dot(m[d], m[z]) < ut;
295
+ (X || Y) && I(p.a) && I(p.b) && ($.push([r(u[p.a]), r(u[p.b])]), D.push([-u[p.a][2], -u[p.b][2]]));
294
296
  }
295
297
  const S = s.opacity * Mt(s.nearFade, P);
296
298
  if (S <= 0) continue;
297
- const $ = f.map(r);
298
- for (let u = 1; u + 1 < $.length; u++)
299
+ const E = f.map(r);
300
+ for (let p = 1; p + 1 < E.length; p++)
299
301
  g.push({
300
302
  objectId: s.objectId,
301
303
  objectIndex: s.objectIndex,
302
304
  layer: s.layer,
303
305
  face: d,
304
- part: u - 1,
305
- screen: [$[0], $[u], $[u + 1]],
306
+ part: p - 1,
307
+ screen: [E[0], E[p], E[p + 1]],
306
308
  depth: P,
307
- depths: [-f[0][2], -f[u][2], -f[u + 1][2]],
309
+ depths: [-f[0][2], -f[p][2], -f[p + 1][2]],
308
310
  centroid: x,
309
311
  normal: k,
310
312
  vertexNormals: v,
311
313
  material: l,
312
314
  color: s.color ?? t.faceColors?.[d],
313
315
  opacity: S,
314
- outline: u === 1 ? T : [],
315
- outlineDepths: u === 1 ? D : [],
316
+ outline: p === 1 ? $ : [],
317
+ outlineDepths: p === 1 ? D : [],
316
318
  ink: s.ink
317
319
  });
318
320
  }
@@ -355,8 +357,8 @@ function ot(t, n) {
355
357
  };
356
358
  for (const s of n.triangles) {
357
359
  l(s), i(s.layer, s.depth);
358
- const { color: c, alpha: a } = U(s, n.lights, n.camera, n.fog), [y, p, m] = s.screen;
359
- t.globalAlpha = a, t.beginPath(), t.moveTo(y.x, y.y), t.lineTo(p.x, p.y), t.lineTo(m.x, m.y), t.closePath(), t.fillStyle = c, t.fill(), a >= 1 && (t.strokeStyle = c, t.lineWidth = 0.75, t.stroke()), s.ink && s.outline.length > 0 && r.push({ objectId: s.objectId, layer: s.layer, depth: s.depth, triangle: s });
360
+ const { color: c, alpha: a } = U(s, n.lights, n.camera, n.fog), [u, y, m] = s.screen;
361
+ t.globalAlpha = a, t.beginPath(), t.moveTo(u.x, u.y), t.lineTo(y.x, y.y), t.lineTo(m.x, m.y), t.closePath(), t.fillStyle = c, t.fill(), a >= 1 && (t.strokeStyle = c, t.lineWidth = 0.75, t.stroke()), s.ink && s.outline.length > 0 && r.push({ objectId: s.objectId, layer: s.layer, depth: s.depth, triangle: s });
360
362
  }
361
363
  l(), i(1 / 0, -1 / 0), t.restore();
362
364
  }
@@ -372,9 +374,9 @@ function St(t, n = {}) {
372
374
  const o = t.width, i = t.height, r = new Uint8ClampedArray(o * i * 4), l = new Float32Array(o * i).fill(1 / 0);
373
375
  if (n.under && n.under.length === r.length) r.set(n.under);
374
376
  else if (t.background && t.background !== "transparent") {
375
- const p = F(typeof t.background == "string" ? t.background : t.background.top), m = F(typeof t.background == "string" ? t.background : t.background.bottom);
377
+ const y = F(typeof t.background == "string" ? t.background : t.background.top), m = F(typeof t.background == "string" ? t.background : t.background.bottom);
376
378
  for (let M = 0; M < i; M++) {
377
- const I = i > 1 ? M / (i - 1) : 0, g = Math.round((p[0] + (m[0] - p[0]) * I) * 255), d = Math.round((p[1] + (m[1] - p[1]) * I) * 255), w = Math.round((p[2] + (m[2] - p[2]) * I) * 255);
379
+ const I = i > 1 ? M / (i - 1) : 0, g = Math.round((y[0] + (m[0] - y[0]) * I) * 255), d = Math.round((y[1] + (m[1] - y[1]) * I) * 255), w = Math.round((y[2] + (m[2] - y[2]) * I) * 255);
378
380
  for (let b = 0; b < o; b++) {
379
381
  const e = M * o + b;
380
382
  r[e * 4] = g, r[e * 4 + 1] = d, r[e * 4 + 2] = w, r[e * 4 + 3] = 255;
@@ -383,21 +385,21 @@ function St(t, n = {}) {
383
385
  }
384
386
  const s = { width: o, height: i, data: r, depth: l };
385
387
  let c = -1 / 0;
386
- const a = [], y = () => {
387
- for (const p of a) K(s, t, p, !1);
388
+ const a = [], u = () => {
389
+ for (const y of a) K(s, t, y, !1);
388
390
  a.length = 0;
389
391
  };
390
- for (const p of t.triangles)
391
- p.layer !== c && (y(), c = p.layer, l.fill(1 / 0)), p.opacity < 1 ? a.push(p) : K(s, t, p, !0);
392
- return y(), s;
392
+ for (const y of t.triangles)
393
+ y.layer !== c && (u(), c = y.layer, l.fill(1 / 0)), y.opacity < 1 ? a.push(y) : K(s, t, y, !0);
394
+ return u(), s;
393
395
  }
394
396
  function K(t, n, o, i) {
395
397
  const { color: r, alpha: l } = U(o, n.lights, n.camera, n.fog), s = F(r).map((c) => Math.round(c * 255));
396
398
  if (Tt(t, o.screen, o.depths, s, l, i), o.ink && o.outline.length > 0) {
397
399
  const c = F(Q(o.ink.color, n.fog, A.distance(o.centroid, n.camera.position))).map((a) => Math.round(a * 255));
398
- o.outline.forEach((a, y) => {
399
- const p = o.outlineDepths[y] ?? [o.depth, o.depth];
400
- $t(t, a[0], a[1], p, o.ink.width, c, l);
400
+ o.outline.forEach((a, u) => {
401
+ const y = o.outlineDepths[u] ?? [o.depth, o.depth];
402
+ $t(t, a[0], a[1], y, o.ink.width, c, l);
401
403
  });
402
404
  }
403
405
  }
@@ -415,26 +417,26 @@ function it(t, n, o, i) {
415
417
  }
416
418
  const Pt = 4e-3;
417
419
  function Tt(t, n, o, i, r, l) {
418
- const [s, c, a] = n, y = (c.x - s.x) * (a.y - s.y) - (c.y - s.y) * (a.x - s.x);
419
- if (y === 0) return;
420
- const p = Math.max(0, Math.floor(Math.min(s.x, c.x, a.x))), m = Math.min(t.width - 1, Math.ceil(Math.max(s.x, c.x, a.x))), M = Math.max(0, Math.floor(Math.min(s.y, c.y, a.y))), I = Math.min(t.height - 1, Math.ceil(Math.max(s.y, c.y, a.y)));
421
- if (p > m || M > I) return;
422
- const g = [1 / Math.max(1e-9, o[0]), 1 / Math.max(1e-9, o[1]), 1 / Math.max(1e-9, o[2])], d = y > 0 ? 1 : -1;
420
+ const [s, c, a] = n, u = (c.x - s.x) * (a.y - s.y) - (c.y - s.y) * (a.x - s.x);
421
+ if (u === 0) return;
422
+ const y = Math.max(0, Math.floor(Math.min(s.x, c.x, a.x))), m = Math.min(t.width - 1, Math.ceil(Math.max(s.x, c.x, a.x))), M = Math.max(0, Math.floor(Math.min(s.y, c.y, a.y))), I = Math.min(t.height - 1, Math.ceil(Math.max(s.y, c.y, a.y)));
423
+ if (y > m || M > I) return;
424
+ const g = [1 / Math.max(1e-9, o[0]), 1 / Math.max(1e-9, o[1]), 1 / Math.max(1e-9, o[2])], d = u > 0 ? 1 : -1;
423
425
  for (let w = M; w <= I; w++) {
424
426
  const b = w + 0.5;
425
- for (let e = p; e <= m; e++) {
427
+ for (let e = y; e <= m; e++) {
426
428
  const f = e + 0.5, h = ((c.x - f) * (a.y - b) - (c.y - b) * (a.x - f)) * d, k = ((a.x - f) * (s.y - b) - (a.y - b) * (s.x - f)) * d, v = ((s.x - f) * (c.y - b) - (s.y - b) * (c.x - f)) * d;
427
429
  if (h < 0 || k < 0 || v < 0) continue;
428
- const P = (h + k + v) / (h * g[0] + k * g[1] + v * g[2]), T = w * t.width + e;
429
- P >= t.depth[T] || (it(t.data, T, i, r), l && (t.depth[T] = P));
430
+ const P = (h + k + v) / (h * g[0] + k * g[1] + v * g[2]), $ = w * t.width + e;
431
+ P >= t.depth[$] || (it(t.data, $, i, r), l && (t.depth[$] = P));
430
432
  }
431
433
  }
432
434
  }
433
435
  function $t(t, n, o, i, r, l, s) {
434
- const c = Math.max(0.5, r / 2), a = Math.max(0, Math.floor(Math.min(n.x, o.x) - c)), y = Math.min(t.width - 1, Math.ceil(Math.max(n.x, o.x) + c)), p = Math.max(0, Math.floor(Math.min(n.y, o.y) - c)), m = Math.min(t.height - 1, Math.ceil(Math.max(n.y, o.y) + c)), M = o.x - n.x, I = o.y - n.y, g = M * M + I * I, d = c * c;
435
- for (let w = p; w <= m; w++) {
436
+ const c = Math.max(0.5, r / 2), a = Math.max(0, Math.floor(Math.min(n.x, o.x) - c)), u = Math.min(t.width - 1, Math.ceil(Math.max(n.x, o.x) + c)), y = Math.max(0, Math.floor(Math.min(n.y, o.y) - c)), m = Math.min(t.height - 1, Math.ceil(Math.max(n.y, o.y) + c)), M = o.x - n.x, I = o.y - n.y, g = M * M + I * I, d = c * c;
437
+ for (let w = y; w <= m; w++) {
436
438
  const b = w + 0.5;
437
- for (let e = a; e <= y; e++) {
439
+ for (let e = a; e <= u; e++) {
438
440
  const f = e + 0.5, h = g > 0 ? Math.min(1, Math.max(0, ((f - n.x) * M + (b - n.y) * I) / g)) : 0, k = n.x + M * h, v = n.y + I * h;
439
441
  if ((f - k) ** 2 + (b - v) ** 2 > d) continue;
440
442
  const x = (i[0] + (i[1] - i[0]) * h) * (1 - Pt), P = w * t.width + e;
@@ -458,7 +460,7 @@ class Ft {
458
460
  et(this.ctx, n);
459
461
  }
460
462
  }
461
- class Ot {
463
+ class Nt {
462
464
  renderer;
463
465
  width;
464
466
  height;
@@ -488,21 +490,21 @@ class Ot {
488
490
  this.renderer.render(tt(n, this.values, { width: this.width, height: this.height, time: this.time, valuesAt: this.valuesAt }));
489
491
  }
490
492
  }
491
- function Rt(t, n, o, i) {
493
+ function Ot(t, n, o, i) {
492
494
  const r = i.stateAt, l = i.valuesAt ?? (r && ((c) => r(c).values)), s = tt(n, o ?? /* @__PURE__ */ new Map(), { width: i.width, height: i.height, time: i.time, period: i.period, valuesAt: l });
493
495
  i.depthBuffer ? et(t, s) : ot(t, s);
494
496
  }
495
- function Xt(t = {}) {
496
- const n = t.id ?? "penrose", o = t.length ?? 4, i = t.thickness ?? 0.8, r = t.material ?? "penrose", [l, s, c] = t.position ?? [0, 0, 0], a = i / 2, y = (g, d, w) => ({
497
+ function Rt(t = {}) {
498
+ const n = t.id ?? "penrose", o = t.length ?? 4, i = t.thickness ?? 0.8, r = t.material ?? "penrose", [l, s, c] = t.position ?? [0, 0, 0], a = i / 2, u = (g, d, w) => ({
497
499
  id: `${n}-${g}`,
498
500
  kind: "mesh",
499
501
  geometry: { type: "box", size: [w[0] - d[0], w[1] - d[1], w[2] - d[2]] },
500
502
  material: r,
501
503
  position: [l + (d[0] + w[0]) / 2, s + (d[1] + w[1]) / 2, c + (d[2] + w[2]) / 2]
502
- }), p = [
503
- y("x", [-a, -a, -a], [o - a, a, a]),
504
- y("y", [o - a, -a, -a], [o + a, o - a, a]),
505
- y("z", [o - a, o - a, -a], [o + a, o + a, o])
504
+ }), y = [
505
+ u("x", [-a, -a, -a], [o - a, a, a]),
506
+ u("y", [o - a, -a, -a], [o + a, o - a, a]),
507
+ u("z", [o - a, o - a, -a], [o + a, o + a, o])
506
508
  ], m = [l + 2 * o / 3, s + o / 3, c + o / 3], M = (t.distance ?? 20) / Math.sqrt(3), I = {
507
509
  id: `${n}-camera`,
508
510
  kind: "camera",
@@ -513,7 +515,7 @@ function Xt(t = {}) {
513
515
  position: [m[0] + M, m[1] + M, m[2] + M],
514
516
  lookAt: m
515
517
  };
516
- return { objects: p, camera: I };
518
+ return { objects: y, camera: I };
517
519
  }
518
520
  const _ = {
519
521
  day: {
@@ -554,7 +556,7 @@ const _ = {
554
556
  fog: { color: "#0a0612", near: 8, far: 24 }
555
557
  }
556
558
  };
557
- function Yt(t, n = {}) {
559
+ function Xt(t, n = {}) {
558
560
  const o = _[t];
559
561
  if (!o) throw new Error(`lightingPreset: unknown mood "${t}" (day, dusk, night, stage)`);
560
562
  const i = n.prefix ? `${n.prefix}-` : "";
@@ -564,19 +566,19 @@ function Yt(t, n = {}) {
564
566
  fog: { ...o.fog }
565
567
  };
566
568
  }
567
- function Nt(t, n, o) {
569
+ function Yt(t, n, o) {
568
570
  const i = _[t], r = _[n];
569
571
  if (!i || !r) throw new Error(`lightingTracks: unknown mood "${i ? n : t}" (day, dusk, night, stage)`);
570
572
  const l = o.prefix ? `${o.prefix}-` : "", s = /* @__PURE__ */ new Set([...i.lights.map((a) => a.id), ...r.lights.map((a) => a.id)]), c = [];
571
573
  for (const a of s) {
572
- const y = i.lights.find((b) => b.id === a), p = r.lights.find((b) => b.id === a), m = `${o.scene}/${l}${a}`, M = (b, e, f) => {
574
+ const u = i.lights.find((b) => b.id === a), y = r.lights.find((b) => b.id === a), m = `${o.scene}/${l}${a}`, M = (b, e, f) => {
573
575
  const h = [{ time: o.start, value: e }, { time: o.end, value: f, easing: o.easing ?? "ease-in-out" }];
574
576
  c.push({ id: `${m}-${b}`, target: m, property: b, keyframes: h });
575
577
  };
576
- M("intensity", y?.intensity ?? 0, p?.intensity ?? 0), M("color", y?.color ?? p.color, p?.color ?? y.color);
577
- const I = y?.position ?? p?.position, g = p?.position ?? y?.position;
578
+ M("intensity", u?.intensity ?? 0, y?.intensity ?? 0), M("color", u?.color ?? y.color, y?.color ?? u.color);
579
+ const I = u?.position ?? y?.position, g = y?.position ?? u?.position;
578
580
  I && g && M("position", [...I], [...g]);
579
- const d = y?.target ?? p?.target, w = p?.target ?? y?.target;
581
+ const d = u?.target ?? y?.target, w = y?.target ?? u?.target;
580
582
  d && w && M("target", [...d], [...w]);
581
583
  }
582
584
  return c;
@@ -592,7 +594,7 @@ export {
592
594
  zt as Canvas2DRenderer,
593
595
  _ as LIGHTING_PRESETS,
594
596
  _t as MeshBuilder,
595
- Ot as Scene3DAdapter,
597
+ Nt as Scene3DAdapter,
596
598
  Ft as SoftwareRenderer,
597
599
  Bt as boxMesh,
598
600
  cn as cameraFollowTracks,
@@ -605,21 +607,21 @@ export {
605
607
  fn as dollyPosition,
606
608
  ot as drawResolvedScene,
607
609
  et as drawResolvedSceneWithDepth,
608
- Rt as drawScene3D,
610
+ Ot as drawScene3D,
609
611
  Gt as extrudeMesh,
610
612
  gt as fogAmount,
611
613
  Jt as geometryMesh,
612
614
  Wt as ground,
613
615
  Q as inkColor,
614
616
  vn as lightAt,
615
- Yt as lightingPreset,
616
- Nt as lightingTracks,
617
+ Xt as lightingPreset,
618
+ Yt as lightingTracks,
617
619
  Kt as loadScene3D,
618
620
  dt as lookAtView,
619
621
  Ut as meshEdges,
620
622
  un as orbitPosition,
621
623
  F as parseColor,
622
- Xt as penroseTriangle3D,
624
+ Rt as penroseTriangle3D,
623
625
  Qt as planeMesh,
624
626
  qt as pointInPolygon,
625
627
  jt as prepareMesh,
@@ -1,26 +1,30 @@
1
- import { C as s, a as i, b as c, c as e, d as t, e as r, f as E, g as I, h as T, i as l, j as _, k, l as R, m as A, n as P, o as K, p as S, q as n, r as F, s as o, t as O, u as N, v as g } from "./cricket-play-Zm5cghdV.js";
1
+ import { C, a as s, b as c, c as e, d as r, e as t, f as I, g as E, h as T, i as l, j as k, k as _, l as R, m as A, n as S, o as n, p as K, q as P, r as F, s as O, t as o, u as N, v as g, w as m, x as y, y as L, z as d } from "./cricket-play-BZNhfgOK.js";
2
2
  export {
3
- s as CRICKET_ACTIONS,
4
- i as CRICKET_CAMERA_ANGLES,
3
+ C as CRICKET_ACTIONS,
4
+ s as CRICKET_CAMERA_ANGLES,
5
5
  c as CRICKET_CASTS,
6
- e as CRICKET_FIELDING_POSITIONS,
6
+ e as CRICKET_DECISION_VIEWS,
7
+ r as CRICKET_FIELDING_POSITIONS,
7
8
  t as CRICKET_FORMATS,
8
- r as CRICKET_MARKING_PROFILES,
9
+ I as CRICKET_MARKING_PROFILES,
9
10
  E as CRICKET_PITCH,
10
- I as CRICKET_PLAY_COMPONENTS,
11
- T as CRICKET_PLAY_EXAMPLES,
12
- l as CRICKET_VIEWS,
11
+ T as CRICKET_PLAY_COMPONENTS,
12
+ l as CRICKET_PLAY_EXAMPLES,
13
+ k as CRICKET_VIEWS,
13
14
  _ as ballFlightPoint,
14
- k as ballFlightTracks,
15
- R as cricketAction,
16
- A as cricketCameraTracks,
15
+ R as ballFlightTracks,
16
+ A as cricketAction,
17
+ S as cricketCameraFraming,
18
+ n as cricketCameraReview,
19
+ K as cricketCameraTracks,
17
20
  P as cricketClip,
18
- K as cricketEventAt,
19
- S as cricketField,
20
- n as cricketFieldingAreaContains,
21
- F as cricketFieldingOverlay,
22
- o as cricketFieldingPositions,
23
- O as cricketPlay,
24
- N as cricketPlayClip,
25
- g as cricketPlayer
21
+ F as cricketDecisionOverlay,
22
+ O as cricketEventAt,
23
+ o as cricketField,
24
+ N as cricketFieldingAreaContains,
25
+ g as cricketFieldingOverlay,
26
+ m as cricketFieldingPositions,
27
+ y as cricketPlay,
28
+ L as cricketPlayClip,
29
+ d as cricketPlayer
26
30
  };