rayzee 5.0.0 → 5.0.2

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/rayzee.es.js CHANGED
@@ -84,9 +84,7 @@ var Ht = K(0, "int"), Ut = Ht, Wt = new b(new Float32Array([
84
84
  Wt.type = D, Wt.needsUpdate = !0;
85
85
  var Gt = vt(Wt);
86
86
  Gt.setUpdateMatrix(!1);
87
- var Kt = q(bt(Gt));
88
- z(1.61803398875);
89
- var qt = z(.61803398875), Jt = z(.38196601125), Yt = /* @__PURE__ */ X("\n fn getSobolDirectionVector( index: i32 ) -> u32 {\n\n switch ( index ) {\n case 0: { return 2147483648u; }\n case 1: { return 1073741824u; }\n case 2: { return 536870912u; }\n case 3: { return 268435456u; }\n case 4: { return 134217728u; }\n case 5: { return 67108864u; }\n case 6: { return 33554432u; }\n case 7: { return 16777216u; }\n case 8: { return 8388608u; }\n case 9: { return 4194304u; }\n case 10: { return 2097152u; }\n case 11: { return 1048576u; }\n case 12: { return 524288u; }\n case 13: { return 262144u; }\n case 14: { return 131072u; }\n case 15: { return 65536u; }\n case 16: { return 32768u; }\n case 17: { return 16384u; }\n case 18: { return 8192u; }\n case 19: { return 4096u; }\n case 20: { return 2048u; }\n case 21: { return 1024u; }\n case 22: { return 512u; }\n case 23: { return 256u; }\n case 24: { return 128u; }\n case 25: { return 64u; }\n case 26: { return 32u; }\n case 27: { return 16u; }\n case 28: { return 8u; }\n case 29: { return 4u; }\n case 30: { return 2u; }\n default: { return 1u; }\n }\n\n }\n"), Xt = /* @__PURE__ */ X("\n fn pcgHash( state: u32 ) -> u32 {\n\n var s = state;\n s = s * 747796405u + 2891336453u;\n s = ( ( s >> ( ( s >> 28u ) + 4u ) ) ^ s ) * 277803737u;\n s = ( s >> 22u ) ^ s;\n return s;\n\n }\n"), Zt = /* @__PURE__ */ X("\n fn wang_hash( seed: u32 ) -> u32 {\n\n var s = seed;\n s = ( s ^ 61u ) ^ ( s >> 16u );\n s = s * 9u;\n s = s ^ ( s >> 4u );\n s = s * 0x27d4eb2du;\n s = s ^ ( s >> 15u );\n return s;\n\n }\n"), Qt = (e) => (e.assign(e.mul(1664525).add(1013904223)), z(e.shiftRight(8)).mul(1 / 16777216)), $t = (e) => (e.assign(Xt({ state: e })), z(e.shiftRight(8)).mul(1 / 16777216)), en = (e) => {
87
+ var Kt = q(bt(Gt)), qt = z(.61803398875), Jt = z(.38196601125), Yt = /* @__PURE__ */ X("\n fn getSobolDirectionVector( index: i32 ) -> u32 {\n\n switch ( index ) {\n case 0: { return 2147483648u; }\n case 1: { return 1073741824u; }\n case 2: { return 536870912u; }\n case 3: { return 268435456u; }\n case 4: { return 134217728u; }\n case 5: { return 67108864u; }\n case 6: { return 33554432u; }\n case 7: { return 16777216u; }\n case 8: { return 8388608u; }\n case 9: { return 4194304u; }\n case 10: { return 2097152u; }\n case 11: { return 1048576u; }\n case 12: { return 524288u; }\n case 13: { return 262144u; }\n case 14: { return 131072u; }\n case 15: { return 65536u; }\n case 16: { return 32768u; }\n case 17: { return 16384u; }\n case 18: { return 8192u; }\n case 19: { return 4096u; }\n case 20: { return 2048u; }\n case 21: { return 1024u; }\n case 22: { return 512u; }\n case 23: { return 256u; }\n case 24: { return 128u; }\n case 25: { return 64u; }\n case 26: { return 32u; }\n case 27: { return 16u; }\n case 28: { return 8u; }\n case 29: { return 4u; }\n case 30: { return 2u; }\n default: { return 1u; }\n }\n\n }\n"), Xt = /* @__PURE__ */ X("\n fn pcgHash( state: u32 ) -> u32 {\n\n var s = state;\n s = s * 747796405u + 2891336453u;\n s = ( ( s >> ( ( s >> 28u ) + 4u ) ) ^ s ) * 277803737u;\n s = ( s >> 22u ) ^ s;\n return s;\n\n }\n"), Zt = /* @__PURE__ */ X("\n fn wang_hash( seed: u32 ) -> u32 {\n\n var s = seed;\n s = ( s ^ 61u ) ^ ( s >> 16u );\n s = s * 9u;\n s = s ^ ( s >> 4u );\n s = s * 0x27d4eb2du;\n s = s ^ ( s >> 15u );\n return s;\n\n }\n"), Qt = (e) => (e.assign(e.mul(1664525).add(1013904223)), z(e.shiftRight(8)).mul(1 / 16777216)), $t = (e) => (e.assign(Xt({ state: e })), z(e.shiftRight(8)).mul(1 / 16777216)), en = (e) => {
90
88
  let t = Qt(e).mul(We).toVar();
91
89
  return q(Je(t), pt(t)).mul(ht(Qt(e)));
92
90
  }, tn = /* @__PURE__ */ X("\n fn cranleyPatterson2D( p: vec2f, offset: vec2f ) -> vec2f {\n\n return fract( p + offset );\n\n }\n"), nn = /* @__PURE__ */ M(([e, t, n, r]) => {
@@ -4814,19 +4812,11 @@ var ns = /* @__PURE__ */ X("\n fn computeNDCDepth( worldPos: vec3f, cameraProjec
4814
4812
  return this.entries.get(e)?.duration ?? 0;
4815
4813
  }
4816
4814
  print() {
4817
- let e = performance.now() - this.totalStart, t = this.order.map((t) => {
4818
- let n = this.entries.get(t)?.duration ?? 0, r = e > 0 ? (n / e * 100).toFixed(1) : "0.0";
4819
- return {
4820
- Step: t,
4821
- "Time (ms)": Math.round(n),
4822
- "%": r + "%"
4823
- };
4824
- });
4825
- return t.push({
4826
- Step: "TOTAL",
4827
- "Time (ms)": Math.round(e),
4828
- "%": "100%"
4829
- }), console.groupCollapsed(`⏱ ${this.label} Timing (${Math.round(e)}ms)`), console.table(t), console.groupEnd(), {
4815
+ let e = performance.now() - this.totalStart, t = this.order.map((e) => {
4816
+ let t = this.entries.get(e)?.duration ?? 0;
4817
+ return t >= 1 ? `${e} ${Math.round(t)}ms` : null;
4818
+ }).filter(Boolean);
4819
+ return console.log(`[${this.label}] ${Math.round(e)}ms` + (t.length ? ` | ${t.join(" · ")}` : "")), {
4830
4820
  steps: Object.fromEntries(this.order.map((e) => [e, Math.round(this.entries.get(e)?.duration ?? 0)])),
4831
4821
  total: Math.round(e)
4832
4822
  };
@@ -5505,7 +5495,7 @@ var ns = /* @__PURE__ */ X("\n fn computeNDCDepth( worldPos: vec3f, cameraProjec
5505
5495
  try {
5506
5496
  let a = new Worker(new URL(
5507
5497
  /* @vite-ignore */
5508
- "" + new URL("assets/BVHWorker-DobVXMda.js", import.meta.url).href,
5498
+ "" + new URL("assets/BVHWorker-BqQTDljT.js", import.meta.url).href,
5509
5499
  "" + import.meta.url
5510
5500
  ), { type: "module" }), o = this.totalTriangles, s = typeof SharedArrayBuffer < "u";
5511
5501
  console.log(`[BVHBuilder] SharedArrayBuffer: ${s ? "enabled" : "unavailable (using transfer fallback)"}`);
@@ -5639,61 +5629,8 @@ var ns = /* @__PURE__ */ X("\n fn computeNDCDepth( worldPos: vec3f, cameraProjec
5639
5629
  let p = new Uint32Array(a);
5640
5630
  for (let e = 0; e < a; e++) p[this.indices[e]] = e;
5641
5631
  this.originalToBvhMap = p, this.splitStats.reorderTime = performance.now() - u, this.splitStats.totalBuildTime = performance.now() - i;
5642
- let m = this.splitStats.totalBuildTime, h = (e) => m > 0 ? (e / m * 100).toFixed(1) + "%" : "0%", g = [
5643
- {
5644
- Phase: "Init + bounds",
5645
- "Time (ms)": Math.round(this.splitStats.initTime),
5646
- "%": h(this.splitStats.initTime)
5647
- },
5648
- {
5649
- Phase: "Morton sort",
5650
- "Time (ms)": Math.round(this.splitStats.mortonSortTime),
5651
- "%": h(this.splitStats.mortonSortTime)
5652
- },
5653
- {
5654
- Phase: "SAH recursive build",
5655
- "Time (ms)": Math.round(this.splitStats.sahBuildTime),
5656
- "%": h(this.splitStats.sahBuildTime)
5657
- },
5658
- {
5659
- Phase: "Treelet optimization",
5660
- "Time (ms)": Math.round(this.splitStats.treeletOptimizationTime),
5661
- "%": h(this.splitStats.treeletOptimizationTime)
5662
- },
5663
- {
5664
- Phase: "Reinsertion optimization",
5665
- "Time (ms)": Math.round(this.splitStats.reinsertionOptimizationTime),
5666
- "%": h(this.splitStats.reinsertionOptimizationTime)
5667
- },
5668
- {
5669
- Phase: "SA ordering",
5670
- "Time (ms)": Math.round(this.splitStats.saOrderTime),
5671
- "%": h(this.splitStats.saOrderTime)
5672
- },
5673
- {
5674
- Phase: "Triangle reorder",
5675
- "Time (ms)": Math.round(this.splitStats.reorderTime),
5676
- "%": h(this.splitStats.reorderTime)
5677
- },
5678
- {
5679
- Phase: "TOTAL",
5680
- "Time (ms)": Math.round(m),
5681
- "%": "100%"
5682
- }
5683
- ];
5684
- return console.groupCollapsed(`⏱ BVH Build (${a.toLocaleString()} triangles, ${Math.round(m)}ms)`), console.table(g), console.table({
5685
- "Total Nodes": this.totalNodes,
5686
- "Max Leaf Size": this.maxLeafSize,
5687
- "SAH Splits": this.splitStats.sahSplits,
5688
- "Object Median Splits": this.splitStats.objectMedianSplits,
5689
- "Spatial Median Splits": this.splitStats.spatialMedianSplits,
5690
- "Failed Splits": this.splitStats.failedSplits,
5691
- "Treelets Processed": this.splitStats.treeletsProcessed,
5692
- "Treelets Improved": this.splitStats.treeletsImproved,
5693
- "Avg SAH Improvement": (this.splitStats.averageSAHImprovement * 100).toFixed(2) + "%",
5694
- "Reinsertions Applied": this.splitStats.reinsertionsApplied,
5695
- "Reinsertion Iterations": this.splitStats.reinsertionIterations
5696
- }), console.groupEnd(), n && n(100), this.centroids = null, this.bMin = null, this.bMax = null, this.mortonCodes = null, c;
5632
+ let m = this.splitStats.totalBuildTime, h = this.splitStats;
5633
+ return console.log(`[BVH] ${a.toLocaleString()} tris → ${this.totalNodes} nodes in ${Math.round(m)}ms | SAH ${h.sahSplits} objMed ${h.objectMedianSplits} spatMed ${h.spatialMedianSplits} failed ${h.failedSplits}` + (h.treeletsProcessed ? ` | treelets ${h.treeletsImproved}/${h.treeletsProcessed} improved` : "") + (h.reinsertionsApplied ? ` | reinsertions ${h.reinsertionsApplied}` : "")), n && n(100), this.centroids = null, this.bMin = null, this.bMax = null, this.mortonCodes = null, c;
5697
5634
  }
5698
5635
  updateProgress(e, t) {
5699
5636
  if (!t) return;
@@ -6110,7 +6047,7 @@ function ws(e, t, n, r) {
6110
6047
  new Float32Array(c).set(e);
6111
6048
  let l = new SharedArrayBuffer(i * 3 * 4), u = new SharedArrayBuffer(i * 3 * 4), d = new SharedArrayBuffer(i * 3 * 4), f = new SharedArrayBuffer(i * 4), p = new SharedArrayBuffer(i * 4), m = new SharedArrayBuffer(i * xs * 4), h = new Worker(new URL(
6112
6049
  /* @vite-ignore */
6113
- "" + new URL("assets/BVHWorker-DobVXMda.js", import.meta.url).href,
6050
+ "" + new URL("assets/BVHWorker-BqQTDljT.js", import.meta.url).href,
6114
6051
  "" + import.meta.url
6115
6052
  ), { type: "module" }), g = null, _ = [h], v = { id: null }, y = !1, b = () => {
6116
6053
  v.id &&= (clearTimeout(v.id), null);
@@ -6219,7 +6156,7 @@ function Ts(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g) {
6219
6156
  if (t.length === 0) continue;
6220
6157
  let s = new Worker(new URL(
6221
6158
  /* @vite-ignore */
6222
- "" + new URL("assets/BVHSubtreeWorker-C02ZWVeG.js", import.meta.url).href,
6159
+ "" + new URL("assets/BVHSubtreeWorker-BoG4D6dP.js", import.meta.url).href,
6223
6160
  "" + import.meta.url
6224
6161
  ), { type: "module" });
6225
6162
  d.push(s), s.onerror = (e) => {
@@ -6276,7 +6213,7 @@ function Es(e, t, n, r) {
6276
6213
  try {
6277
6214
  let o = new Worker(new URL(
6278
6215
  /* @vite-ignore */
6279
- "" + new URL("assets/BVHWorker-DobVXMda.js", import.meta.url).href,
6216
+ "" + new URL("assets/BVHWorker-BqQTDljT.js", import.meta.url).href,
6280
6217
  "" + import.meta.url
6281
6218
  ), { type: "module" }), s = e.byteLength / (xs * 4), c = typeof SharedArrayBuffer < "u" ? new SharedArrayBuffer(s * xs * 4) : null;
6282
6219
  o.onmessage = (e) => {
@@ -7825,7 +7762,7 @@ var Os = 16, ks = class {
7825
7762
  for (let e = 0; e < i; e++) {
7826
7763
  let e = new Worker(new URL(
7827
7764
  /* @vite-ignore */
7828
- "" + new URL("assets/BVHWorker-DobVXMda.js", import.meta.url).href,
7765
+ "" + new URL("assets/BVHWorker-BqQTDljT.js", import.meta.url).href,
7829
7766
  "" + import.meta.url
7830
7767
  ), { type: "module" });
7831
7768
  e.onmessage = (t) => f(e, t), e.onerror = (e) => {
@@ -8130,7 +8067,7 @@ var Os = 16, ks = class {
8130
8067
  a && a.terminate();
8131
8068
  let o = this.triangleData.slice(e.triOffset * n, (e.triOffset + e.triCount) * n), s = new Worker(new URL(
8132
8069
  /* @vite-ignore */
8133
- "" + new URL("assets/BVHWorker-DobVXMda.js", import.meta.url).href,
8070
+ "" + new URL("assets/BVHWorker-BqQTDljT.js", import.meta.url).href,
8134
8071
  "" + import.meta.url
8135
8072
  ), { type: "module" });
8136
8073
  this._pendingRebuilds.set(i, s), s.onmessage = (n) => {