@chocozhang/three-model-render 1.0.3 → 1.0.4

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.
Files changed (42) hide show
  1. package/README.md +93 -96
  2. package/dist/camera/index.d.ts +59 -36
  3. package/dist/camera/index.js +77 -57
  4. package/dist/camera/index.js.map +1 -1
  5. package/dist/camera/index.mjs +77 -57
  6. package/dist/camera/index.mjs.map +1 -1
  7. package/dist/core/index.d.ts +60 -27
  8. package/dist/core/index.js +124 -95
  9. package/dist/core/index.js.map +1 -1
  10. package/dist/core/index.mjs +124 -95
  11. package/dist/core/index.mjs.map +1 -1
  12. package/dist/effect/index.d.ts +47 -134
  13. package/dist/effect/index.js +109 -65
  14. package/dist/effect/index.js.map +1 -1
  15. package/dist/effect/index.mjs +109 -65
  16. package/dist/effect/index.mjs.map +1 -1
  17. package/dist/index.d.ts +397 -341
  18. package/dist/index.js +651 -472
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +651 -472
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/interaction/index.d.ts +85 -52
  23. package/dist/interaction/index.js +161 -133
  24. package/dist/interaction/index.js.map +1 -1
  25. package/dist/interaction/index.mjs +161 -133
  26. package/dist/interaction/index.mjs.map +1 -1
  27. package/dist/loader/index.d.ts +89 -56
  28. package/dist/loader/index.js +115 -76
  29. package/dist/loader/index.js.map +1 -1
  30. package/dist/loader/index.mjs +115 -76
  31. package/dist/loader/index.mjs.map +1 -1
  32. package/dist/setup/index.d.ts +28 -18
  33. package/dist/setup/index.js +33 -24
  34. package/dist/setup/index.js.map +1 -1
  35. package/dist/setup/index.mjs +33 -24
  36. package/dist/setup/index.mjs.map +1 -1
  37. package/dist/ui/index.d.ts +18 -7
  38. package/dist/ui/index.js +32 -22
  39. package/dist/ui/index.js.map +1 -1
  40. package/dist/ui/index.mjs +32 -22
  41. package/dist/ui/index.mjs.map +1 -1
  42. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -3,6 +3,17 @@ import { OutlinePass } from 'three/examples/jsm/postprocessing/OutlinePass';
3
3
  import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer';
4
4
  import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
5
5
 
