bimatter-viewer-react 0.11.9 → 0.11.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bimatter-viewer-react",
3
- "version": "0.11.9",
3
+ "version": "0.11.11",
4
4
  "license": "PolyForm-Noncommercial-1.0.0",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -22,7 +22,8 @@
22
22
  "scripts": {
23
23
  "dev": "vite",
24
24
  "build": "tsc -b && vite build",
25
- "build:lib": "vite build -c vite.lib.config.ts && tsc -p tsconfig.lib.json",
25
+ "build:lib": "vite build -c vite.lib.config.ts && tsc -p tsconfig.lib.json && npm run check:worker-bundles",
26
+ "check:worker-bundles": "node scripts/check-worker-bundles.mjs",
26
27
  "lint": "eslint .",
27
28
  "prepublishOnly": "npm run build:lib",
28
29
  "preview": "vite preview"
@@ -33,14 +34,14 @@
33
34
  "@react-three/postprocessing": "^3.0.4",
34
35
  "pako": "^2.1.0",
35
36
  "postprocessing": "^6.39.1",
36
- "three": "^0.184.0",
37
37
  "three-mesh-bvh": "^0.9.9",
38
38
  "web-ifc": "^0.0.77",
39
39
  "zustand": "^5.0.13"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^19.2.5",
43
- "react-dom": "^19.2.5"
43
+ "react-dom": "^19.2.5",
44
+ "three": "^0.184.0"
44
45
  },
