vitessce 4.0.3 → 4.0.4

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.
@@ -3,8 +3,8 @@ import { useRef as D, useState as le, useMemo as de, useEffect as Q, Suspense as
3
3
  import { useThree as ve, useFrame as Me, Canvas as Pe } from "@react-three/fiber";
4
4
  import { OrbitControls as me } from "@react-three/drei";
5
5
  import * as M from "three";
6
- import { Data3DTexture as ge, RedFormat as Ae, UnsignedByteType as Be, LinearFilter as xe, RedIntegerFormat as Ne, UnsignedIntType as Ue, NearestFilter as pe, Vector3 as C, Vector2 as _, Vector4 as j, UniformsUtils as Le } from "three";
7
- import { l as n, i as Oe, a as ue, L as he, C as P, u as K } from "./index-C0mQDzdh.js";
6
+ import { Data3DTexture as ge, RedFormat as Ae, UnsignedByteType as Be, LinearFilter as pe, RedIntegerFormat as Ne, UnsignedIntType as Ue, NearestFilter as xe, Vector3 as R, Vector2 as _, Vector4 as j, UniformsUtils as Le } from "three";
7
+ import { l as n, i as Oe, a as ue, L as he, C as P, u as K } from "./index-BxR_MGzQ.js";
8
8
  const w = 32, B = 64, Z = 64, fe = 4, ce = B * Z * fe, be = B * w, _e = Z * w, Ce = fe * w, V = {
9
9
  NOT_STARTED: "not_started",
10
10
  IN_PROGRESS: "in_progress",
@@ -74,23 +74,23 @@ function Ge(f, t) {
74
74
  e.xExtent = 1, e.yExtent = 1, e.zExtent = 1;
75
75
  const i = f[0][0];
76
76
  e.z0Extent = i, e.lowestDataRes = f.length - 1;
77
- for (let u = f.length - 1; u > 0; u--)
77
+ for (let c = f.length - 1; c > 0; c--)
78
78
  e.anchors.push([
79
79
  e.xExtent,
80
80
  e.yExtent,
81
81
  e.zExtent
82
- ]), e.xExtent += f[u][2], e.yExtent += f[u][1], e.zExtent += f[u][0];
82
+ ]), e.xExtent += f[c][2], e.yExtent += f[c][1], e.zExtent += f[c][0];
83
83
  e.anchors.push([0, 0, e.zExtent]), e.anchors.reverse(), e.zTotal = e.zExtent + t * i;
84
84
  const o = new Uint8Array(be * _e * Ce);
85
85
  o.fill(0);
86
86
  const r = new Uint32Array(e.xExtent * e.yExtent * e.zTotal);
87
87
  r.fill(0);
88
88
  const a = new ge(o, be, _e, Ce);
89
- a.format = Ae, a.type = Be, a.internalFormat = "R8", a.minFilter = xe, a.magFilter = xe, a.generateMipmaps = !1, a.needsUpdate = !0;
90
- const c = new ge(r, e.xExtent, e.yExtent, e.zTotal);
91
- return c.format = Ne, c.type = Ue, c.internalFormat = "R32UI", c.minFilter = pe, c.magFilter = pe, c.generateMipmaps = !1, c.needsUpdate = !0, n.debug("_initMRMCPT", e, c, a), {
89
+ a.format = Ae, a.type = Be, a.internalFormat = "R8", a.minFilter = pe, a.magFilter = pe, a.generateMipmaps = !1, a.needsUpdate = !0;
90
+ const s = new ge(r, e.xExtent, e.yExtent, e.zTotal);
91
+ return s.format = Ne, s.type = Ue, s.internalFormat = "R32UI", s.minFilter = xe, s.magFilter = xe, s.generateMipmaps = !1, s.needsUpdate = !0, n.debug("_initMRMCPT", e, s, a), {
92
92
  PT: e,
93
- ptTHREE: c,
93
+ ptTHREE: s,
94
94
  bcTHREE: a
95
95
  };
96
96
  }
@@ -100,50 +100,50 @@ function qe(f, t, e, i, o) {
100
100
  }
101
101
  function Ze(f, t, e, i) {
102
102
  const { PT_zExtent: o, PT_z0Extent: r, PT_anchors: a } = i;
103
- let c = -1, u = -1, l = -1, p = -1, m = -1;
103
+ let s = -1, c = -1, h = -1, d = -1, v = -1;
104
104
  if (e >= o)
105
- u = 0, l = f, p = t, m = (e - o) % r, c = Math.floor((e - o) / r);
105
+ c = 0, h = f, d = t, v = (e - o) % r, s = Math.floor((e - o) / r);
106
106
  else
107
- for (let s = 1; s < a.length; s++)
108
- if (!(f < a[s][0] && t < a[s][1] && e < a[s][2])) {
109
- u = s;
110
- const d = [0, 0, 0];
111
- f >= a[s][0] && (d[0] = 1), t >= a[s][1] && (d[1] = 1), e >= a[s][2] && (d[2] = 1);
112
- const v = d[0] << 2 | d[1] << 1 | d[2];
113
- c = Math.max(1, Math.min(7, v)) - 1;
114
- const h = d.map((g, b) => g * a[s][b]);
115
- l = f - h[0], p = t - h[1], m = e - h[2];
107
+ for (let l = 1; l < a.length; l++)
108
+ if (!(f < a[l][0] && t < a[l][1] && e < a[l][2])) {
109
+ c = l;
110
+ const x = [0, 0, 0];
111
+ f >= a[l][0] && (x[0] = 1), t >= a[l][1] && (x[1] = 1), e >= a[l][2] && (x[2] = 1);
112
+ const m = x[0] << 2 | x[1] << 1 | x[2];
113
+ s = Math.max(1, Math.min(7, m)) - 1;
114
+ const u = x.map((g, b) => g * a[l][b]);
115
+ h = f - u[0], d = t - u[1], v = e - u[2];
116
116
  break;
117
117
  }
118
118
  return {
119
- channel: c,
120
- resolution: u,
121
- x: l,
122
- y: p,
123
- z: m
119
+ channel: s,
120
+ resolution: c,
121
+ x: h,
122
+ y: d,
123
+ z: v
124
124
  };
125
125
  }
126
126
  const Xe = 0.25;
127
127
  function je(f, t, e) {
128
- const i = /* @__PURE__ */ new Map(), { width: o, height: r, sigmaNormalized: a } = e, c = Number.isInteger(o) && Number.isInteger(r) && o > 0 && r > 0 && typeof a == "number";
129
- c || n.warn("_requestBufferToRequestObjects: proceeding without weighting");
130
- const u = Math.floor(f.length / 4);
131
- for (let m = 0; m < u; m += 1) {
132
- const s = m * 4, d = f[s], v = f[s + 1], h = f[s + 2], g = f[s + 3];
133
- if ((d | v | h | g) === 0)
128
+ const i = /* @__PURE__ */ new Map(), { width: o, height: r, sigmaNormalized: a } = e, s = Number.isInteger(o) && Number.isInteger(r) && o > 0 && r > 0 && typeof a == "number";
129
+ s || n.warn("_requestBufferToRequestObjects: proceeding without weighting");
130
+ const c = Math.floor(f.length / 4);
131
+ for (let v = 0; v < c; v += 1) {
132
+ const l = v * 4, x = f[l], m = f[l + 1], u = f[l + 2], g = f[l + 3];
133
+ if ((x | m | u | g) === 0)
134
134
  continue;
135
- const b = (d << 24 | v << 16 | h << 8 | g) >>> 0;
136
- let R = 1;
137
- if (c) {
138
- const y = m % o, N = Math.floor(m / o), L = y - o / 2, O = N - r / 2, U = Math.sqrt(L * L / (o * o) + O * O / (r * r)) / a;
139
- R = Math.exp(-0.5 * U * U);
135
+ const b = (x << 24 | m << 16 | u << 8 | g) >>> 0;
136
+ let C = 1;
137
+ if (s) {
138
+ const y = v % o, N = Math.floor(v / o), L = y - o / 2, O = N - r / 2, U = Math.sqrt(L * L / (o * o) + O * O / (r * r)) / a;
139
+ C = Math.exp(-0.5 * U * U);
140
140
  }
141
- i.set(b, (i.get(b) || 0) + R);
141
+ i.set(b, (i.get(b) || 0) + C);
142
142
  }
143
- return { requests: Array.from(i.entries()).toSorted((m, s) => s[1] - m[1]).slice(0, t).map(([m]) => ({
144
- x: m >> 22 & 1023,
145
- y: m >> 12 & 1023,
146
- z: m & 4095
143
+ return { requests: Array.from(i.entries()).toSorted((v, l) => l[1] - v[1]).slice(0, t).map(([v]) => ({
144
+ x: v >> 22 & 1023,
145
+ y: v >> 12 & 1023,
146
+ z: v & 4095
147
147
  })), origRequestCount: i.size };
148
148
  }
149
149
  class Ye {
@@ -329,21 +329,21 @@ class Ye {
329
329
  throw new Error("Invalid imageWrapper or not an OME-Zarr image");
330
330
  const i = e.getMultiResolutionStats(), o = Fe(i), r = i.length;
331
331
  this.zarrStore.resolutions = r;
332
- const a = e.getData();
333
- if (!Array.isArray(a) || a.length < 1)
332
+ const s = e.getData(!1);
333
+ if (!Array.isArray(s) || s.length < 1)
334
334
  throw new Error("Not a multiresolution loader");
335
- if (!Oe(a[0].labels, ["t", "c", "z", "y", "x"]))
335
+ if (!Oe(s[0].labels, ["t", "c", "z", "y", "x"]))
336
336
  throw new Error("Expected OME-Zarr data with dimensions [t, c, z, y, x]");
337
- n.debug("vivData", a);
338
- const c = a.map((l) => l._data), u = new Array(r).fill(null);
337
+ n.debug("vivData", s);
338
+ const c = s.map((d) => d._data), h = new Array(r).fill(null);
339
339
  if (c.length > 0) {
340
- const l = c[0];
340
+ const d = c[0];
341
341
  if (this.zarrStore = {
342
342
  resolutions: r,
343
- chunkSize: l.chunks,
343
+ chunkSize: d.chunks,
344
344
  shapes: o,
345
345
  arrays: c,
346
- dtype: l.dtype,
346
+ dtype: d.dtype,
347
347
  physicalSizeTotal: [],
348
348
  // Will be populated if metadata exists
349
349
  physicalSizeVoxel: [],
@@ -353,56 +353,56 @@ class Ye {
353
353
  // store: this.store,
354
354
  // group: this.group,
355
355
  channelCount: o[0][1],
356
- scales: u
357
- }, this.channels.colorMappings = new Array(Math.min(this.zarrStore.channelCount, 7)).fill(-1), this.channels.zarrMappings = new Array(Math.min(this.zarrStore.channelCount, 7)).fill(void 0), this.channels.downsampleMin = new Array(Math.min(this.zarrStore.channelCount, 7)).fill(void 0), this.channels.downsampleMax = new Array(Math.min(this.zarrStore.channelCount, 7)).fill(void 0), l.meta && l.meta.physicalSizes) {
358
- const { x: d, y: v, z: h } = l.meta.physicalSizes, g = h?.size || 1, b = v?.size || 1, R = d?.size || 1;
359
- this.zarrStore.physicalSizeVoxel = [g, b, R], l.shape && l.shape.length >= 5 && (this.zarrStore.physicalSizeTotal = [
360
- (l.shape[2] || 1) * g,
361
- (l.shape[3] || 1) * b,
362
- (l.shape[4] || 1) * R
356
+ scales: h
357
+ }, this.channels.colorMappings = new Array(Math.min(this.zarrStore.channelCount, 7)).fill(-1), this.channels.zarrMappings = new Array(Math.min(this.zarrStore.channelCount, 7)).fill(void 0), this.channels.downsampleMin = new Array(Math.min(this.zarrStore.channelCount, 7)).fill(void 0), this.channels.downsampleMax = new Array(Math.min(this.zarrStore.channelCount, 7)).fill(void 0), d.meta && d.meta.physicalSizes) {
358
+ const { x: m, y: u, z: g } = d.meta.physicalSizes, b = g?.size || 1, C = u?.size || 1, y = m?.size || 1;
359
+ this.zarrStore.physicalSizeVoxel = [b, C, y], d.shape && d.shape.length >= 5 && (this.zarrStore.physicalSizeTotal = [
360
+ (d.shape[2] || 1) * b,
361
+ (d.shape[3] || 1) * C,
362
+ (d.shape[4] || 1) * y
363
363
  ]);
364
364
  } else
365
365
  this.zarrStore.physicalSizeVoxel = [1, 1, 1], this.zarrStore.physicalSizeTotal = [
366
- l.shape[2] || 1,
367
- l.shape[3] || 1,
368
- l.shape[4] || 1
366
+ d.shape[2] || 1,
367
+ d.shape[3] || 1,
368
+ d.shape[4] || 1
369
369
  ];
370
- const { multiscales: p } = this.ngffMetadata;
371
- if (!p)
370
+ const { multiscales: v } = this.ngffMetadata;
371
+ if (!v)
372
372
  throw new Error("Expected multiscales metadata in group.attrs");
373
- if (p?.[0]?.datasets?.[0]?.coordinateTransformations) {
374
- for (let d = 0; d < r; d++)
375
- if (p?.[0]?.datasets?.[d]?.coordinateTransformations?.[0]?.scale) {
376
- const { scale: v } = p[0].datasets[d].coordinateTransformations[0];
377
- u[d] = [v[4], v[3], v[2]];
373
+ if (v?.[0]?.datasets?.[0]?.coordinateTransformations) {
374
+ for (let m = 0; m < r; m++)
375
+ if (v?.[0]?.datasets?.[m]?.coordinateTransformations?.[0]?.scale) {
376
+ const { scale: u } = v[0].datasets[m].coordinateTransformations[0];
377
+ h[m] = [u[4], u[3], u[2]];
378
378
  }
379
379
  } else {
380
380
  n.error("no coordinateTransformations available, assuming downsampling ratio of 2 per dimension");
381
- for (let d = 0; d < r; d++) {
382
- const v = 2 ** d;
383
- u[d] = [v, v, v];
381
+ for (let m = 0; m < r; m++) {
382
+ const u = 2 ** m;
383
+ h[m] = [u, u, u];
384
384
  }
385
385
  }
386
- this.zarrStore.scales = u;
387
- const { coordinateTransformations: m } = this.ngffMetadata;
388
- if (m?.[0]?.scale) {
389
- const { scale: d } = m[0], v = d.length;
390
- if (v >= 3) {
391
- const h = d[v - 3], g = d[v - 2], b = d[v - 1];
392
- this.zarrStore.physicalSizeVoxel = [h, g, b], l.shape && l.shape.length >= 5 && (this.zarrStore.physicalSizeTotal = [
393
- (l.shape[2] || 1) * h,
394
- (l.shape[3] || 1) * g,
395
- (l.shape[4] || 1) * b
386
+ this.zarrStore.scales = h;
387
+ const { coordinateTransformations: l } = this.ngffMetadata;
388
+ if (l?.[0]?.scale) {
389
+ const { scale: m } = l[0], u = m.length;
390
+ if (u >= 3) {
391
+ const g = m[u - 3], b = m[u - 2], C = m[u - 1];
392
+ this.zarrStore.physicalSizeVoxel = [g, b, C], d.shape && d.shape.length >= 5 && (this.zarrStore.physicalSizeTotal = [
393
+ (d.shape[2] || 1) * g,
394
+ (d.shape[3] || 1) * b,
395
+ (d.shape[4] || 1) * C
396
396
  ]);
397
397
  }
398
398
  }
399
399
  this.zarrStore.brickLayout = Ve(e.getMultiResolutionStats()), n.debug("config", t);
400
- const { omero: s } = this.ngffMetadata || {};
401
- if (!s)
400
+ const { omero: x } = this.ngffMetadata || {};
401
+ if (!x)
402
402
  throw new Error("Expected omero metadata in ngffMetadata");
403
- n.debug("omero", s), Object.keys(t).forEach((d, v) => {
404
- const h = t[d].spatialTargetC;
405
- this.channels.zarrMappings[v] = h, this.channels.colorMappings[v] = v, this.channels.downsampleMin[v] = s?.channels?.[h]?.window?.min || 0, this.channels.downsampleMax[v] = s?.channels?.[h]?.window?.max || 65535;
403
+ n.debug("omero", x), Object.keys(t).forEach((m, u) => {
404
+ const g = t[m].spatialTargetC;
405
+ this.channels.zarrMappings[u] = g, this.channels.colorMappings[u] = u, this.channels.downsampleMin[u] = x?.channels?.[g]?.window?.min || 0, this.channels.downsampleMax[u] = x?.channels?.[g]?.window?.max || 65535;
406
406
  }), n.debug("zarrMappings after init", this.channels.zarrMappings), n.debug("colorMappings after init", this.channels.colorMappings), n.debug("downsampleMin after init", this.channels.downsampleMin), n.debug("downsampleMax after init", this.channels.downsampleMax), this.initMRMCPT();
407
407
  }
408
408
  return this.initStatus = V.COMPLETE, k("INIT() COMPLETE"), {
@@ -446,37 +446,37 @@ class Ye {
446
446
  n.debug("channels not initialized yet");
447
447
  return;
448
448
  }
449
- const e = Object.values(t).map((c) => c.spatialTargetC).filter((c) => c !== void 0), i = this.channels.zarrMappings.filter((c) => c !== void 0), o = [...new Set(e)].sort((c, u) => c - u), r = [...new Set(i)].sort((c, u) => c - u);
450
- o.length === r.length && o.every((c, u) => c === r[u]) && n.debug("Channel mappings unchanged, skipping update"), n.debug("Channel mappings changed:", {
449
+ const e = Object.values(t).map((s) => s.spatialTargetC).filter((s) => s !== void 0), i = this.channels.zarrMappings.filter((s) => s !== void 0), o = [...new Set(e)].sort((s, c) => s - c), r = [...new Set(i)].sort((s, c) => s - c);
450
+ o.length === r.length && o.every((s, c) => s === r[c]) && n.debug("Channel mappings unchanged, skipping update"), n.debug("Channel mappings changed:", {
451
451
  current: r,
452
452
  requested: o
453
- }), Object.entries(t).forEach(([c, u]) => {
454
- const l = u.spatialTargetC;
455
- n.debug(`UI channel "${c}" wants zarr channel ${l}`);
456
- const p = this.channels.zarrMappings.indexOf(l);
457
- if (p === -1) {
458
- const m = this.channels.zarrMappings.findIndex((s) => s === void 0);
459
- if (m !== -1)
460
- this.channels.zarrMappings[m] = l, n.debug("channelData", u), n.debug("this.ngffMetadata?.omero?.channels", this.ngffMetadata?.omero?.channels), n.debug("targetZarrChannel", l), this.channels.downsampleMin[m] = this.ngffMetadata?.omero?.channels?.[l]?.window?.min || 0, this.channels.downsampleMax[m] = this.ngffMetadata?.omero?.channels?.[l]?.window?.max || 65535, n.debug(`Mapped zarr channel ${l} to slot ${m}`), n.debug("channels", this.channels);
453
+ }), Object.entries(t).forEach(([s, c]) => {
454
+ const h = c.spatialTargetC;
455
+ n.debug(`UI channel "${s}" wants zarr channel ${h}`);
456
+ const d = this.channels.zarrMappings.indexOf(h);
457
+ if (d === -1) {
458
+ const v = this.channels.zarrMappings.findIndex((l) => l === void 0);
459
+ if (v !== -1)
460
+ this.channels.zarrMappings[v] = h, n.debug("channelData", c), n.debug("this.ngffMetadata?.omero?.channels", this.ngffMetadata?.omero?.channels), n.debug("targetZarrChannel", h), this.channels.downsampleMin[v] = this.ngffMetadata?.omero?.channels?.[h]?.window?.min || 0, this.channels.downsampleMax[v] = this.ngffMetadata?.omero?.channels?.[h]?.window?.max || 65535, n.debug(`Mapped zarr channel ${h} to slot ${v}`), n.debug("channels", this.channels);
461
461
  else {
462
462
  n.debug("No free slots found, looking for unused mapped channels");
463
- const s = this.channels.zarrMappings.filter((h) => h !== void 0), d = e, v = s.filter((h) => !d.includes(h));
464
- if (n.debug("Currently mapped:", s), n.debug("Still requested:", d), n.debug("Unused mapped channels:", v), v.length > 0) {
465
- const h = this.channels.zarrMappings.findIndex((g) => v.includes(g));
466
- if (h !== -1) {
467
- const g = this.channels.zarrMappings[h];
468
- this.channels.zarrMappings[h] = l, this.channels.downsampleMin[h] = this.ngffMetadata?.omero?.channels?.[l]?.window?.min || 0, this.channels.downsampleMax[h] = this.ngffMetadata?.omero?.channels?.[l]?.window?.max || 65535, n.debug(`Reused slot ${h}: ${g} -> ${l}`), this._purgeChannel(h);
463
+ const l = this.channels.zarrMappings.filter((u) => u !== void 0), x = e, m = l.filter((u) => !x.includes(u));
464
+ if (n.debug("Currently mapped:", l), n.debug("Still requested:", x), n.debug("Unused mapped channels:", m), m.length > 0) {
465
+ const u = this.channels.zarrMappings.findIndex((g) => m.includes(g));
466
+ if (u !== -1) {
467
+ const g = this.channels.zarrMappings[u];
468
+ this.channels.zarrMappings[u] = h, this.channels.downsampleMin[u] = this.ngffMetadata?.omero?.channels?.[h]?.window?.min || 0, this.channels.downsampleMax[u] = this.ngffMetadata?.omero?.channels?.[h]?.window?.max || 65535, n.debug(`Reused slot ${u}: ${g} -> ${h}`), this._purgeChannel(u);
469
469
  } else
470
470
  n.error("Could not find slot to reuse - this should not happen");
471
471
  } else
472
472
  n.error("All slots are full and all mapped channels are still in use");
473
473
  }
474
474
  } else
475
- n.debug(`Zarr channel ${l} already mapped to slot ${p}`);
475
+ n.debug(`Zarr channel ${h} already mapped to slot ${d}`);
476
476
  });
477
- const a = Object.values(t).map((c) => {
478
- const u = this.channels.zarrMappings.indexOf(c.spatialTargetC);
479
- return u !== -1 ? u : -1;
477
+ const a = Object.values(t).map((s) => {
478
+ const c = this.channels.zarrMappings.indexOf(s.spatialTargetC);
479
+ return c !== -1 ? c : -1;
480
480
  });
481
481
  for (; a.length < 7; )
482
482
  a.push(-1);
@@ -579,12 +579,12 @@ class Ye {
579
579
  if (!this.zarrStore || !this.zarrStore.arrays[a])
580
580
  throw new Error("Zarr store or resolution not initialized");
581
581
  n.debug("loadZarrChunk", { t, c: e, z: i, y: o, x: r, resolution: a });
582
- const u = await this.zarrStore.arrays[a].getChunk([t, e, i, o, r]);
583
- if (!u)
582
+ const c = await this.zarrStore.arrays[a].getChunk([t, e, i, o, r]);
583
+ if (!c)
584
584
  throw new Error(`No chunk found at coordinates [${t},${e},${i},${o},${r}]`);
585
- if (u.data.length !== w * w * w)
586
- throw new Error(`Unexpected chunk size: ${u.data.length}`);
587
- return u.data;
585
+ if (c.data.length !== w * w * w)
586
+ throw new Error(`Unexpected chunk size: ${c.data.length}`);
587
+ return c.data;
588
588
  }
589
589
  /**
590
590
  * Process the buffer of brick requests from the shader, turning them into
@@ -631,11 +631,11 @@ class Ye {
631
631
  this.isBusy = !0, this.triggerUsage = !1;
632
632
  const e = ++this.timeStamp, i = /* @__PURE__ */ new Set();
633
633
  for (let o = 0; o < t.length; o += 4) {
634
- const r = t[o], a = t[o + 1], c = t[o + 2];
635
- if ((r | a | c) === 0)
634
+ const r = t[o], a = t[o + 1], s = t[o + 2];
635
+ if ((r | a | s) === 0)
636
636
  continue;
637
- const u = c * B * Z + a * B + r;
638
- u < this.BCTimeStamps.length && i.add(u);
637
+ const c = s * B * Z + a * B + r;
638
+ c < this.BCTimeStamps.length && i.add(c);
639
639
  }
640
640
  Array.from(i).forEach((o) => {
641
641
  this.BCTimeStamps[o] = e;
@@ -670,8 +670,8 @@ class Ye {
670
670
  this.PT.anchors[r][0] * e[0]
671
671
  ];
672
672
  n.debug("anchor", a);
673
- const c = this.zarrStore.brickLayout[r], u = c[0] * c[1] * c[2];
674
- n.debug("extents", c), n.debug("size", u), i.texSubImage3D(i.TEXTURE_3D, 0, a[0], a[1], a[2], c[0], c[1], c[2], i.RED_INTEGER, i.UNSIGNED_INT, new Uint32Array(u));
673
+ const s = this.zarrStore.brickLayout[r], c = s[0] * s[1] * s[2];
674
+ n.debug("extents", s), n.debug("size", c), i.texSubImage3D(i.TEXTURE_3D, 0, a[0], a[1], a[2], s[0], s[1], s[2], i.RED_INTEGER, i.UNSIGNED_INT, new Uint32Array(c));
675
675
  }
676
676
  i.bindTexture(i.TEXTURE_3D, null);
677
677
  }
@@ -700,13 +700,13 @@ class Ye {
700
700
  if (!this.BCFull && this.BCUnusedIndex + t > i && (this.BCFull = !0, n.debug("BRICK CACHE FULL")), this.BCFull)
701
701
  this.LRUStack.length < t && this._buildLRU(), e = this.LRUStack.splice(0, t).map((o) => {
702
702
  this._evictBrick(o);
703
- const r = Math.floor(o / (B * Z)), a = o - r * B * Z, c = Math.floor(a / B), u = a % B;
704
- return { bcIndex: o, x: u, y: c, z: r };
703
+ const r = Math.floor(o / (B * Z)), a = o - r * B * Z, s = Math.floor(a / B), c = a % B;
704
+ return { bcIndex: o, x: c, y: s, z: r };
705
705
  });
706
706
  else {
707
707
  for (let o = 0; o < t; ++o) {
708
- const r = (this.BCUnusedIndex + o) % i, a = Math.floor(r / (B * Z)), c = r - a * B * Z, u = Math.floor(c / B), l = c % B;
709
- e.push({ bcIndex: r, x: l, y: u, z: a });
708
+ const r = (this.BCUnusedIndex + o) % i, a = Math.floor(r / (B * Z)), s = r - a * B * Z, c = Math.floor(s / B), h = s % B;
709
+ e.push({ bcIndex: r, x: h, y: c, z: a });
710
710
  }
711
711
  this.BCUnusedIndex += t;
712
712
  }
@@ -724,7 +724,7 @@ class Ye {
724
724
  n.error("this.PT", this.PT), n.error("ptCoord out of bounds", t);
725
725
  return;
726
726
  }
727
- const { channel: i, resolution: o, x: r, y: a, z: c } = Ze(t.x, t.y, t.z, { PT_zExtent: this.PT.zExtent, PT_z0Extent: this.PT.z0Extent, PT_anchors: this.PT.anchors });
727
+ const { channel: i, resolution: o, x: r, y: a, z: s } = Ze(t.x, t.y, t.z, { PT_zExtent: this.PT.zExtent, PT_z0Extent: this.PT.z0Extent, PT_anchors: this.PT.anchors });
728
728
  if (!this.channels || !this.channels.zarrMappings || this.channels.zarrMappings.length === 0) {
729
729
  n.error("Channel mappings not initialized, skipping brick upload");
730
730
  return;
@@ -733,18 +733,18 @@ class Ye {
733
733
  n.error("Channel index out of bounds", { channel: i, mappingsLength: this.channels.zarrMappings.length });
734
734
  return;
735
735
  }
736
- const u = this.channels.zarrMappings[i];
737
- if (u === void 0 || u === -1)
736
+ const c = this.channels.zarrMappings[i];
737
+ if (c === void 0 || c === -1)
738
738
  if (n.warn("zarrChannel is undefined or -1", {
739
- zarrChannel: u,
739
+ zarrChannel: c,
740
740
  channel: i,
741
741
  ptCoord: t,
742
742
  channelMappings: this.channels.zarrMappings,
743
743
  contextLost: this.isContextLost()
744
744
  }), this._lastChannelConfig && this._lastChannelConfig.zarrMappings[i] !== void 0) {
745
745
  n.warn("Attempting to use last known channel config"), this.channels.zarrMappings = [...this._lastChannelConfig.zarrMappings], this.channels.colorMappings = [...this._lastChannelConfig.colorMappings], this.channels.downsampleMin = [...this._lastChannelConfig.downsampleMin], this.channels.downsampleMax = [...this._lastChannelConfig.downsampleMax];
746
- const R = this.channels.zarrMappings[i];
747
- if (R !== void 0 && R !== -1)
746
+ const C = this.channels.zarrMappings[i];
747
+ if (C !== void 0 && C !== -1)
748
748
  n.debug("Successfully restored channel mapping, continuing with upload");
749
749
  else {
750
750
  n.error("Could not restore valid channel mapping, aborting brick upload");
@@ -754,35 +754,35 @@ class Ye {
754
754
  n.error("No fallback channel config available, aborting brick upload");
755
755
  return;
756
756
  }
757
- n.debug("starting to load zarr chunk", { resolution: o, z: c, y: a, x: r, zarrChannel: u });
758
- let l = await this.loadZarrChunk(0, u, c, a, r, o);
759
- if (n.debug("chunk", l), l instanceof Uint16Array) {
757
+ n.debug("starting to load zarr chunk", { resolution: o, z: s, y: a, x: r, zarrChannel: c });
758
+ let h = await this.loadZarrChunk(0, c, s, a, r, o);
759
+ if (n.debug("chunk", h), h instanceof Uint16Array) {
760
760
  if (n.debug("chunk is Uint16Array, converting to Uint8Array"), this.channels.downsampleMin[i] === void 0) {
761
761
  const T = this.channels.zarrMappings[i];
762
762
  n.debug("channelId was not found in this.channels.downsampleMin[channel]", T), this.channels.downsampleMin[i] = this.ngffMetadata?.omero?.channels?.[T]?.window?.min || 0, this.channels.downsampleMax[i] = this.ngffMetadata?.omero?.channels?.[T]?.window?.max || 65535, n.debug("this.channels.downsampleMin[channel]", this.channels.downsampleMin[i]), n.debug("this.channels.downsampleMax[channel]", this.channels.downsampleMax[i]);
763
763
  }
764
- const R = new Uint16Array(l.buffer), y = new Uint8Array(l.length), N = this.channels.downsampleMin[i], L = this.channels.downsampleMax[i], O = L - N;
765
- for (let T = 0; T < R.length; T++) {
766
- const U = R[T], q = Math.max(N, Math.min(L, U));
764
+ const C = new Uint16Array(h.buffer), y = new Uint8Array(h.length), N = this.channels.downsampleMin[i], L = this.channels.downsampleMax[i], O = L - N;
765
+ for (let T = 0; T < C.length; T++) {
766
+ const U = C[T], q = Math.max(N, Math.min(L, U));
767
767
  y[T] = (q - N) * 255 / O | 0;
768
768
  }
769
- l = y;
769
+ h = y;
770
770
  }
771
- if (!(l instanceof Uint8Array))
772
- throw new Error(`Unsupported chunk type: ${l.constructor.name}. Expected Uint8Array.`);
773
- let p = 255, m = 0;
774
- for (let R = 0; R < l.length; ++R) {
775
- const y = l[R];
776
- y < p && (p = y), y > m && (m = y);
771
+ if (!(h instanceof Uint8Array))
772
+ throw new Error(`Unsupported chunk type: ${h.constructor.name}. Expected Uint8Array.`);
773
+ let d = 255, v = 0;
774
+ for (let C = 0; C < h.length; ++C) {
775
+ const y = h[C];
776
+ y < d && (d = y), y > v && (v = y);
777
777
  }
778
- const { gl: s } = this, d = this.renderer.properties.get(this.bcTHREE).__webglTexture;
779
- s.activeTexture(s.TEXTURE2), s.bindTexture(s.TEXTURE_3D, d), s.pixelStorei(s.UNPACK_ALIGNMENT, 1), s.texSubImage3D(s.TEXTURE_3D, 0, e.x * w, e.y * w, e.z * w, w, w, w, s.RED, s.UNSIGNED_BYTE, l), s.pixelStorei(s.UNPACK_ALIGNMENT, 4), s.bindTexture(s.TEXTURE_3D, null);
780
- const v = s.getError();
781
- v !== s.NO_ERROR && n.error("WebGL error during brick upload:", v, l), i >= this.channels.zarrMappings.length && (n.debug("channel is out of bounds", i), p = 255, m = 255);
782
- const h = qe(p, m, e.x, e.y, e.z), g = this.renderer.properties.get(this.ptTHREE).__webglTexture;
783
- s.activeTexture(s.TEXTURE0), s.bindTexture(s.TEXTURE_3D, g), s.texSubImage3D(s.TEXTURE_3D, 0, t.x, t.y, t.z, 1, 1, 1, s.RED_INTEGER, s.UNSIGNED_INT, new Uint32Array([h])), s.bindTexture(s.TEXTURE_3D, null);
784
- const b = s.getError();
785
- b !== s.NO_ERROR && n.error("WebGL error during pagetable upload:", b, l), this.BCTimeStamps[e.bcIndex] = this.timeStamp, this.BCMinMax[e.bcIndex] = [p, m], this.bc2pt[e.bcIndex] = t;
778
+ const { gl: l } = this, x = this.renderer.properties.get(this.bcTHREE).__webglTexture;
779
+ l.activeTexture(l.TEXTURE2), l.bindTexture(l.TEXTURE_3D, x), l.pixelStorei(l.UNPACK_ALIGNMENT, 1), l.texSubImage3D(l.TEXTURE_3D, 0, e.x * w, e.y * w, e.z * w, w, w, w, l.RED, l.UNSIGNED_BYTE, h), l.pixelStorei(l.UNPACK_ALIGNMENT, 4), l.bindTexture(l.TEXTURE_3D, null);
780
+ const m = l.getError();
781
+ m !== l.NO_ERROR && n.error("WebGL error during brick upload:", m, h), i >= this.channels.zarrMappings.length && (n.debug("channel is out of bounds", i), d = 255, v = 255);
782
+ const u = qe(d, v, e.x, e.y, e.z), g = this.renderer.properties.get(this.ptTHREE).__webglTexture;
783
+ l.activeTexture(l.TEXTURE0), l.bindTexture(l.TEXTURE_3D, g), l.texSubImage3D(l.TEXTURE_3D, 0, t.x, t.y, t.z, 1, 1, 1, l.RED_INTEGER, l.UNSIGNED_INT, new Uint32Array([u])), l.bindTexture(l.TEXTURE_3D, null);
784
+ const b = l.getError();
785
+ b !== l.NO_ERROR && n.error("WebGL error during pagetable upload:", b, h), this.BCTimeStamps[e.bcIndex] = this.timeStamp, this.BCMinMax[e.bcIndex] = [d, v], this.bc2pt[e.bcIndex] = t;
786
786
  }
787
787
  /* ------------------------------------------------------------- *
788
788
  * 5. Public: handle a batch of PT requests (array of {x,y,z}) *
@@ -2437,7 +2437,7 @@ void main(void) {
2437
2437
  }
2438
2438
  `, We = {
2439
2439
  uniforms: {
2440
- u_size: { value: new C(1, 1, 1) },
2440
+ u_size: { value: new R(1, 1, 1) },
2441
2441
  clim0: { value: new _(0.2, 0.8) },
2442
2442
  clim1: { value: new _(0.2, 0.8) },
2443
2443
  clim2: { value: new _(0.2, 0.8) },
@@ -2450,7 +2450,7 @@ void main(void) {
2450
2450
  yClip: { value: new _(0, 1e6) },
2451
2451
  zClip: { value: new _(0, 1e6) },
2452
2452
  u_window_size: { value: new _(1, 1) },
2453
- u_vol_scale: { value: new C(1, 1, 1) },
2453
+ u_vol_scale: { value: new R(1, 1, 1) },
2454
2454
  // Set renderstyle to 3 or 4 for debugging modes
2455
2455
  u_renderstyle: { value: 2 },
2456
2456
  brickCacheTex: { type: "sampler3D", value: null },
@@ -2479,29 +2479,29 @@ void main(void) {
2479
2479
  far: { value: 1e4 },
2480
2480
  opacity: { value: 1 },
2481
2481
  volumeCount: { value: 0 },
2482
- boxSize: { value: new C(1, 1, 1) },
2482
+ boxSize: { value: new R(1, 1, 1) },
2483
2483
  renderRes: { value: 1e3 },
2484
- voxelExtents: { value: new C(1, 1, 1) },
2485
- anchor0: { value: new C(0, 0, 0) },
2486
- anchor1: { value: new C(0, 0, 0) },
2487
- anchor2: { value: new C(0, 0, 0) },
2488
- anchor3: { value: new C(0, 0, 0) },
2489
- anchor4: { value: new C(0, 0, 0) },
2490
- anchor5: { value: new C(0, 0, 0) },
2491
- anchor6: { value: new C(0, 0, 0) },
2492
- anchor7: { value: new C(0, 0, 0) },
2493
- anchor8: { value: new C(0, 0, 0) },
2494
- anchor9: { value: new C(0, 0, 0) },
2495
- scale0: { value: new C(1, 1, 1) },
2496
- scale1: { value: new C(2, 2, 2) },
2497
- scale2: { value: new C(4, 4, 4) },
2498
- scale3: { value: new C(8, 8, 8) },
2499
- scale4: { value: new C(16, 16, 16) },
2500
- scale5: { value: new C(32, 32, 32) },
2501
- scale6: { value: new C(64, 64, 64) },
2502
- scale7: { value: new C(128, 128, 128) },
2503
- scale8: { value: new C(256, 256, 256) },
2504
- scale9: { value: new C(512, 512, 512) }
2484
+ voxelExtents: { value: new R(1, 1, 1) },
2485
+ anchor0: { value: new R(0, 0, 0) },
2486
+ anchor1: { value: new R(0, 0, 0) },
2487
+ anchor2: { value: new R(0, 0, 0) },
2488
+ anchor3: { value: new R(0, 0, 0) },
2489
+ anchor4: { value: new R(0, 0, 0) },
2490
+ anchor5: { value: new R(0, 0, 0) },
2491
+ anchor6: { value: new R(0, 0, 0) },
2492
+ anchor7: { value: new R(0, 0, 0) },
2493
+ anchor8: { value: new R(0, 0, 0) },
2494
+ anchor9: { value: new R(0, 0, 0) },
2495
+ scale0: { value: new R(1, 1, 1) },
2496
+ scale1: { value: new R(2, 2, 2) },
2497
+ scale2: { value: new R(4, 4, 4) },
2498
+ scale3: { value: new R(8, 8, 8) },
2499
+ scale4: { value: new R(16, 16, 16) },
2500
+ scale5: { value: new R(32, 32, 32) },
2501
+ scale6: { value: new R(64, 64, 64) },
2502
+ scale7: { value: new R(128, 128, 128) },
2503
+ scale8: { value: new R(256, 256, 256) },
2504
+ scale9: { value: new R(512, 512, 512) }
2505
2505
  },
2506
2506
  vertexShader: He,
2507
2507
  fragmentShader: Ke
@@ -2528,57 +2528,57 @@ class $e {
2528
2528
  * @returns {Object} Extracted rendering settings
2529
2529
  */
2530
2530
  extractRenderingSettingsFromProps(t) {
2531
- const { images: e = {}, imageLayerScopes: i = [], imageLayerCoordination: o = [{}], imageChannelScopesByLayer: r = {}, imageChannelCoordination: a = [{}], spatialRenderingMode: c } = t, u = i[0];
2532
- if (!u)
2531
+ const { images: e = {}, imageLayerScopes: i = [], imageLayerCoordination: o = [{}], imageChannelScopesByLayer: r = {}, imageChannelCoordination: a = [{}], spatialRenderingMode: s } = t, c = i[0];
2532
+ if (!c)
2533
2533
  return A("Extracting rendering settings from props - no layer scope"), {
2534
2534
  valid: !1
2535
2535
  };
2536
- const l = r[u], p = o[0][u], m = a[0][u], s = e[u]?.image?.instance?.getData();
2537
- if (!s)
2536
+ const h = r[c], d = o[0][c], v = a[0][c], l = e[c]?.image?.instance?.getData();
2537
+ if (!l)
2538
2538
  return A("Extracting rendering settings from props - no image data"), {
2539
2539
  valid: !1
2540
2540
  };
2541
- if (!m[l?.[0]][P.SPATIAL_CHANNEL_WINDOW])
2541
+ if (!v[h?.[0]][P.SPATIAL_CHANNEL_WINDOW])
2542
2542
  return A("Extracting rendering settings from props - no channel window set"), {
2543
2543
  valid: !1
2544
2544
  };
2545
- const d = e[u].image.instance, v = c === "3D", h = p[P.PHOTOMETRIC_INTERPRETATION] === "RGB", g = p[P.SPATIAL_LAYER_VISIBLE], b = p[P.SPATIAL_LAYER_OPACITY], R = h ? [
2545
+ const x = e[c].image.instance, m = s === "3D", u = d[P.PHOTOMETRIC_INTERPRETATION] === "RGB", g = d[P.SPATIAL_LAYER_VISIBLE], b = d[P.SPATIAL_LAYER_OPACITY], C = u ? [
2546
2546
  [255, 0, 0],
2547
2547
  [0, 255, 0],
2548
2548
  [0, 0, 255]
2549
- ] : l.map((S) => m[S][P.SPATIAL_CHANNEL_COLOR]), y = h ? [
2549
+ ] : h.map((S) => v[S][P.SPATIAL_CHANNEL_COLOR]), y = u ? [
2550
2550
  [0, 255],
2551
2551
  [0, 255],
2552
2552
  [0, 255]
2553
- ] : l.map((S) => m[S][P.SPATIAL_CHANNEL_WINDOW] || [0, 255]);
2553
+ ] : h.map((S) => v[S][P.SPATIAL_CHANNEL_WINDOW] || [0, 255]);
2554
2554
  this.maxRangeSet || (this.maxRange = Math.max(...y.map((S) => S[1])), this.maxRangeSet = !0);
2555
- const N = h ? [
2555
+ const N = u ? [
2556
2556
  g && !0,
2557
2557
  g && !0,
2558
2558
  g && !0
2559
- ] : l.map((S) => g && m[S][P.SPATIAL_CHANNEL_VISIBLE]), L = h ? [
2559
+ ] : h.map((S) => g && v[S][P.SPATIAL_CHANNEL_VISIBLE]), L = u ? [
2560
2560
  g && !0,
2561
2561
  g && !0,
2562
2562
  g && !0
2563
- ] : l.map((S) => g && d.getChannelIndex(m[S][P.SPATIAL_TARGET_C])), O = h ? [
2563
+ ] : h.map((S) => g && x.getChannelIndex(v[S][P.SPATIAL_TARGET_C])), O = u ? [
2564
2564
  g && null,
2565
2565
  g && null,
2566
2566
  g && null
2567
- ] : l.map((S) => m[S][P.SPATIAL_MAX_RESOLUTION]);
2568
- let T = p[P.SPATIAL_SLICE_X], U = p[P.SPATIAL_SLICE_Y], q = p[P.SPATIAL_SLICE_Z];
2569
- const Y = p[P.SPATIAL_LOD_FACTOR] ?? 1;
2567
+ ] : h.map((S) => v[S][P.SPATIAL_MAX_RESOLUTION]);
2568
+ let T = d[P.SPATIAL_SLICE_X], U = d[P.SPATIAL_SLICE_Y], q = d[P.SPATIAL_SLICE_Z];
2569
+ const Y = d[P.SPATIAL_LOD_FACTOR] ?? 1;
2570
2570
  T = T !== null ? T : new _(-1, 1e5), U = U !== null ? U : new _(-1, 1e5), q = q !== null ? q : new _(-1, 1e5);
2571
- const X = e[u].image.loaders[0].channels;
2571
+ const X = e[c].image.loaders[0].channels;
2572
2572
  return A("Extracting rendering settings from props - success"), {
2573
2573
  valid: !0,
2574
2574
  channelsVisible: N,
2575
2575
  allChannels: X,
2576
2576
  channelTargetC: L,
2577
2577
  channelMaxResolutionIndex: O,
2578
- data: s,
2579
- colors: R,
2578
+ data: l,
2579
+ colors: C,
2580
2580
  contrastLimits: y,
2581
- is3dMode: v,
2581
+ is3dMode: m,
2582
2582
  layerTransparency: b,
2583
2583
  xSlice: T,
2584
2584
  ySlice: U,
@@ -2600,53 +2600,53 @@ class $e {
2600
2600
  * @param {object} volumeDataManagerProps - Params derived from the volume data manager
2601
2601
  * @returns {Object|null} Updated rendering settings or null if rendering is not possible
2602
2602
  */
2603
- updateRendering({ zarrStoreShapes: t, originalScaleXYZ: e, physicalDimensionsXYZ: i, maxResolutionXYZ: o, boxDimensionsXYZ: r, normalizedScaleXYZ: a, bcTHREE: c, ptTHREE: u }) {
2604
- if (A("Updating rendering"), this.channelTargetC.findIndex((v, h) => this.channelsVisible[h]), !Array.isArray(t) || t.length === 0)
2603
+ updateRendering({ zarrStoreShapes: t, originalScaleXYZ: e, physicalDimensionsXYZ: i, maxResolutionXYZ: o, boxDimensionsXYZ: r, normalizedScaleXYZ: a, bcTHREE: s, ptTHREE: c }) {
2604
+ if (A("Updating rendering"), this.channelTargetC.findIndex((m, u) => this.channelsVisible[u]), !Array.isArray(t) || t.length === 0)
2605
2605
  return null;
2606
- const l = t[0], p = {
2607
- xLength: l[4] || 1,
2608
- yLength: l[3] || 1,
2609
- zLength: l[2] || 1
2610
- }, m = [], s = [], d = [];
2611
- if (this.channelTargetC.forEach((v, h) => {
2612
- this.channelsVisible[h];
2606
+ const h = t[0], d = {
2607
+ xLength: h[4] || 1,
2608
+ yLength: h[3] || 1,
2609
+ zLength: h[2] || 1
2610
+ }, v = [], l = [], x = [];
2611
+ if (this.channelTargetC.forEach((m, u) => {
2612
+ this.channelsVisible[u];
2613
2613
  {
2614
2614
  const b = [0, this.maxRange ? this.maxRange : 255];
2615
- s.push([
2616
- this.colors[h][0] / 255,
2617
- this.colors[h][1] / 255,
2618
- this.colors[h][2] / 255,
2619
- this.channelsVisible[h] ? 1 : 0
2620
- ]), n.debug("colorsSave", s), this.contrastLimits[h][0] === 0 && this.contrastLimits[h][1] === 255 ? d.push([
2615
+ l.push([
2616
+ this.colors[u][0] / 255,
2617
+ this.colors[u][1] / 255,
2618
+ this.colors[u][2] / 255,
2619
+ this.channelsVisible[u] ? 1 : 0
2620
+ ]), n.debug("colorsSave", l), this.contrastLimits[u][0] === 0 && this.contrastLimits[u][1] === 255 ? x.push([
2621
2621
  oe(b[0], b),
2622
2622
  oe(b[1], b)
2623
- ]) : d.push([
2624
- oe(this.contrastLimits[h][0], b),
2625
- oe(this.contrastLimits[h][1], b)
2623
+ ]) : x.push([
2624
+ oe(this.contrastLimits[u][0], b),
2625
+ oe(this.contrastLimits[u][1], b)
2626
2626
  ]);
2627
2627
  }
2628
2628
  }), !this.zarrInit) {
2629
2629
  this.originalScale = e, this.physicalDimensions = i, this.maxResolution = o;
2630
- const v = r;
2630
+ const m = r;
2631
2631
  this.normalizedScale = a, this.meshScale = [
2632
2632
  this.originalScale[0] / this.originalScale[0],
2633
2633
  this.originalScale[1] / this.originalScale[0],
2634
2634
  this.originalScale[2] / this.originalScale[0]
2635
- ], this.geometrySize = v, this.boxSize = v, n.debug("this.boxSize", this.boxSize), n.debug("this.geometrySize", this.geometrySize), n.debug("this.meshScale", this.meshScale), n.debug("this.originalScale", this.originalScale), n.debug("this.physicalDimensions", this.physicalDimensions), n.debug("this.maxResolution", this.maxResolution), n.debug("scaledResolution", v), this.zarrInit = !0;
2635
+ ], this.geometrySize = m, this.boxSize = m, n.debug("this.boxSize", this.boxSize), n.debug("this.geometrySize", this.geometrySize), n.debug("this.meshScale", this.meshScale), n.debug("this.originalScale", this.originalScale), n.debug("this.physicalDimensions", this.physicalDimensions), n.debug("this.maxResolution", this.maxResolution), n.debug("scaledResolution", m), this.zarrInit = !0;
2636
2636
  }
2637
2637
  return this.updateUniforms(
2638
- m,
2639
- p,
2638
+ v,
2639
+ d,
2640
2640
  // Pass dimensions object instead of volume
2641
2641
  this.renderingMode,
2642
- d,
2643
- s,
2642
+ x,
2643
+ l,
2644
2644
  this.layerTransparency,
2645
2645
  this.xSlice,
2646
2646
  this.ySlice,
2647
2647
  this.zSlice,
2648
- c,
2649
- u
2648
+ s,
2649
+ c
2650
2650
  ), {
2651
2651
  uniforms: this.uniforms,
2652
2652
  shader: this.shader,
@@ -2667,10 +2667,10 @@ class $e {
2667
2667
  * @param {Vector2} ySlice - Y clipping plane
2668
2668
  * @param {Vector2} zSlice - Z clipping plane
2669
2669
  */
2670
- updateUniforms(t, e, i, o, r, a, c, u, l, p, m) {
2671
- A("Updating uniforms"), this.uniforms.boxSize.value.set(this.boxSize[0], this.boxSize[1], this.boxSize[2]), this.uniforms.brickCacheTex.value = p, this.uniforms.pageTableTex.value = m, this.uniforms.near.value = 0.1, this.uniforms.far.value = 3e3, this.uniforms.opacity.value = a, this.uniforms.volumeCount.value = t.length, this.uniforms.u_size.value.set(e.xLength, e.yLength, e.zLength), this.uniforms.u_window_size.value.set(0, 0), this.uniforms.u_vol_scale.value.set(1 / e.xLength, 1 / e.yLength, 1 / e.zLength * 2), this.uniforms.clim0.value.set(o.length > 0 ? o[0][0] : null, o.length > 0 ? o[0][1] : null), this.uniforms.clim1.value.set(o.length > 1 ? o[1][0] : null, o.length > 1 ? o[1][1] : null), this.uniforms.clim2.value.set(o.length > 2 ? o[2][0] : null, o.length > 2 ? o[2][1] : null), this.uniforms.clim3.value.set(o.length > 3 ? o[3][0] : null, o.length > 3 ? o[3][1] : null), this.uniforms.clim4.value.set(o.length > 4 ? o[4][0] : null, o.length > 4 ? o[4][1] : null), this.uniforms.clim5.value.set(o.length > 5 ? o[5][0] : null, o.length > 5 ? o[5][1] : null), this.uniforms.clim6.value.set(o.length > 6 ? o[6][0] : null, o.length > 6 ? o[6][1] : null), this.uniforms.xClip.value.set(c[0] * (1 / this.maxResolution[0]) * this.boxSize[0], c[1] * (1 / this.maxResolution[0]) * this.boxSize[0]), this.uniforms.yClip.value.set(u[0] * (1 / this.maxResolution[1]) * this.boxSize[1], u[1] * (1 / this.maxResolution[1]) * this.boxSize[1]), this.uniforms.zClip.value.set(l[0] * (1 / this.maxResolution[2]) * this.boxSize[2], l[1] * (1 / this.maxResolution[2]) * this.boxSize[2]), this.uniforms.color0.value.set(r.length > 0 ? r[0][0] : null, r.length > 0 ? r[0][1] : null, r.length > 0 ? r[0][2] : null, r.length > 0 ? r[0][3] : null), this.uniforms.color1.value.set(r.length > 1 ? r[1][0] : null, r.length > 1 ? r[1][1] : null, r.length > 1 ? r[1][2] : null, r.length > 1 ? r[1][3] : null), this.uniforms.color2.value.set(r.length > 2 ? r[2][0] : null, r.length > 2 ? r[2][1] : null, r.length > 2 ? r[2][2] : null, r.length > 2 ? r[2][3] : null), this.uniforms.color3.value.set(r.length > 3 ? r[3][0] : null, r.length > 3 ? r[3][1] : null, r.length > 3 ? r[3][2] : null, r.length > 3 ? r[3][3] : null), this.uniforms.color4.value.set(r.length > 4 ? r[4][0] : null, r.length > 4 ? r[4][1] : null, r.length > 4 ? r[4][2] : null, r.length > 4 ? r[4][3] : null), this.uniforms.color5.value.set(r.length > 5 ? r[5][0] : null, r.length > 5 ? r[5][1] : null, r.length > 5 ? r[5][2] : null, r.length > 5 ? r[5][3] : null), this.uniforms.color6.value.set(r.length > 6 ? r[6][0] : null, r.length > 6 ? r[6][1] : null, r.length > 6 ? r[6][2] : null, r.length > 6 ? r[6][3] : null);
2672
- for (let s = 0; s < 7; s++)
2673
- typeof this.channelMaxResolutionIndex[s] == "number" && this.uniforms[`res${s}`].value.set(Math.max(1, this.channelMaxResolutionIndex[s]), this.zarrStoreNumResolutions - 1);
2670
+ updateUniforms(t, e, i, o, r, a, s, c, h, d, v) {
2671
+ A("Updating uniforms"), this.uniforms.boxSize.value.set(this.boxSize[0], this.boxSize[1], this.boxSize[2]), this.uniforms.brickCacheTex.value = d, this.uniforms.pageTableTex.value = v, this.uniforms.near.value = 0.1, this.uniforms.far.value = 3e3, this.uniforms.opacity.value = a, this.uniforms.volumeCount.value = t.length, this.uniforms.u_size.value.set(e.xLength, e.yLength, e.zLength), this.uniforms.u_window_size.value.set(0, 0), this.uniforms.u_vol_scale.value.set(1 / e.xLength, 1 / e.yLength, 1 / e.zLength * 2), this.uniforms.clim0.value.set(o.length > 0 ? o[0][0] : null, o.length > 0 ? o[0][1] : null), this.uniforms.clim1.value.set(o.length > 1 ? o[1][0] : null, o.length > 1 ? o[1][1] : null), this.uniforms.clim2.value.set(o.length > 2 ? o[2][0] : null, o.length > 2 ? o[2][1] : null), this.uniforms.clim3.value.set(o.length > 3 ? o[3][0] : null, o.length > 3 ? o[3][1] : null), this.uniforms.clim4.value.set(o.length > 4 ? o[4][0] : null, o.length > 4 ? o[4][1] : null), this.uniforms.clim5.value.set(o.length > 5 ? o[5][0] : null, o.length > 5 ? o[5][1] : null), this.uniforms.clim6.value.set(o.length > 6 ? o[6][0] : null, o.length > 6 ? o[6][1] : null), this.uniforms.xClip.value.set(s[0] * (1 / this.maxResolution[0]) * this.boxSize[0], s[1] * (1 / this.maxResolution[0]) * this.boxSize[0]), this.uniforms.yClip.value.set(c[0] * (1 / this.maxResolution[1]) * this.boxSize[1], c[1] * (1 / this.maxResolution[1]) * this.boxSize[1]), this.uniforms.zClip.value.set(h[0] * (1 / this.maxResolution[2]) * this.boxSize[2], h[1] * (1 / this.maxResolution[2]) * this.boxSize[2]), this.uniforms.color0.value.set(r.length > 0 ? r[0][0] : null, r.length > 0 ? r[0][1] : null, r.length > 0 ? r[0][2] : null, r.length > 0 ? r[0][3] : null), this.uniforms.color1.value.set(r.length > 1 ? r[1][0] : null, r.length > 1 ? r[1][1] : null, r.length > 1 ? r[1][2] : null, r.length > 1 ? r[1][3] : null), this.uniforms.color2.value.set(r.length > 2 ? r[2][0] : null, r.length > 2 ? r[2][1] : null, r.length > 2 ? r[2][2] : null, r.length > 2 ? r[2][3] : null), this.uniforms.color3.value.set(r.length > 3 ? r[3][0] : null, r.length > 3 ? r[3][1] : null, r.length > 3 ? r[3][2] : null, r.length > 3 ? r[3][3] : null), this.uniforms.color4.value.set(r.length > 4 ? r[4][0] : null, r.length > 4 ? r[4][1] : null, r.length > 4 ? r[4][2] : null, r.length > 4 ? r[4][3] : null), this.uniforms.color5.value.set(r.length > 5 ? r[5][0] : null, r.length > 5 ? r[5][1] : null, r.length > 5 ? r[5][2] : null, r.length > 5 ? r[5][3] : null), this.uniforms.color6.value.set(r.length > 6 ? r[6][0] : null, r.length > 6 ? r[6][1] : null, r.length > 6 ? r[6][2] : null, r.length > 6 ? r[6][3] : null);
2672
+ for (let l = 0; l < 7; l++)
2673
+ typeof this.channelMaxResolutionIndex[l] == "number" && this.uniforms[`res${l}`].value.set(Math.max(1, this.channelMaxResolutionIndex[l]), this.zarrStoreNumResolutions - 1);
2674
2674
  }
2675
2675
  /**
2676
2676
  * Sets the processing render target
@@ -2907,8 +2907,8 @@ function tt(f, { screenSceneRef: t, screenCameraRef: e }) {
2907
2907
  f.setRenderTarget(null), f.clear(!0, !0, !0), f.render(t.current, e.current);
2908
2908
  }
2909
2909
  function nt(f, { frameRef: t, dataManager: e, mrtRef: i, bufRequest: o, bufUsage: r }) {
2910
- const a = f.getContext(), c = t.current;
2911
- e.noNewRequests === !0 && !e.manuallyStopped && c % 100 === 0 && c < 500 && (e.noNewRequests = !1), e.triggerRequest === !0 && e.noNewRequests === !1 ? (a.bindFramebuffer(a.READ_FRAMEBUFFER, Re(f, i.current)), a.readBuffer(a.COLOR_ATTACHMENT1), a.readPixels(0, 0, i.current.width, i.current.height, a.RGBA, a.UNSIGNED_BYTE, o.current), e.processRequestData(o.current, {
2910
+ const a = f.getContext(), s = t.current;
2911
+ e.noNewRequests === !0 && !e.manuallyStopped && s % 100 === 0 && s < 500 && (e.noNewRequests = !1), e.triggerRequest === !0 && e.noNewRequests === !1 ? (a.bindFramebuffer(a.READ_FRAMEBUFFER, Re(f, i.current)), a.readBuffer(a.COLOR_ATTACHMENT1), a.readPixels(0, 0, i.current.width, i.current.height, a.RGBA, a.UNSIGNED_BYTE, o.current), e.processRequestData(o.current, {
2912
2912
  // If width/height are not yet available,
2913
2913
  // processRequestData will proceed without weighting.
2914
2914
  width: i?.current?.width,
@@ -2918,29 +2918,29 @@ function nt(f, { frameRef: t, dataManager: e, mrtRef: i, bufRequest: o, bufUsage
2918
2918
  })) : e.triggerUsage === !0 && e.noNewRequests === !1 && (a.bindFramebuffer(a.READ_FRAMEBUFFER, Re(f, i.current)), a.readBuffer(a.COLOR_ATTACHMENT2), a.readPixels(0, 0, i.current.width, i.current.height, a.RGBA, a.UNSIGNED_BYTE, r.current), e.processUsageData(r.current));
2919
2919
  }
2920
2920
  function rt(f, t) {
2921
- const { invalidate: e, isInteracting: i, dataManager: o, spatialRenderingModeChanging: r, meshRef: a, stillRef: c, screenQuadRef: u, lastSampleRef: l, frameRef: p, lastFrameCountRef: m } = t;
2922
- if (u.current && (c.current ? u.current.material.uniforms.gaussian.value = 0 : u.current.material.uniforms.gaussian.value = 7), i) {
2921
+ const { invalidate: e, isInteracting: i, dataManager: o, spatialRenderingModeChanging: r, meshRef: a, stillRef: s, screenQuadRef: c, lastSampleRef: h, frameRef: d, lastFrameCountRef: v } = t;
2922
+ if (c.current && (s.current ? c.current.material.uniforms.gaussian.value = 0 : c.current.material.uniforms.gaussian.value = 7), i) {
2923
2923
  o.manuallyStopped || (o.noNewRequests = !1, o.triggerUsage = !0);
2924
2924
  return;
2925
2925
  }
2926
2926
  if (r)
2927
2927
  return;
2928
- const s = a.current?.material?.uniforms, d = s?.renderRes?.value ?? o?.PT?.lowestDataRes;
2928
+ const l = a.current?.material?.uniforms, x = l?.renderRes?.value ?? o?.PT?.lowestDataRes;
2929
2929
  if (o.noNewRequests) {
2930
- d !== 0 ? (s && (s.renderRes.value = 0), n.debug("Adaptive Quality: No new requests. Setting renderSpeed to 0 (best quality)."), c.current = !1, u.current.material.uniforms.gaussian.value = 7, e()) : c.current || (n.debug("Adaptive Quality: No new requests and already at best quality. Setting stillRef to true."), c.current = !0, u.current.material.uniforms.gaussian.value = 0);
2930
+ x !== 0 ? (l && (l.renderRes.value = 0), n.debug("Adaptive Quality: No new requests. Setting renderSpeed to 0 (best quality)."), s.current = !1, c.current.material.uniforms.gaussian.value = 7, e()) : s.current || (n.debug("Adaptive Quality: No new requests and already at best quality. Setting stillRef to true."), s.current = !0, c.current.material.uniforms.gaussian.value = 0);
2931
2931
  return;
2932
2932
  }
2933
- c.current && (c.current = !1, e());
2934
- const v = f.getElapsedTime();
2935
- if (v - l.current < 1)
2933
+ s.current && (s.current = !1, e());
2934
+ const m = f.getElapsedTime();
2935
+ if (m - h.current < 1)
2936
2936
  return;
2937
- const h = v - l.current, g = p.current - m.current;
2937
+ const u = m - h.current, g = d.current - v.current;
2938
2938
  let b = 0;
2939
- h > 0 && (b = g / h), l.current = v, m.current = p.current;
2940
- const R = b > 100 && d > 0, y = b < 30 && d < o.PT.lowestDataRes;
2941
- if (R || y) {
2942
- const N = d + (y ? 1 : -1);
2943
- s && (s.renderRes.value = N), e();
2939
+ u > 0 && (b = g / u), h.current = m, v.current = d.current;
2940
+ const C = b > 100 && x > 0, y = b < 30 && x < o.PT.lowestDataRes;
2941
+ if (C || y) {
2942
+ const N = x + (y ? 1 : -1);
2943
+ l && (l.renderRes.value = N), e();
2944
2944
  }
2945
2945
  }
2946
2946
  function it(f) {
@@ -2952,21 +2952,21 @@ function it(f) {
2952
2952
  imageChannelCoordination: r,
2953
2953
  // onInitComplete,
2954
2954
  spatialRenderingMode: a,
2955
- spatialRenderingModeChanging: c,
2956
- onVolumeLoadingUpdate: u
2955
+ spatialRenderingModeChanging: s,
2956
+ onVolumeLoadingUpdate: c
2957
2957
  } = f, {
2958
- gl: l
2958
+ gl: h
2959
2959
  // scene,
2960
2960
  // camera
2961
- } = ve(), p = ve((E) => E.invalidate), m = D(null), s = D(null), d = D(null), v = D(null), h = D(null), [g, b] = le({
2961
+ } = ve(), d = ve((E) => E.invalidate), v = D(null), l = D(null), x = D(null), m = D(null), u = D(null), [g, b] = le({
2962
2962
  uniforms: null,
2963
2963
  shader: null,
2964
2964
  meshScale: [1, 1, 1],
2965
2965
  geometrySize: [1, 1, 1]
2966
- }), R = a === "3D", [y, N] = le(!1), L = D(null), O = D(null), T = D(null), [U, q] = le(!1), Y = D(null), X = D(!1), S = D(0), ye = D(0), Ee = D(0), x = de(() => new Ye(l), [l]), z = de(() => new $e(), []);
2966
+ }), C = a === "3D", [y, N] = le(!1), L = D(null), O = D(null), T = D(null), [U, q] = le(!1), Y = D(null), X = D(!1), S = D(0), ye = D(0), Ee = D(0), p = de(() => new Ye(h), [h]), z = de(() => new $e(), []);
2967
2967
  Q(() => {
2968
2968
  J("useEffect MRT target matching canvas");
2969
- const { width: E, height: I } = l.domElement, H = new M.WebGLRenderTarget(E, I, { count: 3 }), F = H.textures;
2969
+ const { width: E, height: I } = h.domElement, H = new M.WebGLRenderTarget(E, I, { count: 3 }), F = H.textures;
2970
2970
  F.forEach(($) => {
2971
2971
  $.format = M.RGBAFormat, $.type = M.UnsignedByteType, $.minFilter = M.NearestFilter, $.magFilter = M.NearestFilter, $.generateMipmaps = !1;
2972
2972
  });
@@ -2983,17 +2983,17 @@ function it(f) {
2983
2983
  fragmentShader: Je,
2984
2984
  transparent: !0
2985
2985
  }), se = new M.Mesh(new M.PlaneGeometry(2, 2), re);
2986
- return te.add(se), L.current = te, O.current = ne, T.current = se, d.current = new Uint8Array(E * I * 4), v.current = new Uint8Array(E * I * 4), h.current = H, () => {
2986
+ return te.add(se), L.current = te, O.current = ne, T.current = se, x.current = new Uint8Array(E * I * 4), m.current = new Uint8Array(E * I * 4), u.current = H, () => {
2987
2987
  H.dispose(), re.dispose(), se.geometry.dispose();
2988
2988
  };
2989
- }, [l]);
2989
+ }, [h]);
2990
2990
  const ae = e?.[0], Te = t?.[ae];
2991
2991
  o?.[ae];
2992
2992
  const ee = r?.[0]?.[ae];
2993
2993
  Q(() => {
2994
2994
  J("useEffect INIT");
2995
2995
  let E = !1;
2996
- if (!x || !z) {
2996
+ if (!p || !z) {
2997
2997
  n.debug("dataManager or renderManager not initialized yet");
2998
2998
  return;
2999
2999
  }
@@ -3006,20 +3006,20 @@ function it(f) {
3006
3006
  return;
3007
3007
  }
3008
3008
  return (async () => {
3009
- if (x.initStatus === V.COMPLETE) {
3009
+ if (p.initStatus === V.COMPLETE) {
3010
3010
  n.debug("dataManager already initialized, skipping"), N(!0);
3011
3011
  return;
3012
3012
  }
3013
- if (x.initImages(t, e), await x.init(ee), E) {
3013
+ if (p.initImages(t, e), await p.init(ee), E) {
3014
3014
  n.debug("Initialization useEffect has rerun, aborting remaining initialization");
3015
3015
  return;
3016
3016
  }
3017
- n.debug("dataManager initialized"), z.setZarrUniforms(x.zarrStore, x.PT), z.setChannelMapping(x.channels.colorMappings), n.debug("rm.uniforms", z.uniforms), N(!0), p();
3017
+ n.debug("dataManager initialized"), z.setZarrUniforms(p.zarrStore, p.PT), z.setChannelMapping(p.channels.colorMappings), n.debug("rm.uniforms", z.uniforms), N(!0), d();
3018
3018
  })(), () => {
3019
3019
  E = !0;
3020
3020
  };
3021
- }, [x, z, t, e]), Q(() => {
3022
- if (a === "3D" && x && z && y) {
3021
+ }, [p, z, t, e]), Q(() => {
3022
+ if (a === "3D" && p && z && y) {
3023
3023
  J("useEffect spatialRenderingMode");
3024
3024
  const I = {
3025
3025
  images: t,
@@ -3031,30 +3031,30 @@ function it(f) {
3031
3031
  };
3032
3032
  if (z.updateFromProps(I)) {
3033
3033
  const { zarrInit: H } = z;
3034
- H || (x.ptTHREE.needsUpdate = !1, x.bcTHREE.needsUpdate = !1, x.renderer.initTexture(x.bcTHREE), x.renderer.initTexture(x.ptTHREE), x.initTexture());
3034
+ H || (p.ptTHREE.needsUpdate = !1, p.bcTHREE.needsUpdate = !1, p.renderer.initTexture(p.bcTHREE), p.renderer.initTexture(p.ptTHREE), p.initTexture());
3035
3035
  const F = z.updateRendering({
3036
- zarrStoreShapes: x.zarrStore.shapes,
3037
- originalScaleXYZ: x.getOriginalScaleXYZ(),
3038
- physicalDimensionsXYZ: x.getPhysicalDimensionsXYZ(),
3039
- maxResolutionXYZ: x.getMaxResolutionXYZ(),
3040
- boxDimensionsXYZ: x.getBoxDimensionsXYZ(),
3041
- normalizedScaleXYZ: x.getNormalizedScaleXYZ(),
3042
- bcTHREE: x.bcTHREE,
3043
- ptTHREE: x.ptTHREE
3036
+ zarrStoreShapes: p.zarrStore.shapes,
3037
+ originalScaleXYZ: p.getOriginalScaleXYZ(),
3038
+ physicalDimensionsXYZ: p.getPhysicalDimensionsXYZ(),
3039
+ maxResolutionXYZ: p.getMaxResolutionXYZ(),
3040
+ boxDimensionsXYZ: p.getBoxDimensionsXYZ(),
3041
+ normalizedScaleXYZ: p.getNormalizedScaleXYZ(),
3042
+ bcTHREE: p.bcTHREE,
3043
+ ptTHREE: p.ptTHREE
3044
3044
  });
3045
3045
  F && b(F);
3046
3046
  }
3047
3047
  }
3048
- }, [x, z, t, e, i, o, r, a, y]), Me((E, I, H) => {
3049
- if (!h.current || !x || !z || !g.shader)
3048
+ }, [p, z, t, e, i, o, r, a, y]), Me((E, I, H) => {
3049
+ if (!u.current || !p || !z || !g.shader)
3050
3050
  return;
3051
3051
  const { gl: F, camera: te, scene: ne, clock: re } = E;
3052
- X.current || et(F, te, ne, { mrtRef: h }), tt(F, { screenSceneRef: L, screenCameraRef: O }), nt(F, { frameRef: S, dataManager: x, mrtRef: h, bufRequest: d, bufUsage: v }), rt(re, {
3053
- invalidate: p,
3052
+ X.current || et(F, te, ne, { mrtRef: u }), tt(F, { screenSceneRef: L, screenCameraRef: O }), nt(F, { frameRef: S, dataManager: p, mrtRef: u, bufRequest: x, bufUsage: m }), rt(re, {
3053
+ invalidate: d,
3054
3054
  isInteracting: U,
3055
- dataManager: x,
3056
- spatialRenderingModeChanging: c,
3057
- meshRef: s,
3055
+ dataManager: p,
3056
+ spatialRenderingModeChanging: s,
3057
+ meshRef: l,
3058
3058
  stillRef: X,
3059
3059
  screenQuadRef: T,
3060
3060
  lastSampleRef: ye,
@@ -3064,8 +3064,8 @@ function it(f) {
3064
3064
  }, 1);
3065
3065
  const W = K((E) => {
3066
3066
  if (J("invalidateOnInteraction callback"), q(E), E) {
3067
- const I = s.current?.material?.uniforms;
3068
- I && (I.renderRes.value = x.PT.lowestDataRes), X.current = !1, p();
3067
+ const I = l.current?.material?.uniforms;
3068
+ I && (I.renderRes.value = p.PT.lowestDataRes), X.current = !1, d();
3069
3069
  }
3070
3070
  }), Se = K((E) => {
3071
3071
  W(!0);
@@ -3075,21 +3075,21 @@ function it(f) {
3075
3075
  }, 300);
3076
3076
  });
3077
3077
  Q(() => {
3078
- y && (J("useEffect firstImageLayerChannelCoordination"), W(!0), n.debug("something about channels changed"), x.updateChannels(ee), z.setChannelMapping(x.channels.colorMappings), clearTimeout(Y.current), Y.current = setTimeout(() => {
3078
+ y && (J("useEffect firstImageLayerChannelCoordination"), W(!0), n.debug("something about channels changed"), p.updateChannels(ee), z.setChannelMapping(p.channels.colorMappings), clearTimeout(Y.current), Y.current = setTimeout(() => {
3079
3079
  W(!1);
3080
3080
  }, 300));
3081
- }, [x, ee, z, W, y]);
3081
+ }, [p, ee, z, W, y]);
3082
3082
  const ze = K(() => {
3083
- x && x.stopLoading();
3083
+ p && p.stopLoading();
3084
3084
  }), ke = K(() => {
3085
- x && x.restartLoading();
3086
- }), Ie = K(() => x ? x.getLoadingProgress() : null);
3085
+ p && p.restartLoading();
3086
+ }), Ie = K(() => p ? p.getLoadingProgress() : null);
3087
3087
  return Q(() => {
3088
- if (!u)
3088
+ if (!c)
3089
3089
  return;
3090
3090
  const E = setInterval(() => {
3091
3091
  const I = Ie();
3092
- u({
3092
+ c({
3093
3093
  loadingProgress: I,
3094
3094
  stillRef: X,
3095
3095
  onStopLoading: ze,
@@ -3097,7 +3097,7 @@ function it(f) {
3097
3097
  });
3098
3098
  }, 1e3);
3099
3099
  return () => clearInterval(E);
3100
- }, [u, X]), !R || !x || !z ? null : g.shader ? ie("group", { children: [G(
3100
+ }, [c, X]), !C || !p || !z ? null : g.shader ? ie("group", { children: [G(
3101
3101
  me,
3102
3102
  {
3103
3103
  // ref={mainOrbitControlsRef}
@@ -3105,7 +3105,7 @@ function it(f) {
3105
3105
  onStart: Se,
3106
3106
  onEnd: we
3107
3107
  }
3108
- ), ie("mesh", { ref: s, scale: g.meshScale, children: [G("boxGeometry", { args: g.geometrySize }), G("shaderMaterial", { uniforms: g.uniforms, vertexShader: g.shader.vertexShader, fragmentShader: g.shader.fragmentShader, side: M.BackSide, transparent: !1, glslVersion: M.GLSL3 })] })] }) : ie("group", { children: [ie("mesh", { children: [G("boxGeometry", { args: [1, 1, 1] }), G("meshBasicMaterial", { color: "#444", wireframe: !0 })] }), G(me, { ref: m })] });
3108
+ ), ie("mesh", { ref: l, scale: g.meshScale, children: [G("boxGeometry", { args: g.geometrySize }), G("shaderMaterial", { uniforms: g.uniforms, vertexShader: g.shader.vertexShader, fragmentShader: g.shader.fragmentShader, side: M.BackSide, transparent: !1, glslVersion: M.GLSL3 })] })] }) : ie("group", { children: [ie("mesh", { children: [G("boxGeometry", { args: [1, 1, 1] }), G("meshBasicMaterial", { color: "#444", wireframe: !0 })] }), G(me, { ref: v })] });
3109
3109
  }
3110
3110
  function ft(f) {
3111
3111
  return G(Pe, { frameloop: "always", style: {