@d5techs/3dgs-lib 1.4.7 → 1.4.8

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
@@ -205,6 +205,33 @@ export declare class App {
205
205
  setAxesVisible(visible: boolean): void;
206
206
  getAxesVisible(): boolean;
207
207
  getSceneAidsRenderer(): SceneAidsRenderer;
208
+ /**
209
+ * 设置渲染缩放比例(影响内部分辨率)
210
+ * 0.5 = 半分辨率(性能提升约 4 倍),1.0 = 正常
211
+ * 适用于移动端提质或桌面端降负载
212
+ */
213
+ setRenderScale(scale: number): void;
214
+ getRenderScale(): number;
215
+ /**
216
+ * 覆盖自动 DPR,传 -1 恢复自动推荐
217
+ */
218
+ setDPR(dpr: number): void;
219
+ getDPR(): number;
220
+ /**
221
+ * 设置桌面端亚像素剔除阈值(默认 1.0)
222
+ * 值越大剔除越激进,近距离性能越好,但远处细节可能丢失
223
+ */
224
+ setPixelCullThreshold(threshold: number): void;
225
+ /**
226
+ * 设置桌面端最大可见 splat 数(0 = 不限制)
227
+ * 限制绘制数量是应对近距离卡顿最直接的手段
228
+ */
229
+ setMaxVisibleSplats(count: number): void;
230
+ /**
231
+ * 设置排序频率(1 = 每帧,2 = 每两帧,以此类推)
232
+ * 降低排序频率可提升帧率,代价是移动时短暂排序瑕疵
233
+ */
234
+ setSortFrequency(frequency: number): void;
208
235
  /**
209
236
  * 销毁应用及所有资源
210
237
  */
@@ -12,6 +12,10 @@ export declare class Renderer {
12
12
  private commandEncoder;
13
13
  private renderPassEncoder;
14
14
  private resizeObserver;
15
+ private _renderScale;
16
+ private _customDPR;
17
+ private _lastCSSWidth;
18
+ private _lastCSSHeight;
15
19
  private _clearColor;
16
20
  constructor(canvas: HTMLCanvasElement);
17
21
  /**
@@ -46,6 +50,21 @@ export declare class Renderer {
46
50
  * 创建深度纹理
47
51
  */
48
52
  private createDepthTexture;
53
+ private getEffectiveDPR;
54
+ /**
55
+ * 设置渲染缩放比例,用于性能/质量权衡
56
+ * 0.5 = 半分辨率(性能提升约 4 倍),1.0 = 正常分辨率
57
+ * 内部等效于降低 DPR,不影响 CSS 布局尺寸
58
+ */
59
+ setRenderScale(scale: number): void;
60
+ getRenderScale(): number;
61
+ /**
62
+ * 覆盖自动 DPR 推荐值
63
+ * 传入 -1 恢复自动模式
64
+ */
65
+ setDPR(dpr: number): void;
66
+ getDPR(): number;
67
+ private applySize;
49
68
  /**
50
69
  * 设置 resize 监听
51
70
  */
@@ -34,6 +34,9 @@ export declare class GSSplatRendererMobile implements IGSSplatRendererWithCapabi
34
34
  private cpuPositions;
35
35
  private frameCount;
36
36
  private sortEveryNFrames;
37
+ private lastSortViewMatrix;
38
+ private lastSortProjMatrix;
39
+ private sortStateInitialized;
37
40
  private position;
38
41
  private rotation;
39
42
  private scaleValue;
@@ -82,13 +85,14 @@ export declare class GSSplatRendererMobile implements IGSSplatRendererWithCapabi
82
85
  * 获取当前模型矩阵
83
86
  */
84
87
  getModelMatrix(): Float32Array;
88
+ private dummySHTexture;
85
89
  /**
86
90
  * 创建渲染管线
87
91
  */
88
92
  private createPipeline;
89
93
  /**
90
94
  * 创建 uniform buffer
91
- * 布局: view (64) + proj (64) + model (64) + cameraPos (12) + pad (4) + screenSize (8) + pad (8) + textureSize (8) + pad (8) = 240 bytes
95
+ * 布局: view(64) + proj(64) + model(64) + cameraPos(12)+pad(4) + screenSize(8)+pad(8) + textureSize(8)+shEnabled(4)+pad(4) = 240 bytes
92
96
  */
93
97
  private createUniformBuffer;
94
98
  /**
@@ -123,21 +127,10 @@ export declare class GSSplatRendererMobile implements IGSSplatRendererWithCapabi
123
127
  * @param n 每 n 帧排序一次
124
128
  */
125
129
  setSortFrequency(n: number): void;
126
- /**
127
- * 设置 SH 模式(移动端仅支持 L0)
128
- */
129
- setSHMode(mode: SHMode): void;
130
- /**
131
- * 获取当前 SH 模式
132
- */
130
+ private hasCameraChanged;
131
+ setSHMode(_mode: SHMode): void;
133
132
  getSHMode(): SHMode;
134
- /**
135
- * 是否支持指定的 SH 模式
136
- */
137
133
  supportsSHMode(mode: SHMode): boolean;
138
- /**
139
- * 获取渲染器能力
140
- */
141
134
  getCapabilities(): RendererCapabilities;
142
135
  /**
143
136
  * 内部销毁资源(不销毁管线)
@@ -28,6 +28,10 @@ export interface CompressedSplatTextures {
28
28
  scaleRotTexture1: GPUTexture;
29
29
  scaleRotTexture2: GPUTexture;
30
30
  colorTexture: GPUTexture;
31
+ shBasis0Texture: GPUTexture | null;
32
+ shBasis1Texture: GPUTexture | null;
33
+ shBasis2Texture: GPUTexture | null;
34
+ hasSH: boolean;
31
35
  boundingBox: {
32
36
  min: [number, number, number];
33
37
  max: [number, number, number];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d5techs/3dgs-lib",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
4
4
  "description": "可扩展的 WebGPU 3D 渲染引擎",
5
5
  "type": "module",
6
6
  "main": "./dist/3dgs-lib.cjs",