@d5techs/3dgs-lib 1.4.8 → 1.4.10

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/App.d.ts CHANGED
@@ -133,6 +133,7 @@ export declare class App {
133
133
  frameCurrentModel(animate?: boolean): boolean;
134
134
  getTransformGizmo(): import(".").TransformGizmo;
135
135
  getViewportGizmo(): import(".").ViewportGizmo;
136
+ setViewportGizmoVisible(visible: boolean): void;
136
137
  getBoundingBoxRenderer(): import(".").BoundingBoxRenderer;
137
138
  setGizmoMode(mode: GizmoMode): void;
138
139
  setUniformScaleOnly(enabled: boolean): void;
@@ -1,83 +1,41 @@
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;
17
+ private _visible;
23
18
  private onAxisClick?;
24
- constructor(renderer: Renderer, camera: Camera, canvas: HTMLCanvasElement);
25
- /**
26
- * 设置轴点击回调
27
- */
19
+ private resizeObserver?;
20
+ constructor(_renderer: Renderer, camera: Camera, canvas: HTMLCanvasElement);
28
21
  setOnAxisClick(callback: (axis: string, positive: boolean) => void): void;
22
+ private createSVG;
23
+ private createCircle;
24
+ private createLine;
25
+ private bindClickEvents;
26
+ private positionContainer;
27
+ private setupResizeObserver;
28
+ get visible(): boolean;
29
+ set visible(v: boolean);
29
30
  /**
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
31
+ * 每帧更新 SVG 位置(从相机视图矩阵中提取轴投影)
51
32
  */
52
- private createUniformBuffer;
33
+ render(_pass: GPURenderPassEncoder): void;
53
34
  /**
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 大小
35
+ * 点击检测 — SVG 版本通过 DOM 事件处理,此方法仅保留接口兼容
77
36
  */
37
+ handleClick(_clientX: number, _clientY: number): boolean;
78
38
  setSize(size: number): void;
79
- /**
80
- * 设置边距
81
- */
82
39
  setMargin(margin: number): void;
40
+ destroy(): void;
83
41
  }
@@ -61,6 +61,7 @@ export declare class GizmoManager {
61
61
  * 获取视口 Gizmo
62
62
  */
63
63
  getViewportGizmo(): ViewportGizmo;
64
+ setViewportGizmoVisible(visible: boolean): void;
64
65
  /**
65
66
  * 获取包围盒渲染器
66
67
  */
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.10",
4
4
  "description": "可扩展的 WebGPU 3D 渲染引擎",
5
5
  "type": "module",
6
6
  "main": "./dist/3dgs-lib.cjs",