@d5techs/3dgs-lib 1.4.8 → 1.4.9

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.
@@ -1,83 +1,38 @@
1
1
  import { Camera } from "../Camera";
2
2
  import { Renderer } from "../Renderer";
3
3
  /**
4
- * ViewportGizmo - 视口坐标轴指示器
5
- * 在画布右上角显示当前相机朝向
4
+ * ViewportGizmo - 视口坐标轴指示器(SVG 实现)
5
+ * 参考 supersplat 的 ViewCube,在画布右上角用 SVG 显示当前相机朝向
6
6
  */
7
7
  export declare class ViewportGizmo {
8
- private renderer;
9
8
  private camera;
10
9
  private canvas;
11
- private pipeline;
12
- private uniformBuffer;
13
- private bindGroup;
14
- private vertexBuffer;
15
- private indexBuffer;
16
- private vertexCount;
17
- private indexCount;
10
+ private container;
11
+ private svg;
12
+ private group;
13
+ private shapes;
18
14
  private size;
19
15
  private margin;
20
- private projMatrix;
21
- private viewMatrix;
22
- private axes;
16
+ private scale;
23
17
  private onAxisClick?;
24
- constructor(renderer: Renderer, camera: Camera, canvas: HTMLCanvasElement);
25
- /**
26
- * 设置轴点击回调
27
- */
18
+ private resizeObserver?;
19
+ constructor(_renderer: Renderer, camera: Camera, canvas: HTMLCanvasElement);
28
20
  setOnAxisClick(callback: (axis: string, positive: boolean) => void): void;
21
+ private createSVG;
22
+ private createCircle;
23
+ private createLine;
24
+ private bindClickEvents;
25
+ private positionContainer;
26
+ private setupResizeObserver;
29
27
  /**
30
- * 创建渲染管线
31
- */
32
- private createPipeline;
33
- /**
34
- * 创建 Gizmo 几何体(三个轴 + 箭头)
35
- */
36
- private createGeometry;
37
- /**
38
- * 创建圆柱体几何
39
- */
40
- private createCylinder;
41
- /**
42
- * 创建圆锥几何
43
- */
44
- private createCone;
45
- /**
46
- * 创建球体几何
47
- */
48
- private createSphere;
49
- /**
50
- * 创建 uniform buffer
28
+ * 每帧更新 SVG 位置(从相机视图矩阵中提取轴投影)
51
29
  */
52
- private createUniformBuffer;
30
+ render(_pass: GPURenderPassEncoder): void;
53
31
  /**
54
- * 设置正交投影矩阵
55
- */
56
- private setupOrthoProjection;
57
- /**
58
- * 更新 Gizmo 视图矩阵(从相机提取旋转部分)
59
- */
60
- private updateViewMatrix;
61
- /**
62
- * 渲染 Gizmo
63
- */
64
- render(pass: GPURenderPassEncoder): void;
65
- /**
66
- * 处理点击事件,检测是否点击了某个轴
67
- */
68
- handleClick(clientX: number, clientY: number): boolean;
69
- /**
70
- * 检测点击了哪个轴
71
- */
72
- private detectClickedAxis;
73
- private cross;
74
- private normalize;
75
- /**
76
- * 设置 Gizmo 大小
32
+ * 点击检测 — SVG 版本通过 DOM 事件处理,此方法仅保留接口兼容
77
33
  */
34
+ handleClick(_clientX: number, _clientY: number): boolean;
78
35
  setSize(size: number): void;
79
- /**
80
- * 设置边距
81
- */
82
36
  setMargin(margin: number): void;
37
+ destroy(): void;
83
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d5techs/3dgs-lib",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "description": "可扩展的 WebGPU 3D 渲染引擎",
5
5
  "type": "module",
6
6
  "main": "./dist/3dgs-lib.cjs",