bimatter-viewer-react 0.6.11 → 0.7.1

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/lib/types.d.ts CHANGED
@@ -9,3 +9,4 @@ export type ViewerCameraRef = RefObject<Camera | null>;
9
9
  export type ViewerControlsRef = RefObject<CameraControlsImpl | null>;
10
10
  export type ViewerLightRef = RefObject<DirectionalLight | null>;
11
11
  export type ViewerMaterialMode = "quality" | "performance";
12
+ export type ViewerUploadMode = "smooth" | "balanced" | "fast";
@@ -1,4 +1,4 @@
1
- import { BufferGeometry, Mesh, Plane } from "three";
1
+ import { BufferGeometry, Mesh, Plane, Vector3 } from "three";
2
2
  import type { ClippingUtils } from "./ClippingUtils";
3
3
  type CapPreselection = {
4
4
  elementID: number;
@@ -9,7 +9,6 @@ export declare class ClippingCaps {
9
9
  readonly plane: Plane;
10
10
  private readonly capMaterial;
11
11
  private readonly capMesh;
12
- private readonly capTexture;
13
12
  private readonly context;
14
13
  private readonly root;
15
14
  private readonly box;
@@ -19,9 +18,6 @@ export declare class ClippingCaps {
19
18
  private readonly tempLine;
20
19
  private readonly tempVector;
21
20
  private readonly tempVector1;
22
- private readonly tempAxisX;
23
- private readonly tempAxisY;
24
- private readonly tempAxisZ;
25
21
  private readonly worldPoint;
26
22
  private capClippingPlanesKey;
27
23
  private capShader;
@@ -34,11 +30,14 @@ export declare class ClippingCaps {
34
30
  setVisible(visible: boolean): void;
35
31
  syncMeshes(): void;
36
32
  getSelectableObject(): Mesh<BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>, import("three").Material<import("three").MaterialEventMap> | import("three").Material<import("three").MaterialEventMap>[], import("three").Object3DEventMap>;
33
+ getSnapPoints(point: Vector3, distance: number): Vector3[];
37
34
  setPreselection(preselection: CapPreselection): void;
35
+ updateColors(): void;
38
36
  updateVisualState(): void;
39
37
  update(): void;
40
38
  private setupWebGpuCapMaterial;
41
39
  private setupCapMaterialShader;
40
+ private updateBaseMaterialColor;
42
41
  private updateColorUniform;
43
42
  private updateColorUniforms;
44
43
  private updatePreselectionUniforms;
@@ -56,8 +55,6 @@ export declare class ClippingCaps {
56
55
  private cleanContour;
57
56
  private triangulateContours;
58
57
  private pushContourVertex;
59
- private getHatchSpacing;
60
- private getModelHatchReferenceDirection;
61
58
  private getModelWorldBox;
62
59
  }
63
60
  export {};
@@ -1,4 +1,4 @@
1
- import { Camera, Material, Mesh, Object3D, Plane, Raycaster, Scene, Vector3, WebGLRenderer } from "three";
1
+ import { Camera, type ColorRepresentation, Material, Mesh, Object3D, Plane, Raycaster, Scene, Vector3, WebGLRenderer } from "three";
2
2
  import type { CameraUtilsApi } from "../../Camera/useCameraUtils";
3
3
  import type { ViewerStoreApi } from "../../store/ViewerStore";
4
4
  import type { ViewerControlsRef, ViewerModelRef } from "../../types";
@@ -27,12 +27,14 @@ export type ViewerClippingApi = {
27
27
  createPlane: (event?: MouseEvent | PointerEvent) => Plane | null;
28
28
  deleteAllPlanes: () => void;
29
29
  getCapsActive: () => boolean;
30
+ getCapsColor: () => ColorRepresentation;
30
31
  getEdgesActive: () => boolean;
31
32
  getHelpersActive: () => boolean;
32
33
  getPlanes: () => Plane[];
33
34
  getActive: () => boolean;
34
35
  setActive: (active: boolean) => void;
35
36
  setCapsActive: (active: boolean) => void;
37
+ setCapsColor: (color: ColorRepresentation) => void;
36
38
  setEdgesActive: (active: boolean) => void;
37
39
  setHelpersActive: (active: boolean) => void;
38
40
  toggle: () => void;
@@ -46,6 +48,8 @@ export declare class ClippingUtils {
46
48
  helpers: PlaneHelper[];
47
49
  private active;
48
50
  private capsActive;
51
+ private capsCameraMotionActive;
52
+ private capsColor;
49
53
  private context;
50
54
  private edgesActive;
51
55
  private helperDragActive;
@@ -60,6 +64,7 @@ export declare class ClippingUtils {
60
64
  getActive(): boolean;
61
65
  getEdgesActive(): boolean;
62
66
  getCapsActive(): boolean;
67
+ getCapsColor(): ColorRepresentation;
63
68
  getHelpersActive(): boolean;
64
69
  getPlanes(): Plane[];
65
70
  getScene(): Scene<import("three").Object3DEventMap>;
@@ -68,20 +73,21 @@ export declare class ClippingUtils {
68
73
  getDomElement(): HTMLCanvasElement;
69
74
  getRaycaster(): Raycaster;
70
75
  getUseWebGPU(): boolean;
71
- getMaxTextureAnisotropy(): number;
72
76
  getControlRef(): ViewerControlsRef;
73
77
  getMeshes(): Mesh<import("three").BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>, Material<import("three").MaterialEventMap> | Material<import("three").MaterialEventMap>[], import("three").Object3DEventMap>[];
74
78
  getObjectModelID(object: Object3D): number;
75
79
  getEdgeSegmentsForPlane(plane: Plane): readonly ClippingIntersectionSegment[] | null;
76
80
  getSelectableObjects(): Mesh<import("three").BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>, Material<import("three").MaterialEventMap> | Material<import("three").MaterialEventMap>[], import("three").Object3DEventMap>[];
81
+ getSnapPoints(point: Vector3, distance: number): Vector3[];
77
82
  getSelected(): import("../..").SelectedStore;
78
- getPreselectionColor(): import("three").ColorRepresentation;
79
- getSelectionColor(): import("three").ColorRepresentation;
83
+ getPreselectionColor(): ColorRepresentation;
84
+ getSelectionColor(): ColorRepresentation;
80
85
  setCapsPreselection(preselection: ClippingPreselection): void;
81
86
  updateCapsVisualState(): void;
82
87
  getHelperHoverIsMoving(): boolean;
83
88
  getHelperDragActive(): boolean;
84
89
  setHelperDragActive(active: boolean): void;
90
+ setCapsCameraMotionActive(active: boolean): void;
85
91
  setCapsDragActive(active: boolean): void;
86
92
  requestCapsDragIdleUpdate(): void;
87
93
  private clearCapsDragIdleTimeout;
@@ -102,6 +108,7 @@ export declare class ClippingUtils {
102
108
  deleteAllPlanes(): void;
103
109
  setHelpersActive(active: boolean): void;
104
110
  setCapsActive(active: boolean): void;
111
+ setCapsColor(color: ColorRepresentation): void;
105
112
  setEdgesActive(active: boolean): void;
106
113
  updateEdges(): void;
107
114
  flushEdgesUpdate(): void;
@@ -114,6 +121,8 @@ export declare class ClippingUtils {
114
121
  }
115
122
  export declare function useClippingUtils(modelRef: ViewerModelRef, controlRef: ViewerControlsRef, cameraUtils: CameraUtilsApi, useWebGPU?: boolean): ViewerClippingApi & {
116
123
  getSelectableObjects: () => Object3D[];
124
+ getSnapPoints: (point: Vector3, distance: number) => Vector3[];
125
+ setCapsCameraMotionActive: (active: boolean) => void;
117
126
  setCapsPreselection: (preselection: ClippingPreselection) => void;
118
127
  syncWithModel: () => void;
119
128
  };
@@ -1,4 +1,4 @@
1
- import { Color, ConeGeometry, Object3D, SphereGeometry, type Camera, type Scene } from "three";
1
+ import { Color, ConeGeometry, Object3D, SphereGeometry, Vector3, type Camera, type Scene } from "three";
2
2
  import { type CameraUtilsApi } from "../../Camera/useCameraUtils";
3
3
  import type { ViewerStoreApi } from "../../store/ViewerStore";
4
4
  import type { ViewerControlsRef, ViewerModelRef } from "../../types";
@@ -9,6 +9,7 @@ type DimensionsContext = {
9
9
  controlRef: ViewerControlsRef;
10
10
  domElement: HTMLCanvasElement;
11
11
  getExtraSnapObjects?: () => Object3D[];
12
+ getExtraSnapPoints?: (point: Vector3, distance: number) => Vector3[];
12
13
  modelRef: ViewerModelRef;
13
14
  scene: Scene;
14
15
  viewerStore: ViewerStoreApi;
@@ -78,6 +79,8 @@ export declare class DimensionsUtils {
78
79
  private getSnapObjects;
79
80
  private getModelHit;
80
81
  private getBoundingBoxes;
82
+ private getExtraSnapPoints;
83
+ private getClosestPoint;
81
84
  private getClosestVertex;
82
85
  private getPreviewEndPoint;
83
86
  private getNextAxis;
@@ -93,7 +96,7 @@ export declare class DimensionsUtils {
93
96
  static createEndpointGeometry(height?: number, radius?: number): ConeGeometry;
94
97
  static createPreviewGeometry(): SphereGeometry;
95
98
  }
96
- export declare function useDimensionsUtils(modelRef: ViewerModelRef, controlRef: ViewerControlsRef, cameraUtils: CameraUtilsApi, getExtraSnapObjects?: () => Object3D[]): ViewerDimensionsApi & {
99
+ export declare function useDimensionsUtils(modelRef: ViewerModelRef, controlRef: ViewerControlsRef, cameraUtils: CameraUtilsApi, getExtraSnapObjects?: () => Object3D[], getExtraSnapPoints?: (point: Vector3, distance: number) => Vector3[]): ViewerDimensionsApi & {
97
100
  syncWithModel: () => void;
98
101
  };
99
102
  export {};
@@ -31,6 +31,7 @@ export type GeometryIndex = {
31
31
  isolatedIdsByModel: Map<number, Set<number>> | null;
32
32
  isolatedIds: Set<number> | null;
33
33
  records: Set<MeshGeometryRecord>;
34
+ version: string;
34
35
  };
35
36
  export type GeometryIndexApi = {
36
37
  buildIndex: () => GeometryIndex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bimatter-viewer-react",
3
- "version": "0.6.11",
3
+ "version": "0.7.1",
4
4
  "license": "PolyForm-Noncommercial-1.0.0",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -1,109 +0,0 @@
1
- import { n as e, t } from "./three.webgpu-Br297kyp.js";
2
- import { a as n, i as r, n as i, r as a, s as o, t as s, u as c } from "./three.tsl-B8mjhAW6.js";
3
- import l, { useEffect as u, useMemo as d, useRef as f } from "react";
4
- import { Color as p, DoubleSide as m } from "three";
5
- import { MeshBVH as h } from "three-mesh-bvh";
6
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
7
- //#region src/viewer/WebGpuSelectableMesh.tsx
8
- var v = 1 / 1.5;
9
- function y({ colorPaletteTexture: c, material: l, materialMode: u, preselectionColor: d, selectionColor: f, useDoubleSideMaterial: h }) {
10
- let g = new p(l.r, l.g, l.b);
11
- u === "performance" && g.multiplyScalar(v);
12
- let _ = l.opacity ?? 1, y = {
13
- color: g.clone(),
14
- opacity: _,
15
- transparent: !!(_ && _ !== 1)
16
- }, b = h ? {
17
- ...y,
18
- side: m
19
- } : y, x = u === "performance" ? new t(b) : new e(b);
20
- x.defaultAttributeValues = {
21
- ...x.defaultAttributeValues,
22
- colorIndex: [0],
23
- ids: [0]
24
- };
25
- let S = a(i("colorIndex", "uint")), C = a(i("ids", "uint")), w = n(-1), T = n(new p(d)), E = n(new p(f)), D = n(g.clone()), O = n(_), k = r(c, o(S.add(.5).div(256), .5)).rgb, A = S.greaterThan(.5), j = s(S.sub(1)), M = j.lessThan(.5), N = j.greaterThan(.5), P = C.equal(w).and(N);
26
- return x.colorNode = P.select(T, M.select(E, A.select(k, D))), x.opacityNode = P.select(a(1), M.select(a(1), A.select(a(1), O))), x.userData.shader = { uniforms: {
27
- elementColorPalette: { value: c },
28
- preSelectionColor: T,
29
- preSelectionId: w,
30
- selectionColor: E
31
- } }, x;
32
- }
33
- var b = l.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, useDoubleSideMaterial: o = !1 }) {
34
- let s = f(null), l = d(() => new Uint32Array(r.ids.length), [r.ids]), m = c((e) => e.preselectionColor), v = c((e) => e.selectionColor), b = f(m);
35
- b.current = m;
36
- let x = f(v);
37
- x.current = v;
38
- let S = d(() => y({
39
- colorPaletteTexture: e,
40
- material: t,
41
- materialMode: n,
42
- preselectionColor: b.current,
43
- selectionColor: x.current,
44
- useDoubleSideMaterial: o
45
- }), [
46
- e,
47
- t,
48
- n,
49
- o
50
- ]);
51
- return u(() => {
52
- let e = S.userData.shader, t = (t, n) => {
53
- let r = e?.uniforms?.[t];
54
- r && (r.value instanceof p ? r.value.set(n) : r.value = new p(n));
55
- };
56
- t("preSelectionColor", m), t("selectionColor", v);
57
- }, [
58
- S,
59
- m,
60
- v
61
- ]), u(() => {
62
- if (!s.current) return;
63
- let e = s.current.geometry;
64
- n !== "performance" && !e.attributes.normal && e.computeVertexNormals();
65
- let t = new h(e, { indirect: !0 });
66
- return Object.assign(e, { boundsTree: t }), () => {
67
- S.dispose(), Object.assign(e, { boundsTree: null });
68
- };
69
- }, [S]), /* @__PURE__ */ _("mesh", {
70
- frustumCulled: !0,
71
- matrix: a,
72
- matrixAutoUpdate: !1,
73
- name: i ? "space" : void 0,
74
- ref: s,
75
- userData: {
76
- isIfcSpace: i,
77
- keepColorIndexAttribute: !0,
78
- useUint32ColorIndex: !0
79
- },
80
- onPointerLeave: (e) => {
81
- let t = e.object;
82
- t.preselected &&= !1;
83
- },
84
- children: [/* @__PURE__ */ _("bufferGeometry", { children: [
85
- /* @__PURE__ */ g("bufferAttribute", {
86
- attach: "attributes-position",
87
- args: [r.pos, 3]
88
- }),
89
- r.norm && /* @__PURE__ */ g("bufferAttribute", {
90
- attach: "attributes-normal",
91
- args: [r.norm, 3]
92
- }),
93
- /* @__PURE__ */ g("bufferAttribute", {
94
- attach: "attributes-ids",
95
- args: [r.ids, 1]
96
- }),
97
- /* @__PURE__ */ g("bufferAttribute", {
98
- attach: "attributes-colorIndex",
99
- args: [l, 1]
100
- }),
101
- /* @__PURE__ */ g("bufferAttribute", {
102
- attach: "index",
103
- args: [r.ind, 1]
104
- })
105
- ] }), /* @__PURE__ */ g("primitive", { object: S })]
106
- });
107
- });
108
- //#endregion
109
- export { b as WebGpuSelectableMesh };
@@ -1,293 +0,0 @@
1
- import { r as e } from "./three.webgpu-Br297kyp.js";
2
- import { createContext as t, useCallback as n, useContext as r, useEffect as i, useMemo as a, useRef as o } from "react";
3
- import { BufferAttribute as s, Color as c, DataTexture as l, NearestFilter as u, RGBAFormat as d, UnsignedByteType as f } from "three";
4
- import { useStore as p } from "zustand";
5
- import { createStore as m } from "zustand/vanilla";
6
- //#region src/viewer/store/ViewerStoreContext.ts
7
- var h = t(null);
8
- //#endregion
9
- //#region src/viewer/store/useViewerStore.ts
10
- function g(e) {
11
- return p(_(), e);
12
- }
13
- function _() {
14
- let e = r(h);
15
- if (!e) throw Error("useViewerStore must be used inside ViewerStoreProvider");
16
- return e;
17
- }
18
- //#endregion
19
- //#region src/viewer/store/ViewerStore.ts
20
- var v = "rgb(17, 148, 189)", y = "rgb(104, 198, 227)", b = {
21
- bottom: !0,
22
- left: !0,
23
- right: !0,
24
- top: !0,
25
- visible: !0
26
- };
27
- function x() {
28
- return m((e) => ({
29
- api: null,
30
- defaultHotkeysEnabled: !0,
31
- gridAxesVisibility: b,
32
- modelNames: {},
33
- modelProps: {},
34
- modelStructure: {},
35
- preselectionColor: y,
36
- selected: {},
37
- selectionColor: v,
38
- selectionInteractionDisabled: !1,
39
- showNavCube: !0,
40
- showStats: !1,
41
- userDevice: "pc",
42
- setApi: (t) => e({ api: t }),
43
- setDefaultHotkeysEnabled: (t) => e({ defaultHotkeysEnabled: t }),
44
- setGridAxesVisibility: (t) => {
45
- e((e) => ({ gridAxesVisibility: {
46
- ...e.gridAxesVisibility,
47
- ...t
48
- } }));
49
- },
50
- setGridAxisVisibility: (t, n) => {
51
- e((e) => ({ gridAxesVisibility: {
52
- ...e.gridAxesVisibility,
53
- [t]: n
54
- } }));
55
- },
56
- setShowGridAxes: (t) => {
57
- e((e) => ({ gridAxesVisibility: {
58
- ...e.gridAxesVisibility,
59
- visible: t
60
- } }));
61
- },
62
- setModelNames: (t) => e({ modelNames: t }),
63
- setModelProps: (t) => e({ modelProps: t }),
64
- setModelStructure: (t) => e({ modelStructure: t }),
65
- setPreselectionColor: (t) => e({ preselectionColor: t }),
66
- setSelectionColor: (t) => e({ selectionColor: t }),
67
- setSelectionInteractionDisabled: (t) => e({ selectionInteractionDisabled: t }),
68
- setShowNavCube: (t) => e({ showNavCube: t }),
69
- setShowStats: (t) => e({ showStats: t }),
70
- setUserDevice: (t) => e({ userDevice: t }),
71
- setSelection: (t) => e({ selected: t }),
72
- setSelected: (t, n, r = !1) => {
73
- e((e) => {
74
- if (r) {
75
- let r = {};
76
- return Object.keys(e.selected).forEach((e) => {
77
- r[Number(e)] = Number(e) === t ? new Set(n) : /* @__PURE__ */ new Set();
78
- }), r[t] || (r[t] = new Set(n)), { selected: r };
79
- }
80
- return { selected: {
81
- ...e.selected,
82
- [t]: new Set(n)
83
- } };
84
- });
85
- },
86
- addSelected: (t, n) => {
87
- e((e) => {
88
- let r = new Set(e.selected[t] ?? []);
89
- return n.forEach((e) => r.add(e)), { selected: {
90
- ...e.selected,
91
- [t]: r
92
- } };
93
- });
94
- },
95
- removeSelected: (t, n) => {
96
- e((e) => {
97
- let r = new Set(e.selected[t] ?? []);
98
- return n.forEach((e) => r.delete(e)), { selected: {
99
- ...e.selected,
100
- [t]: r
101
- } };
102
- });
103
- },
104
- resetSelected: (t) => {
105
- e((e) => {
106
- if (t !== void 0) return { selected: {
107
- ...e.selected,
108
- [t]: /* @__PURE__ */ new Set()
109
- } };
110
- let n = {};
111
- return Object.keys(e.selected).forEach((e) => {
112
- n[Number(e)] = /* @__PURE__ */ new Set();
113
- }), { selected: n };
114
- });
115
- }
116
- }));
117
- }
118
- var S = 2;
119
- function C() {
120
- let e = new l(new Uint8Array(256 * 4), 256, 1, d, f);
121
- return e.magFilter = u, e.minFilter = u, e.generateMipmaps = !1, e.needsUpdate = !0, T(e, 1, new c(v)), e;
122
- }
123
- function w(e) {
124
- return `${e.r.toFixed(6)}:${e.g.toFixed(6)}:${e.b.toFixed(6)}`;
125
- }
126
- function T(e, t, n) {
127
- let r = e.image.data, i = t * 4;
128
- r[i] = Math.round(n.r * 255), r[i + 1] = Math.round(n.g * 255), r[i + 2] = Math.round(n.b * 255), r[i + 3] = 255, e.needsUpdate = !0;
129
- }
130
- function E(e) {
131
- return e.mesh.geometry.attributes.colorIndex;
132
- }
133
- function D(e) {
134
- let t = e.mesh.geometry.attributes.ids;
135
- if (!t) return null;
136
- let n = new s(e.mesh.userData.useUint32ColorIndex === !0 ? new Uint32Array(t.count) : new Uint8Array(t.count), 1);
137
- return e.mesh.geometry.setAttribute("colorIndex", n), n;
138
- }
139
- function O(e, t) {
140
- let n = E(e);
141
- return n || t === 0 ? n : D(e);
142
- }
143
- function k(e) {
144
- e.mesh.userData.keepColorIndexAttribute !== !0 && E(e) && e.mesh.geometry.deleteAttribute("colorIndex");
145
- }
146
- function A(e, t, n) {
147
- let r = e.get(t);
148
- return !r && n && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r;
149
- }
150
- function j(e, t) {
151
- let n = O(e.record, t);
152
- if (!n) return !1;
153
- let r = n.array;
154
- return e.vertexRanges.forEach(({ count: e, start: n }) => {
155
- r.fill(t, n, n + e);
156
- }), n.needsUpdate = !0, !0;
157
- }
158
- function M(e, t, n, r, i) {
159
- e && e.forEach((e) => {
160
- if (e.record.modelID !== t) return;
161
- let a = j(e, r), o = A(i, e.record, r !== 0 && a);
162
- r === 0 ? (o?.delete(n), o?.size || (i.delete(e.record), k(e.record))) : a && o?.add(n);
163
- });
164
- }
165
- function N(e, t, n) {
166
- let r = /* @__PURE__ */ new Set();
167
- return e.elementIndex.forEach((e, i) => {
168
- n.has(i) || e.some((e) => e.record.modelID === t) && r.add(i);
169
- }), r;
170
- }
171
- function P(e) {
172
- let t = /* @__PURE__ */ new Set();
173
- return Object.entries(e).forEach(([e, n]) => {
174
- n.forEach((n) => t.add(`${e}:${n}`));
175
- }), t;
176
- }
177
- function F(e, t) {
178
- let n = /* @__PURE__ */ new Map(), r = (e) => {
179
- let [t, r] = e.split(":").map(Number), i = n.get(t);
180
- i || (i = /* @__PURE__ */ new Set(), n.set(t, i)), i.add(r);
181
- };
182
- return t.forEach((t) => {
183
- e.has(t) || r(t);
184
- }), e.forEach((e) => {
185
- t.has(e) || r(e);
186
- }), n;
187
- }
188
- function I(e) {
189
- let t = g((e) => e.selected), r = g((e) => e.selectionColor), s = a(() => C(), []), l = o(/* @__PURE__ */ new Map()), u = o(S), d = o(/* @__PURE__ */ new Map()), f = o(t), p = o(/* @__PURE__ */ new Set()), m = o(/* @__PURE__ */ new WeakMap());
190
- i(() => {
191
- f.current = t;
192
- }, [t]), i(() => () => s.dispose(), [s]), i(() => {
193
- T(s, 1, new c(r));
194
- }, [s, r]);
195
- let h = n((e, t) => f.current[e]?.has(t) ? 1 : d.current.get(e)?.get(t) ?? 0, []), _ = n((t, n) => {
196
- let r = e.buildIndex();
197
- n.forEach((e) => {
198
- M(r.elementIndex.get(e), t, e, h(t, e), m.current);
199
- });
200
- }, [e, h]), v = n((e) => {
201
- let t = new c(e), n = w(t), r = l.current.get(n);
202
- if (r !== void 0) return r;
203
- let i = u.current;
204
- if (i >= 256) throw Error("Element color palette is full. Maximum colors: 255.");
205
- return l.current.set(n, i), u.current += 1, T(s, i, t), i;
206
- }, [s]);
207
- i(() => {
208
- let e = P(t);
209
- F(p.current, e).forEach((e, t) => {
210
- _(t, Array.from(e));
211
- }), p.current = e;
212
- }, [_, t]);
213
- let y = n((e, t, n) => {
214
- let r = v(n), i = d.current.get(e);
215
- i || (i = /* @__PURE__ */ new Map(), d.current.set(e, i)), t.forEach((e) => i.set(e, r)), _(e, t);
216
- }, [_, v]), b = n((t, n, r) => {
217
- let i = e.buildIndex(), a = /* @__PURE__ */ new Set(), o = Object.entries(n);
218
- o.forEach(([, e]) => {
219
- e.forEach((e) => a.add(e));
220
- }), r !== void 0 && y(t, Array.from(N(i, t, a)), r), o.forEach(([e, n]) => {
221
- y(t, n, e);
222
- });
223
- }, [e, y]), x = n((e, t) => {
224
- Object.entries(e).forEach(([e, n]) => {
225
- b(Number(e), n, t);
226
- });
227
- }, [b]), E = n((e, t) => {
228
- let n = d.current.get(e);
229
- t.forEach((e) => n?.delete(e)), n?.size === 0 && d.current.delete(e), _(e, t);
230
- }, [_]), D = n((e) => {
231
- let t = d.current.get(e);
232
- if (!t?.size) return;
233
- let n = Array.from(t.keys());
234
- t.clear(), d.current.delete(e), _(e, n);
235
- }, [_]), O = n(() => {
236
- let t = e.buildIndex(), n = /* @__PURE__ */ new Map(), r = (e, t) => {
237
- let r = n.get(e);
238
- r || (r = /* @__PURE__ */ new Set(), n.set(e, r)), r.add(t);
239
- };
240
- d.current.forEach((e, t) => {
241
- e.forEach((e, n) => {
242
- r(t, n);
243
- });
244
- }), Object.entries(f.current).forEach(([e, t]) => {
245
- t.forEach((t) => r(Number(e), t));
246
- }), n.forEach((e, n) => {
247
- e.forEach((e) => {
248
- M(t.elementIndex.get(e), n, e, h(n, e), m.current);
249
- });
250
- });
251
- }, [e, h]), A = n(() => {
252
- e.buildIndex().records.forEach((e) => {
253
- m.current.delete(e), k(e);
254
- }), m.current = /* @__PURE__ */ new WeakMap(), d.current.clear(), O();
255
- }, [O, e]);
256
- return {
257
- colorPaletteTexture: s,
258
- colorUtils: a(() => ({
259
- applyStoredColors: O,
260
- clearAllColors: A,
261
- clearColor: E,
262
- clearModelColors: D,
263
- rebuildByColors: x,
264
- rebuildModelByColors: b,
265
- setColor: y
266
- }), [
267
- O,
268
- A,
269
- E,
270
- D,
271
- x,
272
- b,
273
- y
274
- ])
275
- };
276
- }
277
- e.BRDF_GGX, e.BRDF_Lambert, e.BasicPointShadowFilter, e.BasicShadowFilter, e.Break, e.Const, e.Continue, e.DFGLUT, e.D_GGX, e.Discard, e.EPSILON, e.F_Schlick, e.Fn, e.INFINITY, e.If, e.Loop, e.NodeAccess, e.NodeShaderStage, e.NodeType, e.NodeUpdateType, e.PCFShadowFilter, e.PCFSoftShadowFilter, e.PI, e.PI2, e.TWO_PI, e.HALF_PI, e.PointShadowFilter, e.Return, e.Schlick_to_F0, e.ShaderNode, e.Stack, e.Switch, e.TBNViewMatrix, e.VSMShadowFilter, e.V_GGX_SmithCorrelated, e.Var, e.VarIntent;
278
- var L = e.abs;
279
- e.acesFilmicToneMapping, e.acos, e.acosh, e.add, e.addMethodChaining, e.addNodeElement, e.agxToneMapping, e.all, e.alphaT, e.and, e.anisotropy, e.anisotropyB, e.anisotropyT, e.any, e.append, e.array, e.arrayBuffer, e.asin, e.asinh, e.assign, e.atan, e.atanh, e.atomicAdd, e.atomicAnd, e.atomicFunc, e.atomicLoad, e.atomicMax, e.atomicMin, e.atomicOr, e.atomicStore, e.atomicSub, e.atomicXor, e.attenuationColor, e.attenuationDistance;
280
- var R = e.attribute;
281
- e.attributeArray, e.backgroundBlurriness, e.backgroundIntensity, e.backgroundRotation, e.batch, e.bentNormalView, e.billboarding, e.bitAnd, e.bitNot, e.bitOr, e.bitXor, e.bitangentGeometry, e.bitangentLocal, e.bitangentView, e.bitangentWorld, e.bitcast, e.blendBurn, e.blendColor, e.blendDodge, e.blendOverlay, e.blendScreen, e.blur, e.bool, e.buffer, e.bufferAttribute, e.bumpMap, e.builtin, e.builtinAOContext, e.builtinShadowContext, e.bvec2, e.bvec3, e.bvec4, e.bypass, e.cache, e.call, e.cameraFar, e.cameraIndex, e.cameraNear, e.cameraNormalMatrix, e.cameraPosition, e.cameraProjectionMatrix, e.cameraProjectionMatrixInverse, e.cameraViewMatrix, e.cameraViewport, e.cameraWorldMatrix, e.cbrt, e.cdl, e.ceil, e.checker, e.cineonToneMapping, e.clamp, e.clearcoat, e.clearcoatNormalView, e.clearcoatRoughness, e.clipSpace, e.code, e.color, e.colorSpaceToWorking, e.colorToDirection, e.compute, e.computeKernel, e.computeSkinning, e.context, e.convert, e.convertColorSpace, e.convertToTexture, e.countLeadingZeros, e.countOneBits, e.countTrailingZeros, e.cos, e.cosh, e.cross, e.cubeTexture, e.cubeTextureBase, e.dFdx, e.dFdy, e.dashSize, e.debug, e.decrement, e.decrementBefore, e.defaultBuildStages, e.defaultShaderStages, e.defined, e.degrees, e.deltaTime, e.densityFog, e.densityFogFactor, e.depth, e.depthPass, e.determinant, e.difference, e.diffuseColor, e.directPointLight, e.directionToColor, e.directionToFaceDirection, e.dispersion, e.distance, e.div, e.dot, e.drawIndex, e.dynamicBufferAttribute, e.element, e.emissive, e.equal, e.equirectUV, e.exp, e.exp2, e.exponentialHeightFogFactor, e.expression, e.faceDirection, e.faceForward, e.faceforward;
282
- var z = e.float;
283
- e.floatBitsToInt, e.floatBitsToUint, e.floor, e.fog, e.fract, e.frameGroup, e.frameId, e.frontFacing, e.fwidth, e.gain, e.gapSize, e.getConstNodeType, e.getCurrentStack, e.getDirection, e.getDistanceAttenuation, e.getGeometryRoughness, e.getNormalFromDepth, e.interleavedGradientNoise, e.vogelDiskSample, e.getParallaxCorrectNormal, e.getRoughness, e.getScreenPosition, e.getShIrradianceAt, e.getShadowMaterial, e.getShadowRenderObjectFunction, e.getTextureIndex, e.getViewPosition, e.globalId, e.glsl, e.glslFn, e.grayscale, e.greaterThan, e.greaterThanEqual, e.hash, e.highpModelNormalViewMatrix, e.highpModelViewMatrix, e.hue, e.increment, e.incrementBefore, e.instance, e.instanceIndex, e.instancedArray, e.instancedBufferAttribute, e.instancedDynamicBufferAttribute, e.instancedMesh, e.int, e.intBitsToFloat, e.inverse, e.inverseSqrt, e.inversesqrt, e.invocationLocalIndex, e.invocationSubgroupIndex, e.ior, e.iridescence, e.iridescenceIOR, e.iridescenceThickness, e.ivec2, e.ivec3, e.ivec4, e.js, e.label, e.length, e.lengthSq, e.lessThan, e.lessThanEqual, e.lightPosition, e.lightProjectionUV, e.lightShadowMatrix, e.lightTargetDirection, e.lightTargetPosition, e.lightViewPosition, e.lightingContext, e.lights, e.linearDepth, e.linearToneMapping, e.localId, e.log, e.log2, e.logarithmicDepthToViewZ, e.luminance, e.mat2, e.mat3, e.mat4, e.matcapUV, e.materialAO, e.materialAlphaTest, e.materialAnisotropy, e.materialAnisotropyVector, e.materialAttenuationColor, e.materialAttenuationDistance, e.materialClearcoat, e.materialClearcoatNormal, e.materialClearcoatRoughness, e.materialColor, e.materialDispersion, e.materialEmissive, e.materialEnvIntensity, e.materialEnvRotation, e.materialIOR, e.materialIridescence, e.materialIridescenceIOR, e.materialIridescenceThickness, e.materialLightMap, e.materialLineDashOffset, e.materialLineDashSize, e.materialLineGapSize, e.materialLineScale, e.materialLineWidth, e.materialMetalness, e.materialNormal, e.materialOpacity, e.materialPointSize, e.materialReference, e.materialReflectivity, e.materialRefractionRatio, e.materialRotation, e.materialRoughness, e.materialSheen, e.materialSheenRoughness, e.materialShininess, e.materialSpecular, e.materialSpecularColor, e.materialSpecularIntensity, e.materialSpecularStrength, e.materialThickness, e.materialTransmission, e.max, e.maxMipLevel, e.mediumpModelViewMatrix, e.metalness, e.min, e.mix, e.mixElement, e.mod, e.modInt, e.modelDirection, e.modelNormalMatrix, e.modelPosition, e.modelRadius, e.modelScale, e.modelViewMatrix, e.modelViewPosition, e.modelViewProjection, e.modelWorldMatrix, e.modelWorldMatrixInverse, e.morphReference, e.mrt, e.mul, e.mx_aastep, e.mx_add, e.mx_atan2, e.mx_cell_noise_float, e.mx_contrast, e.mx_divide, e.mx_fractal_noise_float, e.mx_fractal_noise_vec2, e.mx_fractal_noise_vec3, e.mx_fractal_noise_vec4, e.mx_frame, e.mx_heighttonormal, e.mx_hsvtorgb, e.mx_ifequal, e.mx_ifgreater, e.mx_ifgreatereq, e.mx_invert, e.mx_modulo, e.mx_multiply, e.mx_noise_float, e.mx_noise_vec3, e.mx_noise_vec4, e.mx_place2d, e.mx_power, e.mx_ramp4, e.mx_ramplr, e.mx_ramptb, e.mx_rgbtohsv, e.mx_rotate2d, e.mx_rotate3d, e.mx_safepower, e.mx_separate, e.mx_splitlr, e.mx_splittb, e.mx_srgb_texture_to_lin_rec709, e.mx_subtract, e.mx_timer, e.mx_transform_uv, e.mx_unifiednoise2d, e.mx_unifiednoise3d, e.mx_worley_noise_float, e.mx_worley_noise_vec2, e.mx_worley_noise_vec3, e.negate, e.neutralToneMapping, e.nodeArray, e.nodeImmutable, e.nodeObject, e.nodeObjectIntent, e.nodeObjects, e.nodeProxy, e.nodeProxyIntent, e.normalFlat, e.normalGeometry, e.normalLocal, e.normalMap, e.normalView, e.normalViewGeometry, e.normalWorld, e.normalWorldGeometry, e.normalize, e.not, e.notEqual, e.numWorkgroups, e.objectDirection, e.objectGroup, e.objectPosition, e.objectRadius, e.objectScale, e.objectViewPosition, e.objectWorldMatrix, e.OnBeforeObjectUpdate, e.OnBeforeMaterialUpdate, e.OnObjectUpdate, e.OnMaterialUpdate, e.oneMinus, e.or, e.orthographicDepthToViewZ, e.oscSawtooth, e.oscSine, e.oscSquare, e.oscTriangle, e.output, e.outputStruct, e.overloadingFn, e.packHalf2x16, e.packSnorm2x16, e.packUnorm2x16, e.parabola, e.parallaxDirection, e.parallaxUV, e.parameter, e.pass, e.passTexture, e.pcurve, e.perspectiveDepthToViewZ, e.pmremTexture, e.pointShadow, e.pointUV, e.pointWidth, e.positionGeometry, e.positionLocal, e.positionPrevious, e.positionView, e.positionViewDirection, e.positionWorld, e.positionWorldDirection, e.posterize, e.pow, e.pow2, e.pow3, e.pow4, e.premultiplyAlpha, e.property, e.radians, e.rand, e.range, e.rangeFog, e.rangeFogFactor, e.reciprocal, e.reference, e.referenceBuffer, e.reflect, e.reflectVector, e.reflectView, e.reflector, e.refract, e.refractVector, e.refractView, e.reinhardToneMapping, e.remap, e.remapClamp, e.renderGroup, e.renderOutput, e.rendererReference, e.replaceDefaultUV, e.rotate, e.rotateUV, e.roughness, e.round, e.rtt, e.sRGBTransferEOTF, e.sRGBTransferOETF, e.sample, e.sampler, e.samplerComparison, e.saturate, e.saturation, e.screen, e.screenCoordinate, e.screenDPR, e.screenSize, e.screenUV, e.select, e.setCurrentStack, e.setName, e.shaderStages, e.shadow, e.shadowPositionWorld, e.shapeCircle, e.sharedUniformGroup, e.sheen, e.sheenRoughness, e.shiftLeft, e.shiftRight, e.shininess, e.sign, e.sin, e.sinh, e.sinc, e.skinning, e.smoothstep, e.smoothstepElement, e.specularColor, e.specularF90, e.spherizeUV, e.split, e.spritesheetUV, e.sqrt, e.stack, e.step, e.stepElement, e.storage, e.storageBarrier, e.storageTexture, e.string, e.struct, e.sub, e.subgroupAdd, e.subgroupAll, e.subgroupAnd, e.subgroupAny, e.subgroupBallot, e.subgroupBroadcast, e.subgroupBroadcastFirst, e.subBuild, e.subgroupElect, e.subgroupExclusiveAdd, e.subgroupExclusiveMul, e.subgroupInclusiveAdd, e.subgroupInclusiveMul, e.subgroupIndex, e.subgroupMax, e.subgroupMin, e.subgroupMul, e.subgroupOr, e.subgroupShuffle, e.subgroupShuffleDown, e.subgroupShuffleUp, e.subgroupShuffleXor, e.subgroupSize, e.subgroupXor, e.tan, e.tanh, e.tangentGeometry, e.tangentLocal, e.tangentView, e.tangentWorld;
284
- var B = e.texture;
285
- e.texture3D, e.textureBarrier, e.textureBicubic, e.textureBicubicLevel, e.textureCubeUV, e.textureLoad, e.textureSize, e.textureLevel, e.textureStore, e.thickness, e.time, e.toneMapping, e.toneMappingExposure, e.toonOutlinePass, e.transformDirection, e.transformNormal, e.transformNormalToView, e.transformedClearcoatNormalView, e.transformedNormalView, e.transformedNormalWorld, e.transmission, e.transpose, e.triNoise3D, e.triplanarTexture, e.triplanarTextures, e.trunc, e.uint, e.uintBitsToFloat;
286
- var V = e.uniform;
287
- e.uniformArray, e.uniformCubeTexture, e.uniformGroup, e.uniformFlow, e.uniformTexture, e.unpackHalf2x16, e.unpackSnorm2x16, e.unpackUnorm2x16, e.unpremultiplyAlpha, e.userData;
288
- var H = e.uv;
289
- e.uvec2, e.uvec3, e.uvec4, e.varying, e.varyingProperty;
290
- var U = e.vec2;
291
- e.vec3, e.vec4, e.vectorComponents, e.velocity, e.vertexColor, e.vertexIndex, e.vertexStage, e.vibrance, e.viewZToLogarithmicDepth, e.viewZToOrthographicDepth, e.viewZToPerspectiveDepth, e.viewZToReversedOrthographicDepth, e.viewZToReversedPerspectiveDepth, e.viewport, e.viewportCoordinate, e.viewportDepthTexture, e.viewportLinearDepth, e.viewportMipTexture, e.viewportOpaqueMipTexture, e.viewportResolution, e.viewportSafeUV, e.viewportSharedTexture, e.viewportSize, e.viewportTexture, e.viewportUV, e.wgsl, e.wgslFn, e.workgroupArray, e.workgroupBarrier, e.workgroupId, e.workingToColorSpace, e.xor;
292
- //#endregion
293
- export { V as a, I as c, _ as d, h as f, B as i, x as l, R as n, H as o, z as r, U as s, L as t, g as u };