@idetik/core 0.35.4 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +67 -68
- package/dist/index.js +127 -110
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +16 -16
- package/dist/index.umd.cjs.map +1 -1
- package/dist/types/src/core/event_dispatcher.d.ts +1 -0
- package/dist/types/src/core/event_dispatcher.d.ts.map +1 -1
- package/dist/types/src/core/image_source_policy.d.ts +5 -5
- package/dist/types/src/core/image_source_policy.d.ts.map +1 -1
- package/dist/types/src/core/layer.d.ts +5 -7
- package/dist/types/src/core/layer.d.ts.map +1 -1
- package/dist/types/src/core/renderer.d.ts +2 -1
- package/dist/types/src/core/renderer.d.ts.map +1 -1
- package/dist/types/src/core/viewport.d.ts +4 -4
- package/dist/types/src/core/viewport.d.ts.map +1 -1
- package/dist/types/src/idetik.d.ts +5 -5
- package/dist/types/src/idetik.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/layers/image_layer.d.ts +4 -3
- package/dist/types/src/layers/image_layer.d.ts.map +1 -1
- package/dist/types/src/layers/label_layer.d.ts +3 -4
- package/dist/types/src/layers/label_layer.d.ts.map +1 -1
- package/dist/types/src/layers/volume_layer.d.ts +3 -2
- package/dist/types/src/layers/volume_layer.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/orbit_controls.d.ts +2 -2
- package/dist/types/src/objects/cameras/orbit_controls.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/orthographic_camera.d.ts +2 -2
- package/dist/types/src/objects/cameras/orthographic_camera.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/perspective_camera.d.ts +2 -2
- package/dist/types/src/objects/cameras/perspective_camera.d.ts.map +1 -1
- package/dist/types/src/objects/renderable/label_image_renderable.d.ts +10 -1
- package/dist/types/src/objects/renderable/label_image_renderable.d.ts.map +1 -1
- package/dist/types/src/objects/renderable/{points.d.ts → points_renderable.d.ts} +4 -4
- package/dist/types/src/objects/renderable/points_renderable.d.ts.map +1 -0
- package/dist/types/src/objects/renderable/{projected_line.d.ts → projected_line_renderable.d.ts} +4 -4
- package/dist/types/src/objects/renderable/projected_line_renderable.d.ts.map +1 -0
- package/dist/types/src/renderers/webgl_renderer.d.ts +4 -1
- package/dist/types/src/renderers/webgl_renderer.d.ts.map +1 -1
- package/dist/types/src/renderers/webgl_state.d.ts +4 -0
- package/dist/types/src/renderers/webgl_state.d.ts.map +1 -1
- package/dist/types/test/event_dispatcher.test.d.ts +2 -0
- package/dist/types/test/event_dispatcher.test.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/types/src/objects/renderable/label_color_map.d.ts +0 -11
- package/dist/types/src/objects/renderable/label_color_map.d.ts.map +0 -1
- package/dist/types/src/objects/renderable/points.d.ts.map +0 -1
- package/dist/types/src/objects/renderable/projected_line.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1600,6 +1600,9 @@ class eQ {
|
|
|
1600
1600
|
currentViewport_ = null;
|
|
1601
1601
|
currentScissor_ = null;
|
|
1602
1602
|
currentCullingMode_ = null;
|
|
1603
|
+
stencilFunc_ = null;
|
|
1604
|
+
stencilRef_ = null;
|
|
1605
|
+
stencilFuncMask_ = null;
|
|
1603
1606
|
constructor(A) {
|
|
1604
1607
|
this.gl_ = A, this.gl_.frontFace(this.gl_.CW);
|
|
1605
1608
|
}
|
|
@@ -1689,6 +1692,9 @@ class eQ {
|
|
|
1689
1692
|
setStencilTest(A) {
|
|
1690
1693
|
A ? this.enable(this.gl_.STENCIL_TEST) : this.disable(this.gl_.STENCIL_TEST);
|
|
1691
1694
|
}
|
|
1695
|
+
setStencilFunc(A, I, B) {
|
|
1696
|
+
(this.stencilFunc_ !== A || this.stencilRef_ !== I || this.stencilFuncMask_ !== B) && (this.gl_.stencilFunc(A, I, B), this.stencilFunc_ = A, this.stencilRef_ = I, this.stencilFuncMask_ = B);
|
|
1697
|
+
}
|
|
1692
1698
|
}
|
|
1693
1699
|
const nQ = PB($(), [1, -1, 1]);
|
|
1694
1700
|
class GQ extends RC {
|
|
@@ -1698,6 +1704,7 @@ class GQ extends RC {
|
|
|
1698
1704
|
textures_;
|
|
1699
1705
|
state_;
|
|
1700
1706
|
renderedObjectsPerFrame_ = 0;
|
|
1707
|
+
stencilRef_ = 0;
|
|
1701
1708
|
currentViewportSize_ = [0, 0];
|
|
1702
1709
|
constructor(A) {
|
|
1703
1710
|
super(A);
|
|
@@ -1720,7 +1727,7 @@ class GQ extends RC {
|
|
|
1720
1727
|
return this.textures_.textureCount;
|
|
1721
1728
|
}
|
|
1722
1729
|
render(A) {
|
|
1723
|
-
this.renderedObjects_ = 0, this.renderedObjectsPerFrame_ = 0;
|
|
1730
|
+
this.renderedObjects_ = 0, this.renderedObjectsPerFrame_ = 0, this.stencilRef_ = 0;
|
|
1724
1731
|
const I = [], B = [];
|
|
1725
1732
|
for (const D of A.layers)
|
|
1726
1733
|
(D.blendMode === "none" ? I : B).push(D);
|
|
@@ -1755,33 +1762,38 @@ class GQ extends RC {
|
|
|
1755
1762
|
this.renderedObjects_ = this.renderedObjectsPerFrame_;
|
|
1756
1763
|
}
|
|
1757
1764
|
initStencil() {
|
|
1758
|
-
this.gl_.clearStencil(0), this.gl_.stencilMask(255), this.gl_.
|
|
1765
|
+
this.gl_.clearStencil(0), this.gl_.stencilMask(255), this.gl_.stencilOp(this.gl_.KEEP, this.gl_.KEEP, this.gl_.REPLACE);
|
|
1766
|
+
}
|
|
1767
|
+
setCoverageStencil(A) {
|
|
1768
|
+
this.state_.setStencilTest(A !== null), A !== null && (this.stencilRef_ += 1, this.stencilRef_ > 255 && k.warn(
|
|
1769
|
+
"WebGLRenderer",
|
|
1770
|
+
"Exceeded 255 stencil coverage groups in one frame; dedup may be incorrect"
|
|
1771
|
+
), this.state_.setStencilFunc(this.gl_.NOTEQUAL, this.stencilRef_, 255));
|
|
1759
1772
|
}
|
|
1760
1773
|
renderLayer(A, I, B) {
|
|
1761
|
-
if (A.objects.length === 0) return;
|
|
1762
1774
|
this.state_.setBlendingMode(A.blendMode);
|
|
1763
|
-
const C
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1775
|
+
for (const [C, Q] of A.coverageGroups) {
|
|
1776
|
+
this.setCoverageStencil(C);
|
|
1777
|
+
for (const E of Q)
|
|
1778
|
+
B.intersectsWithBox3(E.boundingBox) && (this.renderObject(A, E, I), this.renderedObjectsPerFrame_ += 1);
|
|
1779
|
+
}
|
|
1767
1780
|
}
|
|
1768
1781
|
renderObject(A, I, B) {
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
this.textures_.bindTexture(E, i);
|
|
1782
|
+
if (I.popStaleTextures().forEach((Q) => {
|
|
1783
|
+
this.textures_.dispose(Q);
|
|
1784
|
+
}), !I.programName) return;
|
|
1785
|
+
this.state_.setCullFaceMode(I.cullFaceMode), this.state_.setDepthTesting(I.depthTest), this.bindings_.bindGeometry(I.geometry), I.textures.forEach((Q, E) => {
|
|
1786
|
+
this.textures_.bindTexture(Q, E);
|
|
1775
1787
|
});
|
|
1776
|
-
const
|
|
1777
|
-
if (this.drawGeometry(
|
|
1778
|
-
this.bindings_.bindGeometry(
|
|
1779
|
-
const
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1788
|
+
const C = this.programs_.use(I.programName);
|
|
1789
|
+
if (this.drawGeometry(I.geometry, I, A, C, B), I.wireframeEnabled) {
|
|
1790
|
+
this.bindings_.bindGeometry(I.wireframeGeometry);
|
|
1791
|
+
const Q = this.programs_.use("wireframe");
|
|
1792
|
+
Q.setUniform("u_color", I.wireframeColor.rgb), this.drawGeometry(
|
|
1793
|
+
I.wireframeGeometry,
|
|
1794
|
+
I,
|
|
1783
1795
|
A,
|
|
1784
|
-
|
|
1796
|
+
Q,
|
|
1785
1797
|
B
|
|
1786
1798
|
);
|
|
1787
1799
|
}
|
|
@@ -1869,7 +1881,9 @@ class GQ extends RC {
|
|
|
1869
1881
|
this.state_.setViewport(B);
|
|
1870
1882
|
}
|
|
1871
1883
|
clear() {
|
|
1872
|
-
this.gl_.clearColor(0, 0, 0, 0), this.gl_.clear(
|
|
1884
|
+
this.gl_.clearColor(0, 0, 0, 0), this.gl_.clear(
|
|
1885
|
+
this.gl_.COLOR_BUFFER_BIT | this.gl_.DEPTH_BUFFER_BIT | this.gl_.STENCIL_BUFFER_BIT
|
|
1886
|
+
), this.state_.setDepthTesting(!0), this.gl_.depthFunc(this.gl_.LEQUAL);
|
|
1873
1887
|
}
|
|
1874
1888
|
}
|
|
1875
1889
|
function ZA(g, A) {
|
|
@@ -2733,6 +2747,12 @@ class dQ {
|
|
|
2733
2747
|
addEventListener(A) {
|
|
2734
2748
|
this.listeners_.push(A);
|
|
2735
2749
|
}
|
|
2750
|
+
removeEventListener(A) {
|
|
2751
|
+
const I = this.listeners_.indexOf(A);
|
|
2752
|
+
if (I === -1)
|
|
2753
|
+
throw new Error(`Listener to remove could not be found: ${A}`);
|
|
2754
|
+
this.listeners_.splice(I, 1);
|
|
2755
|
+
}
|
|
2736
2756
|
connect() {
|
|
2737
2757
|
if (this.isConnected_) {
|
|
2738
2758
|
k.warn(
|
|
@@ -3081,11 +3101,7 @@ class ho {
|
|
|
3081
3101
|
return this.viewports_.find((I) => I.id === A);
|
|
3082
3102
|
}
|
|
3083
3103
|
addViewport(A) {
|
|
3084
|
-
const [I] = _g(
|
|
3085
|
-
[A],
|
|
3086
|
-
this.canvas,
|
|
3087
|
-
this.context_
|
|
3088
|
-
);
|
|
3104
|
+
const [I] = _g([A], this.canvas, this.context_);
|
|
3089
3105
|
return jB(I, this.viewports_), this.viewports_.push(I), this.running && (I.events.connect(), I.element !== this.canvas && this.sizeObserver_.observe(I.element)), k.info("Idetik", `Added viewport "${I.id}"`), I;
|
|
3090
3106
|
}
|
|
3091
3107
|
removeViewport(A) {
|
|
@@ -11870,7 +11886,7 @@ class OA {
|
|
|
11870
11886
|
}
|
|
11871
11887
|
}
|
|
11872
11888
|
class KI {
|
|
11873
|
-
|
|
11889
|
+
coverageGroups_ = /* @__PURE__ */ new Map();
|
|
11874
11890
|
state_ = "initialized";
|
|
11875
11891
|
attached_ = !1;
|
|
11876
11892
|
callbacks_ = [];
|
|
@@ -11904,8 +11920,8 @@ class KI {
|
|
|
11904
11920
|
}
|
|
11905
11921
|
detach(A) {
|
|
11906
11922
|
}
|
|
11907
|
-
get
|
|
11908
|
-
return this.
|
|
11923
|
+
get coverageGroups() {
|
|
11924
|
+
return this.coverageGroups_;
|
|
11909
11925
|
}
|
|
11910
11926
|
get state() {
|
|
11911
11927
|
return this.state_;
|
|
@@ -11915,26 +11931,20 @@ class KI {
|
|
|
11915
11931
|
}
|
|
11916
11932
|
removeStateChangeCallback(A) {
|
|
11917
11933
|
const I = this.callbacks_.indexOf(A);
|
|
11918
|
-
if (I ===
|
|
11934
|
+
if (I === -1)
|
|
11919
11935
|
throw new Error(`Callback to remove could not be found: ${A}`);
|
|
11920
11936
|
this.callbacks_.splice(I, 1);
|
|
11921
11937
|
}
|
|
11922
|
-
hasMultipleLODs() {
|
|
11923
|
-
return !1;
|
|
11924
|
-
}
|
|
11925
11938
|
setState(A) {
|
|
11926
11939
|
const I = this.state_;
|
|
11927
11940
|
this.state_ = A, this.callbacks_.forEach((B) => B(A, I));
|
|
11928
11941
|
}
|
|
11929
|
-
addObject(A) {
|
|
11930
|
-
this.
|
|
11931
|
-
|
|
11932
|
-
removeObject(A) {
|
|
11933
|
-
const I = this.objects_.indexOf(A);
|
|
11934
|
-
I !== -1 && this.objects_.splice(I, 1);
|
|
11942
|
+
addObject(A, I = null) {
|
|
11943
|
+
const B = this.coverageGroups_.get(I);
|
|
11944
|
+
B ? B.push(A) : this.coverageGroups_.set(I, [A]);
|
|
11935
11945
|
}
|
|
11936
11946
|
clearObjects() {
|
|
11937
|
-
this.
|
|
11947
|
+
this.coverageGroups_.clear();
|
|
11938
11948
|
}
|
|
11939
11949
|
/**
|
|
11940
11950
|
* Get uniforms for shader program. Override in derived classes that need custom uniforms.
|
|
@@ -12210,7 +12220,7 @@ class Hi extends xA {
|
|
|
12210
12220
|
super(), this.geometry = A, this.color_ = x.from(I), this.width_ = B, this.programName = "projectedLine";
|
|
12211
12221
|
}
|
|
12212
12222
|
get type() {
|
|
12213
|
-
return "
|
|
12223
|
+
return "ProjectedLineRenderable";
|
|
12214
12224
|
}
|
|
12215
12225
|
get color() {
|
|
12216
12226
|
return this.color_;
|
|
@@ -12451,6 +12461,7 @@ class eC extends KI {
|
|
|
12451
12461
|
orientation_;
|
|
12452
12462
|
onPickValue_;
|
|
12453
12463
|
visibleChunks_ = /* @__PURE__ */ new Map();
|
|
12464
|
+
orderedChunks_ = [];
|
|
12454
12465
|
pool_ = new pg();
|
|
12455
12466
|
initialChannelProps_;
|
|
12456
12467
|
channelChangeCallbacks_ = [];
|
|
@@ -12478,22 +12489,20 @@ class eC extends KI {
|
|
|
12478
12489
|
onPickValue: E,
|
|
12479
12490
|
...i
|
|
12480
12491
|
}) {
|
|
12481
|
-
super(i), this.setState("initialized"), this.source_ = A, this.policy_ = B, this.sliceCoords_ = I, this.orientation_ = C ?? "XY", this.axes_ = MA(this.orientation_), this.planeRotation_ = dA(this.axes_), this.channelProps_ = Q, this.initialChannelProps_ = Q, this.onPickValue_ = E;
|
|
12492
|
+
super({ blendMode: "additive", ...i }), this.setState("initialized"), this.source_ = A, this.policy_ = B, this.sliceCoords_ = I, this.orientation_ = C ?? "XY", this.axes_ = MA(this.orientation_), this.planeRotation_ = dA(this.axes_), this.channelProps_ = Q, this.initialChannelProps_ = Q, this.onPickValue_ = E;
|
|
12482
12493
|
}
|
|
12483
12494
|
attach(A) {
|
|
12484
12495
|
this.context_ = A, this.chunkStoreView_ = A.chunkManager.addView(
|
|
12485
12496
|
this.source_,
|
|
12486
12497
|
this.policy_,
|
|
12487
12498
|
this.axes_
|
|
12499
|
+
), hC(
|
|
12500
|
+
this.channelProps_,
|
|
12501
|
+
this.chunkStoreView_.channelCount
|
|
12488
12502
|
);
|
|
12489
|
-
const I = this.chunkStoreView_.channelCount;
|
|
12490
|
-
if (hC(this.channelProps_, I), I > 1 && this.sliceCoords_.c !== void 0 && this.sliceCoords_.c.length > 1)
|
|
12491
|
-
throw new Error(
|
|
12492
|
-
`ImageLayer requires exactly one channel in sliceCoords.c for multi-channel sources (found ${I} channels). Use one layer per channel.`
|
|
12493
|
-
);
|
|
12494
12503
|
}
|
|
12495
12504
|
detach(A) {
|
|
12496
|
-
this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.clearObjects(), this.chunkStoreView_?.dispose(), this.chunkStoreView_ = void 0, this.context_ = void 0;
|
|
12505
|
+
this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.orderedChunks_ = [], this.clearObjects(), this.chunkStoreView_?.dispose(), this.chunkStoreView_ = void 0, this.context_ = void 0;
|
|
12497
12506
|
}
|
|
12498
12507
|
update(A) {
|
|
12499
12508
|
if (!A || !this.chunkStoreView_) return;
|
|
@@ -12513,7 +12522,7 @@ class eC extends KI {
|
|
|
12513
12522
|
* for the new plane, chunks already resident in the shared cache are reused.
|
|
12514
12523
|
*/
|
|
12515
12524
|
setOrientation(A) {
|
|
12516
|
-
A !== this.orientation_ && (this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.clearObjects(), this.chunkStoreView_?.dispose(), this.lastPresentationTimeStamp_ = void 0, this.lastPresentationTimeCoord_ = void 0, this.orientation_ = A, this.axes_ = MA(A), this.planeRotation_ = dA(this.axes_), this.context_ && (this.chunkStoreView_ = this.context_.chunkManager.addView(
|
|
12525
|
+
A !== this.orientation_ && (this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.orderedChunks_ = [], this.clearObjects(), this.chunkStoreView_?.dispose(), this.lastPresentationTimeStamp_ = void 0, this.lastPresentationTimeCoord_ = void 0, this.orientation_ = A, this.axes_ = MA(A), this.planeRotation_ = dA(this.axes_), this.context_ && (this.chunkStoreView_ = this.context_.chunkManager.addView(
|
|
12517
12526
|
this.source_,
|
|
12518
12527
|
this.policy_,
|
|
12519
12528
|
this.axes_
|
|
@@ -12531,14 +12540,20 @@ class eC extends KI {
|
|
|
12531
12540
|
const I = this.chunkStoreView_.getChunksToRender(), B = new Set(I), C = Array.from(this.visibleChunks_.keys()).filter(
|
|
12532
12541
|
(Q) => !B.has(Q)
|
|
12533
12542
|
);
|
|
12534
|
-
this.releaseAndRemoveChunks(C)
|
|
12535
|
-
for (const Q of I)
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
|
|
12543
|
+
this.releaseAndRemoveChunks(C);
|
|
12544
|
+
for (const Q of I)
|
|
12545
|
+
this.visibleChunks_.set(
|
|
12546
|
+
Q,
|
|
12547
|
+
this.getImageForChunk(Q, Q.texture)
|
|
12548
|
+
);
|
|
12549
|
+
this.orderedChunks_ = I, this.rebuildRenderGroups();
|
|
12539
12550
|
}
|
|
12540
|
-
|
|
12541
|
-
|
|
12551
|
+
rebuildRenderGroups() {
|
|
12552
|
+
this.clearObjects();
|
|
12553
|
+
for (const A of this.orderedChunks_) {
|
|
12554
|
+
const I = this.visibleChunks_.get(A), B = A.chunkIndex.c;
|
|
12555
|
+
I === void 0 || this.channelProps_?.[B]?.visible === !1 || this.addObject(I, B);
|
|
12556
|
+
}
|
|
12542
12557
|
}
|
|
12543
12558
|
get lastPresentationTimeCoord() {
|
|
12544
12559
|
return this.lastPresentationTimeCoord_;
|
|
@@ -12656,7 +12671,7 @@ class eC extends KI {
|
|
|
12656
12671
|
setChannelProps(A) {
|
|
12657
12672
|
this.channelProps_ = A, this.visibleChunks_.forEach((I, B) => {
|
|
12658
12673
|
I.setChannelProps(this.getChannelPropsForChunk(B));
|
|
12659
|
-
}), this.channelChangeCallbacks_.forEach((I) => {
|
|
12674
|
+
}), this.rebuildRenderGroups(), this.channelChangeCallbacks_.forEach((I) => {
|
|
12660
12675
|
I();
|
|
12661
12676
|
});
|
|
12662
12677
|
}
|
|
@@ -12871,7 +12886,7 @@ class Fo extends KI {
|
|
|
12871
12886
|
pool_ = new pg();
|
|
12872
12887
|
initialChannelProps_;
|
|
12873
12888
|
channelChangeCallbacks_ = [];
|
|
12874
|
-
|
|
12889
|
+
policy_;
|
|
12875
12890
|
chunkStoreView_;
|
|
12876
12891
|
channelProps_;
|
|
12877
12892
|
lastLoadedTime_ = void 0;
|
|
@@ -12893,8 +12908,8 @@ class Fo extends KI {
|
|
|
12893
12908
|
this.debugShowWireframes_ = A;
|
|
12894
12909
|
}
|
|
12895
12910
|
}
|
|
12896
|
-
set
|
|
12897
|
-
this.
|
|
12911
|
+
set imageSourcePolicy(A) {
|
|
12912
|
+
this.policy_ !== A && (this.policy_ = A, this.chunkStoreView_ && this.chunkStoreView_.setImageSourcePolicy(
|
|
12898
12913
|
A,
|
|
12899
12914
|
YI
|
|
12900
12915
|
));
|
|
@@ -12918,12 +12933,12 @@ class Fo extends KI {
|
|
|
12918
12933
|
}
|
|
12919
12934
|
removeChannelChangeCallback(A) {
|
|
12920
12935
|
const I = this.channelChangeCallbacks_.indexOf(A);
|
|
12921
|
-
if (I ===
|
|
12936
|
+
if (I === -1)
|
|
12922
12937
|
throw new Error(`Callback to remove could not be found: ${A}`);
|
|
12923
12938
|
this.channelChangeCallbacks_.splice(I, 1);
|
|
12924
12939
|
}
|
|
12925
12940
|
constructor({ source: A, sliceCoords: I, policy: B, channelProps: C }) {
|
|
12926
|
-
super({ blendMode: "premultiplied" }), this.source_ = A, this.sliceCoords_ = I, this.
|
|
12941
|
+
super({ blendMode: "premultiplied" }), this.source_ = A, this.sliceCoords_ = I, this.policy_ = B, this.initialChannelProps_ = C, this.channelProps_ = C, this.setState("initialized");
|
|
12927
12942
|
}
|
|
12928
12943
|
getOrCreateVolume(A, I) {
|
|
12929
12944
|
const B = this.currentVolumes_.get(A);
|
|
@@ -12939,7 +12954,7 @@ class Fo extends KI {
|
|
|
12939
12954
|
attach(A) {
|
|
12940
12955
|
this.chunkStoreView_ = A.chunkManager.addView(
|
|
12941
12956
|
this.source_,
|
|
12942
|
-
this.
|
|
12957
|
+
this.policy_
|
|
12943
12958
|
), hC(
|
|
12944
12959
|
this.channelProps_,
|
|
12945
12960
|
this.chunkStoreView_.channelCount
|
|
@@ -12948,7 +12963,7 @@ class Fo extends KI {
|
|
|
12948
12963
|
detach(A) {
|
|
12949
12964
|
for (const I of this.currentVolumes_.values())
|
|
12950
12965
|
this.releaseAndRemoveVolume(I);
|
|
12951
|
-
this.clearObjects(), this.chunkStoreView_?.dispose(), this.chunkStoreView_ = void 0;
|
|
12966
|
+
this.currentVolumes_.clear(), this.clearObjects(), this.chunkStoreView_?.dispose(), this.chunkStoreView_ = void 0;
|
|
12952
12967
|
}
|
|
12953
12968
|
updateChunks() {
|
|
12954
12969
|
if (!this.chunkStoreView_) return;
|
|
@@ -12957,10 +12972,9 @@ class Fo extends KI {
|
|
|
12957
12972
|
if (this.lastLoadedTime_ !== I || B.size !== this.currentVolumes_.size || this.lastNumRenderedChannelChunks_ !== A.length) {
|
|
12958
12973
|
for (const [Q, E] of this.currentVolumes_)
|
|
12959
12974
|
B.has(Q) || (this.releaseAndRemoveVolume(E), this.currentVolumes_.delete(Q));
|
|
12960
|
-
this.clearObjects();
|
|
12961
12975
|
for (const [Q, E] of B) {
|
|
12962
12976
|
const i = this.getOrCreateVolume(Q, E);
|
|
12963
|
-
i.wireframeEnabled = this.debugShowWireframes, this.currentVolumes_.set(Q, i)
|
|
12977
|
+
i.wireframeEnabled = this.debugShowWireframes, this.currentVolumes_.set(Q, i);
|
|
12964
12978
|
}
|
|
12965
12979
|
this.lastLoadedTime_ = I, this.lastNumRenderedChannelChunks_ = A.length;
|
|
12966
12980
|
}
|
|
@@ -12993,7 +13007,13 @@ class Fo extends KI {
|
|
|
12993
13007
|
A.camera.getViewProjection()
|
|
12994
13008
|
);
|
|
12995
13009
|
const I = A.cameraControls?.isMoving ?? !1;
|
|
12996
|
-
this.interactiveStepSizeScale_ = I ? xi : 1, this.updateChunks(),
|
|
13010
|
+
this.interactiveStepSizeScale_ = I ? xi : 1, this.updateChunks(), this.rebuildObjects(A.camera);
|
|
13011
|
+
}
|
|
13012
|
+
rebuildObjects(A) {
|
|
13013
|
+
const I = Array.from(this.currentVolumes_.values());
|
|
13014
|
+
Ti(I, A), this.clearObjects();
|
|
13015
|
+
for (const B of I)
|
|
13016
|
+
this.addObject(B);
|
|
12997
13017
|
}
|
|
12998
13018
|
getUniforms() {
|
|
12999
13019
|
return {
|
|
@@ -13040,37 +13060,63 @@ class lB extends Fg {
|
|
|
13040
13060
|
return this.height_;
|
|
13041
13061
|
}
|
|
13042
13062
|
}
|
|
13043
|
-
const
|
|
13063
|
+
const Pi = [
|
|
13064
|
+
[1, 0.5, 0.5],
|
|
13065
|
+
[0.5, 1, 0.5],
|
|
13066
|
+
[0.5, 0.5, 1],
|
|
13067
|
+
[0.5, 1, 1],
|
|
13068
|
+
[1, 0.5, 1],
|
|
13069
|
+
[1, 1, 0.5]
|
|
13070
|
+
];
|
|
13071
|
+
function Oi(g) {
|
|
13072
|
+
return g = g ?? /* @__PURE__ */ new Map(), new Map(
|
|
13073
|
+
Array.from(g.entries()).map(([A, I]) => [
|
|
13074
|
+
A,
|
|
13075
|
+
x.from(I)
|
|
13076
|
+
])
|
|
13077
|
+
);
|
|
13078
|
+
}
|
|
13079
|
+
function Vi(g) {
|
|
13080
|
+
return g = g ?? Pi, g.map(x.from);
|
|
13081
|
+
}
|
|
13082
|
+
class fB {
|
|
13083
|
+
lookupTable;
|
|
13084
|
+
cycle;
|
|
13085
|
+
constructor(A = {}) {
|
|
13086
|
+
this.lookupTable = Oi(A.lookupTable), this.cycle = Vi(A.cycle);
|
|
13087
|
+
}
|
|
13088
|
+
}
|
|
13089
|
+
const nC = /* @__PURE__ */ new Set(["byte", "short", "int"]), vi = /* @__PURE__ */ new Set([
|
|
13044
13090
|
"unsigned_byte",
|
|
13045
13091
|
"unsigned_short",
|
|
13046
13092
|
"unsigned_int"
|
|
13047
13093
|
]);
|
|
13048
|
-
function
|
|
13094
|
+
function Xi(g) {
|
|
13049
13095
|
if (g.dataFormat !== "scalar")
|
|
13050
13096
|
throw new Error(
|
|
13051
13097
|
`Image data format must be scalar, instead found: ${g.dataFormat}`
|
|
13052
13098
|
);
|
|
13053
|
-
if (!nC.has(g.dataType) && !
|
|
13099
|
+
if (!nC.has(g.dataType) && !vi.has(g.dataType))
|
|
13054
13100
|
throw new Error(
|
|
13055
13101
|
`Image data type must be an integer, instead found: ${g.dataType}`
|
|
13056
13102
|
);
|
|
13057
13103
|
return g;
|
|
13058
13104
|
}
|
|
13059
|
-
function
|
|
13105
|
+
function ji(g) {
|
|
13060
13106
|
return nC.has(g.dataType) ? "intLabelImage" : "labelImage";
|
|
13061
13107
|
}
|
|
13062
|
-
class
|
|
13108
|
+
class zi extends xA {
|
|
13063
13109
|
outlineSelected_;
|
|
13064
13110
|
selectedValue_;
|
|
13065
13111
|
worldToTexCoord = $();
|
|
13066
13112
|
constructor(A) {
|
|
13067
|
-
super(), this.geometry = new tC(A.width, A.height, 1, 1), this.setTexture(0,
|
|
13113
|
+
super(), this.geometry = new tC(A.width, A.height, 1, 1), this.setTexture(0, Xi(A.imageData));
|
|
13068
13114
|
const I = this.makeColorCycleTexture(A.colorMap.cycle);
|
|
13069
13115
|
this.setTexture(1, I);
|
|
13070
13116
|
const B = this.makeColorLookupTableTexture(
|
|
13071
13117
|
A.colorMap.lookupTable
|
|
13072
13118
|
);
|
|
13073
|
-
this.setTexture(2, B), this.outlineSelected_ = A.outlineSelected ?? !1, this.selectedValue_ = A.selectedValue ?? null, this.programName =
|
|
13119
|
+
this.setTexture(2, B), this.outlineSelected_ = A.outlineSelected ?? !1, this.selectedValue_ = A.selectedValue ?? null, this.programName = ji(A.imageData);
|
|
13074
13120
|
}
|
|
13075
13121
|
get type() {
|
|
13076
13122
|
return "LabelImageRenderable";
|
|
@@ -13103,32 +13149,6 @@ class vi extends xA {
|
|
|
13103
13149
|
return Q.set(I, 0), Q.set(B, C), new lB(Q, C, 2);
|
|
13104
13150
|
}
|
|
13105
13151
|
}
|
|
13106
|
-
const Xi = [
|
|
13107
|
-
[1, 0.5, 0.5],
|
|
13108
|
-
[0.5, 1, 0.5],
|
|
13109
|
-
[0.5, 0.5, 1],
|
|
13110
|
-
[0.5, 1, 1],
|
|
13111
|
-
[1, 0.5, 1],
|
|
13112
|
-
[1, 1, 0.5]
|
|
13113
|
-
];
|
|
13114
|
-
function ji(g) {
|
|
13115
|
-
return g = g ?? /* @__PURE__ */ new Map(), new Map(
|
|
13116
|
-
Array.from(g.entries()).map(([A, I]) => [
|
|
13117
|
-
A,
|
|
13118
|
-
x.from(I)
|
|
13119
|
-
])
|
|
13120
|
-
);
|
|
13121
|
-
}
|
|
13122
|
-
function zi(g) {
|
|
13123
|
-
return g = g ?? Xi, g.map(x.from);
|
|
13124
|
-
}
|
|
13125
|
-
class fB {
|
|
13126
|
-
lookupTable;
|
|
13127
|
-
cycle;
|
|
13128
|
-
constructor(A = {}) {
|
|
13129
|
-
this.lookupTable = ji(A.lookupTable), this.cycle = zi(A.cycle);
|
|
13130
|
-
}
|
|
13131
|
-
}
|
|
13132
13152
|
class GC extends KI {
|
|
13133
13153
|
type = "LabelLayer";
|
|
13134
13154
|
source_;
|
|
@@ -13213,12 +13233,9 @@ class GC extends KI {
|
|
|
13213
13233
|
this.releaseAndRemoveChunks(C), this.clearObjects();
|
|
13214
13234
|
for (const Q of I) {
|
|
13215
13235
|
const E = this.getLabelForChunk(Q, Q.texture);
|
|
13216
|
-
this.visibleChunks_.set(Q, E), this.addObject(E);
|
|
13236
|
+
this.visibleChunks_.set(Q, E), this.addObject(E, 0);
|
|
13217
13237
|
}
|
|
13218
13238
|
}
|
|
13219
|
-
hasMultipleLODs() {
|
|
13220
|
-
return this.chunkStoreView_ ? this.chunkStoreView_.lodCount > 1 : !1;
|
|
13221
|
-
}
|
|
13222
13239
|
isPresentationStale() {
|
|
13223
13240
|
return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > GC.STALE_PRESENTATION_MS_;
|
|
13224
13241
|
}
|
|
@@ -13309,7 +13326,7 @@ class GC extends KI {
|
|
|
13309
13326
|
return C ? (C.setTexture(0, I), C.setColorMap(this.colorMap_), C.setSelectedValue(this.selectedValue_), this.updateLabelChunk(C, A), C) : this.createLabel(A, I);
|
|
13310
13327
|
}
|
|
13311
13328
|
createLabel(A, I) {
|
|
13312
|
-
const B = new
|
|
13329
|
+
const B = new zi({
|
|
13313
13330
|
width: A.shape[this.axes_.u],
|
|
13314
13331
|
height: A.shape[this.axes_.v],
|
|
13315
13332
|
imageData: I,
|
|
@@ -13402,7 +13419,7 @@ class ro extends xA {
|
|
|
13402
13419
|
}), this.geometry = B, this.setTexture(0, $i());
|
|
13403
13420
|
}
|
|
13404
13421
|
get type() {
|
|
13405
|
-
return "
|
|
13422
|
+
return "PointsRenderable";
|
|
13406
13423
|
}
|
|
13407
13424
|
}
|
|
13408
13425
|
let PI;
|
|
@@ -13913,7 +13930,7 @@ export {
|
|
|
13913
13930
|
eC as ImageLayer,
|
|
13914
13931
|
li as ImageRenderable,
|
|
13915
13932
|
fB as LabelColorMap,
|
|
13916
|
-
|
|
13933
|
+
zi as LabelImageRenderable,
|
|
13917
13934
|
GC as LabelLayer,
|
|
13918
13935
|
KI as Layer,
|
|
13919
13936
|
OA as OmeZarrImageSource,
|
|
@@ -13921,8 +13938,8 @@ export {
|
|
|
13921
13938
|
Ro as OrthographicCamera,
|
|
13922
13939
|
No as PanZoomControls,
|
|
13923
13940
|
co as PerspectiveCamera,
|
|
13924
|
-
ro as
|
|
13925
|
-
Hi as
|
|
13941
|
+
ro as PointsRenderable,
|
|
13942
|
+
Hi as ProjectedLineRenderable,
|
|
13926
13943
|
Fo as VolumeLayer,
|
|
13927
13944
|
mi as VolumeRenderable,
|
|
13928
13945
|
Uo as createExplorationPolicy,
|