6
+ /**
7
+ * @file labelManager.ts
8
+ * @description
9
+ * Manages HTML labels attached to 3D objects. Efficiently updates label positions based on camera movement.
10
+ *
11
+ * @best-practice
12
+ * - Use `addChildModelLabels` to label parts of a loaded model.
13
+ * - Labels are HTML elements overlaid on the canvas.
14
+ * - Supports performance optimization via caching and visibility culling.
15
+ */
16
+
6
17
  interface LabelOptions$1 {
7
18
  fontSize?: string;
8
19
  color?: string;
@@ -19,23 +30,34 @@ interface LabelManager$1 {
19
30
  isRunning: () => boolean;
20
31
  }
21
32
  /**
22
- * 给子模型添加头顶标签(支持 Mesh Group)- 优化版
23
- *
24
- * ✨ 性能优化:
25
- * - 缓存包围盒,避免每帧重复计算
26
- * - 支持暂停/恢复更新
27
- * - 可配置更新间隔,降低 CPU 占用
28
- * - 只在可见时更新,隐藏时自动暂停
29
- *
30
- * @param camera THREE.Camera - 场景摄像机
31
- * @param renderer THREE.WebGLRenderer - 渲染器,用于屏幕尺寸
32
- * @param parentModel THREE.Object3D - FBX 根节点或 Group
33
- * @param modelLabelsMap Record<string,string> - 模型 name 标签文字 映射表
34
- * @param options LabelOptions - 可选标签样式配置
35
- * @returns LabelManager - 包含 pause/resume/dispose 的管理接口
33
+ * Add overhead labels to child models (supports Mesh and Group)
34
+ *
35
+ * Features:
36
+ * - Caches bounding boxes to avoid repetitive calculation every frame
37
+ * - Supports pause/resume
38
+ * - Configurable update interval to reduce CPU usage
39
+ * - Automatically pauses when hidden
40
+ *
41
+ * @param camera THREE.Camera - Scene camera
42
+ * @param renderer THREE.WebGLRenderer - Renderer, used for screen size
43
+ * @param parentModel THREE.Object3D - FBX root node or Group
44
+ * @param modelLabelsMap Record<string,string> - Map of model name to label text
45
+ * @param options LabelOptions - Optional label style configuration
46
+ * @returns LabelManager - Management interface containing pause/resume/dispose
36
47
  */
37
48
  declare function addChildModelLabels(camera: THREE.Camera, renderer: THREE.WebGLRenderer, parentModel: THREE.Object3D, modelLabelsMap: Record<string, string>, options?: LabelOptions$1): LabelManager$1;
38
49
 
50
+ /**
51
+ * @file hoverEffect.ts
52
+ * @description
53
+ * Singleton highlight effect manager. Uses OutlinePass to create a breathing highlight effect on hovered objects.
54
+ *
55
+ * @best-practice
56
+ * - Initialize once in your setup/mounted hook.
57
+ * - Call `updateHighlightNames` to filter which objects are interactive.
58
+ * - Automatically handles mousemove throttling and cleanup on dispose.
59
+ */
60
+
39
61
  type HoverBreathOptions = {
40
62
  camera: THREE.Camera;
41
63
  scene: THREE.Scene;
@@ -48,13 +70,13 @@ type HoverBreathOptions = {
48
70
  throttleDelay?: number;
49
71
  };
50
72
  /**
51
- * 创建单例高亮器 —— 推荐在 mounted 时创建一次
52
- * 返回 { updateHighlightNames, dispose, getHoveredName } 接口
73
+ * Create a singleton highlighter - Recommended to create once on mount
74
+ * Returns { updateHighlightNames, dispose, getHoveredName } interface
53
75
  *
54
- * ✨ 性能优化:
55
- * - hover 对象时自动暂停动画
56
- * - mousemove 节流处理,避免过度计算
57
- * - 使用 passive 事件监听器提升滚动性能
76
+ * Features:
77
+ * - Automatically pauses animation when no object is hovered
78
+ * - Throttles mousemove events to avoid excessive calculation
79
+ * - Uses passive event listeners to improve scrolling performance
58
80
  */
59
81
  declare function enableHoverBreath(opts: HoverBreathOptions): {
60
82
  updateHighlightNames: (names: string[] | null) => void;
@@ -64,7 +86,18 @@ declare function enableHoverBreath(opts: HoverBreathOptions): {
64
86
  };
65
87
 
66
88
  /**
67
- * 后期处理配置选项
89
+ * @file postProcessing.ts
90
+ * @description
91
+ * Manages the post-processing chain, specifically for Outline effects and Gamma correction.
92
+ *
93
+ * @best-practice
94
+ * - call `initPostProcessing` after creating your renderer and scene.
95
+ * - Use the returned `composer` in your render loop instead of `renderer.render`.
96
+ * - Handles resizing automatically via the `resize` method.
97
+ */
98
+
99
+ /**
100
+ * Post-processing configuration options
68
101
  */
69
102
  interface PostProcessingOptions {
70
103
  edgeStrength?: number;
@@ -75,7 +108,7 @@ interface PostProcessingOptions {
75
108
  resolutionScale?: number;
76
109
  }
77
110
  /**
78
- * 后期处理管理接口
111
+ * Post-processing management interface
79
112
  */
80
113
  interface PostProcessingManager {
81
114
  composer: EffectComposer;
@@ -84,23 +117,34 @@ interface PostProcessingManager {
84
117
  dispose: () => void;
85
118
  }
86
119
  /**
87
- * 初始化描边相关信息(包含 OutlinePass)- 优化版
120
+ * Initialize outline-related information (contains OutlinePass)
88
121
  *
89
- * ✨ 功能增强:
90
- * - 支持窗口 resize 自动更新
91
- * - 可配置分辨率缩放提升性能
92
- * - 完善的资源释放管理
122
+ * Capabilities:
123
+ * - Supports automatic update on window resize
124
+ * - Configurable resolution scale for performance improvement
125
+ * - Comprehensive resource disposal management
93
126
  *
94
127
  * @param renderer THREE.WebGLRenderer
95
128
  * @param scene THREE.Scene
96
129
  * @param camera THREE.Camera
97
- * @param options PostProcessingOptions - 可选配置
98
- * @returns PostProcessingManager - 包含 composer/outlinePass/resize/dispose 的管理接口
130
+ * @param options PostProcessingOptions - Optional configuration
131
+ * @returns PostProcessingManager - Management interface containing composer/outlinePass/resize/dispose
99
132
  */
100
133
  declare function initPostProcessing(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, options?: PostProcessingOptions): PostProcessingManager;
101
134
 
102
135
  /**
103
- * 点击处理器配置选项
136
+ * @file clickHandler.ts
137
+ * @description
138
+ * Tool for handling model clicks and highlighting (OutlinePass version).
139
+ *
140
+ * @best-practice
141
+ * - Use `createModelClickHandler` to setup interaction.
142
+ * - Handles debouncing and click threshold automatically.
143
+ * - Cleanup using the returned dispose function.
144
+ */
145
+
146
+ /**
147
+ * Click Handler Options
104
148
  */
105
149
  interface ClickHandlerOptions {
106
150
  clickThreshold?: number;
@@ -115,21 +159,21 @@ interface ClickHandlerOptions {
115
159
  maxThickness?: number;
116
160
  }
117
161
  /**
118
- * 创建模型点击高亮工具(OutlinePass 版)- 优化版
119
- *
120
- * ✨ 功能增强:
121
- * - 使用 AbortController 统一管理事件生命周期
122
- * - 支持防抖处理避免频繁触发
123
- * - 可自定义 Raycaster 参数
124
- * - 根据相机距离动态调整描边厚度
125
- *
126
- * @param camera 相机
127
- * @param scene 场景
128
- * @param renderer 渲染器
129
- * @param outlinePass 已初始化的 OutlinePass
130
- * @param onClick 点击回调
131
- * @param options 可选配置
132
- * @returns dispose 函数,用于清理事件和资源
162
+ * Create Model Click Highlight Tool (OutlinePass Version) - Optimized
163
+ *
164
+ * Features:
165
+ * - Uses AbortController to unify event lifecycle management
166
+ * - Supports debounce to avoid frequent triggering
167
+ * - Customizable Raycaster parameters
168
+ * - Dynamically adjusts outline thickness based on camera distance
169
+ *
170
+ * @param camera Camera
171
+ * @param scene Scene
172
+ * @param renderer Renderer
173
+ * @param outlinePass Initialized OutlinePass
174
+ * @param onClick Click callback
175
+ * @param options Optional configuration
176
+ * @returns Dispose function, used to clean up events and resources
133
177
  */
134
178
  declare function createModelClickHandler(camera: THREE.Camera, scene: THREE.Scene, renderer: THREE.WebGLRenderer, outlinePass: OutlinePass, onClick: (object: THREE.Object3D | null, info?: {
135
179
  name?: string;
@@ -137,17 +181,28 @@ declare function createModelClickHandler(camera: THREE.Camera, scene: THREE.Scen
137
181
  uuid?: string;
138
182
  }) => void, options?: ClickHandlerOptions): () => void;
139
183
 
184
+ /**
185
+ * @file arrowGuide.ts
186
+ * @description
187
+ * Arrow guide effect tool, supports highlighting models and fading other objects.
188
+ *
189
+ * @best-practice
190
+ * - Use `highlight` to focus on specific models.
191
+ * - Automatically manages materials and memory using WeakMap.
192
+ * - Call `dispose` when component unmounts.
193
+ */
194
+
140
195
  type FilterFn = (obj: THREE.Object3D) => boolean;
141
196
  /**
142
- * ArrowGuide - 优化版
143
- * 箭头引导效果工具,支持高亮模型并淡化其他对象
144
- *
145
- * ✨ 优化内容:
146
- * - 使用 WeakMap 自动回收材质,避免内存泄漏
147
- * - 使用 AbortController 管理事件生命周期
148
- * - 添加材质复用机制,减少重复创建
149
- * - 改进 dispose 逻辑,确保完全释放资源
150
- * - 添加错误处理和边界检查
197
+ * ArrowGuide - Optimized Version
198
+ * Arrow guide effect tool, supports highlighting models and fading other objects.
199
+ *
200
+ * Features:
201
+ * - Uses WeakMap for automatic material recycling, preventing memory leaks
202
+ * - Uses AbortController to manage event lifecycle
203
+ * - Adds material reuse mechanism to reuse materials
204
+ * - Improved dispose logic ensuring complete resource release
205
+ * - Adds error handling and boundary checks
151
206
  */
152
207
  declare class ArrowGuide {
153
208
  private renderer;
@@ -176,44 +231,55 @@ declare class ArrowGuide {
176
231
  private makeFadedClone;
177
232
  private createFadedMaterialFrom;
178
233
  /**
179
- * 设置箭头 Mesh
234
+ * Set Arrow Mesh
180
235
  */
181
236
  setArrowMesh(mesh: THREE.Mesh): void;
182
237
  /**
183
- * 高亮指定模型
238
+ * Highlight specified models
184
239
  */
185
240
  highlight(models: THREE.Object3D[]): void;
186
241
  private applyHighlight;
187
242
  restore(): void;
188
243
  /**
189
- * 动画更新(每帧调用)
244
+ * Animation update (called every frame)
190
245
  */
191
246
  animate(): void;
192
247
  /**
193
- * 初始化事件监听器
248
+ * Initialize event listeners
194
249
  */
195
250
  private initEvents;
196
251
  /**
197
- * 释放所有资源
252
+ * Dispose all resources
198
253
  */
199
254
  dispose(): void;
200
255
  }
201
256
 
257
+ /**
258
+ * @file liquidFiller.ts
259
+ * @description
260
+ * Liquid filling effect for single or multiple models using local clipping planes.
261
+ *
262
+ * @best-practice
263
+ * - Use `fillTo` to animate liquid level.
264
+ * - Supports multiple independent liquid levels.
265
+ * - Call `dispose` to clean up resources and event listeners.
266
+ */
267
+
202
268
  interface LiquidFillerOptions {
203
269
  color?: number;
204
270
  opacity?: number;
205
271
  speed?: number;
206
272
  }
207
273
  /**
208
- * LiquidFillerGroup - 优化版
209
- * 支持单模型或多模型液位动画、独立颜色控制
210
- *
211
- * ✨ 优化内容:
212
- * - 使用 renderer.domElement 替代 window 事件
213
- * - 使用 AbortController 管理事件生命周期
214
- * - 添加错误处理和边界检查
215
- * - 优化动画管理,避免内存泄漏
216
- * - 完善资源释放逻辑
274
+ * LiquidFillerGroup - Optimized
275
+ * Supports single or multi-model liquid level animation with independent color control.
276
+ *
277
+ * Features:
278
+ * - Uses renderer.domElement instead of window events
279
+ * - Uses AbortController to manage event lifecycle
280
+ * - Adds error handling and boundary checks
281
+ * - Optimized animation management to prevent memory leaks
282
+ * - Comprehensive resource disposal logic
217
283
  */
218
284
  declare class LiquidFillerGroup {
219
285
  private items;
@@ -225,35 +291,47 @@ declare class LiquidFillerGroup {
225
291
  private clickThreshold;
226
292
  private abortController;
227
293
  /**
228
- * 构造函数
229
- * @param models 单个或多个 THREE.Object3D
230
- * @param scene 场景
231
- * @param camera 相机
232
- * @param renderer 渲染器
233
- * @param defaultOptions 默认液体选项
234
- * @param clickThreshold 点击阈值,单位像素
294
+ * Constructor
295
+ * @param models Single or multiple THREE.Object3D
296
+ * @param scene Scene
297
+ * @param camera Camera
298
+ * @param renderer Renderer
299
+ * @param defaultOptions Default liquid options
300
+ * @param clickThreshold Click threshold in pixels
235
301
  */
236
302
  constructor(models: THREE.Object3D | THREE.Object3D[], scene: THREE.Scene, camera: THREE.Camera, renderer: THREE.WebGLRenderer, defaultOptions?: LiquidFillerOptions, clickThreshold?: number);
237
- /** pointerdown 记录位置 */
303
+ /** pointerdown record position */
238
304
  private handlePointerDown;
239
- /** pointerup 判断点击空白,恢复原始材质 */
305
+ /** pointerup check click blank, restore original material */
240
306
  private handlePointerUp;
241
307
  /**
242
- * 设置液位
243
- * @param models 单个模型或模型数组
244
- * @param percent 液位百分比 0~1
245
- */
308
+ * Set liquid level
309
+ * @param models Single model or array of models
310
+ * @param percent Liquid level percentage 0~1
311
+ */
246
312
  fillTo(models: THREE.Object3D | THREE.Object3D[], percent: number): void;
247
- /** 设置多个模型液位,percentList items 顺序对应 */
313
+ /** Set multiple model levels, percentList corresponds to items order */
248
314
  fillToAll(percentList: number[]): void;
249
- /** 恢复单个模型原始材质并移除液体 */
315
+ /** Restore single model original material and remove liquid */
250
316
  restore(model: THREE.Object3D): void;
251
- /** 恢复所有模型 */
317
+ /** Restore all models */
252
318
  restoreAll(): void;
253
- /** 销毁方法,释放事件和资源 */
319
+ /** Dispose method, release events and resources */
254
320
  dispose(): void;
255
321
  }
256
322
 
323
+ /**
324
+ * @file followModels.ts
325
+ * @description
326
+ * Camera utility to automatically follow and focus on 3D models.
327
+ * It smoothly moves the camera to an optimal viewing position relative to the target object(s).
328
+ *
329
+ * @best-practice
330
+ * - Use `followModels` to focus on a newly selected object.
331
+ * - Call `cancelFollow` before starting a new manual camera interaction if needed.
332
+ * - Adjust `padding` to control how tight the camera framing is.
333
+ */
334
+
257
335
  interface FollowOptions {
258
336
  duration?: number;
259
337
  padding?: number;
@@ -269,72 +347,83 @@ interface FollowOptions {
269
347
  onProgress?: (progress: number) => void;
270
348
  }
271
349
  /**
272
- * 推荐角度枚举,便于快速选取常见视角
350
+ * Recommended camera angles for quick selection of common views
273
351
  */
274
352
  declare const FOLLOW_ANGLES: {
275
- /** 等距斜视(默认视角)- 适合建筑、机械设备展示 */
353
+ /** Isometric view (default) - suitable for architecture, mechanical equipment */
276
354
  readonly ISOMETRIC: {
277
355
  readonly azimuth: number;
278
356
  readonly elevation: number;
279
357
  };
280
- /** 正前视角 - 适合正面展示、UI 对齐 */
358
+ /** Front view - suitable for frontal display, UI alignment */
281
359
  readonly FRONT: {
282
360
  readonly azimuth: 0;
283
361
  readonly elevation: 0;
284
362
  };
285
- /** 右侧视角 - 适合机械剖面、侧视检查 */
363
+ /** Right view - suitable for mechanical sections, side inspection */
286
364
  readonly RIGHT: {
287
365
  readonly azimuth: number;
288
366
  readonly elevation: 0;
289
367
  };
290
- /** 左侧视角 */
368
+ /** Left view */
291
369
  readonly LEFT: {
292
370
  readonly azimuth: number;
293
371
  readonly elevation: 0;
294
372
  };
295
- /** 后视角 */
373
+ /** Back view */
296
374
  readonly BACK: {
297
375
  readonly azimuth: number;
298
376
  readonly elevation: 0;
299
377
  };
300
- /** 顶视图 - 适合地图、平面布局展示 */
378
+ /** Top view - suitable for maps, layout display */
301
379
  readonly TOP: {
302
380
  readonly azimuth: 0;
303
381
  readonly elevation: number;
304
382
  };
305
- /** 低角度俯视 - 适合车辆、人物等近地物体 */
383
+ /** Low angle view - suitable for vehicles, characters near the ground */
306
384
  readonly LOW_ANGLE: {
307
385
  readonly azimuth: number;
308
386
  readonly elevation: number;
309
387
  };
310
- /** 高角度俯视 - 适合鸟瞰、全景浏览 */
388
+ /** High angle view - suitable for bird's eye view, panoramic browsing */
311
389
  readonly HIGH_ANGLE: {
312
390
  readonly azimuth: number;
313
391
  readonly elevation: number;
314
392
  };
315
393
  };
316
394
  /**
317
- * 自动将相机移到目标的斜上角位置,并保证目标在可视范围内(平滑过渡)- 优化版
318
- *
319
- * ✨ 优化内容:
320
- * - 支持多种缓动函数
321
- * - 添加进度回调
322
- * - 支持取消动画
323
- * - WeakMap 跟踪防止泄漏
324
- * - 完善错误处理
395
+ * Automatically moves the camera to a diagonal position relative to the target,
396
+ * ensuring the target is within the field of view (smooth transition).
397
+ *
398
+ * Features:
399
+ * - Supports multiple easing functions
400
+ * - Adds progress callback
401
+ * - Supports animation cancellation
402
+ * - Uses WeakMap to track and prevent memory leaks
403
+ * - Robust error handling
325
404
  */
326
405
  declare function followModels(camera: THREE.Camera, targets: THREE.Object3D | THREE.Object3D[] | null | undefined, options?: FollowOptions): Promise<void>;
327
406
  /**
328
- * 取消相机的跟随动画
407
+ * Cancel the camera follow animation
329
408
  */
330
409
  declare function cancelFollow(camera: THREE.Camera): void;
331
410
 
332
411
  /**
333
- * 视角类型
412
+ * @file setView.ts
413
+ * @description
414
+ * Utility to smoothly transition the camera to preset views (Front, Back, Top, Isometric, etc.).
415
+ *
416
+ * @best-practice
417
+ * - Use `setView` for UI buttons that switch camera angles.
418
+ * - Leverage `ViewPresets` for readable code when using standard views.
419
+ */
420
+
421
+ /**
422
+ * View types
334
423
  */
335
424
  type ViewPosition = 'front' | 'back' | 'left' | 'right' | 'top' | 'bottom' | 'iso';
336
425
  /**
337
- * 视角配置选项
426
+ * View configuration options
338
427
  */
339
428
  interface SetViewOptions {
340
429
  distanceFactor?: number;
@@ -343,46 +432,57 @@ interface SetViewOptions {
343
432
  onProgress?: (progress: number) => void;
344
433
  }
345
434
  /**
346
- * 平滑切换相机到模型的最佳视角 - 优化版
347
- *
348
- * ✨ 优化内容:
349
- * - 复用 followModels 逻辑,避免代码重复
350
- * - 支持更多视角
351
- * - 配置选项增强
352
- * - 返回 Promise 支持链式调用
353
- * - 支持取消动画
354
- *
355
- * @param camera THREE.PerspectiveCamera 相机实例
356
- * @param controls OrbitControls 控制器实例
357
- * @param targetObj THREE.Object3D 模型对象
358
- * @param position 视角位置
359
- * @param options 配置选项
435
+ * Smoothly switches the camera to the optimal angle for the model.
436
+ *
437
+ * Features:
438
+ * - Reuses followModels logic to avoid code duplication
439
+ * - Supports more angles
440
+ * - Enhanced configuration options
441
+ * - Returns Promise to support chaining
442
+ * - Supports animation cancellation
443
+ *
444
+ * @param camera THREE.PerspectiveCamera instance
445
+ * @param controls OrbitControls instance
446
+ * @param targetObj THREE.Object3D model object
447
+ * @param position View position
448
+ * @param options Configuration options
360
449
  * @returns Promise<void>
361
450
  */
362
451
  declare function setView(camera: THREE.PerspectiveCamera, controls: OrbitControls, targetObj: THREE.Object3D, position?: ViewPosition, options?: SetViewOptions): Promise<void>;
363
452
  /**
364
- * 取消视角切换动画
453
+ * Cancel view switch animation
365
454
  */
366
455
  declare function cancelSetView(camera: THREE.PerspectiveCamera): void;
367
456
  /**
368
- * 预设视角快捷方法
457
+ * Preset view shortcut methods
369
458
  */
370
459
  declare const ViewPresets: {
371
460
  /**
372
- * 前视图
461
+ * Front View
373
462
  */
374
463
  front: (camera: THREE.PerspectiveCamera, controls: OrbitControls, target: THREE.Object3D, options?: SetViewOptions) => Promise<void>;
375
464
  /**
376
- * 等距视图
465
+ * Isometric View
377
466
  */
378
467
  isometric: (camera: THREE.PerspectiveCamera, controls: OrbitControls, target: THREE.Object3D, options?: SetViewOptions) => Promise<void>;
379
468
  /**
380
- * 顶视图
469
+ * Top View
381
470
  */
382
471
  top: (camera: THREE.PerspectiveCamera, controls: OrbitControls, target: THREE.Object3D, options?: SetViewOptions) => Promise<void>;
383
472
  };
384
473
 
385
- /** 加载参数:现在有默认值 */
474
+ /**
475
+ * @file modelLoader.ts
476
+ * @description
477
+ * Utility to load 3D models (GLTF, FBX, OBJ, PLY, STL) from URLs.
478
+ *
479
+ * @best-practice
480
+ * - Use `loadModelByUrl` for a unified loading interface.
481
+ * - Supports Draco compression and KTX2 textures for GLTF.
482
+ * - Includes optimization options like geometry merging and texture downscaling.
483
+ */
484
+
485
+ /** Loading Options: Now has default values */
386
486
  interface LoadOptions {
387
487
  manager?: THREE.LoadingManager;
388
488
  dracoDecoderPath?: string | null;
@@ -394,21 +494,32 @@ interface LoadOptions {
394
494
  skipSkinned?: boolean;
395
495
  }
396
496
  declare function loadModelByUrl(url: string, options?: LoadOptions): Promise<THREE.Object3D>;
397
- /** 彻底释放对象:几何体,材质和其贴图(危险:共享资源会被释放) */
497
+ /** Completely dispose object: geometry, material and its textures (Danger: shared resources will be disposed) */
398
498
  declare function disposeObject(obj: THREE.Object3D | null): void;
399
- /** 释放材质及其贴图 */
499
+ /** Dispose material and its textures */
400
500
  declare function disposeMaterial(mat: any): void;
401
501
 
402
502
  /**
403
- * Skybox 加载工具
503
+ * @file skyboxLoader.ts
504
+ * @description
505
+ * Utility for loading skyboxes (CubeTexture or Equirectangular/HDR).
506
+ *
507
+ * @best-practice
508
+ * - Use `loadSkybox` for a unified interface.
509
+ * - Supports internal caching to avoid reloading the same skybox.
510
+ * - Can set background and environment map independently.
511
+ */
512
+
513
+ /**
514
+ * Skybox Loader Utility
404
515
  *
405
- * 支持:
406
- * - 立方体贴图:paths: [px, nx, py, ny, pz, nz]
407
- * - 等距 / HDR 全景:url: 'path/to/scene.hdr' jpg
516
+ * Supports:
517
+ * - Cube Texture: paths: [px, nx, py, ny, pz, nz]
518
+ * - Equirectangular / HDR Panorama: url: 'path/to/scene.hdr' or jpg
408
519
  *
409
- * 返回一个 SkyboxHandle,包含对 scene 的修改记录和 dispose() 方法。
520
+ * Returns a SkyboxHandle containing modification records for the scene and a dispose() method.
410
521
  */
411
- /** 统一返回句柄 */
522
+ /** Unified Return Handle */
412
523
  type SkyboxHandle = {
413
524
  key: string;
414
525
  backgroundTexture: THREE.Texture | null;
@@ -416,10 +527,10 @@ type SkyboxHandle = {
416
527
  pmremGenerator: THREE.PMREMGenerator | null;
417
528
  setAsBackground: boolean;
418
529
  setAsEnvironment: boolean;
419
- /** 卸载并释放资源(如果是缓存共享,需要 refCount 逻辑) */
530
+ /** Unload and release resources (if cached/shared, refCount logic is needed) */
420
531
  dispose: () => void;
421
532
  };
422
- /** 加载选项与默认值 */
533
+ /** Loading Options & Defaults */
423
534
  interface SkyboxOptions {
424
535
  setAsBackground?: boolean;
425
536
  setAsEnvironment?: boolean;
@@ -428,15 +539,15 @@ interface SkyboxOptions {
428
539
  cache?: boolean;
429
540
  }
430
541
  /**
431
- * 加载立方体贴图(6张)
432
- * @param renderer THREE.WebGLRenderer - 用于 PMREM 生成环境贴图
542
+ * Load Cube Texture (6 images)
543
+ * @param renderer THREE.WebGLRenderer - Used for PMREM generating environment map
433
544
  * @param scene THREE.Scene
434
- * @param paths string[] 6 张图片地址,顺序:[px, nx, py, ny, pz, nz]
545
+ * @param paths string[] 6 image paths, order: [px, nx, py, ny, pz, nz]
435
546
  * @param opts SkyboxOptions
436
547
  */
437
548
  declare function loadCubeSkybox(renderer: THREE.WebGLRenderer, scene: THREE.Scene, paths: string[], opts?: SkyboxOptions): Promise<SkyboxHandle>;
438
549
  /**
439
- * 加载等距/单图(支持 HDR via RGBELoader
550
+ * Load Equirectangular/Single Image (Supports HDR via RGBELoader)
440
551
  * @param renderer THREE.WebGLRenderer
441
552
  * @param scene THREE.Scene
442
553
  * @param url string - *.hdr, *.exr, *.jpg, *.png
@@ -451,15 +562,26 @@ type LoadSkyboxParams = {
451
562
  url: string;
452
563
  };
453
564
  declare function loadSkybox(renderer: THREE.WebGLRenderer, scene: THREE.Scene, params: LoadSkyboxParams, opts?: SkyboxOptions): Promise<SkyboxHandle>;
454
- /** 释放一个缓存的 skybox(会减少 refCountrefCount=0 时才真正 dispose) */
565
+ /** Release a cached skybox (decrements refCount, only truly disposes when refCount=0) */
455
566
  declare function releaseSkybox(handle: SkyboxHandle): void;
456
567
 
457
568
  /**
458
- * 加载进度回调类型
569
+ * @file blueSkyManager.ts
570
+ * @description
571
+ * Global singleton manager for loading and managing HDR/EXR blue sky environment maps.
572
+ *
573
+ * @best-practice
574
+ * - Call `init` once before use.
575
+ * - Use `loadAsync` to load skyboxes with progress tracking.
576
+ * - Automatically handles PMREM generation for realistic lighting.
577
+ */
578
+
579
+ /**
580
+ * Load progress callback type
459
581
  */
460
582
  type LoadProgressCallback = (progress: number) => void;
461
583
  /**
462
- * 加载选项
584
+ * Load options
463
585
  */
464
586
  interface LoadSkyOptions {
465
587
  background?: boolean;
@@ -468,91 +590,102 @@ interface LoadSkyOptions {
468
590
  onError?: (error: any) => void;
469
591
  }
470
592
  /**
471
- * BlueSkyManager - 优化版
593
+ * BlueSkyManager - Optimized
472
594
  * ---------------------------------------------------------
473
- * 一个全局单例管理器,用于加载和管理基于 HDR/EXR 的蓝天白云环境贴图。
474
- *
475
- * ✨ 优化内容:
476
- * - 添加加载进度回调
477
- * - 支持加载取消
478
- * - 完善错误处理
479
- * - 返回 Promise 支持异步
480
- * - 添加加载状态管理
595
+ * A global singleton manager for loading and managing HDR/EXR based blue sky environment maps.
596
+ *
597
+ * Features:
598
+ * - Adds load progress callback
599
+ * - Supports load cancellation
600
+ * - Improved error handling
601
+ * - Returns Promise for async operation
602
+ * - Adds loading state management
481
603
  */
482
604
  declare class BlueSkyManager {
483
- /** three.js 渲染器实例 */
605
+ /** three.js renderer instance */
484
606
  private renderer;
485
- /** three.js 场景实例 */
607
+ /** three.js scene instance */
486
608
  private scene;
487
- /** PMREM 生成器,用于将 HDR/EXR 转换为高效的反射贴图 */
609
+ /** PMREM generator, used to convert HDR/EXR to efficient reflection maps */
488
610
  private pmremGen;
489
- /** 当前环境贴图的 RenderTarget,用于后续释放 */
611
+ /** RenderTarget for current environment map, used for subsequent disposal */
490
612
  private skyRT;
491
- /** 是否已经初始化 */
613
+ /** Whether already initialized */
492
614
  private isInitialized;
493
- /** 当前加载器,用于取消加载 */
615
+ /** Current loader, used for cancelling load */
494
616
  private currentLoader;
495
- /** 加载状态 */
617
+ /** Loading state */
496
618
  private loadingState;
497
619
  /**
498
- * 初始化
620
+ * Initialize
499
621
  * ---------------------------------------------------------
500
- * 必须在使用 BlueSkyManager 之前调用一次。
501
- * @param renderer WebGLRenderer 实例
502
- * @param scene Three.js 场景
503
- * @param exposure 曝光度 (默认 1.0)
622
+ * Must be called once before using BlueSkyManager.
623
+ * @param renderer WebGLRenderer instance
624
+ * @param scene Three.js Scene
625
+ * @param exposure Exposure (default 1.0)
504
626
  */
505
627
  init(renderer: THREE.WebGLRenderer, scene: THREE.Scene, exposure?: number): void;
506
628
  /**
507
- * 加载蓝天 HDR/EXR 贴图并应用到场景(Promise 版本)
629
+ * Load blue sky HDR/EXR map and apply to scene (Promise version)
508
630
  * ---------------------------------------------------------
509
- * @param exrPath HDR/EXR 文件路径
510
- * @param options 加载选项
631
+ * @param exrPath HDR/EXR file path
632
+ * @param options Load options
511
633
  * @returns Promise<void>
512
634
  */
513
635
  loadAsync(exrPath: string, options?: LoadSkyOptions): Promise<void>;
514
636
  /**
515
- * 加载蓝天 HDR/EXR 贴图并应用到场景(同步 API,保持向后兼容)
637
+ * Load blue sky HDR/EXR map and apply to scene (Sync API, for backward compatibility)
516
638
  * ---------------------------------------------------------
517
- * @param exrPath HDR/EXR 文件路径
518
- * @param background 是否应用为场景背景 (默认 true)
639
+ * @param exrPath HDR/EXR file path
640
+ * @param background Whether to apply as scene background (default true)
519
641
  */
520
642
  load(exrPath: string, background?: boolean): void;
521
643
  /**
522
- * 取消当前加载
644
+ * Cancel current load
523
645
  */
524
646
  cancelLoad(): void;
525
647
  /**
526
- * 获取加载状态
648
+ * Get loading state
527
649
  */
528
650
  getLoadingState(): 'idle' | 'loading' | 'loaded' | 'error';
529
651
  /**
530
- * 是否正在加载
652
+ * Is loading
531
653
  */
532
654
  isLoading(): boolean;
533
655
  /**
534
- * 释放当前的天空贴图资源
656
+ * Release current sky texture resources
535
657
  * ---------------------------------------------------------
536
- * 仅清理 skyRT,不销毁 PMREM
537
- * 适用于切换 HDR/EXR 文件时调用
658
+ * Only cleans up skyRT, does not destroy PMREM
659
+ * Suitable for calling when switching HDR/EXR files
538
660
  */
539
661
  dispose(): void;
540
662
  /**
541
- * 完全销毁 BlueSkyManager
663
+ * Completely destroy BlueSkyManager
542
664
  * ---------------------------------------------------------
543
- * 包括 PMREMGenerator 的销毁
544
- * 通常在场景彻底销毁或应用退出时调用
665
+ * Includes destruction of PMREMGenerator
666
+ * Usually called when the scene is completely destroyed or the application exits
545
667
  */
546
668
  destroy(): void;
547
669
  }
548
670
  /**
549
- * 🌐 全局单例
671
+ * Global Singleton
550
672
  * ---------------------------------------------------------
551
- * 直接导出一个全局唯一的 BlueSkyManager 实例,
552
- * 保证整个应用中只用一个 PMREMGenerator,性能最佳。
673
+ * Directly export a globally unique BlueSkyManager instance,
674
+ * Ensuring only one PMREMGenerator is used throughout the application for best performance.
553
675
  */
554
676
  declare const BlueSky: BlueSkyManager;
555
677
 
678
+ /**
679
+ * @file modelsLabel.ts
680
+ * @description
681
+ * Creates interactive 2D labels (DOM elements) attached to 3D objects with connecting lines.
682
+ *
683
+ * @best-practice
684
+ * - Use `createModelsLabel` to annotate parts of a model.
685
+ * - Supports fading endpoints, pulsing dots, and custom styling.
686
+ * - Performance optimized with caching and RAF throttling.
687
+ */
688
+
556
689
  interface LabelOptions {
557
690
  fontSize?: string;
558
691
  color?: string;
@@ -575,153 +708,48 @@ interface LabelManager {
575
708
  dispose: () => void;
576
709
  }
577
710
  /**
578
- * 创建模型标签(带连线和脉冲圆点)- 优化版
579
- *
580
- * ✨ 优化内容:
581
- * - 支持暂停/恢复更新
582
- * - 可配置更新间隔
583
- * - 淡入淡出效果
584
- * - 缓存包围盒计算
585
- * - RAF 管理优化
711
+ * Create Model Labels (with connecting lines and pulsing dots) - Optimized
712
+ *
713
+ * Features:
714
+ * - Supports pause/resume
715
+ * - Configurable update interval
716
+ * - Fade in/out effects
717
+ * - Cached bounding box calculation
718
+ * - RAF management optimization
586
719
  */
587
720
  declare function createModelsLabel(camera: THREE.Camera, renderer: THREE.WebGLRenderer, parentModel: THREE.Object3D, modelLabelsMap: Record<string, string>, options?: LabelOptions): LabelManager;
588
721
 
589
722
  /**
590
- * GroupExploder - 基于 Three.js 的模型爆炸效果工具(支持 Vue3 + TS)
591
- * ----------------------------------------------------------------------
592
- * 该工具用于对指定 Mesh 的集合进行“爆炸 / 还原”动画:
593
- * - 仅初始化一次(onMounted)
594
- * - 支持动态切换模型并自动还原上一个模型的爆炸状态
595
- * - 支持多种排列模式(ring / spiral / grid / radial)
596
- * - 支持非爆炸对象自动透明化(dimOthers)
597
- * - 支持摄像机自动前置定位到最佳观察点
598
- * - 所有动画均采用原生 requestAnimationFrame 实现
599
- *
600
- * ----------------------------------------------------------------------
601
- * 🔧 构造参数
602
- * ----------------------------------------------------------------------
603
- * @param scene Three.js 场景实例
604
- * @param camera Three.js 相机(一般为 PerspectiveCamera)
605
- * @param controls OrbitControls 控件实例(必须绑定 camera)
606
- *
723
+ * @file exploder.ts
724
+ * @description
725
+ * GroupExploder - Three.js based model explosion effect tool (Vue3 + TS Support)
607
726
  * ----------------------------------------------------------------------
608
- * 🔥 爆炸参数 ExplodeOptions
609
- * ----------------------------------------------------------------------
610
- * 所有参数均可在 explode() 调用时指定,也可设置默认值。
611
- *
612
- * type ArrangeMode = 'ring' | 'spiral' | 'grid' | 'radial'
613
- *
614
- * @param mode?: ArrangeMode
615
- * 爆炸排列方式:
616
- * - 'ring' 环形排列(默认)
617
- * - 'spiral' 螺旋上升排列
618
- * - 'grid' 平面网格排列(规则整齐)
619
- * - 'radial' 从中心点向外扩散
620
- *
621
- * @param spacing?: number
622
- * 相邻爆炸对象之间的间距(默认:2.5)
623
- *
624
- * @param duration?: number
625
- * 爆炸动画时长(ms),原生 rAF 完成(默认:1000)
626
- *
627
- * @param lift?: number
628
- * 爆炸对象整体抬升的高度因子,用于让爆炸看起来更立体(默认:0.6)
629
- *
630
- * @param cameraPadding?: number
631
- * 摄像机贴合爆炸后包围球时的额外安全距离(默认:1.2)
632
- *
633
- * @param autoRestorePrev?: boolean
634
- * 当切换模型时,是否自动 restore 上一个模型的爆炸元素(默认:true)
635
- *
636
- * @param dimOthers?: { enabled: boolean; opacity?: number }
637
- * 非爆炸对象透明化配置:
638
- * - enabled: true 开启
639
- * - opacity: number 指定非爆炸对象透明度(默认:0.15)
640
- *
641
- * @param debug?: boolean
642
- * 是否开启调试日志,输出所有内部状态(默认 false)
643
- *
644
- *
645
- * ----------------------------------------------------------------------
646
- * 📌 方法说明
647
- * ----------------------------------------------------------------------
648
- *
649
- * ◆ setMeshes(meshSet: Set<Mesh>, contextId?: string)
650
- * 设置当前模型的爆炸 Mesh 集合:
651
- * - 会记录 Mesh 的初始 transform
652
- * - 根据 autoRestorePrev 自动还原上次爆炸
653
- * - 第二个参数 contextId 可选,用于区分业务场景
654
- *
655
- *
656
- * ◆ explode(options?: ExplodeOptions)
657
- * 对当前 meshSet 执行爆炸动画:
658
- * - 根据 mode 生成爆炸布局
659
- * - 相机先自动飞向最佳观察点
660
- * - 执行 mesh 位移动画
661
- * - 按需将非爆炸模型透明化
662
- *
663
- *
664
- * ◆ restore(duration?: number)
665
- * 还原所有爆炸 Mesh 到爆炸前的 transform:
666
- * - 支持平滑动画
667
- * - 自动取消透明化
668
- *
669
- *
670
- * ◆ dispose()
671
- * 移除事件监听、取消动画、清理引用(在组件销毁时调用)
672
- *
673
- *
674
- * ----------------------------------------------------------------------
675
- * 🎨 排列模式说明
676
- * ----------------------------------------------------------------------
677
- *
678
- * 1. Ring(环形)
679
- * - 按圆均匀分布
680
- * - spacing 控制半径
681
- * - lift 控制整体抬起高度
682
- *
683
- * 2. Spiral(螺旋)
684
- * - 在环形基础上添加高度递增(y++)
685
- * - 数量大时视觉效果最强
686
- *
687
- * 3. Grid(网格)
688
- * - 类似棋盘布局
689
- * - spacing 控制网格大小
690
- * - z 不变或小幅度变化
691
- *
692
- * 4. Radial(径向扩散)
693
- * - 从中心向外 “爆炸式” 发散
694
- * - 对于大型组件分解展示非常适合
695
- *
696
- *
697
- * ----------------------------------------------------------------------
698
- * 📌 使用示例(业务层 Vue)
699
- * ----------------------------------------------------------------------
700
- *
701
- * const exploder = new GroupExploder(scene, camera, controls);
702
- *
703
- * onMounted(() => {
704
- * exploder.setMeshes(new Set([meshA, meshB, meshC]));
705
- * });
706
- *
707
- * const triggerExplode = () => {
708
- * exploder.explode({
709
- * mode: 'ring',
710
- * spacing: 3,
711
- * duration: 1200,
712
- * lift: 0.8,
713
- * cameraPadding: 1.3,
714
- * dimOthers: { enabled: true, opacity: 0.2 },
715
- * });
716
- * };
717
- *
718
- * const triggerRestore = () => {
719
- * exploder.restore(600);
720
- * };
721
- *
727
+ * This tool is used to perform "explode / restore" animations on a set of specified Meshes:
728
+ * - Initialize only once (onMounted)
729
+ * - Supports dynamic switching of models and automatically restores the explosion state of the previous model
730
+ * - Supports multiple arrangement modes (ring / spiral / grid / radial)
731
+ * - Supports automatic transparency for non-exploded objects (dimOthers)
732
+ * - Supports automatic camera positioning to the best observation point
733
+ * - All animations use native requestAnimationFrame
734
+ *
735
+ * @best-practice
736
+ * - Initialize in `onMounted`.
737
+ * - Use `setMeshes` to update the active set of meshes to explode.
738
+ * - Call `explode()` to trigger the effect and `restore()` to reset.
722
739
  */
723
740
 
724
741
  type ArrangeMode = 'ring' | 'spiral' | 'grid' | 'radial';
742
+ /**
743
+ * Explosion Parameters
744
+ * @param mode Explosion arrangement mode: 'ring' | 'spiral' | 'grid' | 'radial'
745
+ * @param spacing Spacing between adjacent exploded objects (default: 2.5)
746
+ * @param duration Animation duration in ms (default: 1000)
747
+ * @param lift Lift factor for exploded objects (default: 0.6)
748
+ * @param cameraPadding Extra safety distance for camera framing (default: 1.2)
749
+ * @param autoRestorePrev Whether to automatically restore the previous model's explosion when switching models (default: true)
750
+ * @param dimOthers Configuration for dimming non-exploded objects
751
+ * @param debug Enable debug logs (default: false)
752
+ */
725
753
  type ExplodeOptions = {
726
754
  mode?: ArrangeMode;
727
755
  spacing?: number;
@@ -751,6 +779,12 @@ declare class GroupExploder {
751
779
  private isExploded;
752
780
  private isInitialized;
753
781
  onLog?: (s: string) => void;
782
+ /**
783
+ * Constructor
784
+ * @param scene Three.js Scene instance
785
+ * @param camera Three.js Camera (usually PerspectiveCamera)
786
+ * @param controls OrbitControls instance (must be bound to camera)
787
+ */
754
788
  constructor(scene: THREE.Scene, camera: THREE.PerspectiveCamera | THREE.Camera, controls?: {
755
789
  target?: THREE.Vector3;
756
790
  update?: () => void;
@@ -758,10 +792,12 @@ declare class GroupExploder {
758
792
  private log;
759
793
  init(): void;
760
794
  /**
761
- * setMeshes(newSet):
795
+ * Set the current set of meshes for explosion.
762
796
  * - Detects content-level changes even if same Set reference is used.
763
797
  * - Preserves prevSet/stateMap to allow async restore when needed.
764
798
  * - Ensures stateMap contains snapshots for *all meshes in the new set*.
799
+ * @param newSet The new set of meshes
800
+ * @param contextId Optional context ID to distinguish business scenarios
765
801
  */
766
802
  setMeshes(newSet: Set<THREE.Mesh> | null, options?: {
767
803
  autoRestorePrev?: boolean;
@@ -777,6 +813,11 @@ declare class GroupExploder {
777
813
  * animate camera to that targetBound, then animate meshes to targets.
778
814
  */
779
815
  explode(opts?: ExplodeOptions): Promise<void>;
816
+ /**
817
+ * Restore all exploded meshes to their original transform:
818
+ * - Supports smooth animation
819
+ * - Automatically cancels transparency
820
+ */
780
821
  restore(duration?: number): Promise<void>;
781
822
  /**
782
823
  * restoreSet: reparent and restore transforms using provided stateMap.
@@ -791,29 +832,44 @@ declare class GroupExploder {
791
832
  private computeBoundingSphereForPositionsAndMeshes;
792
833
  private computeTargetsByMode;
793
834
  private animateCameraToFit;
794
- private getCameraLookAtPoint;
835
+ /**
836
+ * Cancel all running animations
837
+ */
795
838
  private cancelAnimations;
796
- dispose(restoreBefore?: boolean): Promise<void>;
839
+ /**
840
+ * Dispose: remove listener, cancel animation, clear references
841
+ */
842
+ dispose(): void;
797
843
  }
798
844
 
845
+ /**
846
+ * @file autoSetup.ts
847
+ * @description
848
+ * Automatically sets up the camera and basic lighting scene based on the model's bounding box.
849
+ *
850
+ * @best-practice
851
+ * - Call `autoSetupCameraAndLight` after loading a model to get a quick "good looking" scene.
852
+ * - Returns a handle to dispose lights or update intensity later.
853
+ */
854
+
799
855
  interface AutoSetupOptions {
800
- /** 相机在包围球基础上的额外填充倍数(>1 扩大可视范围) */
856
+ /** Extra padding multiplier based on bounding sphere (>1 expands view range) */
801
857
  padding?: number;
802
- /** 相机仰角偏移(弧度),默认小俯视(0.2 rad ≈ 11°) */
858
+ /** Camera elevation offset (radians), default slight top-down (0.2 rad ≈ 11°) */
803
859
  elevation?: number;
804
- /** 是否启用阴影(shadow) - 性能开销大,默认 false */
860
+ /** Whether to enable shadows - high performance cost, default false */
805
861
  enableShadows?: boolean;
806
- /** 阴影贴图尺寸,越高越清晰越耗性能,默认 1024 */
862
+ /** Shadow map size, higher is clearer but more expensive, default 1024 */
807
863
  shadowMapSize?: number;
808
- /** DirectionalLights 的数量(均匀分布在四面) */
864
+ /** Number of DirectionalLights (evenly distributed around) */
809
865
  directionalCount?: number;
810
- /** 是否自动把 mesh.castShadow / mesh.receiveShadow 设置为 true(默认 true */
866
+ /** Whether to automatically set mesh.castShadow / mesh.receiveShadow to true (default true) */
811
867
  setMeshShadowProps?: boolean;
812
- /** 如果传入 renderer,则工具会自动启用 renderer.shadowMap(如果 enableShadows true */
868
+ /** If renderer is passed, the tool will automatically enable renderer.shadowMap (if enableShadows is true) */
813
869
  renderer?: THREE.WebGLRenderer | null;
814
870
  }
815
871
  /**
816
- * 返回值句柄,包含 created lights groupcomputed center/radius、以及 dispose 方法
872
+ * Return handle, containing created lights group, computed center/radius, and dispose method
817
873
  */
818
874
  type AutoSetupHandle = {
819
875
  lightsGroup: THREE.Group;
@@ -823,19 +879,19 @@ type AutoSetupHandle = {
823
879
  updateLightIntensity: (factor: number) => void;
824
880
  };
825
881
  /**
826
- * 自动设置相机与基础灯光 - 优化版
882
+ * Automatically setup camera and basic lighting - Optimized
827
883
  *
828
- * ✨ 优化内容:
829
- * - 添加灯光强度调整方法
830
- * - 完善错误处理
831
- * - 优化dispose逻辑
884
+ * Features:
885
+ * - Adds light intensity adjustment method
886
+ * - Improved error handling
887
+ * - Optimized dispose logic
832
888
  *
833
- * - camera: THREE.PerspectiveCamera(会被移动并指向模型中心)
834
- * - scene: THREE.Scene(会把新创建的 light group 加入 scene
835
- * - model: THREE.Object3D 已加载的模型(任意 transform/坐标)
836
- * - options: 可选配置(见 AutoSetupOptions
889
+ * - camera: THREE.PerspectiveCamera (will be moved and pointed at model center)
890
+ * - scene: THREE.Scene (newly created light group will be added to the scene)
891
+ * - model: THREE.Object3D loaded model (arbitrary transform/coordinates)
892
+ * - options: Optional configuration (see AutoSetupOptions)
837
893
  *
838
- * 返回 AutoSetupHandle,调用方在组件卸载/切换时请调用 handle.dispose()
894
+ * Returns AutoSetupHandle, caller should call handle.dispose() when component unmounts/switches
839
895
  */
840
896
  declare function autoSetupCameraAndLight(camera: THREE.PerspectiveCamera, scene: THREE.Scene, model: THREE.Object3D, options?: AutoSetupOptions): AutoSetupHandle;
841
897