@d5techs/3dgs-lib 1.1.3 → 1.3.0

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
@@ -23,6 +23,8 @@ import type { HotspotInfo } from "./interaction/HotspotManager";
23
23
  import { SplatTransformProxy, MeshGroupProxy, SplatBoundingBoxProvider } from "./scene/proxies";
24
24
  import { TransformableObject, GizmoMode } from "./core/gizmo/TransformGizmo";
25
25
  import type { BoundingBoxProvider } from "./types";
26
+ import { SceneAidsRenderer } from "./core/SceneAidsRenderer";
27
+ import type { CoordinateSystem } from "./gs/PLYLoaderMobile";
26
28
  /**
27
29
  * 统一进度回调类型
28
30
  * @param progress 进度值 0-100
@@ -43,6 +45,7 @@ export declare class App {
43
45
  private sceneManager;
44
46
  private gizmoManager;
45
47
  private hotspotManager;
48
+ private sceneAids;
46
49
  private isRunning;
47
50
  private animationId;
48
51
  private useMobileRenderer;
@@ -62,8 +65,12 @@ export declare class App {
62
65
  addOBJ(url: string): Promise<Mesh[]>;
63
66
  /**
64
67
  * 加载 PLY 文件 (3D Gaussian Splatting)
68
+ * @param urlOrBuffer PLY 文件 URL 或 ArrayBuffer
69
+ * @param onProgress 进度回调
70
+ * @param isLocalFile 是否为本地文件
71
+ * @param coordinateSystem 源数据坐标系,默认 'blender'(Z-up → Y-up 自动转换)
65
72
  */
66
- addPLY(urlOrBuffer: string | ArrayBuffer, onProgress?: ProgressCallback, isLocalFile?: boolean): Promise<number>;
73
+ addPLY(urlOrBuffer: string | ArrayBuffer, onProgress?: ProgressCallback, isLocalFile?: boolean, coordinateSystem?: CoordinateSystem): Promise<number>;
67
74
  /**
68
75
  * 加载 Splat 文件
69
76
  */