45
46
  "devDependencies": {
46
47
  "@eslint/js": "^10.0.1",
@@ -61,6 +62,7 @@
61
62
  "lil-gui": "^0.21.0",
62
63
  "react": "^19.2.5",
63
64
  "react-dom": "^19.2.5",
65
+ "three": "^0.184.0",
64
66
  "typescript": "~6.0.2",
65
67
  "typescript-eslint": "^8.58.2",
66
68
  "vite": "^8.0.10"
@@ -1,104 +0,0 @@
1
- import { a as e, f as t, g as n, h as r, i, m as a, p as o, r as s, s as c, u as l } from "./three.webgpu-7Fqpf016.js";
2
- import { A as u, B as d, C as f, D as p, E as m, I as h, L as g, M as _, N as v, O as y, P as b, R as x, S, T as C, V as w, _ as T, a as E, b as D, c as O, d as k, f as A, g as j, h as M, i as N, j as P, k as F, m as I, n as L, o as R, p as z, r as B, s as V, t as H, u as U, v as W, w as G, x as K, y as q, z as J } from "./three.tsl-Dfou2CS1.js";
3
- //#region node_modules/three/examples/jsm/tsl/display/GTAONode.js
4
- var Y = /* @__PURE__ */ new i(), X = /* @__PURE__ */ new r(), Z = [
5
- 60,
6
- 300,
7
- 180,
8
- 240,
9
- 120,
10
- 0
11
- ], Q, $ = class extends c {
12
- static get type() {
13
- return "GTAONode";
14
- }
15
- constructor(e, n, i) {
16
- super("float"), this.depthNode = e, this.normalNode = n, this.resolutionScale = 1, this.updateBeforeType = N.FRAME, this._aoRenderTarget = new o(1, 1, {
17
- depthBuffer: !1,
18
- format: t
19
- }), this._aoRenderTarget.texture.name = "GTAONode.AO", this.radius = h(.25), this.resolution = h(new r()), this.thickness = h(1), this.distanceExponent = h(1), this.distanceFallOff = h(1), this.scale = h(1), this.samples = h(16), this.useTemporalFiltering = !1, this._noiseNode = v(ee()), this._cameraProjectionMatrix = h(i.projectionMatrix), this._cameraProjectionMatrixInverse = h(i.projectionMatrixInverse), this._cameraNear = F("near", "float", i), this._cameraFar = F("far", "float", i), this._temporalDirection = h(0), this._material = new s(), this._material.name = "GTAO", this._textureNode = p(this, this._aoRenderTarget.texture);
20
- }
21
- getTextureNode() {
22
- return this._textureNode;
23
- }
24
- setSize(e, t) {
25
- e = Math.round(this.resolutionScale * e), t = Math.round(this.resolutionScale * t), this.resolution.value.set(e, t), this._aoRenderTarget.setSize(e, t);
26
- }
27
- updateBefore(t) {
28
- let { renderer: n } = t;
29
- if (Q = e.resetRendererState(n, Q), this.useTemporalFiltering === !0) {
30
- let e = t.frameId;
31
- this._temporalDirection.value = Z[e % 6] / 360;
32
- } else this._temporalDirection.value = 0;
33
- let r = n.getDrawingBufferSize(X);
34
- this.setSize(r.width, r.height), Y.material = this._material, Y.name = "AO", n.setClearColor(16777215, 1), n.setRenderTarget(this._aoRenderTarget), Y.render(n), e.restoreRendererState(n, Q);
35
- }
36
- setup(e) {
37
- let t = g(), n = (t) => {
38
- let n = this.depthNode.sample(t).r;
39
- return e.renderer.logarithmicDepthBuffer === !0 ? w(D(n, this._cameraNear, this._cameraFar), this._cameraNear, this._cameraFar) : n;
40
- }, r = (e) => this._noiseNode.sample(e), i = (e) => this.normalNode === null ? j(e, this.depthNode.value, this._cameraProjectionMatrixInverse) : this.normalNode.sample(e).rgb.normalize(), a = H(() => {
41
- let e = n(t).toVar();
42
- e.greaterThanEqual(1).discard();
43
- let a = W(t, e, this._cameraProjectionMatrixInverse).toVar(), o = i(t).toVar(), s = this.radius, c = b(this._noiseNode, 0), l = x(t.x, t.y.oneMinus());
44
- l = l.mul(this.resolution.div(c));
45
- let p = r(l), h = J(p.xyz.mul(2).sub(1).xy, 0).normalize(), g = K(h, J(h.y.mul(-1), h.x, 0), J(0, 0, 1)), v = this.samples.lessThan(30).select(3, 5).toVar(), C = O(this.samples, v.sub(1)).div(v).toVar(), w = M(0).toVar();
46
- return B({
47
- start: q(0),
48
- end: v,
49
- type: "int",
50
- condition: "<"
51
- }, ({ i: e }) => {
52
- let t = M(e).div(M(v)).mul(E).add(this._temporalDirection).toVar(), r = d(k(t), u(t), 0, O(.5, G(.5, p.w)));
53
- r.xyz = m(g.mul(r.xyz));
54
- let i = m(a.xyz.negate()).toVar(), c = m(A(r.xyz, i)).toVar(), l = A(c, i), h = m(o.sub(c.mul(I(o, c)))), b = A(h, c).toVar(), D = x(I(i, b), I(i, b.negate())).toVar();
55
- B({
56
- end: C,
57
- type: "int",
58
- name: "j",
59
- condition: "<"
60
- }, ({ j: e }) => {
61
- let t = r.xyz.mul(s).mul(r.w).mul(y(z(M(e).add(1), M(C)), this.distanceExponent)), o = T(a.add(t), this._cameraProjectionMatrix).toVar(), c = W(o, n(o).toVar(), this._cameraProjectionMatrixInverse).toVar().sub(a).toVar();
62
- L(R(c.z).lessThan(this.thickness), () => {
63
- let t = I(i, m(c));
64
- D.x.addAssign(S(0, G(t.sub(D.x), f(1, M(2).div(M(e).add(2)), this.distanceFallOff))));
65
- });
66
- let l = T(a.sub(t), this._cameraProjectionMatrix).toVar(), u = W(l, n(l).toVar(), this._cameraProjectionMatrixInverse).toVar().sub(a).toVar();
67
- L(R(u.z).lessThan(this.thickness), () => {
68
- let t = I(i, m(u));
69
- D.y.addAssign(S(0, G(t.sub(D.y), f(1, M(2).div(M(e).add(2)), this.distanceFallOff))));
70
- });
71
- });
72
- let j = P(_(1, D.mul(D))).toVar(), N = I(h, l), F = I(h, i), H = G(.5, V(D.y).sub(V(D.x)).add(j.x.mul(D.x).sub(j.y.mul(D.y)))), U = G(.5, _(2, D.x.mul(D.x)).sub(D.y.mul(D.y))), K = N.mul(H).add(F.mul(U));
73
- w.addAssign(K);
74
- }), w.assign(U(w.div(v), 0, 1)), w.assign(y(w, this.scale)), w;
75
- });
76
- return this._material.fragmentNode = a().context(e.getSharedContext()), this._material.needsUpdate = !0, this._textureNode;
77
- }
78
- dispose() {
79
- this._aoRenderTarget.dispose(), this._material.dispose();
80
- }
81
- };
82
- function ee(e = 5) {
83
- let t = Math.floor(e) % 2 == 0 ? Math.floor(e) + 1 : Math.floor(e), r = te(t), i = r.length, o = new Uint8Array(i * 4);
84
- for (let e = 0; e < i; ++e) {
85
- let t = r[e], a = 2 * Math.PI * t / i, s = new n(Math.cos(a), Math.sin(a), 0).normalize();
86
- o[e * 4] = (s.x * .5 + .5) * 255, o[e * 4 + 1] = (s.y * .5 + .5) * 255, o[e * 4 + 2] = 127, o[e * 4 + 3] = 255;
87
- }
88
- let s = new l(o, t, t);
89
- return s.wrapS = a, s.wrapT = a, s.needsUpdate = !0, s;
90
- }
91
- function te(e) {
92
- let t = Math.floor(e) % 2 == 0 ? Math.floor(e) + 1 : Math.floor(e), n = t * t, r = Array(n).fill(0), i = Math.floor(t / 2), a = t - 1;
93
- for (let e = 1; e <= n;) {
94
- if (i === -1 && a === t ? (a = t - 2, i = 0) : (a === t && (a = 0), i < 0 && (i = t - 1)), r[i * t + a] !== 0) {
95
- a -= 2, i++;
96
- continue;
97
- } else r[i * t + a] = e++;
98
- a++, i--;
99
- }
100
- return r;
101
- }
102
- var ne = (e, t, n) => new $(C(e), C(t), n);
103
- //#endregion
104
- export { ne as ao, $ as default };
@@ -1,11 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var e = Object.defineProperty, t = (t, n) => {
3
- let r = {};
4
- for (var i in t) e(r, i, {
5
- get: t[i],
6
- enumerable: !0
7
- });
8
- return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
- };
10
- //#endregion
11
- export { t };