bimatter-viewer-react 1.0.0 → 1.0.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.
@@ -0,0 +1,24 @@
1
+ import type { DataTexture, Material, Plane } from "three";
2
+ import type { BmtMaterialData } from "./Loaders/BmtLoader";
3
+ import type { ViewerMaterialMode } from "./types";
4
+ /**
5
+ * Materials shared by the meshes of one model that look the same. The cache
6
+ * must stay per model: preselection writes the element id into the material
7
+ * uniforms of every mesh of the preselected model, so a material shared
8
+ * between models would highlight the same id in all of them.
9
+ *
10
+ * Keys include everything a material is built from, so a cache can outlive
11
+ * palette or renderer changes without handing out a mismatched material.
12
+ */
13
+ export declare class SharedMeshMaterials {
14
+ private readonly materials;
15
+ get<T extends Material>(key: string, create: () => T): T;
16
+ dispose(): void;
17
+ }
18
+ export declare function getSharedMeshMaterialKey(renderer: "webgl" | "webgpu", colorPaletteTexture: DataTexture, material: BmtMaterialData, materialMode: ViewerMaterialMode, useDoubleSideMaterial: boolean): string;
19
+ /**
20
+ * Gives a model material the current section planes before it is rendered,
21
+ * so a mesh added while clipping is active never shows up unclipped for a
22
+ * frame. It also compiles the shader with the planes right away.
23
+ */
24
+ export declare function applyMaterialClippingPlanes(material: Material, planes: Plane[] | undefined): void;
@@ -112,6 +112,11 @@ export declare class ClippingUtils {
112
112
  private getSelectedWorldBox;
113
113
  setControlsEnabled(enabled: boolean): void;
114
114
  setSelectionInteractionDisabled(disabled: boolean): void;
115
+ /**
116
+ * The plane array model materials reference: the live planes while
117
+ * clipping is active, so dragging a plane needs no material update.
118
+ */
119
+ getMaterialPlanes(): Plane[];
115
120
  updateMaterials(): void;
116
121
  setActive(active: boolean): void;
117
122
  toggle(): void;
@@ -140,6 +145,7 @@ export declare function useClippingUtils(modelRef: ViewerModelRef, controlRef: V
140
145
  getPlanVisualObjects: () => Object3D[];
141
146
  setCapsCameraMotionActive: (active: boolean) => void;
142
147
  setEdgesCameraMotionActive: (active: boolean) => void;
148
+ getMaterialPlanes: () => Plane[];
143
149
  setCapsPreselection: (preselection: ClippingPreselection) => void;
144
150
  syncWithModel: () => void;
145
151
  };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Turns a worker "error" event into an Error with whatever the browser told
3
+ * us. Errors thrown inside a running task come back as messages instead, so
4
+ * an event without a message usually means the worker script never started.
5
+ */
6
+ export declare function createWorkerEventError(workerName: string, event: ErrorEvent): Error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bimatter-viewer-react",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "license": "PolyForm-Noncommercial-1.0.0",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",