hilo3d 2.0.0-alpha.5 → 2.0.0-alpha.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/Hilo3d.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Hilo3d 2.0.0-alpha.5
2
+ * Hilo3d 2.0.0-alpha.6
3
3
  * Copyright (c) 2017-present Alibaba Group Holding Ltd.
4
4
  * @license MIT
5
5
  */
@@ -7218,7 +7218,7 @@ var vh = class {
7218
7218
  }
7219
7219
  return e;
7220
7220
  }
7221
- }, Sh = "2.0.0-alpha.5", Ch = class extends To {
7221
+ }, Sh = "2.0.0-alpha.6", Ch = class extends To {
7222
7222
  static typeName = "AmbientLight";
7223
7223
  isAmbientLight = !0;
7224
7224
  className = "AmbientLight";
@@ -40524,6 +40524,7 @@ var Jh = class extends d {
40524
40524
  useLogDepth = !1;
40525
40525
  cameraRelative = !1;
40526
40526
  renderingProfile = "portable";
40527
+ shadowUpdateMode = "paged";
40527
40528
  vertexPrecision = "highp";
40528
40529
  fragmentPrecision = "highp";
40529
40530
  fog = null;
@@ -54315,7 +54316,7 @@ var Dj = null, Oj = null;
54315
54316
  function kj() {
54316
54317
  if (Dj !== null) return Promise.resolve(Dj);
54317
54318
  if (Oj !== null) return Oj;
54318
- let e = import("./web_naga-DucvGikP.js").then(async (e) => (await e.default(), e)).then((t) => (Oj === e && (Dj = t), t), (t) => {
54319
+ let e = import("./web_naga-De3KziYL.js").then(async (e) => (await e.default(), e)).then((t) => (Oj === e && (Dj = t), t), (t) => {
54319
54320
  throw Oj === e && (Oj = null), t;
54320
54321
  });
54321
54322
  return Oj = e, e;
@@ -63803,49 +63804,53 @@ var CR = class {
63803
63804
  }
63804
63805
  });
63805
63806
  }
63806
- stage(e, t, n, r) {
63807
+ stage(e, t, n, r, i = "paged") {
63807
63808
  this.assertAlive();
63808
- let i = e.slices.length;
63809
- if (t.sliceCount !== i || t.updateIds.length !== i || n.length !== i) throw TypeError("Shadow page residency requires matching dense slice inputs");
63810
- this.beginTransaction(r), this.#c = i, this.#s = 0, this.#r.length = i, this.#r.fill(!1);
63811
- let a = 0, o = 0, s = 0, c = this.maxPageUpdatesPerFrame;
63812
- this.#i.length = i, this.#i.fill(0);
63813
- for (let r = 0; r < i; r += 1) {
63809
+ let a = i;
63810
+ if (a !== "paged" && a !== "full") throw TypeError("Shadow page update mode must be \"paged\" or \"full\"");
63811
+ let o = e.slices.length;
63812
+ if (t.sliceCount !== o || t.updateIds.length !== o || n.length !== o) throw TypeError("Shadow page residency requires matching dense slice inputs");
63813
+ this.beginTransaction(r), this.#c = o, this.#s = 0, this.#r.length = o, this.#r.fill(!1);
63814
+ let s = 0, c = 0, l = 0, u = this.maxPageUpdatesPerFrame;
63815
+ this.#i.length = o, this.#i.fill(0);
63816
+ for (let r = 0; r < o; r += 1) {
63814
63817
  if (t.dirtySlices[r] !== !0 || n[r] !== !0) continue;
63815
- let i = e.slices[r], l = t.updateIds[r] ?? 0;
63816
- if (i === void 0 || l === 0) throw Error("Dirty shadow pages require a slice and non-zero update revision");
63817
- let u = this.sliceAt(r);
63818
- this.configureSlice(u, i.viewport);
63819
- let d = t.reasons[r], f = d === "allocation" || d === "layout" || d === "light", p = u.columns * u.rows, m = 0;
63820
- for (let e = 0; e < p; e += 1) {
63821
- let t = u.pages[e];
63818
+ let a = e.slices[r], o = t.updateIds[r] ?? 0;
63819
+ if (a === void 0 || o === 0) throw Error("Dirty shadow pages require a slice and non-zero update revision");
63820
+ let d = this.sliceAt(r);
63821
+ this.configureSlice(d, a.viewport);
63822
+ let f = t.reasons[r], p = f === "allocation" || f === "layout" || f === "light", m = i === "full" || p, h = d.columns * d.rows, g = 0;
63823
+ for (let e = 0; e < h; e += 1) {
63824
+ let t = d.pages[e];
63822
63825
  if (t === void 0) throw Error("Shadow page storage is incomplete");
63823
- this.pageMatchesTarget(t, l) || m++;
63826
+ this.pageMatchesTarget(t, o) || g++;
63824
63827
  }
63825
- if (a += m, this.#i[r] = m, this.#r[r] = m === 0, f) {
63828
+ if (s += g, this.#i[r] = g, this.#r[r] = g === 0, m) {
63826
63829
  for (; (this.#i[r] ?? 0) > 0;) {
63827
- if (!this.scheduleNextPage(r, l, u)) throw Error("Mandatory shadow page scheduling made no progress");
63828
- this.#i[r] = (this.#i[r] ?? 0) - 1, s++, o++, c > 0 && c--;
63830
+ if (!this.scheduleNextPage(r, o, d)) throw Error("Complete shadow slice scheduling made no progress");
63831
+ this.#i[r] = (this.#i[r] ?? 0) - 1, p && l++, c++, u > 0 && u--;
63829
63832
  }
63830
63833
  this.#r[r] = !0;
63831
63834
  }
63832
63835
  }
63833
- let l = this.#d === this.#f ? this.#u : this.#l;
63834
- for (; c > 0 && i > 0;) {
63836
+ let d = this.#d === this.#f ? this.#u : this.#l;
63837
+ for (; u > 0 && o > 0;) {
63835
63838
  let r = -1;
63836
- for (let e = 0; e < i; e += 1) {
63837
- let a = (l + e) % i;
63838
- if ((this.#i[a] ?? 0) > 0 && t.dirtySlices[a] === !0 && n[a] === !0) {
63839
- r = a;
63839
+ for (let e = 0; e < o; e += 1) {
63840
+ let i = (d + e) % o;
63841
+ if ((this.#i[i] ?? 0) > 0 && t.dirtySlices[i] === !0 && n[i] === !0) {
63842
+ r = i;
63840
63843
  break;
63841
63844
  }
63842
63845
  }
63843
63846
  if (r < 0) break;
63844
- let a = e.slices[r], s = this.#e[r], u = t.updateIds[r] ?? 0;
63845
- if (a === void 0 || s === void 0 || u === 0 || !this.scheduleNextPage(r, u, s)) throw Error("Budgeted shadow page scheduling made no progress");
63846
- this.#i[r] = (this.#i[r] ?? 0) - 1, this.#r[r] = this.#i[r] === 0, o++, c--, l = (r + 1) % i, this.#u = l, this.#d = this.#f;
63847
+ let i = e.slices[r], a = this.#e[r], s = t.updateIds[r] ?? 0;
63848
+ if (i === void 0 || a === void 0 || s === 0) throw Error("Budgeted shadow page scheduling made no progress");
63849
+ let l = this.#i[r] ?? 0;
63850
+ for (let e = 0; e < l; e += 1) if (!this.scheduleNextPage(r, s, a)) throw Error("Atomic shadow slice scheduling made no progress");
63851
+ this.#i[r] = 0, this.#r[r] = !0, c += l, u = Math.max(0, u - l), d = (r + 1) % o, this.#u = d, this.#d = this.#f;
63847
63852
  }
63848
- return this.truncateRegions(this.#s), this.coalesceUpdateRegions(), this.#a.requestedPageCount = a, this.#a.scheduledPageCount = o, this.#a.deferredPageCount = a - o, this.#a.mandatoryPageCount = s, this.#a.budgetOverflowCount = Math.max(0, o - this.maxPageUpdatesPerFrame), this.#a.residentPageCount = this.residentPageCount(), this.#o;
63853
+ return this.truncateRegions(this.#s), this.coalesceUpdateRegions(), this.#a.requestedPageCount = s, this.#a.scheduledPageCount = c, this.#a.deferredPageCount = s - c, this.#a.mandatoryPageCount = l, this.#a.budgetOverflowCount = Math.max(0, c - this.maxPageUpdatesPerFrame), this.#a.residentPageCount = this.residentPageCount(), this.#o;
63849
63854
  }
63850
63855
  stageEmpty(e) {
63851
63856
  this.assertAlive(), this.beginTransaction(e), this.#c = 0, this.#s = 0, this.truncateRegions(0), this.#r.length = 0, this.#i.length = 0, this.#a.requestedPageCount = 0, this.#a.scheduledPageCount = 0, this.#a.deferredPageCount = 0, this.#a.mandatoryPageCount = 0, this.#a.budgetOverflowCount = 0;
@@ -72049,15 +72054,17 @@ var yU = class extends Jh {
72049
72054
  Object.assign(this, t);
72050
72055
  let n = this.renderingProfile;
72051
72056
  if (n !== "portable" && n !== "high-end") throw TypeError("Renderer renderingProfile must be \"portable\" or \"high-end\"");
72057
+ let r = this.shadowUpdateMode;
72058
+ if (r !== "paged" && r !== "full") throw TypeError("Renderer shadowUpdateMode must be \"paged\" or \"full\"");
72052
72059
  this.renderingProfile === "high-end" && (this.cameraRelative = !0);
72053
- let r = "requiredFeatures" in t ? t.requiredFeatures : void 0, i = "requiredLimits" in t ? t.requiredLimits : void 0;
72054
- this.requiredFeatures = Object.freeze([...r ?? []]), this.requiredLimits = Object.freeze({ ...i ?? {} }), this.attachRegisteredDiagnostics(this.domElement), this.resourceManager.on("destroyMesh", this.#Q);
72055
- let a = pU(this.requiredFeatures);
72060
+ let i = "requiredFeatures" in t ? t.requiredFeatures : void 0, a = "requiredLimits" in t ? t.requiredLimits : void 0;
72061
+ this.requiredFeatures = Object.freeze([...i ?? []]), this.requiredLimits = Object.freeze({ ...a ?? {} }), this.attachRegisteredDiagnostics(this.domElement), this.resourceManager.on("destroyMesh", this.#Q);
72062
+ let o = pU(this.requiredFeatures);
72056
72063
  this.#m = Object.freeze({
72057
72064
  ...this.powerPreference === "low-power" || this.powerPreference === "high-performance" ? { powerPreference: this.powerPreference } : {},
72058
72065
  forceFallbackAdapter: this.forceFallbackAdapter,
72059
72066
  rejectFallbackAdapter: this.failIfMajorPerformanceCaveat,
72060
- requiredFeatures: a,
72067
+ requiredFeatures: o,
72061
72068
  optionalFeatures: sU,
72062
72069
  requiredLimits: this.requiredLimits,
72063
72070
  label: "Hilo3d shared renderer WebGPU RHI",
@@ -72072,8 +72079,8 @@ var yU = class extends Jh {
72072
72079
  failIfMajorPerformanceCaveat: this.failIfMajorPerformanceCaveat,
72073
72080
  powerPreference: this.powerPreference === "low-power" || this.powerPreference === "high-performance" ? this.powerPreference : "default"
72074
72081
  });
72075
- let o = {};
72076
- Object.defineProperties(o, {
72082
+ let s = {};
72083
+ Object.defineProperties(s, {
72077
72084
  device: {
72078
72085
  enumerable: !0,
72079
72086
  get: () => this.requireDevice()
@@ -72086,9 +72093,9 @@ var yU = class extends Jh {
72086
72093
  enumerable: !0,
72087
72094
  get: () => this.#x?.recovery.state ?? "destroyed"
72088
72095
  }
72089
- }), this.#g = Object.freeze(o);
72090
- let s = {};
72091
- Object.defineProperties(s, {
72096
+ }), this.#g = Object.freeze(s);
72097
+ let c = {};
72098
+ Object.defineProperties(c, {
72092
72099
  executionDevice: {
72093
72100
  enumerable: !0,
72094
72101
  get: () => this.requireDevice()
@@ -72115,7 +72122,7 @@ var yU = class extends Jh {
72115
72122
  this.setPresentationViewport(e);
72116
72123
  }
72117
72124
  }
72118
- }), this.#_ = Object.freeze(s), this.ready = e === "webgl2" ? this.initializeWebGL2() : this.initializeWebGPU();
72125
+ }), this.#_ = Object.freeze(c), this.ready = e === "webgl2" ? this.initializeWebGL2() : this.initializeWebGPU();
72119
72126
  }
72120
72127
  get isReady() {
72121
72128
  return this.#D && this.#i.initialized && !this.#O && this.#v?.destroyed === !1 && this.#x?.recovery.state === "ready";
@@ -72917,7 +72924,7 @@ var yU = class extends Jh {
72917
72924
  budgetOverflowPages: 0
72918
72925
  }), e.shadowPreparer.retireAll(t), e.shadowResources.detach(e.shadowOwner), null;
72919
72926
  }
72920
- let c = e.shadowResources.prepare(e.shadowOwner, s.atlas, t.camera.depthMode), l = this.#i.requireActiveScope(), u = e.shadowContent.stage(c, s, r, l.uploads), d = e.shadowUpdates.schedule(s, u, t.frameIndex), f = e.shadowPages.stage(s, u, d.scheduledSlices, l.uploads), p = 0;
72927
+ let c = e.shadowResources.prepare(e.shadowOwner, s.atlas, t.camera.depthMode), l = this.#i.requireActiveScope(), u = e.shadowContent.stage(c, s, r, l.uploads), d = e.shadowUpdates.schedule(s, u, t.frameIndex), f = e.shadowPages.stage(s, u, d.scheduledSlices, l.uploads, this.shadowUpdateMode), p = 0;
72921
72928
  for (let e = 0; e < u.sliceCount; e += 1) u.dirtySlices[e] === !0 && f.completedSlices[e] === !0 && p++;
72922
72929
  if (this.rendererDiagnosticsSink?.recordShadowScheduling({
72923
72930
  requestedSlices: d.requestedUpdateCount,