@d5techs/3dgs-lib 1.4.16 → 1.4.18

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.
@@ -64,6 +64,8 @@ export declare class SplatEditor {
64
64
  undo(): void;
65
65
  redo(): void;
66
66
  exportPLY(): ArrayBuffer | null;
67
+ exportSOG(): Promise<ArrayBuffer | null>;
68
+ private getFilteredCompactData;
67
69
  downloadPLY(filename?: string): void;
68
70
  private selectByRect;
69
71
  private selectByMask;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * SOGEncoder - 将 CompactSplatData 编码为 SOG v2 格式
3
+ *
4
+ * SOG 是 PlayCanvas 的压缩容器格式,本质是 ZIP 包含 meta.json + WebP 图像
5
+ * 编码步骤:
6
+ * 1. 位置:对称对数变换 → 16-bit 量化 → 拆分为 lower/upper 两张 WebP
7
+ * 2. 缩放:k-means 构建 256 codebook → 量化 → WebP
8
+ * 3. 四元数:smallest-three 编码 → WebP
9
+ * 4. DC 颜色 + 不透明度:codebook 量化 → WebP
10
+ */
11
+ import type { CompactSplatData, CoordinateSystem } from './PLYLoaderMobile';
12
+ /**
13
+ * @param coordinateSystem 内部数据的坐标系来源。
14
+ * 'blender' 表示数据在加载时做过 Blender→WebGPU 变换,需要先做逆变换再编码。
15
+ * 'webgpu' 表示数据已在 SOG 原生坐标系,直接编码。
16
+ */
17
+ export declare function serializeSOG(data: CompactSplatData, coordinateSystem?: CoordinateSystem): Promise<ArrayBuffer>;
package/dist/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export type { MobileLoadOptions, CompactSplatData, CoordinateSystem } from './gs
28
28
  export { loadSplat, deserializeSplat } from './gs/SplatLoader';
29
29
  export { loadSOG, deserializeSOG } from './gs/SOGLoader';
30
30
  export type { SOGProgressCallback } from './gs/SOGLoader';
31
+ export { serializeSOG } from './gs/SOGEncoder';
31
32
  export { GSSplatRenderer } from './gs/GSSplatRenderer';
32
33
  export { GSSplatSorter } from './gs/GSSplatSorter';
33
34
  export type { SorterOptions, CullingOptions, ScreenInfo } from './gs/GSSplatSorter';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d5techs/3dgs-lib",
3
- "version": "1.4.16",
3
+ "version": "1.4.18",
4
4
  "description": "可扩展的 WebGPU 3D 渲染引擎",
5
5
  "type": "module",
6
6
  "main": "./dist/3dgs-lib.cjs",