@idetik/core 0.7.6 → 0.7.7

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 CHANGED
@@ -546,7 +546,7 @@ declare class ChunkStoreView {
546
546
  getChunksToRender(sliceCoords: SliceCoordinates): Chunk[];
547
547
  updateChunkStatesForVolume(sliceCoords: SliceCoordinates): void;
548
548
  updateChunkStates(sliceCoords: SliceCoordinates, viewport: Viewport): void;
549
- allVisibleLowestLODLoaded(sliceCoords: SliceCoordinates): boolean;
549
+ allVisibleFallbackLODLoaded(sliceCoords: SliceCoordinates): boolean;
550
550
  get currentLOD(): number;
551
551
  maybeForgetChunk(chunk: Chunk): void;
552
552
  dispose(): void;
@@ -558,6 +558,7 @@ declare class ChunkStoreView {
558
558
  private markTimeChunksForPrefetch;
559
559
  private computePriority;
560
560
  private isChunkWithinBounds;
561
+ private fallbackLOD;
561
562
  private getZBounds;
562
563
  private viewBounds2DChanged;
563
564
  private zBoundsChanged;
package/dist/index.js CHANGED
@@ -2154,7 +2154,7 @@ class _C {
2154
2154
  getChunksToRender(A) {
2155
2155
  const I = this.store_.getTimeIndex(A), B = this.store_.getChunksAtTime(I), C = B.filter(
2156
2156
  (i) => i.lod === this.currentLOD_ && this.chunkViewStates_.get(i)?.visible === !0 && i.state === "loaded"
2157
- ), Q = this.store_.getLowestResLOD();
2157
+ ), Q = this.fallbackLOD();
2158
2158
  if (this.currentLOD_ === Q)
2159
2159
  return C;
2160
2160
  const E = B.filter(
@@ -2200,9 +2200,9 @@ class _C {
2200
2200
  const h = this.getZBounds(A);
2201
2201
  (this.policyChanged_ || this.viewBounds2DChanged(Q) || this.zBoundsChanged(h) || this.lastTCoord_ !== A.t) && (this.updateChunkViewStates(A, Q), this.policyChanged_ = !1, this.lastViewBounds2D_ = Q.clone(), this.lastZBounds_ = h, this.lastTCoord_ = A.t);
2202
2202
  }
2203
- allVisibleLowestLODLoaded(A) {
2204
- const I = this.store_.getTimeIndex(A), B = this.store_.getChunksAtTime(I).filter((C) => C.visible && C.lod === this.store_.getLowestResLOD());
2205
- return B.length > 0 && B.every((C) => C.state === "loaded");
2203
+ allVisibleFallbackLODLoaded(A) {
2204
+ const I = this.store_.getTimeIndex(A), B = this.fallbackLOD(), C = this.store_.getChunksAtTime(I).filter((Q) => Q.visible && Q.lod === B);
2205
+ return C.length > 0 && C.every((Q) => Q.state === "loaded");
2206
2206
  }
2207
2207
  get currentLOD() {
2208
2208
  return this.currentLOD_;
@@ -2264,22 +2264,22 @@ class _C {
2264
2264
  return I.c === void 0 || I.c === A.chunkIndex.c;
2265
2265
  }
2266
2266
  updateChunksAtTimeIndex(A, I, B, C) {
2267
- const Q = this.getPaddedBounds(B), E = this.store_.getChunksAtTime(A);
2268
- for (const i of E) {
2269
- const o = this.isChunkWithinBounds(i, B), a = this.isChunkChannelInSlice(i, I), D = i.lod === this.currentLOD_, h = i.lod === this.store_.getLowestResLOD(), t = !o && a && D && this.isChunkWithinBounds(i, Q), y = o && a, w = this.computePriority(
2270
- h,
2271
- D,
2272
- o,
2267
+ const Q = this.getPaddedBounds(B), E = this.store_.getChunksAtTime(A), i = this.fallbackLOD();
2268
+ for (const o of E) {
2269
+ const a = this.isChunkWithinBounds(o, B), D = this.isChunkChannelInSlice(o, I), h = o.lod === this.currentLOD_, t = o.lod === i, y = !a && D && h && this.isChunkWithinBounds(o, Q), w = a && D, F = this.computePriority(
2273
2270
  t,
2274
- a
2271
+ h,
2272
+ a,
2273
+ y,
2274
+ D
2275
2275
  );
2276
- if (w !== null) {
2277
- const F = this.squareDistance2D(i, C);
2278
- this.chunkViewStates_.set(i, {
2279
- visible: y,
2280
- prefetch: t,
2281
- priority: w,
2282
- orderKey: F
2276
+ if (F !== null) {
2277
+ const S = this.squareDistance2D(o, C);
2278
+ this.chunkViewStates_.set(o, {
2279
+ visible: w,
2280
+ prefetch: y,
2281
+ priority: F,
2282
+ orderKey: S
2283
2283
  });
2284
2284
  }
2285
2285
  }
@@ -2288,20 +2288,20 @@ class _C {
2288
2288
  const Q = this.store_.dimensions.t?.lods[0].size ?? 1, E = Math.min(
2289
2289
  Q - 1,
2290
2290
  A + this.policy_.prefetch.t
2291
- );
2292
- for (let i = A + 1; i <= E; ++i)
2293
- for (const o of this.store_.getChunksAtTime(i)) {
2294
- if (o.lod !== this.store_.getLowestResLOD() || !this.isChunkChannelInSlice(o, I) || !this.isChunkWithinBounds(o, B)) continue;
2295
- const a = this.policy_.priorityMap.prefetchTime, D = this.squareDistance2D(o, C), h = vA(
2296
- D / this.sourceMaxSquareDistance2D_,
2291
+ ), i = this.fallbackLOD();
2292
+ for (let o = A + 1; o <= E; ++o)
2293
+ for (const a of this.store_.getChunksAtTime(o)) {
2294
+ if (a.lod !== i || !this.isChunkChannelInSlice(a, I) || !this.isChunkWithinBounds(a, B)) continue;
2295
+ const D = this.policy_.priorityMap.prefetchTime, h = this.squareDistance2D(a, C), t = vA(
2296
+ h / this.sourceMaxSquareDistance2D_,
2297
2297
  0,
2298
2298
  1 - Number.EPSILON
2299
- ), t = i - A + h;
2300
- this.chunkViewStates_.set(o, {
2299
+ ), y = o - A + t;
2300
+ this.chunkViewStates_.set(a, {
2301
2301
  visible: !1,
2302
2302
  prefetch: !0,
2303
- priority: a,
2304
- orderKey: t
2303
+ priority: D,
2304
+ orderKey: y
2305
2305
  });
2306
2306
  }
2307
2307
  }
@@ -2321,6 +2321,9 @@ class _C {
2321
2321
  );
2322
2322
  return SA.intersects(B, I);
2323
2323
  }
2324
+ fallbackLOD() {
2325
+ return Math.min(this.policy_.lod.max, this.store_.getLowestResLOD());
2326
+ }
2324
2327
  getZBounds(A) {
2325
2328
  const I = this.store_.dimensions.z;
2326
2329
  if (I === void 0) return [0, 1];
@@ -4103,7 +4106,7 @@ class dB extends wA {
4103
4106
  !A || !this.chunkStoreView_ || (this.chunkStoreView_.updateChunkStates(this.sliceCoords_, A.viewport), this.updateChunks(), this.resliceIfZChanged());
4104
4107
  }
4105
4108
  updateChunks() {
4106
- if (!this.chunkStoreView_ || (this.state !== "ready" && this.setState("ready"), this.visibleChunks_.size > 0 && !this.chunkStoreView_.allVisibleLowestLODLoaded(this.sliceCoords_) && !this.isPresentationStale()))
4109
+ if (!this.chunkStoreView_ || (this.state !== "ready" && this.setState("ready"), this.visibleChunks_.size > 0 && !this.chunkStoreView_.allVisibleFallbackLODLoaded(this.sliceCoords_) && !this.isPresentationStale()))
4107
4110
  return;
4108
4111
  this.lastPresentationTimeStamp_ = performance.now(), this.lastPresentationTimeCoord_ = this.sliceCoords_.t;
4109
4112
  const A = this.chunkStoreView_.getChunksToRender(