vitessce 3.8.4 → 3.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{OrbitControls-BPjlaGV8.js → OrbitControls-C2dOs24x.js} +1 -1
- package/dist/{ReactNeuroglancer-BHTpX0MC.js → ReactNeuroglancer-CaOIGlg9.js} +1 -1
- package/dist/{deflate-BWOJLACC.js → deflate-CaQeb8Tx.js} +1 -1
- package/dist/{higlass-BY33paLT.js → higlass-BAF05ZTi.js} +1 -1
- package/dist/{index-DXytQZZ7.js → index-BEURla9m.js} +476 -384
- package/dist/{index-DMTYKoRz.js → index-DZWdk61W.js} +3 -3
- package/dist/{index-ComgeJ8K.js → index-Du-5tfGa.js} +83635 -83330
- package/dist/index.min.js +31 -28
- package/dist/{jpeg-CFY7vuiM.js → jpeg-CxUVaNda.js} +1 -1
- package/dist/{lerc-CdpQvApA.js → lerc-CULZy_G7.js} +1 -1
- package/dist/{lzw-otFROpaB.js → lzw-KWfcfjsb.js} +1 -1
- package/dist/{packbits-du-JqizB.js → packbits-9XDFDw2G.js} +1 -1
- package/dist/{raw-B8fNhkhk.js → raw-Dt6PYqjk.js} +1 -1
- package/dist/{troika-three-text.esm-Cq70YhLH.js → troika-three-text.esm-BmTJyLXG.js} +1 -1
- package/dist/{webimage-JJ4ZPZGi.js → webimage-BK-HPGLG.js} +1 -1
- package/package.json +7 -7
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { aw as
|
|
2
|
-
import { useRef as z, useState as
|
|
3
|
-
import { u as fe, a as Ue, O as de, C as Oe } from "./OrbitControls-
|
|
4
|
-
const
|
|
1
|
+
import { aw as r, ax as ye, ay as ae, ar as le, as as Te, az as pe, l as ce, aA as Ee, aB as Se, m as te, aC as oe, e as C, V as b, ag as V, ae as we, aq as D, aD as ze, aE as ke, av as Ie, W as De, ad as Me, z as Pe, aF as Ae, ao as M, aG as Be, am as Ne } from "./index-Du-5tfGa.js";
|
|
2
|
+
import { useRef as z, useState as re, useMemo as ue, useEffect as H, useCallback as he } from "react";
|
|
3
|
+
import { u as fe, a as Ue, O as de, C as Oe } from "./OrbitControls-C2dOs24x.js";
|
|
4
|
+
const E = 32, I = 64, O = 64, se = 4, ie = I * O * se, ve = I * E, me = O * E, xe = se * E, G = {
|
|
5
5
|
NOT_STARTED: "not_started",
|
|
6
6
|
IN_PROGRESS: "in_progress",
|
|
7
7
|
COMPLETE: "complete",
|
|
8
8
|
FAILED: "failed"
|
|
9
9
|
};
|
|
10
|
-
function
|
|
11
|
-
oe
|
|
10
|
+
function k(f) {
|
|
11
|
+
ae(oe.DEBUG) && console.warn(`%cDM: ${f}`, "background: blue; color: white; padding: 2px; border-radius: 3px;");
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
function Le(f) {
|
|
14
|
+
return f.map((t) => {
|
|
15
15
|
const { dims: e } = t;
|
|
16
16
|
return [
|
|
17
17
|
// Other spatial-accelerated code assumes TCZYX dimension order
|
|
@@ -25,8 +25,8 @@ function Fe(h) {
|
|
|
25
25
|
];
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
28
|
+
function Fe(f) {
|
|
29
|
+
return f.map((t) => {
|
|
30
30
|
const e = [
|
|
31
31
|
t.depth,
|
|
32
32
|
// z
|
|
@@ -36,14 +36,14 @@ function Le(h) {
|
|
|
36
36
|
// x
|
|
37
37
|
];
|
|
38
38
|
return [
|
|
39
|
-
Math.ceil((e[0] || 1) /
|
|
40
|
-
Math.ceil((e[1] || 1) /
|
|
41
|
-
Math.ceil((e[2] || 1) /
|
|
39
|
+
Math.ceil((e[0] || 1) / E),
|
|
40
|
+
Math.ceil((e[1] || 1) / E),
|
|
41
|
+
Math.ceil((e[2] || 1) / E)
|
|
42
42
|
];
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
function Ve(
|
|
46
|
-
|
|
45
|
+
function Ve(f, t) {
|
|
46
|
+
r.debug("_initMRMCPT", f, t);
|
|
47
47
|
const e = {
|
|
48
48
|
channelOffsets: [
|
|
49
49
|
[0, 0, 1],
|
|
@@ -68,88 +68,89 @@ function Ve(h, t) {
|
|
|
68
68
|
// original z extent plus the l0 z extent times the channel count
|
|
69
69
|
};
|
|
70
70
|
e.xExtent = 1, e.yExtent = 1, e.zExtent = 1;
|
|
71
|
-
const
|
|
72
|
-
e.z0Extent =
|
|
73
|
-
for (let
|
|
71
|
+
const i = f[0][0];
|
|
72
|
+
e.z0Extent = i, e.lowestDataRes = f.length - 1;
|
|
73
|
+
for (let c = f.length - 1; c > 0; c--)
|
|
74
74
|
e.anchors.push([
|
|
75
75
|
e.xExtent,
|
|
76
76
|
e.yExtent,
|
|
77
77
|
e.zExtent
|
|
78
|
-
]), e.xExtent +=
|
|
79
|
-
e.anchors.push([0, 0, e.zExtent]), e.anchors.reverse(), e.zTotal = e.zExtent + t *
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
return
|
|
78
|
+
]), e.xExtent += f[c][2], e.yExtent += f[c][1], e.zExtent += f[c][0];
|
|
79
|
+
e.anchors.push([0, 0, e.zExtent]), e.anchors.reverse(), e.zTotal = e.zExtent + t * i;
|
|
80
|
+
const a = new Uint8Array(ve * me * xe);
|
|
81
|
+
a.fill(0);
|
|
82
|
+
const n = new Uint32Array(e.xExtent * e.yExtent * e.zTotal);
|
|
83
|
+
n.fill(0);
|
|
84
|
+
const o = new le(a, ve, me, xe);
|
|
85
|
+
o.format = Te, o.type = pe, o.internalFormat = "R8", o.minFilter = ce, o.magFilter = ce, o.generateMipmaps = !1, o.needsUpdate = !0;
|
|
86
|
+
const l = new le(n, e.xExtent, e.yExtent, e.zTotal);
|
|
87
|
+
return l.format = Ee, l.type = Se, l.internalFormat = "R32UI", l.minFilter = te, l.magFilter = te, l.generateMipmaps = !1, l.needsUpdate = !0, r.debug("_initMRMCPT", e, l, o), {
|
|
88
88
|
PT: e,
|
|
89
|
-
ptTHREE:
|
|
90
|
-
bcTHREE:
|
|
89
|
+
ptTHREE: l,
|
|
90
|
+
bcTHREE: o
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
function Ge(
|
|
94
|
-
const
|
|
95
|
-
return (1 << 31 | 1 << 30 |
|
|
93
|
+
function Ge(f, t, e, i, a) {
|
|
94
|
+
const n = (o) => Math.max(0, Math.min(127, Math.floor(o / 2)));
|
|
95
|
+
return (1 << 31 | 1 << 30 | n(f) << 23 | n(t) << 16 | (e & 63) << 10 | (i & 63) << 4 | a & 15) >>> 0;
|
|
96
96
|
}
|
|
97
|
-
function Ze(
|
|
98
|
-
const { PT_zExtent:
|
|
99
|
-
let
|
|
100
|
-
if (e >=
|
|
101
|
-
|
|
97
|
+
function Ze(f, t, e, i) {
|
|
98
|
+
const { PT_zExtent: a, PT_z0Extent: n, PT_anchors: o } = i;
|
|
99
|
+
let l = -1, c = -1, s = -1, x = -1, m = -1;
|
|
100
|
+
if (e >= a)
|
|
101
|
+
c = 0, s = f, x = t, m = (e - a) % n, l = Math.floor((e - a) / n);
|
|
102
102
|
else
|
|
103
|
-
for (let u = 1; u <
|
|
104
|
-
if (!(
|
|
105
|
-
|
|
103
|
+
for (let u = 1; u < o.length; u++)
|
|
104
|
+
if (!(f < o[u][0] && t < o[u][1] && e < o[u][2])) {
|
|
105
|
+
c = u;
|
|
106
106
|
const d = [0, 0, 0];
|
|
107
|
-
|
|
107
|
+
f >= o[u][0] && (d[0] = 1), t >= o[u][1] && (d[1] = 1), e >= o[u][2] && (d[2] = 1);
|
|
108
108
|
const v = d[0] << 2 | d[1] << 1 | d[2];
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
s =
|
|
109
|
+
l = Math.max(1, Math.min(7, v)) - 1;
|
|
110
|
+
const h = d.map((p, _) => p * o[u][_]);
|
|
111
|
+
s = f - h[0], x = t - h[1], m = e - h[2];
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
114
114
|
return {
|
|
115
|
-
channel:
|
|
116
|
-
resolution:
|
|
115
|
+
channel: l,
|
|
116
|
+
resolution: c,
|
|
117
117
|
x: s,
|
|
118
118
|
y: x,
|
|
119
119
|
z: m
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
function Xe(
|
|
122
|
+
function Xe(f, t) {
|
|
123
123
|
const e = /* @__PURE__ */ new Map();
|
|
124
|
-
for (let
|
|
125
|
-
const
|
|
126
|
-
if ((
|
|
124
|
+
for (let a = 0; a < f.length; a += 4) {
|
|
125
|
+
const n = f[a], o = f[a + 1], l = f[a + 2], c = f[a + 3];
|
|
126
|
+
if ((n | o | l | c) === 0)
|
|
127
127
|
continue;
|
|
128
|
-
const s = (
|
|
128
|
+
const s = (n << 24 | o << 16 | l << 8 | c) >>> 0;
|
|
129
129
|
e.set(s, (e.get(s) || 0) + 1);
|
|
130
130
|
}
|
|
131
|
-
return { requests: [...e.entries()].sort((
|
|
132
|
-
x:
|
|
133
|
-
y:
|
|
134
|
-
z:
|
|
131
|
+
return { requests: [...e.entries()].sort((a, n) => n[1] - a[1]).slice(0, t).map(([a]) => ({
|
|
132
|
+
x: a >> 22 & 1023,
|
|
133
|
+
y: a >> 12 & 1023,
|
|
134
|
+
z: a & 4095
|
|
135
135
|
})), origRequestCount: e.size };
|
|
136
136
|
}
|
|
137
137
|
class je {
|
|
138
138
|
constructor(t) {
|
|
139
|
-
|
|
140
|
-
const e = t.getContext?.() || t,
|
|
141
|
-
e.domElement && e.getContext ? this.gl = e.getContext() : e.isWebGLRenderer ? this.gl = e.getContext() : this.gl = e, this.renderer =
|
|
142
|
-
getParameter: (
|
|
139
|
+
k("CLASS INITIALIZING"), r.debug("VolumeDataManager constructor", { glParam: t, glParamContext: t.getContext?.() });
|
|
140
|
+
const e = t.getContext?.() || t, i = t;
|
|
141
|
+
e.domElement && e.getContext ? this.gl = e.getContext() : e.isWebGLRenderer ? this.gl = e.getContext() : this.gl = e, this.renderer = i, (!this.gl || typeof this.gl.getParameter != "function") && (r.debug("Unable to get WebGL context, using mock context"), this.gl = {
|
|
142
|
+
getParameter: (a) => ({
|
|
143
143
|
MAX_TEXTURE_SIZE: 4096,
|
|
144
144
|
MAX_3D_TEXTURE_SIZE: 256,
|
|
145
145
|
MAX_RENDERBUFFER_SIZE: 4096,
|
|
146
146
|
MAX_UNIFORM_BUFFER_BINDINGS: 16
|
|
147
|
-
})[
|
|
147
|
+
})[a] || 0,
|
|
148
|
+
isContextLost: () => !1,
|
|
148
149
|
MAX_TEXTURE_SIZE: "MAX_TEXTURE_SIZE",
|
|
149
150
|
MAX_3D_TEXTURE_SIZE: "MAX_3D_TEXTURE_SIZE",
|
|
150
151
|
MAX_RENDERBUFFER_SIZE: "MAX_RENDERBUFFER_SIZE",
|
|
151
152
|
MAX_UNIFORM_BUFFER_BINDINGS: "MAX_UNIFORM_BUFFER_BINDINGS"
|
|
152
|
-
}),
|
|
153
|
+
}), this._originalGlParam = t, this._isContextLost = !1, this._contextRestoredCallbacks = [], this.gl && this.gl.canvas && (this.gl.canvas.addEventListener("webglcontextlost", this._handleContextLost.bind(this)), this.gl.canvas.addEventListener("webglcontextrestored", this._handleContextRestored.bind(this))), r.debug("GL CONSTANTS"), r.debug(this.gl), r.debug(this.gl.TEXTURE0), r.debug(this.gl.textures), r.debug("RENDERER"), r.debug(this.renderer), this.deviceLimits = {
|
|
153
154
|
maxTextureSize: this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE),
|
|
154
155
|
max3DTextureSize: this.gl.getParameter(this.gl.MAX_3D_TEXTURE_SIZE),
|
|
155
156
|
maxRenderbufferSize: this.gl.getParameter(this.gl.MAX_RENDERBUFFER_SIZE),
|
|
@@ -212,10 +213,51 @@ class je {
|
|
|
212
213
|
// l0 z extent
|
|
213
214
|
zTotal: 0
|
|
214
215
|
// original z extent plus the l0 z extent times the channel count
|
|
215
|
-
}, this.bricksEverLoaded = /* @__PURE__ */ new Set(), this.isBusy = !1, this.BCTimeStamps = new Array(ie).fill(0), this.BCMinMax = new Array(ie).fill([0, 0]), this.BCFull = !1, this.BCUnusedIndex = 0, this.bc2pt = new Array(ie).fill(null), this.LRUStack = [], this.triggerUsage = !0, this.triggerRequest = !1, this.timeStamp = 0, this.k = 40, this.noNewRequests = !1, this.needsBailout = !1, this.initStatus = G.NOT_STARTED, this.initError = null,
|
|
216
|
+
}, this.bricksEverLoaded = /* @__PURE__ */ new Set(), this.isBusy = !1, this.BCTimeStamps = new Array(ie).fill(0), this.BCMinMax = new Array(ie).fill([0, 0]), this.BCFull = !1, this.BCUnusedIndex = 0, this.bc2pt = new Array(ie).fill(null), this.LRUStack = [], this.triggerUsage = !0, this.triggerRequest = !1, this.timeStamp = 0, this.k = 40, this.noNewRequests = !1, this.needsBailout = !1, this.initStatus = G.NOT_STARTED, this.initError = null, this._lastChannelConfig = null, k("VolumeDataManager constructor complete");
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Handle WebGL context loss
|
|
220
|
+
*/
|
|
221
|
+
_handleContextLost(t) {
|
|
222
|
+
k("CONTEXT LOST"), r.warn("WebGL context lost, preventing default and setting flag"), t.preventDefault(), this._isContextLost = !0, this.channels && this.channels.zarrMappings && (this._lastChannelConfig = {
|
|
223
|
+
zarrMappings: [...this.channels.zarrMappings],
|
|
224
|
+
colorMappings: [...this.channels.colorMappings],
|
|
225
|
+
downsampleMin: [...this.channels.downsampleMin],
|
|
226
|
+
downsampleMax: [...this.channels.downsampleMax]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Handle WebGL context restoration
|
|
231
|
+
*/
|
|
232
|
+
_handleContextRestored(t) {
|
|
233
|
+
if (k("CONTEXT RESTORED"), r.warn("WebGL context restored, reinitializing textures"), this._isContextLost = !1, this._originalGlParam && this._originalGlParam.getContext && (this.gl = this._originalGlParam.getContext()), this._lastChannelConfig && (this.channels.zarrMappings = [...this._lastChannelConfig.zarrMappings], this.channels.colorMappings = [...this._lastChannelConfig.colorMappings], this.channels.downsampleMin = [...this._lastChannelConfig.downsampleMin], this.channels.downsampleMax = [...this._lastChannelConfig.downsampleMax], r.debug("Restored channel configuration after context loss")), this.PT && this.zarrStore && this.zarrStore.brickLayout)
|
|
234
|
+
try {
|
|
235
|
+
this.initMRMCPT(), r.debug("Successfully reinitialized MRMCPT after context restoration");
|
|
236
|
+
} catch (e) {
|
|
237
|
+
r.error("Failed to reinitialize MRMCPT after context restoration:", e);
|
|
238
|
+
}
|
|
239
|
+
this._contextRestoredCallbacks.forEach((e) => {
|
|
240
|
+
try {
|
|
241
|
+
e();
|
|
242
|
+
} catch (i) {
|
|
243
|
+
r.error("Error in context restored callback:", i);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Check if WebGL context is lost
|
|
249
|
+
*/
|
|
250
|
+
isContextLost() {
|
|
251
|
+
return this._isContextLost ? !0 : this.gl && typeof this.gl.isContextLost == "function" ? this.gl.isContextLost() : !1;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Register a callback to be called when context is restored
|
|
255
|
+
*/
|
|
256
|
+
onContextRestored(t) {
|
|
257
|
+
typeof t == "function" && this._contextRestoredCallbacks.push(t);
|
|
216
258
|
}
|
|
217
259
|
initImages(t, e) {
|
|
218
|
-
|
|
260
|
+
k("INIT IMAGES"), this.images = t, this.imageLayerScopes = e;
|
|
219
261
|
}
|
|
220
262
|
/**
|
|
221
263
|
* Initialize the VolumeDataManager with Zarr store details and device limits
|
|
@@ -224,8 +266,8 @@ class je {
|
|
|
224
266
|
* @returns {Promise<Object>} Object with Zarr store details and device limits
|
|
225
267
|
*/
|
|
226
268
|
async init(t) {
|
|
227
|
-
if (
|
|
228
|
-
return
|
|
269
|
+
if (k("INIT()"), this.initStatus !== G.NOT_STARTED)
|
|
270
|
+
return r.debug("VolumeDataManager init() was called more than once!"), this.initStatus === G.COMPLETE ? {
|
|
229
271
|
success: !0,
|
|
230
272
|
deviceLimits: this.deviceLimits,
|
|
231
273
|
zarrStore: this.zarrStore,
|
|
@@ -241,27 +283,27 @@ class je {
|
|
|
241
283
|
pending: !0,
|
|
242
284
|
error: "Initialization in progress"
|
|
243
285
|
};
|
|
244
|
-
this.initStatus = G.IN_PROGRESS,
|
|
286
|
+
this.initStatus = G.IN_PROGRESS, k("INIT() IN PROGRESS");
|
|
245
287
|
try {
|
|
246
288
|
const e = this.images?.[this.imageLayerScopes?.[0]]?.image?.instance;
|
|
247
|
-
if (this.ngffMetadata = e.vivLoader.metadata,
|
|
289
|
+
if (this.ngffMetadata = e.vivLoader.metadata, r.debug("ngffMetadata", this.ngffMetadata), !e || e.getType() !== "ome-zarr")
|
|
248
290
|
throw new Error("Invalid imageWrapper or not an OME-Zarr image");
|
|
249
|
-
const
|
|
250
|
-
this.zarrStore.resolutions =
|
|
251
|
-
const
|
|
252
|
-
if (!Array.isArray(
|
|
291
|
+
const i = e.getMultiResolutionStats(), a = Le(i), n = i.length;
|
|
292
|
+
this.zarrStore.resolutions = n;
|
|
293
|
+
const o = e.getData();
|
|
294
|
+
if (!Array.isArray(o) || o.length < 1)
|
|
253
295
|
throw new Error("Not a multiresolution loader");
|
|
254
|
-
if (!
|
|
296
|
+
if (!ye(o[0].labels, ["t", "c", "z", "y", "x"]))
|
|
255
297
|
throw new Error("Expected OME-Zarr data with dimensions [t, c, z, y, x]");
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
259
|
-
const s =
|
|
298
|
+
r.debug("vivData", o);
|
|
299
|
+
const l = o.map((s) => s._data), c = new Array(n).fill(null);
|
|
300
|
+
if (l.length > 0) {
|
|
301
|
+
const s = l[0];
|
|
260
302
|
if (this.zarrStore = {
|
|
261
|
-
resolutions:
|
|
303
|
+
resolutions: n,
|
|
262
304
|
chunkSize: s.chunks,
|
|
263
|
-
shapes:
|
|
264
|
-
arrays:
|
|
305
|
+
shapes: a,
|
|
306
|
+
arrays: l,
|
|
265
307
|
dtype: s.dtype,
|
|
266
308
|
physicalSizeTotal: [],
|
|
267
309
|
// Will be populated if metadata exists
|
|
@@ -271,14 +313,14 @@ class je {
|
|
|
271
313
|
// Calculate from shapes and chunk sizes
|
|
272
314
|
// store: this.store,
|
|
273
315
|
// group: this.group,
|
|
274
|
-
channelCount:
|
|
275
|
-
scales:
|
|
316
|
+
channelCount: a[0][1],
|
|
317
|
+
scales: c
|
|
276
318
|
}, 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), s.meta && s.meta.physicalSizes) {
|
|
277
|
-
const { x: d, y: v, z:
|
|
278
|
-
this.zarrStore.physicalSizeVoxel = [p, _,
|
|
319
|
+
const { x: d, y: v, z: h } = s.meta.physicalSizes, p = h?.size || 1, _ = v?.size || 1, y = d?.size || 1;
|
|
320
|
+
this.zarrStore.physicalSizeVoxel = [p, _, y], s.shape && s.shape.length >= 5 && (this.zarrStore.physicalSizeTotal = [
|
|
279
321
|
(s.shape[2] || 1) * p,
|
|
280
322
|
(s.shape[3] || 1) * _,
|
|
281
|
-
(s.shape[4] || 1) *
|
|
323
|
+
(s.shape[4] || 1) * y
|
|
282
324
|
]);
|
|
283
325
|
} else
|
|
284
326
|
this.zarrStore.physicalSizeVoxel = [1, 1, 1], this.zarrStore.physicalSizeTotal = [
|
|
@@ -290,41 +332,41 @@ class je {
|
|
|
290
332
|
if (!x)
|
|
291
333
|
throw new Error("Expected multiscales metadata in group.attrs");
|
|
292
334
|
if (x?.[0]?.datasets?.[0]?.coordinateTransformations) {
|
|
293
|
-
for (let d = 0; d <
|
|
335
|
+
for (let d = 0; d < n; d++)
|
|
294
336
|
if (x?.[0]?.datasets?.[d]?.coordinateTransformations?.[0]?.scale) {
|
|
295
337
|
const { scale: v } = x[0].datasets[d].coordinateTransformations[0];
|
|
296
|
-
|
|
338
|
+
c[d] = [v[4], v[3], v[2]];
|
|
297
339
|
}
|
|
298
340
|
} else {
|
|
299
|
-
|
|
300
|
-
for (let d = 0; d <
|
|
341
|
+
r.error("no coordinateTransformations available, assuming downsampling ratio of 2 per dimension");
|
|
342
|
+
for (let d = 0; d < n; d++) {
|
|
301
343
|
const v = 2 ** d;
|
|
302
|
-
|
|
344
|
+
c[d] = [v, v, v];
|
|
303
345
|
}
|
|
304
346
|
}
|
|
305
|
-
this.zarrStore.scales =
|
|
347
|
+
this.zarrStore.scales = c;
|
|
306
348
|
const { coordinateTransformations: m } = this.ngffMetadata;
|
|
307
349
|
if (m?.[0]?.scale) {
|
|
308
350
|
const { scale: d } = m[0], v = d.length;
|
|
309
351
|
if (v >= 3) {
|
|
310
|
-
const
|
|
311
|
-
this.zarrStore.physicalSizeVoxel = [
|
|
312
|
-
(s.shape[2] || 1) *
|
|
352
|
+
const h = d[v - 3], p = d[v - 2], _ = d[v - 1];
|
|
353
|
+
this.zarrStore.physicalSizeVoxel = [h, p, _], s.shape && s.shape.length >= 5 && (this.zarrStore.physicalSizeTotal = [
|
|
354
|
+
(s.shape[2] || 1) * h,
|
|
313
355
|
(s.shape[3] || 1) * p,
|
|
314
356
|
(s.shape[4] || 1) * _
|
|
315
357
|
]);
|
|
316
358
|
}
|
|
317
359
|
}
|
|
318
|
-
this.zarrStore.brickLayout =
|
|
360
|
+
this.zarrStore.brickLayout = Fe(e.getMultiResolutionStats()), r.debug("config", t);
|
|
319
361
|
const { omero: u } = this.ngffMetadata || {};
|
|
320
362
|
if (!u)
|
|
321
363
|
throw new Error("Expected omero metadata in ngffMetadata");
|
|
322
|
-
|
|
323
|
-
const
|
|
324
|
-
this.channels.zarrMappings[v] =
|
|
325
|
-
}),
|
|
364
|
+
r.debug("omero", u), Object.keys(t).forEach((d, v) => {
|
|
365
|
+
const h = t[d].spatialTargetC;
|
|
366
|
+
this.channels.zarrMappings[v] = h, this.channels.colorMappings[v] = v, this.channels.downsampleMin[v] = u?.channels?.[h]?.window?.min || 0, this.channels.downsampleMax[v] = u?.channels?.[h]?.window?.max || 65535;
|
|
367
|
+
}), r.debug("zarrMappings after init", this.channels.zarrMappings), r.debug("colorMappings after init", this.channels.colorMappings), r.debug("downsampleMin after init", this.channels.downsampleMin), r.debug("downsampleMax after init", this.channels.downsampleMax), this.initMRMCPT();
|
|
326
368
|
}
|
|
327
|
-
return this.initStatus = G.COMPLETE,
|
|
369
|
+
return this.initStatus = G.COMPLETE, k("INIT() COMPLETE"), {
|
|
328
370
|
success: !0,
|
|
329
371
|
deviceLimits: this.deviceLimits,
|
|
330
372
|
zarrStore: this.zarrStore,
|
|
@@ -334,7 +376,7 @@ class je {
|
|
|
334
376
|
error: null
|
|
335
377
|
};
|
|
336
378
|
} catch (e) {
|
|
337
|
-
return
|
|
379
|
+
return k("INIT() FAILED"), r.error("Error initializing VolumeDataManager:", e), this.initStatus = G.FAILED, this.initError = e.message || "Unknown error", {
|
|
338
380
|
success: !1,
|
|
339
381
|
error: this.initError
|
|
340
382
|
};
|
|
@@ -350,9 +392,9 @@ class je {
|
|
|
350
392
|
* -
|
|
351
393
|
*/
|
|
352
394
|
initMRMCPT() {
|
|
353
|
-
|
|
354
|
-
const { PT: t, ptTHREE: e, bcTHREE:
|
|
355
|
-
this.PT = t, this.ptTHREE = e, this.bcTHREE =
|
|
395
|
+
k("initMRMCPT");
|
|
396
|
+
const { PT: t, ptTHREE: e, bcTHREE: i } = Ve(this.zarrStore.brickLayout, this.channels.zarrMappings.length);
|
|
397
|
+
this.PT = t, this.ptTHREE = e, this.bcTHREE = i, k("initMRMCPT() COMPLETE");
|
|
356
398
|
}
|
|
357
399
|
/*
|
|
358
400
|
testTexture() {
|
|
@@ -367,45 +409,50 @@ class je {
|
|
|
367
409
|
await this.handleBrickRequests(t);
|
|
368
410
|
}
|
|
369
411
|
updateChannels(t) {
|
|
370
|
-
if (
|
|
371
|
-
|
|
412
|
+
if (k("updateChannels"), r.debug("channelProps", t), r.debug("this.channels.zarrMappings", this.channels.zarrMappings), r.debug("this.channels.colorMappings", this.channels.colorMappings), r.debug("this.channels.downsampleMin", this.channels.downsampleMin), r.debug("this.channels.downsampleMax", this.channels.downsampleMax), this.channels.zarrMappings.length === 0) {
|
|
413
|
+
r.debug("channels not initialized yet");
|
|
372
414
|
return;
|
|
373
415
|
}
|
|
374
|
-
const e = Object.values(t).map((
|
|
375
|
-
|
|
376
|
-
current:
|
|
377
|
-
requested:
|
|
378
|
-
}), Object.entries(t).forEach(([
|
|
379
|
-
const s =
|
|
380
|
-
|
|
416
|
+
const e = Object.values(t).map((l) => l.spatialTargetC).filter((l) => l !== void 0), i = this.channels.zarrMappings.filter((l) => l !== void 0), a = [...new Set(e)].sort((l, c) => l - c), n = [...new Set(i)].sort((l, c) => l - c);
|
|
417
|
+
a.length === n.length && a.every((l, c) => l === n[c]) && r.debug("Channel mappings unchanged, skipping update"), r.debug("Channel mappings changed:", {
|
|
418
|
+
current: n,
|
|
419
|
+
requested: a
|
|
420
|
+
}), Object.entries(t).forEach(([l, c]) => {
|
|
421
|
+
const s = c.spatialTargetC;
|
|
422
|
+
r.debug(`UI channel "${l}" wants zarr channel ${s}`);
|
|
381
423
|
const x = this.channels.zarrMappings.indexOf(s);
|
|
382
424
|
if (x === -1) {
|
|
383
425
|
const m = this.channels.zarrMappings.findIndex((u) => u === void 0);
|
|
384
426
|
if (m !== -1)
|
|
385
|
-
this.channels.zarrMappings[m] = s,
|
|
427
|
+
this.channels.zarrMappings[m] = s, r.debug("channelData", c), r.debug("this.ngffMetadata?.omero?.channels", this.ngffMetadata?.omero?.channels), r.debug("targetZarrChannel", s), this.channels.downsampleMin[m] = this.ngffMetadata?.omero?.channels?.[s]?.window?.min || 0, this.channels.downsampleMax[m] = this.ngffMetadata?.omero?.channels?.[s]?.window?.max || 65535, r.debug(`Mapped zarr channel ${s} to slot ${m}`), r.debug("channels", this.channels);
|
|
386
428
|
else {
|
|
387
|
-
|
|
388
|
-
const u = this.channels.zarrMappings.filter((
|
|
389
|
-
if (
|
|
390
|
-
const
|
|
391
|
-
if (
|
|
392
|
-
const p = this.channels.zarrMappings[
|
|
393
|
-
this.channels.zarrMappings[
|
|
429
|
+
r.debug("No free slots found, looking for unused mapped channels");
|
|
430
|
+
const u = this.channels.zarrMappings.filter((h) => h !== void 0), d = e, v = u.filter((h) => !d.includes(h));
|
|
431
|
+
if (r.debug("Currently mapped:", u), r.debug("Still requested:", d), r.debug("Unused mapped channels:", v), v.length > 0) {
|
|
432
|
+
const h = this.channels.zarrMappings.findIndex((p) => v.includes(p));
|
|
433
|
+
if (h !== -1) {
|
|
434
|
+
const p = this.channels.zarrMappings[h];
|
|
435
|
+
this.channels.zarrMappings[h] = s, this.channels.downsampleMin[h] = this.ngffMetadata?.omero?.channels?.[s]?.window?.min || 0, this.channels.downsampleMax[h] = this.ngffMetadata?.omero?.channels?.[s]?.window?.max || 65535, r.debug(`Reused slot ${h}: ${p} -> ${s}`), this._purgeChannel(h);
|
|
394
436
|
} else
|
|
395
|
-
|
|
437
|
+
r.error("Could not find slot to reuse - this should not happen");
|
|
396
438
|
} else
|
|
397
|
-
|
|
439
|
+
r.error("All slots are full and all mapped channels are still in use");
|
|
398
440
|
}
|
|
399
441
|
} else
|
|
400
|
-
|
|
442
|
+
r.debug(`Zarr channel ${s} already mapped to slot ${x}`);
|
|
401
443
|
});
|
|
402
|
-
const
|
|
403
|
-
const
|
|
404
|
-
return
|
|
444
|
+
const o = Object.values(t).map((l) => {
|
|
445
|
+
const c = this.channels.zarrMappings.indexOf(l.spatialTargetC);
|
|
446
|
+
return c !== -1 ? c : -1;
|
|
405
447
|
});
|
|
406
|
-
for (;
|
|
407
|
-
|
|
408
|
-
|
|
448
|
+
for (; o.length < 7; )
|
|
449
|
+
o.push(-1);
|
|
450
|
+
r.debug("newColorMappings", o), this.channels.colorMappings = o, r.debug("updatedChannels", this.channels), this._lastChannelConfig = {
|
|
451
|
+
zarrMappings: [...this.channels.zarrMappings],
|
|
452
|
+
colorMappings: [...this.channels.colorMappings],
|
|
453
|
+
downsampleMin: [...this.channels.downsampleMin],
|
|
454
|
+
downsampleMax: [...this.channels.downsampleMax]
|
|
455
|
+
};
|
|
409
456
|
}
|
|
410
457
|
/**
|
|
411
458
|
* Try to load a resolution level
|
|
@@ -437,53 +484,53 @@ class je {
|
|
|
437
484
|
* @returns {Array} Physical dimensions [X, Y, Z]
|
|
438
485
|
*/
|
|
439
486
|
getPhysicalDimensionsXYZ() {
|
|
440
|
-
|
|
487
|
+
r.debug("getPhysicalDimensionsXYZ"), r.debug("this.zarrStore.physicalSizeTotal", this.zarrStore.physicalSizeTotal);
|
|
441
488
|
const t = [
|
|
442
489
|
this.zarrStore.physicalSizeTotal[2],
|
|
443
490
|
this.zarrStore.physicalSizeTotal[1],
|
|
444
491
|
this.zarrStore.physicalSizeTotal[0]
|
|
445
492
|
];
|
|
446
|
-
return
|
|
493
|
+
return r.debug("out", t), t;
|
|
447
494
|
}
|
|
448
495
|
/**
|
|
449
496
|
* Get the maximum resolution
|
|
450
497
|
* @returns {number} Maximum resolution
|
|
451
498
|
*/
|
|
452
499
|
getMaxResolutionXYZ() {
|
|
453
|
-
|
|
500
|
+
r.debug("getMaxResolutionXYZ"), r.debug("this.zarrStore.shapes", this.zarrStore.shapes);
|
|
454
501
|
const t = [
|
|
455
502
|
this.zarrStore.shapes[0][4],
|
|
456
503
|
this.zarrStore.shapes[0][3],
|
|
457
504
|
this.zarrStore.shapes[0][2]
|
|
458
505
|
];
|
|
459
|
-
return
|
|
506
|
+
return r.debug("out", t), t;
|
|
460
507
|
}
|
|
461
508
|
getOriginalScaleXYZ() {
|
|
462
|
-
|
|
509
|
+
k("getOriginalScaleXYZ"), r.debug("this.zarrStore.physicalSizeVoxel", this.zarrStore.physicalSizeVoxel);
|
|
463
510
|
const t = [
|
|
464
511
|
this.zarrStore.physicalSizeVoxel[2],
|
|
465
512
|
this.zarrStore.physicalSizeVoxel[1],
|
|
466
513
|
this.zarrStore.physicalSizeVoxel[0]
|
|
467
514
|
];
|
|
468
|
-
return
|
|
515
|
+
return r.debug("out", t), t;
|
|
469
516
|
}
|
|
470
517
|
getNormalizedScaleXYZ() {
|
|
471
|
-
|
|
518
|
+
r.debug("getNormalizedScaleXYZ");
|
|
472
519
|
const t = [
|
|
473
520
|
1,
|
|
474
521
|
this.zarrStore.physicalSizeVoxel[1] / this.zarrStore.physicalSizeVoxel[2],
|
|
475
522
|
this.zarrStore.physicalSizeVoxel[0] / this.zarrStore.physicalSizeVoxel[0]
|
|
476
523
|
];
|
|
477
|
-
return
|
|
524
|
+
return r.debug("out", t), t;
|
|
478
525
|
}
|
|
479
526
|
getBoxDimensionsXYZ() {
|
|
480
|
-
|
|
527
|
+
r.debug("getBoxDimensionsXYZ"), r.debug("this.zarrStore.shapes", this.zarrStore.shapes);
|
|
481
528
|
const t = [
|
|
482
529
|
1,
|
|
483
530
|
this.zarrStore.shapes[0][3] / this.zarrStore.shapes[0][4],
|
|
484
531
|
this.zarrStore.shapes[0][2] / this.zarrStore.shapes[0][4]
|
|
485
532
|
];
|
|
486
|
-
return
|
|
533
|
+
return r.debug("out", t), t;
|
|
487
534
|
}
|
|
488
535
|
/**
|
|
489
536
|
* Load a specific Zarr chunk based on [t,c,z,y,x] coordinates
|
|
@@ -495,41 +542,49 @@ class je {
|
|
|
495
542
|
* @param {number} resolution - Resolution level
|
|
496
543
|
* @returns {Promise<Uint8Array>} 32x32x32 chunk data
|
|
497
544
|
*/
|
|
498
|
-
async loadZarrChunk(t = 0, e = 0,
|
|
499
|
-
if (!this.zarrStore || !this.zarrStore.arrays[
|
|
545
|
+
async loadZarrChunk(t = 0, e = 0, i, a, n, o) {
|
|
546
|
+
if (!this.zarrStore || !this.zarrStore.arrays[o])
|
|
500
547
|
throw new Error("Zarr store or resolution not initialized");
|
|
501
|
-
const
|
|
502
|
-
if (!
|
|
503
|
-
throw new Error(`No chunk found at coordinates [${t},${e},${
|
|
504
|
-
if (
|
|
505
|
-
throw new Error(`Unexpected chunk size: ${
|
|
506
|
-
return
|
|
548
|
+
const c = await this.zarrStore.arrays[o].getChunk([t, e, i, a, n]);
|
|
549
|
+
if (!c)
|
|
550
|
+
throw new Error(`No chunk found at coordinates [${t},${e},${i},${a},${n}]`);
|
|
551
|
+
if (c.data.length !== E * E * E)
|
|
552
|
+
throw new Error(`Unexpected chunk size: ${c.data.length}`);
|
|
553
|
+
return c.data;
|
|
507
554
|
}
|
|
508
555
|
async processRequestData(t) {
|
|
509
556
|
if (this.isBusy) {
|
|
510
|
-
|
|
557
|
+
r.debug("processRequestData: already busy, skipping");
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
if (this.isContextLost()) {
|
|
561
|
+
r.debug("processRequestData: WebGL context is lost, skipping");
|
|
511
562
|
return;
|
|
512
563
|
}
|
|
513
564
|
this.isBusy = !0, this.triggerRequest = !1;
|
|
514
|
-
const { requests: e, origRequestCount:
|
|
515
|
-
e.length === 0 && (this.noNewRequests = !0),
|
|
565
|
+
const { requests: e, origRequestCount: i } = Xe(t, this.k);
|
|
566
|
+
e.length === 0 && (this.noNewRequests = !0), r.debug(`processRequestData: handling ${e.length} requests of ${i}`), await this.handleBrickRequests(e), this.triggerUsage = !0, this.isBusy = !1;
|
|
516
567
|
}
|
|
517
568
|
async processUsageData(t) {
|
|
518
569
|
if (this.isBusy) {
|
|
519
|
-
|
|
570
|
+
r.debug("processUsageData: already busy, skipping"), this.needsBailout = !0;
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
if (this.isContextLost()) {
|
|
574
|
+
r.debug("processUsageData: WebGL context is lost, skipping");
|
|
520
575
|
return;
|
|
521
576
|
}
|
|
522
577
|
this.isBusy = !0, this.triggerUsage = !1;
|
|
523
|
-
const e = ++this.timeStamp,
|
|
524
|
-
for (let
|
|
525
|
-
const
|
|
526
|
-
if ((
|
|
578
|
+
const e = ++this.timeStamp, i = /* @__PURE__ */ new Set();
|
|
579
|
+
for (let a = 0; a < t.length; a += 4) {
|
|
580
|
+
const n = t[a], o = t[a + 1], l = t[a + 2];
|
|
581
|
+
if ((n | o | l) === 0)
|
|
527
582
|
continue;
|
|
528
|
-
const
|
|
529
|
-
|
|
583
|
+
const c = l * I * O + o * I + n;
|
|
584
|
+
c < this.BCTimeStamps.length && i.add(c);
|
|
530
585
|
}
|
|
531
|
-
Array.from(
|
|
532
|
-
this.BCTimeStamps[
|
|
586
|
+
Array.from(i).forEach((a) => {
|
|
587
|
+
this.BCTimeStamps[a] = e;
|
|
533
588
|
}), this.BCFull && this._buildLRU(), this.triggerRequest = !0, this.isBusy = !1;
|
|
534
589
|
}
|
|
535
590
|
// Helper method to update PT entries for evicted bricks
|
|
@@ -537,37 +592,45 @@ class je {
|
|
|
537
592
|
const e = this.bc2pt[t];
|
|
538
593
|
if (!e)
|
|
539
594
|
return;
|
|
540
|
-
const [
|
|
541
|
-
this._updatePTEntry(e.x, e.y, e.z,
|
|
595
|
+
const [i, a] = this.BCMinMax[t] || [0, 0], n = (0 | 1 << 30 | Math.min(127, i >> 1) << 23 | Math.min(127, a >> 1) << 16) >>> 0;
|
|
596
|
+
this._updatePTEntry(e.x, e.y, e.z, n), this.bc2pt[t] = null;
|
|
542
597
|
}
|
|
543
598
|
_purgeChannel(t) {
|
|
544
|
-
if (
|
|
545
|
-
|
|
599
|
+
if (r.debug("purging channel", t), r.debug("corresponding zarr channel", this.channels.zarrMappings[t]), !this.ptTHREE) {
|
|
600
|
+
r.error("pagetable texture not initialized");
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
if (this.isContextLost()) {
|
|
604
|
+
r.warn("WebGL context is lost, skipping channel purge");
|
|
546
605
|
return;
|
|
547
606
|
}
|
|
548
607
|
this.channels.downsampleMin[t] = void 0, this.channels.downsampleMax[t] = void 0, this.channels.zarrMappings[t] = void 0;
|
|
549
608
|
const e = this.PT.channelOffsets[t];
|
|
550
|
-
|
|
551
|
-
const { gl:
|
|
552
|
-
|
|
553
|
-
for (let
|
|
554
|
-
const
|
|
555
|
-
this.PT.anchors[
|
|
556
|
-
this.PT.anchors[
|
|
557
|
-
this.PT.anchors[
|
|
609
|
+
r.debug("channelMask", e), r.error("TODO: not tested yet");
|
|
610
|
+
const { gl: i } = this, a = this.renderer.properties.get(this.ptTHREE).__webglTexture;
|
|
611
|
+
i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_3D, a);
|
|
612
|
+
for (let n = 0; n < this.zarrStore.resolutions; n++) {
|
|
613
|
+
const o = [
|
|
614
|
+
this.PT.anchors[n][2] * e[2],
|
|
615
|
+
this.PT.anchors[n][1] * e[1],
|
|
616
|
+
this.PT.anchors[n][0] * e[0]
|
|
558
617
|
];
|
|
559
|
-
|
|
560
|
-
const
|
|
561
|
-
|
|
618
|
+
r.debug("anchor", o);
|
|
619
|
+
const l = this.zarrStore.brickLayout[n], c = l[0] * l[1] * l[2];
|
|
620
|
+
r.debug("extents", l), r.debug("size", c), i.texSubImage3D(i.TEXTURE_3D, 0, o[0], o[1], o[2], l[0], l[1], l[2], i.RED_INTEGER, i.UNSIGNED_INT, new Uint32Array(c));
|
|
562
621
|
}
|
|
563
|
-
|
|
622
|
+
i.bindTexture(i.TEXTURE_3D, null);
|
|
564
623
|
}
|
|
565
624
|
// Update a PT entry
|
|
566
|
-
_updatePTEntry(t, e,
|
|
625
|
+
_updatePTEntry(t, e, i, a) {
|
|
567
626
|
if (!this.ptTHREE)
|
|
568
627
|
return;
|
|
569
|
-
|
|
570
|
-
|
|
628
|
+
if (this.isContextLost()) {
|
|
629
|
+
r.warn("WebGL context is lost, skipping PT entry update");
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
const { gl: n } = this, o = this.renderer.properties.get(this.ptTHREE).__webglTexture;
|
|
633
|
+
n.activeTexture(n.TEXTURE0), n.bindTexture(n.TEXTURE_3D, o), n.texSubImage3D(n.TEXTURE_3D, 0, t, e, i, 1, 1, 1, n.RED_INTEGER, n.UNSIGNED_INT, new Uint32Array([a])), n.bindTexture(n.TEXTURE_3D, null);
|
|
571
634
|
}
|
|
572
635
|
/* ------------------------------------------------------------- *
|
|
573
636
|
* 2. Allocate the next n free bricks in the brick cache *
|
|
@@ -579,17 +642,17 @@ class je {
|
|
|
579
642
|
*/
|
|
580
643
|
_allocateBCSlots(t) {
|
|
581
644
|
let e = [];
|
|
582
|
-
const
|
|
583
|
-
if (!this.BCFull && this.BCUnusedIndex + t >
|
|
584
|
-
this.LRUStack.length < t && this._buildLRU(), e = this.LRUStack.splice(0, t).map((
|
|
585
|
-
this._evictBrick(
|
|
586
|
-
const
|
|
587
|
-
return { bcIndex:
|
|
645
|
+
const i = I * O * se;
|
|
646
|
+
if (!this.BCFull && this.BCUnusedIndex + t > i && (this.BCFull = !0, r.debug("BRICK CACHE FULL")), this.BCFull)
|
|
647
|
+
this.LRUStack.length < t && this._buildLRU(), e = this.LRUStack.splice(0, t).map((a) => {
|
|
648
|
+
this._evictBrick(a);
|
|
649
|
+
const n = Math.floor(a / (I * O)), o = a - n * I * O, l = Math.floor(o / I), c = o % I;
|
|
650
|
+
return { bcIndex: a, x: c, y: l, z: n };
|
|
588
651
|
});
|
|
589
652
|
else {
|
|
590
|
-
for (let
|
|
591
|
-
const
|
|
592
|
-
e.push({ bcIndex:
|
|
653
|
+
for (let a = 0; a < t; ++a) {
|
|
654
|
+
const n = (this.BCUnusedIndex + a) % i, o = Math.floor(n / (I * O)), l = n - o * I * O, c = Math.floor(l / I), s = l % I;
|
|
655
|
+
e.push({ bcIndex: n, x: s, y: c, z: o });
|
|
593
656
|
}
|
|
594
657
|
this.BCUnusedIndex += t;
|
|
595
658
|
}
|
|
@@ -599,42 +662,71 @@ class je {
|
|
|
599
662
|
* 4. Upload one brick + PT entry *
|
|
600
663
|
* ------------------------------------------------------------- */
|
|
601
664
|
async _uploadBrick(t, e) {
|
|
665
|
+
if (r.debug("uploading brick", t, e), this.isContextLost()) {
|
|
666
|
+
r.warn("WebGL context is lost, skipping brick upload");
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
602
669
|
if (t.x >= this.PT.xExtent || t.y >= this.PT.yExtent || t.z >= this.PT.zTotal || t.x < 0 || t.y < 0 || t.z < 0) {
|
|
603
|
-
|
|
670
|
+
r.error("this.PT", this.PT), r.error("ptCoord out of bounds", t);
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
const { channel: i, resolution: a, x: n, y: o, z: l } = Ze(t.x, t.y, t.z, { PT_zExtent: this.PT.zExtent, PT_z0Extent: this.PT.z0Extent, PT_anchors: this.PT.anchors });
|
|
674
|
+
if (!this.channels || !this.channels.zarrMappings || this.channels.zarrMappings.length === 0) {
|
|
675
|
+
r.error("Channel mappings not initialized, skipping brick upload");
|
|
604
676
|
return;
|
|
605
677
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
i.error("zarrChannel is undefined or -1", l);
|
|
678
|
+
if (i < 0 || i >= this.channels.zarrMappings.length) {
|
|
679
|
+
r.error("Channel index out of bounds", { channel: i, mappingsLength: this.channels.zarrMappings.length });
|
|
609
680
|
return;
|
|
610
681
|
}
|
|
611
|
-
|
|
612
|
-
|
|
682
|
+
const c = this.channels.zarrMappings[i];
|
|
683
|
+
if (c === void 0 || c === -1)
|
|
684
|
+
if (r.warn("zarrChannel is undefined or -1", {
|
|
685
|
+
zarrChannel: c,
|
|
686
|
+
channel: i,
|
|
687
|
+
ptCoord: t,
|
|
688
|
+
channelMappings: this.channels.zarrMappings,
|
|
689
|
+
contextLost: this.isContextLost()
|
|
690
|
+
}), this._lastChannelConfig && this._lastChannelConfig.zarrMappings[i] !== void 0) {
|
|
691
|
+
r.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];
|
|
692
|
+
const y = this.channels.zarrMappings[i];
|
|
693
|
+
if (y !== void 0 && y !== -1)
|
|
694
|
+
r.debug("Successfully restored channel mapping, continuing with upload");
|
|
695
|
+
else {
|
|
696
|
+
r.error("Could not restore valid channel mapping, aborting brick upload");
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
} else {
|
|
700
|
+
r.error("No fallback channel config available, aborting brick upload");
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
r.debug("starting to load zarr chunk", { resolution: a, z: l, y: o, x: n, zarrChannel: c });
|
|
704
|
+
let s = await this.loadZarrChunk(0, c, l, o, n, a);
|
|
613
705
|
if (s instanceof Uint16Array) {
|
|
614
|
-
if (
|
|
615
|
-
const
|
|
616
|
-
|
|
706
|
+
if (r.debug("chunk is Uint16Array, converting to Uint8Array"), this.channels.downsampleMin[i] === void 0) {
|
|
707
|
+
const R = this.channels.zarrMappings[i];
|
|
708
|
+
r.debug("channelId was not found in this.channels.downsampleMin[channel]", R), this.channels.downsampleMin[i] = this.ngffMetadata?.omero?.channels?.[R]?.window?.min || 0, this.channels.downsampleMax[i] = this.ngffMetadata?.omero?.channels?.[R]?.window?.max || 65535, r.debug("this.channels.downsampleMin[channel]", this.channels.downsampleMin[i]), r.debug("this.channels.downsampleMax[channel]", this.channels.downsampleMax[i]);
|
|
617
709
|
}
|
|
618
|
-
const
|
|
619
|
-
for (let
|
|
620
|
-
|
|
621
|
-
s =
|
|
710
|
+
const y = new Uint8Array(s.length);
|
|
711
|
+
for (let R = 0; R < s.length; R++)
|
|
712
|
+
y[R] = Math.floor((s[R] - this.channels.downsampleMin[i]) / (this.channels.downsampleMax[i] - this.channels.downsampleMin[i]) * 255);
|
|
713
|
+
s = y;
|
|
622
714
|
}
|
|
623
715
|
if (!(s instanceof Uint8Array))
|
|
624
716
|
throw new Error(`Unsupported chunk type: ${s.constructor.name}. Expected Uint8Array.`);
|
|
625
717
|
let x = 255, m = 0;
|
|
626
|
-
for (let
|
|
627
|
-
const
|
|
628
|
-
|
|
718
|
+
for (let y = 0; y < s.length; ++y) {
|
|
719
|
+
const R = s[y];
|
|
720
|
+
R < x && (x = R), R > m && (m = R);
|
|
629
721
|
}
|
|
630
722
|
const { gl: u } = this, d = this.renderer.properties.get(this.bcTHREE).__webglTexture;
|
|
631
|
-
u.activeTexture(u.TEXTURE2), u.bindTexture(u.TEXTURE_3D, d), u.pixelStorei(u.UNPACK_ALIGNMENT, 1), u.texSubImage3D(u.TEXTURE_3D, 0, e.x *
|
|
723
|
+
u.activeTexture(u.TEXTURE2), u.bindTexture(u.TEXTURE_3D, d), u.pixelStorei(u.UNPACK_ALIGNMENT, 1), u.texSubImage3D(u.TEXTURE_3D, 0, e.x * E, e.y * E, e.z * E, E, E, E, u.RED, u.UNSIGNED_BYTE, s), u.pixelStorei(u.UNPACK_ALIGNMENT, 4), u.bindTexture(u.TEXTURE_3D, null);
|
|
632
724
|
const v = u.getError();
|
|
633
|
-
v !== u.NO_ERROR &&
|
|
634
|
-
const
|
|
635
|
-
u.activeTexture(u.TEXTURE0), u.bindTexture(u.TEXTURE_3D, p), u.texSubImage3D(u.TEXTURE_3D, 0, t.x, t.y, t.z, 1, 1, 1, u.RED_INTEGER, u.UNSIGNED_INT, new Uint32Array([
|
|
725
|
+
v !== u.NO_ERROR && r.error("WebGL error during brick upload:", v, s), i >= this.channels.zarrMappings.length && (r.debug("channel is out of bounds", i), x = 255, m = 255);
|
|
726
|
+
const h = Ge(x, m, e.x, e.y, e.z), p = this.renderer.properties.get(this.ptTHREE).__webglTexture;
|
|
727
|
+
u.activeTexture(u.TEXTURE0), u.bindTexture(u.TEXTURE_3D, p), u.texSubImage3D(u.TEXTURE_3D, 0, t.x, t.y, t.z, 1, 1, 1, u.RED_INTEGER, u.UNSIGNED_INT, new Uint32Array([h])), u.bindTexture(u.TEXTURE_3D, null);
|
|
636
728
|
const _ = u.getError();
|
|
637
|
-
_ !== u.NO_ERROR &&
|
|
729
|
+
_ !== u.NO_ERROR && r.error("WebGL error during pagetable upload:", _, s), this.BCTimeStamps[e.bcIndex] = this.timeStamp, this.BCMinMax[e.bcIndex] = [x, m], this.bc2pt[e.bcIndex] = t;
|
|
638
730
|
}
|
|
639
731
|
/* ------------------------------------------------------------- *
|
|
640
732
|
* 5. Public: handle a batch of PT requests (array of {x,y,z}) *
|
|
@@ -643,23 +735,23 @@ class je {
|
|
|
643
735
|
if (t.length === 0)
|
|
644
736
|
return;
|
|
645
737
|
const e = this._allocateBCSlots(t.length);
|
|
646
|
-
|
|
647
|
-
for (let
|
|
648
|
-
|
|
649
|
-
const
|
|
650
|
-
if (this.bricksEverLoaded.add(`${t[
|
|
651
|
-
|
|
738
|
+
r.debug("Handling brick requests:", { requestCount: t.length, slotCount: e.length }), r.debug("handleBrickRequests: starting for loop");
|
|
739
|
+
for (let i = 0; i < t.length; ++i) {
|
|
740
|
+
r.debug("uploading brick", t[i], e[i]), await this._uploadBrick(t[i], e[i]);
|
|
741
|
+
const a = this.bricksEverLoaded.size;
|
|
742
|
+
if (this.bricksEverLoaded.add(`${t[i].x},${t[i].y},${t[i].z}`), a === this.bricksEverLoaded.size && r.debug("DUPLICATE BRICK LOADED", t[i]), this.needsBailout) {
|
|
743
|
+
r.debug("Bailing out of handleBrickRequests early due to needsBailout flag"), this.needsBailout = !1;
|
|
652
744
|
break;
|
|
653
745
|
}
|
|
654
746
|
}
|
|
655
|
-
|
|
747
|
+
r.debug("this.bricksEverLoaded", this.bricksEverLoaded);
|
|
656
748
|
}
|
|
657
749
|
/* --------------------------------------------------------- *
|
|
658
750
|
* Rebuild the LRUStack with the k least-recently-used bricks *
|
|
659
751
|
* --------------------------------------------------------- */
|
|
660
752
|
_buildLRU() {
|
|
661
|
-
const t = this.BCTimeStamps.map((e,
|
|
662
|
-
this.LRUStack = t.sort((e,
|
|
753
|
+
const t = this.BCTimeStamps.map((e, i) => ({ index: i, time: e }));
|
|
754
|
+
this.LRUStack = t.sort((e, i) => e.time - i.time).slice(0, this.k).map((e) => e.index);
|
|
663
755
|
}
|
|
664
756
|
}
|
|
665
757
|
const qe = `//
|
|
@@ -2270,7 +2362,7 @@ void main(void) {
|
|
|
2270
2362
|
}
|
|
2271
2363
|
`, He = {
|
|
2272
2364
|
uniforms: {
|
|
2273
|
-
u_size: { value: new
|
|
2365
|
+
u_size: { value: new C(1, 1, 1) },
|
|
2274
2366
|
clim0: { value: new b(0.2, 0.8) },
|
|
2275
2367
|
clim1: { value: new b(0.2, 0.8) },
|
|
2276
2368
|
clim2: { value: new b(0.2, 0.8) },
|
|
@@ -2283,7 +2375,7 @@ void main(void) {
|
|
|
2283
2375
|
yClip: { value: new b(0, 1e6) },
|
|
2284
2376
|
zClip: { value: new b(0, 1e6) },
|
|
2285
2377
|
u_window_size: { value: new b(1, 1) },
|
|
2286
|
-
u_vol_scale: { value: new
|
|
2378
|
+
u_vol_scale: { value: new C(1, 1, 1) },
|
|
2287
2379
|
u_renderstyle: { value: 2 },
|
|
2288
2380
|
brickCacheTex: { type: "sampler3D", value: null },
|
|
2289
2381
|
pageTableTex: { type: "usampler3D", value: null },
|
|
@@ -2311,38 +2403,38 @@ void main(void) {
|
|
|
2311
2403
|
far: { value: 1e4 },
|
|
2312
2404
|
opacity: { value: 1 },
|
|
2313
2405
|
volumeCount: { value: 0 },
|
|
2314
|
-
boxSize: { value: new
|
|
2406
|
+
boxSize: { value: new C(1, 1, 1) },
|
|
2315
2407
|
renderRes: { value: 1e3 },
|
|
2316
|
-
voxelExtents: { value: new
|
|
2317
|
-
anchor0: { value: new
|
|
2318
|
-
anchor1: { value: new
|
|
2319
|
-
anchor2: { value: new
|
|
2320
|
-
anchor3: { value: new
|
|
2321
|
-
anchor4: { value: new
|
|
2322
|
-
anchor5: { value: new
|
|
2323
|
-
anchor6: { value: new
|
|
2324
|
-
anchor7: { value: new
|
|
2325
|
-
anchor8: { value: new
|
|
2326
|
-
anchor9: { value: new
|
|
2327
|
-
scale0: { value: new
|
|
2328
|
-
scale1: { value: new
|
|
2329
|
-
scale2: { value: new
|
|
2330
|
-
scale3: { value: new
|
|
2331
|
-
scale4: { value: new
|
|
2332
|
-
scale5: { value: new
|
|
2333
|
-
scale6: { value: new
|
|
2334
|
-
scale7: { value: new
|
|
2335
|
-
scale8: { value: new
|
|
2336
|
-
scale9: { value: new
|
|
2408
|
+
voxelExtents: { value: new C(1, 1, 1) },
|
|
2409
|
+
anchor0: { value: new C(0, 0, 0) },
|
|
2410
|
+
anchor1: { value: new C(0, 0, 0) },
|
|
2411
|
+
anchor2: { value: new C(0, 0, 0) },
|
|
2412
|
+
anchor3: { value: new C(0, 0, 0) },
|
|
2413
|
+
anchor4: { value: new C(0, 0, 0) },
|
|
2414
|
+
anchor5: { value: new C(0, 0, 0) },
|
|
2415
|
+
anchor6: { value: new C(0, 0, 0) },
|
|
2416
|
+
anchor7: { value: new C(0, 0, 0) },
|
|
2417
|
+
anchor8: { value: new C(0, 0, 0) },
|
|
2418
|
+
anchor9: { value: new C(0, 0, 0) },
|
|
2419
|
+
scale0: { value: new C(1, 1, 1) },
|
|
2420
|
+
scale1: { value: new C(2, 2, 2) },
|
|
2421
|
+
scale2: { value: new C(4, 4, 4) },
|
|
2422
|
+
scale3: { value: new C(8, 8, 8) },
|
|
2423
|
+
scale4: { value: new C(16, 16, 16) },
|
|
2424
|
+
scale5: { value: new C(32, 32, 32) },
|
|
2425
|
+
scale6: { value: new C(64, 64, 64) },
|
|
2426
|
+
scale7: { value: new C(128, 128, 128) },
|
|
2427
|
+
scale8: { value: new C(256, 256, 256) },
|
|
2428
|
+
scale9: { value: new C(512, 512, 512) }
|
|
2337
2429
|
},
|
|
2338
2430
|
vertexShader: qe,
|
|
2339
2431
|
fragmentShader: Ye
|
|
2340
2432
|
};
|
|
2341
|
-
function U(
|
|
2342
|
-
oe
|
|
2433
|
+
function U(f) {
|
|
2434
|
+
ae(oe.DEBUG) && console.warn(`%cRM: ${f}`, "background: orange; color: white; padding: 2px; border-radius: 3px;");
|
|
2343
2435
|
}
|
|
2344
|
-
function ee(
|
|
2345
|
-
return
|
|
2436
|
+
function ee(f, t) {
|
|
2437
|
+
return f / t[1];
|
|
2346
2438
|
}
|
|
2347
2439
|
class Ke {
|
|
2348
2440
|
constructor() {
|
|
@@ -2361,59 +2453,59 @@ class Ke {
|
|
|
2361
2453
|
*/
|
|
2362
2454
|
extractRenderingSettingsFromProps(t) {
|
|
2363
2455
|
U("Extracting rendering settings from props");
|
|
2364
|
-
const { images: e = {}, imageLayerScopes:
|
|
2365
|
-
if (!
|
|
2456
|
+
const { images: e = {}, imageLayerScopes: i = [], imageLayerCoordination: a = [{}], imageChannelScopesByLayer: n = {}, imageChannelCoordination: o = [{}], spatialRenderingMode: l } = t, c = i[0];
|
|
2457
|
+
if (!c)
|
|
2366
2458
|
return {
|
|
2367
2459
|
valid: !1
|
|
2368
2460
|
};
|
|
2369
|
-
const s =
|
|
2461
|
+
const s = n[c], x = a[0][c], m = o[0][c], u = e[c]?.image?.instance?.getData();
|
|
2370
2462
|
if (!u)
|
|
2371
2463
|
return {
|
|
2372
2464
|
valid: !1
|
|
2373
2465
|
};
|
|
2374
|
-
if (!m[s?.[0]][
|
|
2466
|
+
if (!m[s?.[0]][D.SPATIAL_CHANNEL_WINDOW])
|
|
2375
2467
|
return {
|
|
2376
2468
|
valid: !1
|
|
2377
2469
|
};
|
|
2378
|
-
const d = e[
|
|
2470
|
+
const d = e[c].image.instance, v = l === "3D", h = x[D.PHOTOMETRIC_INTERPRETATION] === "RGB", p = x[D.SPATIAL_LAYER_VISIBLE], _ = x[D.SPATIAL_LAYER_OPACITY], y = h ? [
|
|
2379
2471
|
[255, 0, 0],
|
|
2380
2472
|
[0, 255, 0],
|
|
2381
2473
|
[0, 0, 255]
|
|
2382
|
-
] : s.map((S) => m[S][
|
|
2474
|
+
] : s.map((S) => m[S][D.SPATIAL_CHANNEL_COLOR]), R = h ? [
|
|
2383
2475
|
[0, 255],
|
|
2384
2476
|
[0, 255],
|
|
2385
2477
|
[0, 255]
|
|
2386
|
-
] : s.map((S) => m[S][
|
|
2387
|
-
this.maxRangeSet || (this.maxRange = Math.max(...
|
|
2388
|
-
const Z =
|
|
2478
|
+
] : s.map((S) => m[S][D.SPATIAL_CHANNEL_WINDOW] || [0, 255]);
|
|
2479
|
+
this.maxRangeSet || (this.maxRange = Math.max(...R.map((S) => S[1])), this.maxRangeSet = !0);
|
|
2480
|
+
const Z = h ? [
|
|
2389
2481
|
p && !0,
|
|
2390
2482
|
p && !0,
|
|
2391
2483
|
p && !0
|
|
2392
|
-
] : s.map((S) => p && m[S][
|
|
2484
|
+
] : s.map((S) => p && m[S][D.SPATIAL_CHANNEL_VISIBLE]), W = h ? [
|
|
2393
2485
|
p && !0,
|
|
2394
2486
|
p && !0,
|
|
2395
2487
|
p && !0
|
|
2396
|
-
] : s.map((S) => p && d.getChannelIndex(m[S][
|
|
2488
|
+
] : s.map((S) => p && d.getChannelIndex(m[S][D.SPATIAL_TARGET_C])), X = h ? [
|
|
2397
2489
|
p && null,
|
|
2398
2490
|
p && null,
|
|
2399
2491
|
p && null
|
|
2400
|
-
] : s.map((S) => m[S][
|
|
2401
|
-
let
|
|
2402
|
-
|
|
2403
|
-
const j = e[
|
|
2492
|
+
] : s.map((S) => m[S][D.SPATIAL_MAX_RESOLUTION]);
|
|
2493
|
+
let P = x[D.SPATIAL_SLICE_X], A = x[D.SPATIAL_SLICE_Y], N = x[D.SPATIAL_SLICE_Z];
|
|
2494
|
+
P = P !== null ? P : new b(-1, 1e5), A = A !== null ? A : new b(-1, 1e5), N = N !== null ? N : new b(-1, 1e5);
|
|
2495
|
+
const j = e[c].image.loaders[0].channels;
|
|
2404
2496
|
return {
|
|
2405
2497
|
valid: !0,
|
|
2406
2498
|
channelsVisible: Z,
|
|
2407
2499
|
allChannels: j,
|
|
2408
|
-
channelTargetC:
|
|
2500
|
+
channelTargetC: W,
|
|
2409
2501
|
channelMaxResolutionIndex: X,
|
|
2410
2502
|
data: u,
|
|
2411
|
-
colors:
|
|
2412
|
-
contrastLimits:
|
|
2503
|
+
colors: y,
|
|
2504
|
+
contrastLimits: R,
|
|
2413
2505
|
is3dMode: v,
|
|
2414
2506
|
layerTransparency: _,
|
|
2415
|
-
xSlice:
|
|
2416
|
-
ySlice:
|
|
2507
|
+
xSlice: P,
|
|
2508
|
+
ySlice: A,
|
|
2417
2509
|
zSlice: N
|
|
2418
2510
|
};
|
|
2419
2511
|
}
|
|
@@ -2432,39 +2524,39 @@ class Ke {
|
|
|
2432
2524
|
* @param {object} volumeDataManagerProps - Params derived from the volume data manager
|
|
2433
2525
|
* @returns {Object|null} Updated rendering settings or null if rendering is not possible
|
|
2434
2526
|
*/
|
|
2435
|
-
updateRendering({ zarrStoreShapes: t, originalScaleXYZ: e, physicalDimensionsXYZ:
|
|
2436
|
-
if (U("Updating rendering"), this.channelTargetC.findIndex((v,
|
|
2527
|
+
updateRendering({ zarrStoreShapes: t, originalScaleXYZ: e, physicalDimensionsXYZ: i, maxResolutionXYZ: a, boxDimensionsXYZ: n, normalizedScaleXYZ: o, bcTHREE: l, ptTHREE: c }) {
|
|
2528
|
+
if (U("Updating rendering"), this.channelTargetC.findIndex((v, h) => this.channelsVisible[h]), !Array.isArray(t) || t.length === 0)
|
|
2437
2529
|
return null;
|
|
2438
2530
|
const s = t[0], x = {
|
|
2439
2531
|
xLength: s[4] || 1,
|
|
2440
2532
|
yLength: s[3] || 1,
|
|
2441
2533
|
zLength: s[2] || 1
|
|
2442
2534
|
}, m = [], u = [], d = [];
|
|
2443
|
-
if (this.channelTargetC.forEach((v,
|
|
2444
|
-
this.channelsVisible[
|
|
2535
|
+
if (this.channelTargetC.forEach((v, h) => {
|
|
2536
|
+
this.channelsVisible[h];
|
|
2445
2537
|
{
|
|
2446
2538
|
const _ = [0, this.maxRange ? this.maxRange : 255];
|
|
2447
2539
|
u.push([
|
|
2448
|
-
this.colors[
|
|
2449
|
-
this.colors[
|
|
2450
|
-
this.colors[
|
|
2451
|
-
this.channelsVisible[
|
|
2452
|
-
]),
|
|
2540
|
+
this.colors[h][0] / 255,
|
|
2541
|
+
this.colors[h][1] / 255,
|
|
2542
|
+
this.colors[h][2] / 255,
|
|
2543
|
+
this.channelsVisible[h] ? 1 : 0
|
|
2544
|
+
]), r.debug("colorsSave", u), this.contrastLimits[h][0] === 0 && this.contrastLimits[h][1] === 255 ? d.push([
|
|
2453
2545
|
ee(_[0], _),
|
|
2454
2546
|
ee(_[1], _)
|
|
2455
2547
|
]) : d.push([
|
|
2456
|
-
ee(this.contrastLimits[
|
|
2457
|
-
ee(this.contrastLimits[
|
|
2548
|
+
ee(this.contrastLimits[h][0], _),
|
|
2549
|
+
ee(this.contrastLimits[h][1], _)
|
|
2458
2550
|
]);
|
|
2459
2551
|
}
|
|
2460
2552
|
}), !this.zarrInit) {
|
|
2461
|
-
this.originalScale = e, this.physicalDimensions =
|
|
2462
|
-
const v =
|
|
2463
|
-
this.normalizedScale =
|
|
2553
|
+
this.originalScale = e, this.physicalDimensions = i, this.maxResolution = a;
|
|
2554
|
+
const v = n;
|
|
2555
|
+
this.normalizedScale = o, this.meshScale = [
|
|
2464
2556
|
this.originalScale[0] / this.originalScale[0],
|
|
2465
2557
|
this.originalScale[1] / this.originalScale[0],
|
|
2466
2558
|
this.originalScale[2] / this.originalScale[0]
|
|
2467
|
-
], this.geometrySize = v, this.boxSize = v,
|
|
2559
|
+
], this.geometrySize = v, this.boxSize = v, r.debug("this.boxSize", this.boxSize), r.debug("this.geometrySize", this.geometrySize), r.debug("this.meshScale", this.meshScale), r.debug("this.originalScale", this.originalScale), r.debug("this.physicalDimensions", this.physicalDimensions), r.debug("this.maxResolution", this.maxResolution), r.debug("scaledResolution", v), this.zarrInit = !0;
|
|
2468
2560
|
}
|
|
2469
2561
|
return this.updateUniforms(
|
|
2470
2562
|
m,
|
|
@@ -2477,8 +2569,8 @@ class Ke {
|
|
|
2477
2569
|
this.xSlice,
|
|
2478
2570
|
this.ySlice,
|
|
2479
2571
|
this.zSlice,
|
|
2480
|
-
|
|
2481
|
-
|
|
2572
|
+
l,
|
|
2573
|
+
c
|
|
2482
2574
|
), {
|
|
2483
2575
|
uniforms: this.uniforms,
|
|
2484
2576
|
shader: this.shader,
|
|
@@ -2499,8 +2591,8 @@ class Ke {
|
|
|
2499
2591
|
* @param {Vector2} ySlice - Y clipping plane
|
|
2500
2592
|
* @param {Vector2} zSlice - Z clipping plane
|
|
2501
2593
|
*/
|
|
2502
|
-
updateUniforms(t, e,
|
|
2503
|
-
U("Updating uniforms"), this.uniforms.boxSize.value.set(this.boxSize[0], this.boxSize[1], this.boxSize[2]), this.uniforms.brickCacheTex.value = x, this.uniforms.pageTableTex.value = m, this.uniforms.near.value = 0.1, this.uniforms.far.value = 3e3, this.uniforms.opacity.value =
|
|
2594
|
+
updateUniforms(t, e, i, a, n, o, l, c, s, x, m) {
|
|
2595
|
+
U("Updating uniforms"), this.uniforms.boxSize.value.set(this.boxSize[0], this.boxSize[1], this.boxSize[2]), this.uniforms.brickCacheTex.value = x, this.uniforms.pageTableTex.value = m, this.uniforms.near.value = 0.1, this.uniforms.far.value = 3e3, this.uniforms.opacity.value = o, 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(a.length > 0 ? a[0][0] : null, a.length > 0 ? a[0][1] : null), this.uniforms.clim1.value.set(a.length > 1 ? a[1][0] : null, a.length > 1 ? a[1][1] : null), this.uniforms.clim2.value.set(a.length > 2 ? a[2][0] : null, a.length > 2 ? a[2][1] : null), this.uniforms.clim3.value.set(a.length > 3 ? a[3][0] : null, a.length > 3 ? a[3][1] : null), this.uniforms.clim4.value.set(a.length > 4 ? a[4][0] : null, a.length > 4 ? a[4][1] : null), this.uniforms.clim5.value.set(a.length > 5 ? a[5][0] : null, a.length > 5 ? a[5][1] : null), this.uniforms.clim6.value.set(a.length > 6 ? a[6][0] : null, a.length > 6 ? a[6][1] : null), this.uniforms.xClip.value.set(l[0] * (1 / this.maxResolution[0]) * this.boxSize[0], l[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(s[0] * (1 / this.maxResolution[2]) * this.boxSize[2], s[1] * (1 / this.maxResolution[2]) * this.boxSize[2]), this.uniforms.color0.value.set(n.length > 0 ? n[0][0] : null, n.length > 0 ? n[0][1] : null, n.length > 0 ? n[0][2] : null, n.length > 0 ? n[0][3] : null), this.uniforms.color1.value.set(n.length > 1 ? n[1][0] : null, n.length > 1 ? n[1][1] : null, n.length > 1 ? n[1][2] : null, n.length > 1 ? n[1][3] : null), this.uniforms.color2.value.set(n.length > 2 ? n[2][0] : null, n.length > 2 ? n[2][1] : null, n.length > 2 ? n[2][2] : null, n.length > 2 ? n[2][3] : null), this.uniforms.color3.value.set(n.length > 3 ? n[3][0] : null, n.length > 3 ? n[3][1] : null, n.length > 3 ? n[3][2] : null, n.length > 3 ? n[3][3] : null), this.uniforms.color4.value.set(n.length > 4 ? n[4][0] : null, n.length > 4 ? n[4][1] : null, n.length > 4 ? n[4][2] : null, n.length > 4 ? n[4][3] : null), this.uniforms.color5.value.set(n.length > 5 ? n[5][0] : null, n.length > 5 ? n[5][1] : null, n.length > 5 ? n[5][2] : null, n.length > 5 ? n[5][3] : null), this.uniforms.color6.value.set(n.length > 6 ? n[6][0] : null, n.length > 6 ? n[6][1] : null, n.length > 6 ? n[6][2] : null, n.length > 6 ? n[6][3] : null);
|
|
2504
2596
|
for (let u = 0; u < 7; u++)
|
|
2505
2597
|
typeof this.channelMaxResolutionIndex[u] == "number" && this.uniforms[`res${u}`].value.set(Math.max(1, this.channelMaxResolutionIndex[u]), this.zarrStoreNumResolutions - 1);
|
|
2506
2598
|
}
|
|
@@ -2515,31 +2607,31 @@ class Ke {
|
|
|
2515
2607
|
}
|
|
2516
2608
|
*/
|
|
2517
2609
|
setChannelMapping(t) {
|
|
2518
|
-
U("setting channel mapping"),
|
|
2610
|
+
U("setting channel mapping"), r.debug("channelMapping", t), this.uniforms.channelMapping.value = t;
|
|
2519
2611
|
}
|
|
2520
2612
|
// Only called on initialization of the
|
|
2521
2613
|
// VolumeDataManager and VolumeRenderManager for a particular image.
|
|
2522
2614
|
setZarrUniforms(t, e) {
|
|
2523
|
-
U("setting zarr uniforms"),
|
|
2524
|
-
for (let
|
|
2525
|
-
e.anchors && e.anchors[
|
|
2526
|
-
|
|
2527
|
-
for (let
|
|
2528
|
-
this.uniforms[`res${
|
|
2615
|
+
U("setting zarr uniforms"), r.debug("zarrStore", t), r.debug("PT", e);
|
|
2616
|
+
for (let i = 0; i <= 9; i++)
|
|
2617
|
+
e.anchors && e.anchors[i] ? this.uniforms[`anchor${i}`].value.set(e.anchors[i][0] || 0, e.anchors[i][1] || 0, e.anchors[i][2] || 0) : (r.debug("anchor", i, "does not exist"), this.uniforms[`anchor${i}`].value.set(0, 0, 0)), t.scales && t.scales[i] ? this.uniforms[`scale${i}`].value.set(t.scales[i][0] || 1, t.scales[i][1] || 1, t.scales[i][2] || 1) : r.debug("scale", i, "does not exist");
|
|
2618
|
+
r.debug("zarrStore.brickLayout", t.brickLayout), this.zarrStoreNumResolutions = t.brickLayout.length;
|
|
2619
|
+
for (let i = 0; i < 7; i++)
|
|
2620
|
+
this.uniforms[`res${i}`].value.set(
|
|
2529
2621
|
// TODO(mark) make this dependent on the per-channel maxResolution slider value.
|
|
2530
2622
|
1,
|
|
2531
2623
|
t.brickLayout.length - 1
|
|
2532
2624
|
);
|
|
2533
|
-
this.uniforms.resGlobal.value.set(1, t.brickLayout.length - 1), this.uniforms.voxelExtents.value.set(t.shapes[0][4], t.shapes[0][3], t.shapes[0][2]), this.uniforms.maxChannels.value = Math.min(t.channelCount, 7),
|
|
2625
|
+
this.uniforms.resGlobal.value.set(1, t.brickLayout.length - 1), this.uniforms.voxelExtents.value.set(t.shapes[0][4], t.shapes[0][3], t.shapes[0][2]), this.uniforms.maxChannels.value = Math.min(t.channelCount, 7), r.debug("this.channelsVisible", this.channelsVisible), r.debug("zarrStore.shapes[0]", t.shapes[0]), r.debug("PT", e), r.debug("uniforms", this.uniforms);
|
|
2534
2626
|
}
|
|
2535
2627
|
}
|
|
2536
|
-
const
|
|
2628
|
+
const We = `//
|
|
2537
2629
|
varying vec2 vUv;
|
|
2538
2630
|
void main() {
|
|
2539
2631
|
vUv = uv;
|
|
2540
2632
|
gl_Position = vec4(position, 1.0);
|
|
2541
2633
|
}
|
|
2542
|
-
`,
|
|
2634
|
+
`, $e = `//
|
|
2543
2635
|
// Input texture to blur
|
|
2544
2636
|
uniform sampler2D tDiffuse;
|
|
2545
2637
|
// Resolution of the texture (width, height)
|
|
@@ -2725,73 +2817,73 @@ void main() {
|
|
|
2725
2817
|
gl_FragColor = color;
|
|
2726
2818
|
}
|
|
2727
2819
|
`;
|
|
2728
|
-
function ge(
|
|
2729
|
-
const e =
|
|
2820
|
+
function ge(f, t) {
|
|
2821
|
+
const e = f.properties?.get(t);
|
|
2730
2822
|
return e?.framebuffer || e?.__webglFramebuffer || t.__webglFramebuffer;
|
|
2731
2823
|
}
|
|
2732
|
-
function K(
|
|
2733
|
-
oe
|
|
2824
|
+
function K(f) {
|
|
2825
|
+
ae(oe.DEBUG) && console.warn(`%cV: ${f}`, "background: deeppink; color: white; padding: 2px; border-radius: 3px;");
|
|
2734
2826
|
}
|
|
2735
|
-
function Qe(
|
|
2736
|
-
|
|
2827
|
+
function Qe(f, t, e, { mrtRef: i }) {
|
|
2828
|
+
f.setRenderTarget(i.current), f.clear(!0, !0, !0), f.render(e, t);
|
|
2737
2829
|
}
|
|
2738
|
-
function Je(
|
|
2739
|
-
|
|
2830
|
+
function Je(f, { screenSceneRef: t, screenCameraRef: e }) {
|
|
2831
|
+
f.setRenderTarget(null), f.clear(!0, !0, !0), f.render(t.current, e.current);
|
|
2740
2832
|
}
|
|
2741
|
-
function et(
|
|
2742
|
-
const
|
|
2743
|
-
e.noNewRequests === !0 &&
|
|
2833
|
+
function et(f, { frameRef: t, dataManager: e, mrtRef: i, bufRequest: a, bufUsage: n }) {
|
|
2834
|
+
const o = f.getContext(), l = t.current;
|
|
2835
|
+
e.noNewRequests === !0 && l % 100 === 0 && l < 500 && (e.noNewRequests = !1), e.triggerRequest === !0 && e.noNewRequests === !1 ? (o.bindFramebuffer(o.READ_FRAMEBUFFER, ge(f, i.current)), o.readBuffer(o.COLOR_ATTACHMENT1), o.readPixels(0, 0, i.current.width, i.current.height, o.RGBA, o.UNSIGNED_BYTE, a.current), e.processRequestData(a.current)) : e.triggerUsage === !0 && e.noNewRequests === !1 && (o.bindFramebuffer(o.READ_FRAMEBUFFER, ge(f, i.current)), o.readBuffer(o.COLOR_ATTACHMENT2), o.readPixels(0, 0, i.current.width, i.current.height, o.RGBA, o.UNSIGNED_BYTE, n.current), e.processUsageData(n.current));
|
|
2744
2836
|
}
|
|
2745
|
-
function tt(
|
|
2746
|
-
const { invalidate: e, isInteracting:
|
|
2747
|
-
if (
|
|
2748
|
-
|
|
2837
|
+
function tt(f, t) {
|
|
2838
|
+
const { invalidate: e, isInteracting: i, dataManager: a, spatialRenderingModeChanging: n, meshRef: o, stillRef: l, screenQuadRef: c, lastSampleRef: s, frameRef: x, lastFrameCountRef: m } = t;
|
|
2839
|
+
if (c.current && (l.current ? c.current.material.uniforms.gaussian.value = 0 : c.current.material.uniforms.gaussian.value = 7), i) {
|
|
2840
|
+
a.noNewRequests = !1, a.triggerUsage = !0;
|
|
2749
2841
|
return;
|
|
2750
2842
|
}
|
|
2751
|
-
if (
|
|
2843
|
+
if (n)
|
|
2752
2844
|
return;
|
|
2753
|
-
const u =
|
|
2754
|
-
if (
|
|
2755
|
-
d !== 0 ? (u && (u.renderRes.value = 0),
|
|
2845
|
+
const u = o.current?.material?.uniforms, d = u?.renderRes?.value ?? a?.PT?.lowestDataRes;
|
|
2846
|
+
if (a.noNewRequests) {
|
|
2847
|
+
d !== 0 ? (u && (u.renderRes.value = 0), r.debug("Adaptive Quality: No new requests. Setting renderSpeed to 0 (best quality)."), l.current = !1, c.current.material.uniforms.gaussian.value = 7, e()) : l.current || (r.debug("Adaptive Quality: No new requests and already at best quality. Setting stillRef to true."), l.current = !0, c.current.material.uniforms.gaussian.value = 0);
|
|
2756
2848
|
return;
|
|
2757
2849
|
}
|
|
2758
|
-
|
|
2759
|
-
const v =
|
|
2850
|
+
l.current && (l.current = !1, e());
|
|
2851
|
+
const v = f.getElapsedTime();
|
|
2760
2852
|
if (v - s.current < 1)
|
|
2761
2853
|
return;
|
|
2762
|
-
const
|
|
2854
|
+
const h = v - s.current, p = x.current - m.current;
|
|
2763
2855
|
let _ = 0;
|
|
2764
|
-
|
|
2765
|
-
const
|
|
2766
|
-
if (
|
|
2767
|
-
const Z = d + (
|
|
2856
|
+
h > 0 && (_ = p / h), s.current = v, m.current = x.current;
|
|
2857
|
+
const y = _ > 100 && d > 0, R = _ < 30 && d < a.PT.lowestDataRes;
|
|
2858
|
+
if (y || R) {
|
|
2859
|
+
const Z = d + (R ? 1 : -1);
|
|
2768
2860
|
u && (u.renderRes.value = Z), e();
|
|
2769
2861
|
}
|
|
2770
2862
|
}
|
|
2771
|
-
function
|
|
2863
|
+
function nt(f) {
|
|
2772
2864
|
const {
|
|
2773
2865
|
images: t,
|
|
2774
2866
|
imageLayerScopes: e,
|
|
2775
|
-
imageLayerCoordination:
|
|
2776
|
-
imageChannelScopesByLayer:
|
|
2777
|
-
imageChannelCoordination:
|
|
2867
|
+
imageLayerCoordination: i,
|
|
2868
|
+
imageChannelScopesByLayer: a,
|
|
2869
|
+
imageChannelCoordination: n,
|
|
2778
2870
|
// onInitComplete,
|
|
2779
|
-
spatialRenderingMode:
|
|
2780
|
-
spatialRenderingModeChanging:
|
|
2781
|
-
} =
|
|
2782
|
-
gl:
|
|
2871
|
+
spatialRenderingMode: o,
|
|
2872
|
+
spatialRenderingModeChanging: l
|
|
2873
|
+
} = f, {
|
|
2874
|
+
gl: c
|
|
2783
2875
|
// scene,
|
|
2784
2876
|
// camera
|
|
2785
|
-
} = fe(), s = fe((
|
|
2877
|
+
} = fe(), s = fe((T) => T.invalidate), x = z(null), m = z(null), u = z(null), d = z(null), v = z(null), [h, p] = re({
|
|
2786
2878
|
uniforms: null,
|
|
2787
2879
|
shader: null,
|
|
2788
2880
|
meshScale: [1, 1, 1],
|
|
2789
2881
|
geometrySize: [1, 1, 1]
|
|
2790
|
-
}), [_,
|
|
2882
|
+
}), [_, y] = re(!1), R = z(null), Z = z(null), W = z(null), [X, P] = re(!1), A = z(null), N = z(!1), j = z(0), S = z(0), be = z(0), g = ue(() => new je(c), [c]), w = ue(() => new Ke(), []);
|
|
2791
2883
|
H(() => {
|
|
2792
2884
|
K("useEffect MRT target matching canvas");
|
|
2793
|
-
const { width:
|
|
2794
|
-
|
|
2885
|
+
const { width: T, height: L } = c.domElement, F = new ze(T, L, 3);
|
|
2886
|
+
F.texture.forEach((Y) => {
|
|
2795
2887
|
Y.format = ke, Y.type = pe, Y.minFilter = te, Y.magFilter = te, Y.generateMipmaps = !1;
|
|
2796
2888
|
});
|
|
2797
2889
|
const B = new Ie(), Q = new De(-1, 1, 1, -1, 0.1, 10);
|
|
@@ -2799,35 +2891,35 @@ function rt(h) {
|
|
|
2799
2891
|
const J = new Me({
|
|
2800
2892
|
uniforms: {
|
|
2801
2893
|
// Bind the first render target texture as the input of the gaussian blur shader.
|
|
2802
|
-
tDiffuse: { value:
|
|
2803
|
-
resolution: { value: new b(
|
|
2894
|
+
tDiffuse: { value: F.texture[0] },
|
|
2895
|
+
resolution: { value: new b(T, L) },
|
|
2804
2896
|
gaussian: { value: 7 }
|
|
2805
2897
|
},
|
|
2806
|
-
vertexShader:
|
|
2807
|
-
fragmentShader:
|
|
2898
|
+
vertexShader: We,
|
|
2899
|
+
fragmentShader: $e,
|
|
2808
2900
|
transparent: !0
|
|
2809
|
-
}), q = new
|
|
2810
|
-
return B.add(q),
|
|
2811
|
-
|
|
2901
|
+
}), q = new Pe(new Ae(2, 2), J);
|
|
2902
|
+
return B.add(q), R.current = B, Z.current = Q, W.current = q, u.current = new Uint8Array(T * L * 4), d.current = new Uint8Array(T * L * 4), v.current = F, () => {
|
|
2903
|
+
F.dispose(), J.dispose(), q.geometry.dispose();
|
|
2812
2904
|
};
|
|
2813
|
-
}, [
|
|
2814
|
-
const
|
|
2815
|
-
|
|
2816
|
-
const
|
|
2905
|
+
}, [c]);
|
|
2906
|
+
const ne = e?.[0], _e = t?.[ne];
|
|
2907
|
+
a?.[ne];
|
|
2908
|
+
const $ = n?.[0]?.[ne];
|
|
2817
2909
|
H(() => {
|
|
2818
2910
|
if (K("useEffect INIT"), !g || !w) {
|
|
2819
|
-
|
|
2911
|
+
r.debug("dataManager or renderManager not initialized yet");
|
|
2820
2912
|
return;
|
|
2821
2913
|
}
|
|
2822
2914
|
if (!_e) {
|
|
2823
|
-
|
|
2915
|
+
r.debug("no first image layer yet");
|
|
2824
2916
|
return;
|
|
2825
2917
|
}
|
|
2826
|
-
if (
|
|
2827
|
-
|
|
2918
|
+
if (!$) {
|
|
2919
|
+
r.debug("no firstImageLayerChannelCoordination yet");
|
|
2828
2920
|
return;
|
|
2829
2921
|
}
|
|
2830
|
-
(async () => (g.initImages(t, e), await g.init(
|
|
2922
|
+
(async () => (g.initImages(t, e), await g.init($), w.setZarrUniforms(g.zarrStore, g.PT), w.setChannelMapping(g.channels.colorMappings), r.debug("rm.uniforms", w.uniforms)))();
|
|
2831
2923
|
}, [
|
|
2832
2924
|
g,
|
|
2833
2925
|
w,
|
|
@@ -2835,19 +2927,19 @@ function rt(h) {
|
|
|
2835
2927
|
e
|
|
2836
2928
|
]), H(() => {
|
|
2837
2929
|
K("useEffect spatialRenderingMode");
|
|
2838
|
-
const
|
|
2839
|
-
if (
|
|
2840
|
-
const
|
|
2930
|
+
const T = o === "3D";
|
|
2931
|
+
if (y(T), T && g && w) {
|
|
2932
|
+
const L = {
|
|
2841
2933
|
images: t,
|
|
2842
2934
|
imageLayerScopes: e,
|
|
2843
|
-
imageLayerCoordination:
|
|
2844
|
-
imageChannelScopesByLayer:
|
|
2845
|
-
imageChannelCoordination:
|
|
2846
|
-
spatialRenderingMode:
|
|
2935
|
+
imageLayerCoordination: i,
|
|
2936
|
+
imageChannelScopesByLayer: a,
|
|
2937
|
+
imageChannelCoordination: n,
|
|
2938
|
+
spatialRenderingMode: o
|
|
2847
2939
|
};
|
|
2848
|
-
if (w.updateFromProps(
|
|
2849
|
-
const { zarrInit:
|
|
2850
|
-
|
|
2940
|
+
if (w.updateFromProps(L)) {
|
|
2941
|
+
const { zarrInit: F } = w;
|
|
2942
|
+
F || (g.ptTHREE.needsUpdate = !1, g.bcTHREE.needsUpdate = !1, g.renderer.initTexture(g.bcTHREE), g.renderer.initTexture(g.ptTHREE), g.initTexture());
|
|
2851
2943
|
const B = w.updateRendering({
|
|
2852
2944
|
zarrStoreShapes: g.zarrStore.shapes,
|
|
2853
2945
|
originalScaleXYZ: g.getOriginalScaleXYZ(),
|
|
@@ -2866,55 +2958,55 @@ function rt(h) {
|
|
|
2866
2958
|
w,
|
|
2867
2959
|
t,
|
|
2868
2960
|
e,
|
|
2961
|
+
i,
|
|
2962
|
+
a,
|
|
2869
2963
|
n,
|
|
2870
|
-
o
|
|
2871
|
-
r,
|
|
2872
|
-
a
|
|
2964
|
+
o
|
|
2873
2965
|
]), H(() => {
|
|
2874
2966
|
if (K("useEffect isInteracting"), X) {
|
|
2875
|
-
const
|
|
2876
|
-
|
|
2967
|
+
const T = m.current?.material?.uniforms;
|
|
2968
|
+
T && (T.renderRes.value = g.PT.lowestDataRes), N.current = !1, s();
|
|
2877
2969
|
}
|
|
2878
|
-
}, [s, X]), Ue((
|
|
2879
|
-
if (!v.current || !g || !w)
|
|
2970
|
+
}, [s, X]), Ue((T, L, F) => {
|
|
2971
|
+
if (!v.current || !g || !w || !h.shader)
|
|
2880
2972
|
return;
|
|
2881
|
-
const { gl: B, camera: Q, scene: J, clock: q } =
|
|
2882
|
-
N.current || Qe(B, Q, J, { mrtRef: v }), Je(B, { screenSceneRef:
|
|
2973
|
+
const { gl: B, camera: Q, scene: J, clock: q } = T;
|
|
2974
|
+
N.current || Qe(B, Q, J, { mrtRef: v }), Je(B, { screenSceneRef: R, screenCameraRef: Z }), et(B, { frameRef: j, dataManager: g, mrtRef: v, bufRequest: u, bufUsage: d }), tt(q, {
|
|
2883
2975
|
invalidate: s,
|
|
2884
2976
|
isInteracting: X,
|
|
2885
2977
|
dataManager: g,
|
|
2886
|
-
spatialRenderingModeChanging:
|
|
2978
|
+
spatialRenderingModeChanging: l,
|
|
2887
2979
|
meshRef: m,
|
|
2888
2980
|
stillRef: N,
|
|
2889
|
-
screenQuadRef:
|
|
2981
|
+
screenQuadRef: W,
|
|
2890
2982
|
lastSampleRef: S,
|
|
2891
2983
|
frameRef: j,
|
|
2892
2984
|
lastFrameCountRef: be
|
|
2893
2985
|
}), j.current += 1;
|
|
2894
2986
|
}, 1);
|
|
2895
|
-
const
|
|
2896
|
-
|
|
2897
|
-
}, []),
|
|
2898
|
-
clearTimeout(
|
|
2899
|
-
|
|
2987
|
+
const Ce = he((T) => {
|
|
2988
|
+
P(!0);
|
|
2989
|
+
}, []), Re = he((T) => {
|
|
2990
|
+
clearTimeout(A.current), A.current = setTimeout(() => {
|
|
2991
|
+
P(!1);
|
|
2900
2992
|
}, 300);
|
|
2901
2993
|
}, []);
|
|
2902
2994
|
return H(() => {
|
|
2903
|
-
K("useEffect firstImageLayerChannelCoordination"),
|
|
2904
|
-
|
|
2995
|
+
K("useEffect firstImageLayerChannelCoordination"), P(!0), r.debug("something about channels changed"), g.updateChannels($), w.setChannelMapping(g.channels.colorMappings), clearTimeout(A.current), A.current = setTimeout(() => {
|
|
2996
|
+
P(!1);
|
|
2905
2997
|
}, 300);
|
|
2906
|
-
}, [
|
|
2998
|
+
}, [$]), !_ || !g || !w ? null : h.shader ? M.jsxs("group", { children: [M.jsx(
|
|
2907
2999
|
de,
|
|
2908
3000
|
{
|
|
2909
3001
|
// ref={mainOrbitControlsRef}
|
|
2910
3002
|
enableDamping: !1,
|
|
2911
|
-
onStart:
|
|
2912
|
-
onEnd:
|
|
3003
|
+
onStart: Ce,
|
|
3004
|
+
onEnd: Re
|
|
2913
3005
|
}
|
|
2914
|
-
),
|
|
3006
|
+
), M.jsxs("mesh", { ref: m, scale: h.meshScale, children: [M.jsx("boxGeometry", { args: h.geometrySize }), M.jsx("shaderMaterial", { uniforms: h.uniforms, vertexShader: h.shader.vertexShader, fragmentShader: h.shader.fragmentShader, side: Ne, transparent: !1, glslVersion: Be })] })] }) : M.jsxs("group", { children: [M.jsxs("mesh", { children: [M.jsx("boxGeometry", { args: [1, 1, 1] }), M.jsx("meshBasicMaterial", { color: "#444", wireframe: !0 })] }), M.jsx(de, { ref: x })] });
|
|
2915
3007
|
}
|
|
2916
|
-
function st(
|
|
2917
|
-
return
|
|
3008
|
+
function st(f) {
|
|
3009
|
+
return M.jsx(Oe, { frameloop: "always", style: {
|
|
2918
3010
|
position: "absolute",
|
|
2919
3011
|
top: 0,
|
|
2920
3012
|
left: 0,
|
|
@@ -2934,7 +3026,7 @@ function st(h) {
|
|
|
2934
3026
|
logarithmicDepthBuffer: !1,
|
|
2935
3027
|
preserveDrawingBuffer: !1,
|
|
2936
3028
|
autoClear: !1
|
|
2937
|
-
}, children:
|
|
3029
|
+
}, children: M.jsx(nt, { ...f }) });
|
|
2938
3030
|
}
|
|
2939
3031
|
export {
|
|
2940
3032
|
st as SpatialWrapper
|