three-cad-viewer 4.3.4 → 4.3.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/scene/clipping.d.ts +6 -0
- package/dist/three-cad-viewer.esm.js +20 -5
- package/dist/three-cad-viewer.esm.js.map +1 -1
- package/dist/three-cad-viewer.esm.min.js +1 -1
- package/dist/three-cad-viewer.js +20 -5
- package/dist/three-cad-viewer.min.js +1 -1
- package/package.json +2 -3
- package/src/_version.ts +0 -1
- package/src/camera/camera.ts +0 -445
- package/src/camera/controls/CADOrbitControls.ts +0 -241
- package/src/camera/controls/CADTrackballControls.ts +0 -598
- package/src/camera/controls.ts +0 -380
- package/src/core/patches.ts +0 -16
- package/src/core/studio-manager.ts +0 -652
- package/src/core/types.ts +0 -892
- package/src/core/viewer-state.ts +0 -784
- package/src/core/viewer.ts +0 -4821
- package/src/index.ts +0 -151
- package/src/rendering/environment.ts +0 -840
- package/src/rendering/light-detection.ts +0 -327
- package/src/rendering/material-factory.ts +0 -735
- package/src/rendering/material-presets.ts +0 -289
- package/src/rendering/raycast.ts +0 -291
- package/src/rendering/room-environment.ts +0 -192
- package/src/rendering/studio-composer.ts +0 -577
- package/src/rendering/studio-floor.ts +0 -108
- package/src/rendering/texture-cache.ts +0 -324
- package/src/rendering/tree-model.ts +0 -542
- package/src/rendering/triplanar.ts +0 -329
- package/src/scene/animation.ts +0 -343
- package/src/scene/axes.ts +0 -108
- package/src/scene/bbox.ts +0 -223
- package/src/scene/clipping.ts +0 -640
- package/src/scene/grid.ts +0 -864
- package/src/scene/nestedgroup.ts +0 -1444
- package/src/scene/objectgroup.ts +0 -866
- package/src/scene/orientation.ts +0 -259
- package/src/scene/render-shape.ts +0 -634
- package/src/tools/cad_tools/measure.ts +0 -811
- package/src/tools/cad_tools/select.ts +0 -100
- package/src/tools/cad_tools/tools.ts +0 -231
- package/src/tools/cad_tools/ui.ts +0 -454
- package/src/tools/cad_tools/zebra.ts +0 -369
- package/src/types/html.d.ts +0 -5
- package/src/types/n8ao.d.ts +0 -28
- package/src/types/three-augmentation.d.ts +0 -60
- package/src/ui/display.ts +0 -3295
- package/src/ui/index.html +0 -505
- package/src/ui/info.ts +0 -177
- package/src/ui/slider.ts +0 -206
- package/src/ui/toolbar.ts +0 -347
- package/src/ui/treeview.ts +0 -945
- package/src/utils/decode-instances.ts +0 -233
- package/src/utils/font.ts +0 -60
- package/src/utils/gpu-tracker.ts +0 -265
- package/src/utils/logger.ts +0 -92
- package/src/utils/sizeof.ts +0 -116
- package/src/utils/timer.ts +0 -69
- package/src/utils/utils.ts +0 -446
package/src/core/types.ts
DELETED
|
@@ -1,892 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeScript type definitions for three-cad-viewer
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as THREE from "three";
|
|
6
|
-
import type { Vector3Tuple, QuaternionTuple } from "three";
|
|
7
|
-
|
|
8
|
-
// Re-export tuple types for external API use
|
|
9
|
-
export type { Vector3Tuple, QuaternionTuple } from "three";
|
|
10
|
-
|
|
11
|
-
// =============================================================================
|
|
12
|
-
// Basic Types
|
|
13
|
-
// =============================================================================
|
|
14
|
-
|
|
15
|
-
/** Theme input option (browser resolves to light or dark) */
|
|
16
|
-
export type ThemeInput = "light" | "dark" | "browser";
|
|
17
|
-
|
|
18
|
-
/** Resolved theme (after browser detection) */
|
|
19
|
-
export type Theme = "light" | "dark";
|
|
20
|
-
|
|
21
|
-
/** Control type */
|
|
22
|
-
export type ControlType = "orbit" | "trackball";
|
|
23
|
-
|
|
24
|
-
/** Up direction */
|
|
25
|
-
export type UpDirection = "Z" | "Y" | "legacy";
|
|
26
|
-
|
|
27
|
-
/** Animation mode */
|
|
28
|
-
export type AnimationMode = "none" | "animation" | "explode";
|
|
29
|
-
|
|
30
|
-
/** Active sidebar tab */
|
|
31
|
-
export type ActiveTab = "tree" | "clip" | "material" | "zebra" | "studio";
|
|
32
|
-
|
|
33
|
-
/** Zebra color scheme */
|
|
34
|
-
export type ZebraColorScheme = "blackwhite" | "colorful" | "grayscale";
|
|
35
|
-
|
|
36
|
-
/** Zebra mapping mode */
|
|
37
|
-
export type ZebraMappingMode = "reflection" | "normal";
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Studio environment preset name.
|
|
41
|
-
* - "studio": Built-in procedural RoomEnvironment (zero network)
|
|
42
|
-
* - "none": No environment map
|
|
43
|
-
* - Any other string: Poly Haven HDR preset slug or custom HDR URL
|
|
44
|
-
*/
|
|
45
|
-
export type StudioEnvironment = string;
|
|
46
|
-
|
|
47
|
-
/** Studio tone mapping algorithm */
|
|
48
|
-
export type StudioToneMapping = "neutral" | "ACES" | "none";
|
|
49
|
-
|
|
50
|
-
/** Studio background mode */
|
|
51
|
-
export type StudioBackground = "grey" | "darkgrey" | "white" | "gradient" | "gradient-dark" | "environment" | "transparent";
|
|
52
|
-
|
|
53
|
-
/** Studio texture mapping mode */
|
|
54
|
-
export type StudioTextureMapping = "triplanar" | "parametric";
|
|
55
|
-
|
|
56
|
-
/** Shape type */
|
|
57
|
-
export type ShapeType = "shapes" | "edges" | "vertices";
|
|
58
|
-
|
|
59
|
-
/** Shape subtype */
|
|
60
|
-
export type ShapeSubtype = "solid" | "faces";
|
|
61
|
-
|
|
62
|
-
/** Axis identifier */
|
|
63
|
-
export type Axis = "x" | "y" | "z";
|
|
64
|
-
|
|
65
|
-
/** Clip plane index (0, 1, or 2) */
|
|
66
|
-
export type ClipIndex = 0 | 1 | 2;
|
|
67
|
-
|
|
68
|
-
/** Valid clip indices as array for iteration */
|
|
69
|
-
export const CLIP_INDICES: readonly ClipIndex[] = [0, 1, 2];
|
|
70
|
-
|
|
71
|
-
/** Type guard to check if a number is a valid ClipIndex */
|
|
72
|
-
export function isClipIndex(n: number): n is ClipIndex {
|
|
73
|
-
return n === 0 || n === 1 || n === 2;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** Tree collapse state */
|
|
77
|
-
export enum CollapseState {
|
|
78
|
-
LEAVES = -1, // Button "1" - smart expand (openLevel -1)
|
|
79
|
-
COLLAPSED = 0, // Button "C" - all nodes collapsed
|
|
80
|
-
ROOT = 1, // Button "R" - only root expanded
|
|
81
|
-
EXPANDED = 2, // Button "E" - all nodes expanded (maxLevel)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/** Color value that THREE.Color accepts - hex number or CSS string */
|
|
85
|
-
export type ColorValue = number | string;
|
|
86
|
-
|
|
87
|
-
/** RGB color as tuple [r, g, b] with values 0-1 */
|
|
88
|
-
export type RGBColor = [number, number, number];
|
|
89
|
-
|
|
90
|
-
/** RGBA color as tuple [r, g, b, a] with values 0-1 */
|
|
91
|
-
export type RGBAColor = [number, number, number, number];
|
|
92
|
-
|
|
93
|
-
/** Axis colors per theme - array of RGB colors for X, Y, Z axes */
|
|
94
|
-
export type AxisColors = Record<Theme, RGBColor[]>;
|
|
95
|
-
|
|
96
|
-
/** Flat axis colors per theme - all RGB values concatenated for line geometry */
|
|
97
|
-
export type AxisColorsFlatArray = Record<Theme, number[]>;
|
|
98
|
-
|
|
99
|
-
// =============================================================================
|
|
100
|
-
// State Change Types
|
|
101
|
-
// =============================================================================
|
|
102
|
-
|
|
103
|
-
/** State change object with old and new values */
|
|
104
|
-
export interface StateChange<T> {
|
|
105
|
-
old: T | null | undefined;
|
|
106
|
-
new: T;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/** Callback for state change subscriptions */
|
|
110
|
-
export type StateSubscriber<T> = (change: StateChange<T>) => void;
|
|
111
|
-
|
|
112
|
-
/** Callback for global state subscriptions */
|
|
113
|
-
export type GlobalStateSubscriber = (key: string, change: StateChange<unknown>) => void;
|
|
114
|
-
|
|
115
|
-
// =============================================================================
|
|
116
|
-
// Bounding Box & Sphere
|
|
117
|
-
// =============================================================================
|
|
118
|
-
|
|
119
|
-
export interface BoundingBox {
|
|
120
|
-
min: { x: number; y: number; z: number };
|
|
121
|
-
max: { x: number; y: number; z: number };
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export interface BoundingSphere {
|
|
125
|
-
center: { x: number; y: number; z: number };
|
|
126
|
-
radius: number;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export interface BoundingBoxFlat {
|
|
130
|
-
xmin: number;
|
|
131
|
-
xmax: number;
|
|
132
|
-
ymin: number;
|
|
133
|
-
ymax: number;
|
|
134
|
-
zmin: number;
|
|
135
|
-
zmax: number;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// =============================================================================
|
|
139
|
-
// Pick Info
|
|
140
|
-
// =============================================================================
|
|
141
|
-
|
|
142
|
-
export interface PickInfo {
|
|
143
|
-
path: string;
|
|
144
|
-
name: string;
|
|
145
|
-
boundingBox: BoundingBox;
|
|
146
|
-
boundingSphere: BoundingSphere;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// =============================================================================
|
|
150
|
-
// Change Notifications
|
|
151
|
-
// =============================================================================
|
|
152
|
-
|
|
153
|
-
/** Camera position/zoom, UI and pick changes */
|
|
154
|
-
export interface ChangeInfos {
|
|
155
|
-
camera_position?: Vector3Tuple;
|
|
156
|
-
camera_zoom?: number;
|
|
157
|
-
axes?: boolean;
|
|
158
|
-
axes0?: boolean;
|
|
159
|
-
ortho?: boolean;
|
|
160
|
-
grid?: [boolean, boolean, boolean];
|
|
161
|
-
lastPick?: PickInfo | null;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/** Camera position/zoom, UI and pick change notification with old/new values */
|
|
165
|
-
export interface ChangeNotification {
|
|
166
|
-
// Camera state
|
|
167
|
-
camera_position?: StateChange<Vector3Tuple>;
|
|
168
|
-
camera_zoom?: StateChange<number>;
|
|
169
|
-
position?: StateChange<Vector3Tuple>;
|
|
170
|
-
quaternion?: StateChange<QuaternionTuple>;
|
|
171
|
-
target?: StateChange<Vector3Tuple>;
|
|
172
|
-
zoom?: StateChange<number>;
|
|
173
|
-
// Reset location
|
|
174
|
-
position0?: StateChange<Vector3Tuple>;
|
|
175
|
-
quaternion0?: StateChange<QuaternionTuple>;
|
|
176
|
-
target0?: StateChange<Vector3Tuple>;
|
|
177
|
-
zoom0?: StateChange<number>;
|
|
178
|
-
// UI state
|
|
179
|
-
axes?: StateChange<boolean>;
|
|
180
|
-
axes0?: StateChange<boolean>;
|
|
181
|
-
ortho?: StateChange<boolean>;
|
|
182
|
-
grid?: StateChange<[boolean, boolean, boolean]>;
|
|
183
|
-
tab?: StateChange<ActiveTab | null>;
|
|
184
|
-
// Clipping
|
|
185
|
-
clip_normal_0?: StateChange<Vector3Tuple | null>;
|
|
186
|
-
clip_normal_1?: StateChange<Vector3Tuple | null>;
|
|
187
|
-
clip_normal_2?: StateChange<Vector3Tuple | null>;
|
|
188
|
-
// Pick info
|
|
189
|
-
lastPick?: StateChange<PickInfo | null>;
|
|
190
|
-
// Allow other state properties dynamically
|
|
191
|
-
[key: string]: StateChange<unknown> | undefined;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/** Callback for notifications */
|
|
195
|
-
export type NotificationCallback = (change: ChangeNotification) => void;
|
|
196
|
-
|
|
197
|
-
// =============================================================================
|
|
198
|
-
// Options
|
|
199
|
-
// =============================================================================
|
|
200
|
-
|
|
201
|
-
/** Action shortcut names for toolbar buttons and tabs */
|
|
202
|
-
export type ActionShortcutName =
|
|
203
|
-
| "axes" | "axes0" | "grid" | "gridxy" | "perspective" | "transparent" | "blackedges" | "zscale"
|
|
204
|
-
| "reset" | "resize" | "iso" | "front" | "rear" | "top" | "bottom" | "left" | "right"
|
|
205
|
-
| "explode" | "distance" | "properties" | "select" | "help"
|
|
206
|
-
| "play" | "stop"
|
|
207
|
-
| "tree" | "clip" | "material" | "zebra" | "studio";
|
|
208
|
-
|
|
209
|
-
/** Action keymap: action name → key character */
|
|
210
|
-
export type ActionKeymap = Partial<Record<ActionShortcutName, string>>;
|
|
211
|
-
|
|
212
|
-
/** Combined keymap: modifier keys + action shortcuts */
|
|
213
|
-
export type Keymap = Partial<{ shift: string; ctrl: string; meta: string; alt: string }> & ActionKeymap;
|
|
214
|
-
|
|
215
|
-
/** Display options */
|
|
216
|
-
export interface DisplayOptions {
|
|
217
|
-
/** Width of CAD canvas (default: 800) */
|
|
218
|
-
cadWidth?: number;
|
|
219
|
-
/** Height of CAD canvas (default: 600) */
|
|
220
|
-
height?: number;
|
|
221
|
-
/** Width of tree navigation (default: 250) */
|
|
222
|
-
treeWidth?: number;
|
|
223
|
-
/** Height of tree navigation (default: 400) */
|
|
224
|
-
treeHeight?: number;
|
|
225
|
-
/** Theme: "light", "dark", or "browser" (default: "light") */
|
|
226
|
-
theme?: Theme;
|
|
227
|
-
/** Enable pinning (default: false) */
|
|
228
|
-
pinning?: boolean;
|
|
229
|
-
/** Enable glass mode (default: false) */
|
|
230
|
-
glass?: boolean;
|
|
231
|
-
/** Show/hide all tools (default: true) */
|
|
232
|
-
tools?: boolean;
|
|
233
|
-
/** Keymap configuration */
|
|
234
|
-
keymap?: Keymap;
|
|
235
|
-
/** Use new tree behavior (default: true) */
|
|
236
|
-
newTreeBehavior?: boolean;
|
|
237
|
-
/** Show measure tools (default: true) */
|
|
238
|
-
measureTools?: boolean;
|
|
239
|
-
/** Show select tool (default: true) */
|
|
240
|
-
selectTool?: boolean;
|
|
241
|
-
/** Show explode tool (default: true) */
|
|
242
|
-
explodeTool?: boolean;
|
|
243
|
-
/** Show z-scale tool (default: false) */
|
|
244
|
-
zscaleTool?: boolean;
|
|
245
|
-
/** Show zebra tool (default: true) */
|
|
246
|
-
zebraTool?: boolean;
|
|
247
|
-
/** Show studio tool (default: true) */
|
|
248
|
-
studioTool?: boolean;
|
|
249
|
-
/** Enable measurement debug mode (default: false) */
|
|
250
|
-
measurementDebug?: boolean;
|
|
251
|
-
/** External canvas element to use for the WebGL renderer, enabling shared WebGL context scenarios (default: undefined — renderer creates its own canvas) */
|
|
252
|
-
canvas?: HTMLCanvasElement;
|
|
253
|
-
/** External WebGL context to use for the renderer. When provided together with `canvas`, the renderer will use this context instead of creating a new one. Useful for sharing a context with other renderers like PixiJS. (default: undefined) */
|
|
254
|
-
gl?: WebGLRenderingContext | WebGL2RenderingContext;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/** Render options */
|
|
258
|
-
export interface RenderOptions {
|
|
259
|
-
/** Default edge color (default: 0x707070) */
|
|
260
|
-
edgeColor?: number;
|
|
261
|
-
/** Ambient light intensity (default: 1) */
|
|
262
|
-
ambientIntensity?: number;
|
|
263
|
-
/** Direct light intensity (default: 1.1) */
|
|
264
|
-
directIntensity?: number;
|
|
265
|
-
/** Metalness (default: 0.3) */
|
|
266
|
-
metalness?: number;
|
|
267
|
-
/** Roughness (default: 0.65) */
|
|
268
|
-
roughness?: number;
|
|
269
|
-
/** Default opacity level for transparency (default: 0.5) */
|
|
270
|
-
defaultOpacity?: number;
|
|
271
|
-
/** Show triangle normals when normalLen > 0 (default: 0) */
|
|
272
|
-
normalLen?: number;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/** Viewer options (includes studio mode configuration) */
|
|
276
|
-
export interface ViewerOptions extends StudioModeOptions {
|
|
277
|
-
/** Use OrbitControls or TrackballControls (default: "orbit") */
|
|
278
|
-
control?: ControlType;
|
|
279
|
-
/** Show X-, Y-, Z-axes (default: false) */
|
|
280
|
-
axes?: boolean;
|
|
281
|
-
/** Show axes at [0,0,0] or at object center (default: false) */
|
|
282
|
-
axes0?: boolean;
|
|
283
|
-
/** Initial grid setting [xy, xz, yz] (default: [false, false, false]) */
|
|
284
|
-
grid?: [boolean, boolean, boolean];
|
|
285
|
-
/** Use orthographic (true) or perspective camera (default: true) */
|
|
286
|
-
ortho?: boolean;
|
|
287
|
-
/** Show CAD object transparent (default: false) */
|
|
288
|
-
transparent?: boolean;
|
|
289
|
-
/** Show edges in black instead of edgeColor (default: false) */
|
|
290
|
-
blackEdges?: boolean;
|
|
291
|
-
/** Collapse level (default: 0) */
|
|
292
|
-
collapse?: number;
|
|
293
|
-
/** Use intersection clipping (default: false) */
|
|
294
|
-
clipIntersection?: boolean;
|
|
295
|
-
/** Show clipping planes (default: false) */
|
|
296
|
-
clipPlaneHelpers?: boolean;
|
|
297
|
-
/** Use object colors for clipping (default: false) */
|
|
298
|
-
clipObjectColors?: boolean;
|
|
299
|
-
/** Normal direction for clipping plane 0 (default: [-1, 0, 0]) */
|
|
300
|
-
clipNormal0?: Vector3Tuple;
|
|
301
|
-
/** Normal direction for clipping plane 1 (default: [0, -1, 0]) */
|
|
302
|
-
clipNormal1?: Vector3Tuple;
|
|
303
|
-
/** Normal direction for clipping plane 2 (default: [0, 0, -1]) */
|
|
304
|
-
clipNormal2?: Vector3Tuple;
|
|
305
|
-
/** Clip slider 0 value (default: -1) */
|
|
306
|
-
clipSlider0?: number;
|
|
307
|
-
/** Clip slider 1 value (default: -1) */
|
|
308
|
-
clipSlider1?: number;
|
|
309
|
-
/** Clip slider 2 value (default: -1) */
|
|
310
|
-
clipSlider2?: number;
|
|
311
|
-
/** Holroyd mode for controls (default: true) */
|
|
312
|
-
holroyd?: boolean;
|
|
313
|
-
/** Up direction (default: "Z") */
|
|
314
|
-
up?: UpDirection;
|
|
315
|
-
/** Hint for the number of grid ticks (default: 10) */
|
|
316
|
-
ticks?: number;
|
|
317
|
-
/** Grid font size (default: 10) */
|
|
318
|
-
gridFontSize?: number;
|
|
319
|
-
/** Center grid on object (default: false) */
|
|
320
|
-
centerGrid?: boolean;
|
|
321
|
-
/** Camera position as 3-dim array */
|
|
322
|
-
position?: Vector3Tuple | null;
|
|
323
|
-
/** Camera rotation as 4-dim quaternion [x,y,z,w] */
|
|
324
|
-
quaternion?: QuaternionTuple | null;
|
|
325
|
-
/** Camera target */
|
|
326
|
-
target?: Vector3Tuple | null;
|
|
327
|
-
/** Camera zoom value (default: 1) */
|
|
328
|
-
zoom?: number;
|
|
329
|
-
/** Pan speed (default: 1.0) */
|
|
330
|
-
panSpeed?: number;
|
|
331
|
-
/** Rotation speed (default: 1.0) */
|
|
332
|
-
rotateSpeed?: number;
|
|
333
|
-
/** Zoom speed (default: 1.0) */
|
|
334
|
-
zoomSpeed?: number;
|
|
335
|
-
/** Show timings in browser console (default: false) */
|
|
336
|
-
timeit?: boolean;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
/** Zebra tool options */
|
|
340
|
-
export interface ZebraOptions {
|
|
341
|
-
/** Zebra stripe count (default: 9) */
|
|
342
|
-
zebraCount?: number;
|
|
343
|
-
/** Zebra opacity (default: 1.0) */
|
|
344
|
-
zebraOpacity?: number;
|
|
345
|
-
/** Zebra direction (default: 0) */
|
|
346
|
-
zebraDirection?: number;
|
|
347
|
-
/** Zebra color scheme (default: "blackwhite") */
|
|
348
|
-
zebraColorScheme?: ZebraColorScheme;
|
|
349
|
-
/** Zebra mapping mode (default: "reflection") */
|
|
350
|
-
zebraMappingMode?: ZebraMappingMode;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/** Studio mode options (environment, tone mapping, edges) */
|
|
354
|
-
export interface StudioModeOptions {
|
|
355
|
-
/** Environment preset or custom HDR URL (default: "studio") */
|
|
356
|
-
studioEnvironment?: string;
|
|
357
|
-
/** Environment map intensity, 0-1 (default: 0.5) */
|
|
358
|
-
studioEnvIntensity?: number;
|
|
359
|
-
/** Background mode (default: "environment") */
|
|
360
|
-
studioBackground?: StudioBackground;
|
|
361
|
-
/** Tone mapping algorithm (default: "neutral") */
|
|
362
|
-
studioToneMapping?: StudioToneMapping;
|
|
363
|
-
/** Tone mapping exposure, 0-2 (default: 1.0) */
|
|
364
|
-
studioExposure?: number;
|
|
365
|
-
/** Use 4K environment maps instead of 2K (default: false) */
|
|
366
|
-
studio4kEnvMaps?: boolean;
|
|
367
|
-
/** Texture mapping mode: triplanar projection or parametric UVs (default: "triplanar") */
|
|
368
|
-
studioTextureMapping?: StudioTextureMapping;
|
|
369
|
-
/** Environment map rotation in degrees, 0-360 (default: 0) */
|
|
370
|
-
studioEnvRotation?: number;
|
|
371
|
-
/** Shadow intensity, 0-1 (default: 0 = off) */
|
|
372
|
-
studioShadowIntensity?: number;
|
|
373
|
-
/** Shadow softness, 0-1 (default: 0.3) */
|
|
374
|
-
studioShadowSoftness?: number;
|
|
375
|
-
/** Ambient occlusion intensity, 0-3.0 (default: 0 = off) */
|
|
376
|
-
studioAOIntensity?: number;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
/** Combined options for initialization */
|
|
380
|
-
export type CombinedOptions = DisplayOptions & RenderOptions & ViewerOptions & ZebraOptions & StudioModeOptions;
|
|
381
|
-
|
|
382
|
-
// =============================================================================
|
|
383
|
-
// Viewer State Shape
|
|
384
|
-
// =============================================================================
|
|
385
|
-
|
|
386
|
-
/** Complete state shape with all properties */
|
|
387
|
-
export interface ViewerStateShape {
|
|
388
|
-
// Display
|
|
389
|
-
theme: Theme;
|
|
390
|
-
cadWidth: number;
|
|
391
|
-
treeWidth: number;
|
|
392
|
-
treeHeight: number;
|
|
393
|
-
height: number;
|
|
394
|
-
pinning: boolean;
|
|
395
|
-
glass: boolean;
|
|
396
|
-
tools: boolean;
|
|
397
|
-
keymap: Keymap;
|
|
398
|
-
newTreeBehavior: boolean;
|
|
399
|
-
measureTools: boolean;
|
|
400
|
-
selectTool: boolean;
|
|
401
|
-
explodeTool: boolean;
|
|
402
|
-
zscaleTool: boolean;
|
|
403
|
-
zebraTool: boolean;
|
|
404
|
-
studioTool: boolean;
|
|
405
|
-
measurementDebug: boolean;
|
|
406
|
-
|
|
407
|
-
// Render
|
|
408
|
-
ambientIntensity: number;
|
|
409
|
-
directIntensity: number;
|
|
410
|
-
metalness: number;
|
|
411
|
-
roughness: number;
|
|
412
|
-
defaultOpacity: number;
|
|
413
|
-
edgeColor: number;
|
|
414
|
-
normalLen: number;
|
|
415
|
-
|
|
416
|
-
// Viewer
|
|
417
|
-
axes: boolean;
|
|
418
|
-
axes0: boolean;
|
|
419
|
-
grid: [boolean, boolean, boolean];
|
|
420
|
-
ortho: boolean;
|
|
421
|
-
transparent: boolean;
|
|
422
|
-
blackEdges: boolean;
|
|
423
|
-
collapse: number;
|
|
424
|
-
clipIntersection: boolean;
|
|
425
|
-
clipPlaneHelpers: boolean;
|
|
426
|
-
clipObjectColors: boolean;
|
|
427
|
-
clipNormal0: THREE.Vector3;
|
|
428
|
-
clipNormal1: THREE.Vector3;
|
|
429
|
-
clipNormal2: THREE.Vector3;
|
|
430
|
-
clipSlider0: number;
|
|
431
|
-
clipSlider1: number;
|
|
432
|
-
clipSlider2: number;
|
|
433
|
-
control: ControlType;
|
|
434
|
-
holroyd: boolean;
|
|
435
|
-
up: UpDirection;
|
|
436
|
-
ticks: number;
|
|
437
|
-
gridFontSize: number;
|
|
438
|
-
centerGrid: boolean;
|
|
439
|
-
position: THREE.Vector3 | null;
|
|
440
|
-
quaternion: THREE.Quaternion | null;
|
|
441
|
-
target: THREE.Vector3 | null;
|
|
442
|
-
zoom: number;
|
|
443
|
-
panSpeed: number;
|
|
444
|
-
rotateSpeed: number;
|
|
445
|
-
zoomSpeed: number;
|
|
446
|
-
timeit: boolean;
|
|
447
|
-
|
|
448
|
-
// Zebra
|
|
449
|
-
zebraCount: number;
|
|
450
|
-
zebraOpacity: number;
|
|
451
|
-
zebraDirection: number;
|
|
452
|
-
zebraColorScheme: ZebraColorScheme;
|
|
453
|
-
zebraMappingMode: ZebraMappingMode;
|
|
454
|
-
|
|
455
|
-
// Studio
|
|
456
|
-
studioEnvironment: string;
|
|
457
|
-
studioEnvIntensity: number;
|
|
458
|
-
studioBackground: StudioBackground;
|
|
459
|
-
studioToneMapping: StudioToneMapping;
|
|
460
|
-
studioExposure: number;
|
|
461
|
-
studio4kEnvMaps: boolean;
|
|
462
|
-
studioTextureMapping: StudioTextureMapping;
|
|
463
|
-
studioEnvRotation: number;
|
|
464
|
-
studioShadowIntensity: number;
|
|
465
|
-
studioShadowSoftness: number;
|
|
466
|
-
studioAOIntensity: number;
|
|
467
|
-
|
|
468
|
-
// Runtime
|
|
469
|
-
activeTool: string | null;
|
|
470
|
-
animationMode: AnimationMode;
|
|
471
|
-
animationSliderValue: number;
|
|
472
|
-
zscaleActive: boolean;
|
|
473
|
-
highlightedButton: string | null;
|
|
474
|
-
activeTab: ActiveTab;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
/** Keys of ViewerStateShape */
|
|
478
|
-
export type StateKey = keyof ViewerStateShape;
|
|
479
|
-
|
|
480
|
-
// =============================================================================
|
|
481
|
-
// Material Appearance (Studio Mode)
|
|
482
|
-
// =============================================================================
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Material appearance definition for Studio mode.
|
|
486
|
-
*
|
|
487
|
-
* All fields are optional. Only provided fields override defaults.
|
|
488
|
-
* In Studio mode the viewer uses MeshPhysicalMaterial; properties left
|
|
489
|
-
* unset default to their "off" values (transmission=0, clearcoat=0, etc.)
|
|
490
|
-
* which the shader skips at near-zero cost.
|
|
491
|
-
*
|
|
492
|
-
* This is a data-format interface (describes JSON input), not a Three.js material.
|
|
493
|
-
* Texture string fields are either a data URI or a URL resolved against the HTML page.
|
|
494
|
-
*/
|
|
495
|
-
export interface MaterialAppearance {
|
|
496
|
-
/** Display name */
|
|
497
|
-
name?: string;
|
|
498
|
-
/** Reference to a built-in preset (e.g., "stainless-steel", "car-paint") */
|
|
499
|
-
builtin?: string;
|
|
500
|
-
|
|
501
|
-
// -- Color --
|
|
502
|
-
|
|
503
|
-
/** sRGB base color. Accepts RGBA tuple [r,g,b,a] (0-1) or CSS hex string "#rrggbb". */
|
|
504
|
-
color?: RGBAColor | string;
|
|
505
|
-
/** Texture reference for base color */
|
|
506
|
-
map?: string;
|
|
507
|
-
|
|
508
|
-
// -- Metallic-Roughness PBR --
|
|
509
|
-
|
|
510
|
-
/** Metalness factor, 0-1 (default: 0.0) */
|
|
511
|
-
metalness?: number;
|
|
512
|
-
/** Roughness factor, 0-1 (default: 0.5) */
|
|
513
|
-
roughness?: number;
|
|
514
|
-
|
|
515
|
-
// -- Textures (Standard) --
|
|
516
|
-
|
|
517
|
-
/** Normal map texture reference */
|
|
518
|
-
normalMap?: string;
|
|
519
|
-
/** Ambient occlusion texture reference */
|
|
520
|
-
aoMap?: string;
|
|
521
|
-
/** Metalness map texture reference */
|
|
522
|
-
metalnessMap?: string;
|
|
523
|
-
/** Roughness map texture reference */
|
|
524
|
-
roughnessMap?: string;
|
|
525
|
-
|
|
526
|
-
// -- Emissive --
|
|
527
|
-
|
|
528
|
-
/** Emissive color, linear RGB */
|
|
529
|
-
emissive?: RGBColor;
|
|
530
|
-
/** Emissive map texture reference */
|
|
531
|
-
emissiveMap?: string;
|
|
532
|
-
/** Emissive intensity multiplier (default: 1.0) */
|
|
533
|
-
emissiveIntensity?: number;
|
|
534
|
-
|
|
535
|
-
// -- Alpha --
|
|
536
|
-
|
|
537
|
-
/** Alpha blending mode */
|
|
538
|
-
alphaMode?: "OPAQUE" | "MASK" | "BLEND";
|
|
539
|
-
/** Alpha cutoff threshold for MASK mode (default: 0.5) */
|
|
540
|
-
alphaCutoff?: number;
|
|
541
|
-
|
|
542
|
-
// -- Transmission (glass, water) --
|
|
543
|
-
|
|
544
|
-
/** Transmission factor, 0-1 */
|
|
545
|
-
transmission?: number;
|
|
546
|
-
/** Transmission map texture reference */
|
|
547
|
-
transmissionMap?: string;
|
|
548
|
-
|
|
549
|
-
// -- Clearcoat (car paint, varnish) --
|
|
550
|
-
|
|
551
|
-
/** Clearcoat intensity, 0-1 */
|
|
552
|
-
clearcoat?: number;
|
|
553
|
-
/** Clearcoat roughness */
|
|
554
|
-
clearcoatRoughness?: number;
|
|
555
|
-
/** Clearcoat intensity texture reference */
|
|
556
|
-
clearcoatMap?: string;
|
|
557
|
-
/** Clearcoat roughness texture reference */
|
|
558
|
-
clearcoatRoughnessMap?: string;
|
|
559
|
-
/** Clearcoat normal map texture reference */
|
|
560
|
-
clearcoatNormalMap?: string;
|
|
561
|
-
|
|
562
|
-
// -- Volume (subsurface: jade, wax, skin) --
|
|
563
|
-
|
|
564
|
-
/** Thickness for volume effects */
|
|
565
|
-
thickness?: number;
|
|
566
|
-
/** Thickness map texture reference */
|
|
567
|
-
thicknessMap?: string;
|
|
568
|
-
/** Attenuation distance for volume absorption */
|
|
569
|
-
attenuationDistance?: number;
|
|
570
|
-
/** Attenuation color, linear RGB */
|
|
571
|
-
attenuationColor?: RGBColor;
|
|
572
|
-
|
|
573
|
-
// -- IOR --
|
|
574
|
-
|
|
575
|
-
/** Index of refraction (default: 1.5) */
|
|
576
|
-
ior?: number;
|
|
577
|
-
|
|
578
|
-
// -- Specular --
|
|
579
|
-
|
|
580
|
-
/** Specular intensity, 0-1 */
|
|
581
|
-
specularIntensity?: number;
|
|
582
|
-
/** Specular tint color, linear RGB */
|
|
583
|
-
specularColor?: RGBColor;
|
|
584
|
-
/** Specular intensity texture reference */
|
|
585
|
-
specularIntensityMap?: string;
|
|
586
|
-
/** Specular color texture reference */
|
|
587
|
-
specularColorMap?: string;
|
|
588
|
-
|
|
589
|
-
// -- Sheen (fabric, velvet) --
|
|
590
|
-
|
|
591
|
-
/** Sheen intensity, 0-1 (required to enable sheen layer) */
|
|
592
|
-
sheen?: number;
|
|
593
|
-
/** Sheen tint color, linear RGB */
|
|
594
|
-
sheenColor?: RGBColor;
|
|
595
|
-
/** Sheen roughness */
|
|
596
|
-
sheenRoughness?: number;
|
|
597
|
-
/** Sheen color texture reference */
|
|
598
|
-
sheenColorMap?: string;
|
|
599
|
-
/** Sheen roughness texture reference */
|
|
600
|
-
sheenRoughnessMap?: string;
|
|
601
|
-
|
|
602
|
-
// -- Anisotropy (brushed metal) --
|
|
603
|
-
|
|
604
|
-
/** Anisotropy strength, 0-1 */
|
|
605
|
-
anisotropy?: number;
|
|
606
|
-
/** Anisotropy rotation in radians */
|
|
607
|
-
anisotropyRotation?: number;
|
|
608
|
-
/** Anisotropy direction texture reference */
|
|
609
|
-
anisotropyMap?: string;
|
|
610
|
-
|
|
611
|
-
// -- Misc --
|
|
612
|
-
|
|
613
|
-
/** Use MeshBasicMaterial (unlit, no shading) */
|
|
614
|
-
unlit?: boolean;
|
|
615
|
-
/** Render both sides of faces (THREE.DoubleSide) */
|
|
616
|
-
doubleSided?: boolean;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
// =============================================================================
|
|
620
|
-
// MaterialX Material (threejs-materials format)
|
|
621
|
-
// =============================================================================
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* Material definition from threejs-materials (Three.js MeshPhysicalMaterial-compatible).
|
|
625
|
-
*
|
|
626
|
-
* This format is produced by the threejs-materials Python library, which catalogs
|
|
627
|
-
* PBR materials from ambientCG, GPUOpen, PolyHaven, and PhysicallyBased.
|
|
628
|
-
* `values` contains scalar properties (e.g., color as linear RGB array,
|
|
629
|
-
* roughness as float). `textures` contains texture references (inline data URIs
|
|
630
|
-
* or file paths) keyed by property name.
|
|
631
|
-
*
|
|
632
|
-
* Detected by the presence of the `values` key.
|
|
633
|
-
* Extra keys from threejs-materials (id, name, source, url, license) pass through
|
|
634
|
-
* harmlessly and are not part of this interface.
|
|
635
|
-
*/
|
|
636
|
-
export interface MaterialXMaterial {
|
|
637
|
-
/** Scalar PBR property values (e.g., color, metalness, roughness). */
|
|
638
|
-
values: Record<string, unknown>;
|
|
639
|
-
/** Texture map references keyed by property name (e.g., color, normal). */
|
|
640
|
-
textures: Record<string, string>;
|
|
641
|
-
/** Optional texture tiling [u, v], default [1, 1]. Applied to all textures. */
|
|
642
|
-
textureRepeat?: [number, number];
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* Type guard to check if a material entry is a threejs-materials format dict.
|
|
647
|
-
* Detected by the presence of the `values` key.
|
|
648
|
-
*/
|
|
649
|
-
export function isMaterialXMaterial(m: unknown): m is MaterialXMaterial {
|
|
650
|
-
return typeof m === "object" && m !== null && "values" in m;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// =============================================================================
|
|
654
|
-
// Studio Options
|
|
655
|
-
// =============================================================================
|
|
656
|
-
|
|
657
|
-
/**
|
|
658
|
-
* Root-level Studio mode configuration.
|
|
659
|
-
*
|
|
660
|
-
* Optional configuration for the rendering environment, only used when
|
|
661
|
-
* the Studio tab is active. Fields map directly to ViewerState keys on load.
|
|
662
|
-
*/
|
|
663
|
-
export interface StudioOptions {
|
|
664
|
-
/** Environment preset slug, custom HDR URL, or "none" (default: "studio") */
|
|
665
|
-
environment?: StudioEnvironment;
|
|
666
|
-
/** Environment map intensity, 0-1 (default: 0.5) */
|
|
667
|
-
envIntensity?: number;
|
|
668
|
-
/** Background mode (default: "environment") */
|
|
669
|
-
background?: StudioBackground;
|
|
670
|
-
/** Tone mapping algorithm (default: "neutral") */
|
|
671
|
-
toneMapping?: StudioToneMapping;
|
|
672
|
-
/** Tone mapping exposure (default: 1.0) */
|
|
673
|
-
toneMappingExposure?: number;
|
|
674
|
-
/** Use 4K environment maps instead of 2K (default: false) */
|
|
675
|
-
use4kEnvMaps?: boolean;
|
|
676
|
-
/** Texture mapping mode (default: "triplanar") */
|
|
677
|
-
textureMapping?: StudioTextureMapping;
|
|
678
|
-
/** Environment map rotation in degrees (default: 0) */
|
|
679
|
-
envRotation?: number;
|
|
680
|
-
/** Shadow intensity, 0-1 (default: 0 = off) */
|
|
681
|
-
shadowIntensity?: number;
|
|
682
|
-
/** Shadow softness, 0-1 (default: 0.3) */
|
|
683
|
-
shadowSoftness?: number;
|
|
684
|
-
/** Ambient occlusion intensity, 0-3.0 (default: 0 = off) */
|
|
685
|
-
aoIntensity?: number;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
// =============================================================================
|
|
689
|
-
// Shape & Texture Types
|
|
690
|
-
// =============================================================================
|
|
691
|
-
|
|
692
|
-
/** Encoded texture */
|
|
693
|
-
export interface Texture {
|
|
694
|
-
height: number;
|
|
695
|
-
width: number;
|
|
696
|
-
image: {
|
|
697
|
-
data: string;
|
|
698
|
-
format: "png";
|
|
699
|
-
};
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
/**
|
|
703
|
-
* A tessellated 3D shape.
|
|
704
|
-
*
|
|
705
|
-
* Data can come in different formats depending on serialization:
|
|
706
|
-
* - Arrays from JSON: number[] or number[][]
|
|
707
|
-
* - TypedArrays from binary: Float32Array, Uint32Array, Uint8Array
|
|
708
|
-
*/
|
|
709
|
-
export interface Shape {
|
|
710
|
-
/** Flattened list of 3-dim vertices defining the triangles */
|
|
711
|
-
vertices: number[] | Float32Array;
|
|
712
|
-
/** Vertex normals - flat array, nested number[][], or Float32Array */
|
|
713
|
-
normals: number[] | number[][] | Float32Array;
|
|
714
|
-
/** Triangle indices - flat Uint32Array with triangles_per_face, or nested number[][] */
|
|
715
|
-
triangles: number[] | number[][] | Uint32Array;
|
|
716
|
-
/** Edge segments - flat Float32Array with segments_per_edge, or nested number[][] */
|
|
717
|
-
edges: number[] | number[][] | Float32Array;
|
|
718
|
-
/** Flattened list of 3-dim vertices of the CAD object */
|
|
719
|
-
obj_vertices: number[] | Float32Array;
|
|
720
|
-
/** OCP types of the edges */
|
|
721
|
-
edge_types: number[] | Uint8Array | Uint32Array;
|
|
722
|
-
/** OCP types of the faces */
|
|
723
|
-
face_types: number[] | Uint32Array;
|
|
724
|
-
/** Number of triangles per face (when triangles is flat) */
|
|
725
|
-
triangles_per_face?: number[] | Uint32Array;
|
|
726
|
-
/** Number of segments per edge (when edges is flat) */
|
|
727
|
-
segments_per_edge?: number[] | Uint32Array;
|
|
728
|
-
/** UV coordinates (2 floats per vertex, same indexing as vertices) */
|
|
729
|
-
uvs?: number[] | Float32Array;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
/**
|
|
733
|
-
* Shape with flat binary format (TypedArrays with per-face/per-edge counts).
|
|
734
|
-
*/
|
|
735
|
-
export interface ShapeBinary {
|
|
736
|
-
vertices: Float32Array;
|
|
737
|
-
normals: Float32Array;
|
|
738
|
-
triangles: Uint32Array;
|
|
739
|
-
edges: Float32Array;
|
|
740
|
-
obj_vertices: Float32Array;
|
|
741
|
-
edge_types: Uint8Array;
|
|
742
|
-
face_types: Uint32Array;
|
|
743
|
-
triangles_per_face: Uint32Array;
|
|
744
|
-
segments_per_edge: Uint32Array;
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
/**
|
|
748
|
-
* Shape with nested array format (JSON-serialized).
|
|
749
|
-
*/
|
|
750
|
-
export interface ShapeNested {
|
|
751
|
-
vertices: number[];
|
|
752
|
-
normals: number[];
|
|
753
|
-
triangles: number[][];
|
|
754
|
-
edges: number[][];
|
|
755
|
-
obj_vertices: number[];
|
|
756
|
-
edge_types: number[];
|
|
757
|
-
face_types: number[];
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
/**
|
|
761
|
-
* Shape reference for the instanced/compressed format.
|
|
762
|
-
* Before decoding, a part's shape field may be `{ ref: N }` referencing
|
|
763
|
-
* the Nth entry in the instances array. After decoding, all ShapeRefs
|
|
764
|
-
* are replaced with full Shape objects.
|
|
765
|
-
*/
|
|
766
|
-
export interface ShapeRef {
|
|
767
|
-
ref: number;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
/**
|
|
771
|
-
* Check if shape uses binary format (has triangles_per_face).
|
|
772
|
-
*/
|
|
773
|
-
export function isShapeBinaryFormat(shape: Shape): shape is Shape & { triangles_per_face: Uint32Array | number[] } {
|
|
774
|
-
return shape.triangles_per_face !== undefined;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
/**
|
|
778
|
-
* Check if triangles are in flat format (Uint32Array or number[] with triangles_per_face).
|
|
779
|
-
*/
|
|
780
|
-
export function hasTrianglesPerFace(shape: Shape): shape is Shape & {
|
|
781
|
-
triangles_per_face: Uint32Array | number[];
|
|
782
|
-
triangles: Uint32Array | number[];
|
|
783
|
-
face_types: Uint32Array | number[];
|
|
784
|
-
} {
|
|
785
|
-
return shape.triangles_per_face !== undefined;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
/**
|
|
789
|
-
* Check if edges are in flat format (Float32Array or number[] with segments_per_edge).
|
|
790
|
-
*/
|
|
791
|
-
export function hasSegmentsPerEdge(shape: Shape): shape is Shape & {
|
|
792
|
-
segments_per_edge: Uint32Array | number[];
|
|
793
|
-
edges: Float32Array | number[];
|
|
794
|
-
edge_types: Uint8Array | Uint32Array | number[];
|
|
795
|
-
} {
|
|
796
|
-
return shape.segments_per_edge !== undefined;
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
/** Location tuple: position and quaternion */
|
|
800
|
-
export type Location = [Vector3Tuple, QuaternionTuple];
|
|
801
|
-
|
|
802
|
-
/** Visibility state value: 0=unselected, 1=selected, 2=mixed, 3=disabled */
|
|
803
|
-
export type VisibilityValue = 0 | 1 | 2 | 3;
|
|
804
|
-
|
|
805
|
-
/** Visibility state: [faces, edges] where 1=shown, 0=hidden, 3=n/a */
|
|
806
|
-
export type VisibilityState = [VisibilityValue, VisibilityValue];
|
|
807
|
-
|
|
808
|
-
/** Hierarchical/grouped objects of type Shape */
|
|
809
|
-
export interface Shapes {
|
|
810
|
-
/** Protocol version */
|
|
811
|
-
version: number;
|
|
812
|
-
/** Group name */
|
|
813
|
-
name: string;
|
|
814
|
-
/** ID of the group (slash-separated path) */
|
|
815
|
-
id: string;
|
|
816
|
-
/** Location: [position, quaternion] */
|
|
817
|
-
loc?: Location | undefined;
|
|
818
|
-
/** Children of the group */
|
|
819
|
-
parts?: Shapes[] | undefined;
|
|
820
|
-
/** Shape object (null if parts != null) */
|
|
821
|
-
shape?: Shape | null | undefined;
|
|
822
|
-
/** Visibility state [faces, edges] */
|
|
823
|
-
state?: VisibilityState | undefined;
|
|
824
|
-
/** Object type */
|
|
825
|
-
type?: ShapeType | undefined;
|
|
826
|
-
/** Object subtype (only for type "shapes") */
|
|
827
|
-
subtype?: ShapeSubtype | undefined;
|
|
828
|
-
/** RGB object color in CSS format or array of colors for multi-colored edges */
|
|
829
|
-
color?: string | string[] | undefined;
|
|
830
|
-
/** Object alpha transparency (0-1) */
|
|
831
|
-
alpha?: number | undefined;
|
|
832
|
-
/** Whether to render the back of the face */
|
|
833
|
-
renderback?: boolean | undefined;
|
|
834
|
-
/** Encoded texture */
|
|
835
|
-
texture?: Texture | null | undefined;
|
|
836
|
-
/** Bounding box */
|
|
837
|
-
bb?: BoundingBoxFlat | null | undefined;
|
|
838
|
-
/** Accuracy */
|
|
839
|
-
accuracy?: number | null | undefined;
|
|
840
|
-
/** Normal length */
|
|
841
|
-
normal_len?: number | undefined;
|
|
842
|
-
/** Format identifier (e.g., "GDS" for GDSII format) */
|
|
843
|
-
format?: string | undefined;
|
|
844
|
-
/** Instances data for GDS format */
|
|
845
|
-
instances?: Record<string, number[]> | undefined;
|
|
846
|
-
/** Geometry type (added during decomposition) */
|
|
847
|
-
geomtype?: number | undefined;
|
|
848
|
-
/** Whether the shape is from an exploded view (added during decomposition) */
|
|
849
|
-
exploded?: boolean | undefined;
|
|
850
|
-
/** Edge width in pixels (added during decomposition for edge shapes) */
|
|
851
|
-
width?: number | undefined;
|
|
852
|
-
/** Vertex size in pixels (added during decomposition for vertex shapes) */
|
|
853
|
-
size?: number | undefined;
|
|
854
|
-
/** Material tag referencing materials table or built-in preset (leaf nodes) */
|
|
855
|
-
material?: string | undefined;
|
|
856
|
-
/** User-defined material library (root node).
|
|
857
|
-
* Values can be:
|
|
858
|
-
* - string: builtin preset reference (e.g., "builtin:car-paint")
|
|
859
|
-
* - MaterialXMaterial: threejs-materials format (detected by `values` key)
|
|
860
|
-
* - MaterialAppearance: preset with overrides (e.g., { builtin: "acrylic-clear", color: "#55a0e3" })
|
|
861
|
-
*/
|
|
862
|
-
materials?: Record<string, string | MaterialXMaterial | MaterialAppearance> | undefined;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
// =============================================================================
|
|
866
|
-
// DOM Event Types
|
|
867
|
-
// =============================================================================
|
|
868
|
-
|
|
869
|
-
/** Callback for DOM events */
|
|
870
|
-
export type DomEventCallback = (event: Event) => void;
|
|
871
|
-
|
|
872
|
-
// =============================================================================
|
|
873
|
-
// THREE.js Material Types
|
|
874
|
-
// =============================================================================
|
|
875
|
-
|
|
876
|
-
/**
|
|
877
|
-
* Material with color property - used for highlighting and theme changes.
|
|
878
|
-
* Matches MeshBasicMaterial, MeshStandardMaterial, LineBasicMaterial, etc.
|
|
879
|
-
*/
|
|
880
|
-
export interface ColoredMaterial extends THREE.Material {
|
|
881
|
-
color: THREE.Color;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
// =============================================================================
|
|
885
|
-
// Subscription Options
|
|
886
|
-
// =============================================================================
|
|
887
|
-
|
|
888
|
-
/** Options for state subscriptions */
|
|
889
|
-
export interface SubscribeOptions {
|
|
890
|
-
/** If true, immediately invoke listener with current value */
|
|
891
|
-
immediate?: boolean;
|
|
892
|
-
}
|