@@ -156,6 +163,11 @@ export declare class App {
156
163
  getOverlayMeshByIndex(index: number): import("./mesh/Mesh").Mesh | null;
157
164
  private fetchWithProgress;
158
165
  private parsePLYBuffer;
166
+ setGridVisible(visible: boolean): void;
167
+ getGridVisible(): boolean;
168
+ setAxesVisible(visible: boolean): void;
169
+ getAxesVisible(): boolean;
170
+ getSceneAidsRenderer(): SceneAidsRenderer;
159
171
  /**
160
172
  * 销毁应用及所有资源
161
173
  */
@@ -0,0 +1,32 @@
1
+ import { Renderer } from "./Renderer";
2
+ import { Camera } from "./Camera";
3
+ /**
4
+ * SceneAidsRenderer - 场景辅助渲染器
5
+ * 渲染无限网格(XZ 平面)和世界坐标轴(RGB = XYZ)
6
+ */
7
+ export declare class SceneAidsRenderer {
8
+ private renderer;
9
+ private camera;
10
+ private _gridVisible;
11
+ private _axesVisible;
12
+ private gridPipeline;
13
+ private gridUniformBuffer;
14
+ private gridBindGroup;
15
+ private axesPipeline;
16
+ private axesUniformBuffer;
17
+ private axesBindGroup;
18
+ private axesVertexBuffer;
19
+ constructor(renderer: Renderer, camera: Camera);
20
+ private createGridPipeline;
21
+ private createAxesPipeline;
22
+ private createAxesVertexBuffer;
23
+ get gridVisible(): boolean;
24
+ set gridVisible(v: boolean);
25
+ get axesVisible(): boolean;
26
+ set axesVisible(v: boolean);
27
+ render(pass: GPURenderPassEncoder): void;
28
+ private renderGrid;
29
+ private renderAxes;
30
+ private invertMatrix4;
31
+ destroy(): void;
32
+ }
@@ -14,9 +14,15 @@ export type SplatCPU = {
14
14
  opacity: number;
15
15
  shRest?: Float32Array;
16
16
  };
17
+ import type { CoordinateSystem } from './PLYLoaderMobile';
18
+ export interface PLYLoadOptions {
19
+ /** 源数据坐标系,默认 'blender'(Z-up → Y-up 自动转换) */
20
+ coordinateSystem?: CoordinateSystem;
21
+ }
17
22
  /**
18
23
  * 加载并解析 PLY 文件
19
24
  * @param url PLY 文件的 URL
25
+ * @param options 加载选项
20
26
  * @returns SplatCPU 数组
21
27
  */
22
- export declare function loadPLY(url: string): Promise<SplatCPU[]>;
28
+ export declare function loadPLY(url: string, options?: PLYLoadOptions): Promise<SplatCPU[]>;
@@ -9,6 +9,12 @@
9
9
  * 5. 支持多种 PLY 数据类型
10
10
  * 6. 确定性采样(基于文件内容的种子)
11
11
  */
12
+ /**
13
+ * 坐标系类型
14
+ * - 'blender': Blender 坐标系 (Z-up, 右手系),加载时自动将 Y/Z 对调转换为 WebGPU 的 Y-up 坐标系
15
+ * - 'webgpu': WebGPU 坐标系 (Y-up),数据已经是 Y-up 格式,不做转换
16
+ */
17
+ export type CoordinateSystem = 'blender' | 'webgpu';
12
18
  /**
13
19
  * 移动端加载配置
14
20
  */
@@ -21,6 +27,8 @@ export interface MobileLoadOptions {
21
27
  onProgress?: (loaded: number, total: number) => void;
22
28
  /** 随机种子(用于确定性采样,默认使用文件大小作为种子) */
23
29
  seed?: number;
30
+ /** 源数据坐标系,默认 'blender'(Z-up → Y-up 自动转换) */
31
+ coordinateSystem?: CoordinateSystem;
24
32
  }
25
33
  /**
26
34
  * 紧凑 Splat 数据(用于移动端)
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export { Camera } from './core/Camera';
10
10
  export { OrbitControls } from './core/OrbitControls';
11
11
  export { ViewportGizmo } from './core/gizmo/ViewportGizmo';
12
12
  export { BoundingBoxRenderer } from './core/BoundingBoxRenderer';
13
+ export { SceneAidsRenderer } from './core/SceneAidsRenderer';
13
14
  export { Mesh } from './mesh/Mesh';
14
15
  export { MeshRenderer } from './mesh/MeshRenderer';
15
16
  export { GLBLoader } from './loaders/GLBLoader';
@@ -21,9 +22,9 @@ export { MTLParser } from './loaders/MTLParser';
21
22
  export type { ParsedMaterial } from './loaders/MTLParser';
22
23
  export type { IGSSplatRenderer, IGSSplatRendererWithCapabilities, } from './gs/IGSSplatRenderer';
23
24
  export { loadPLY } from './gs/PLYLoader';
24
- export type { SplatCPU } from './gs/PLYLoader';
25
+ export type { SplatCPU, PLYLoadOptions } from './gs/PLYLoader';
25
26
  export { loadPLYMobile, parsePLYBuffer, compactDataToGPUBuffer } from './gs/PLYLoaderMobile';
26
- export type { MobileLoadOptions, CompactSplatData } from './gs/PLYLoaderMobile';
27
+ export type { MobileLoadOptions, CompactSplatData, CoordinateSystem } from './gs/PLYLoaderMobile';
27
28
  export { loadSplat, deserializeSplat } from './gs/SplatLoader';
28
29
  export { loadSOG, deserializeSOG } from './gs/SOGLoader';
29
30
  export type { SOGProgressCallback } from './gs/SOGLoader';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d5techs/3dgs-lib",
3
- "version": "1.1.3",
3
+ "version": "1.3.0",
4
4
  "description": "可扩展的 WebGPU 3D 渲染引擎",
5
5
  "type": "module",
6
6
  "main": "./dist/3dgs-lib.cjs",