s3m-maplibre 0.4.21 → 0.4.23

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/docs/API.md CHANGED
@@ -131,7 +131,7 @@ new S3MLayer(options?: S3MLayerOptions)
131
131
  | `anisotropyCap` | `number` | `Infinity` | 各向异性过滤上限(不封顶 = GPU 最大值,通常 16)。移动端 4 / 8 通常肉眼无差,见[移动端 / 差设备](../s3m-three/docs/API.md#移动端--差设备) |
132
132
  | `maxTextureSize` | `number` | `Infinity` | 纹理长边像素上限(不限制)。手机上 1024 即可,显存降到 1/4;图集与 DXT 直传不受影响 |
133
133
  | `maxImageCache` | `number` | `128` | 纹理缓存条数上限,1024² RGBA 约 4MB / 条。低端设备 32~48,见[移动端 / 差设备](../s3m-three/docs/API.md#移动端--差设备) |
134
- | `materialQuality` | `'pbr' \| 'lambert'` | `'pbr'` | 光照模型,`lambert` 片元约省一半。模块级全局,只影响之后创建的材质 |
134
+ | `materialQuality` | `'pbr' \| 'lambert'` | `'pbr'` | 光照模型,`lambert` 片元约省一半。图层级设置,同页多个图层各用各的、互不覆盖;只影响之后创建的材质 |
135
135
  | `attributes` | `AttributeQueryOptions` | — | 业务属性查询配置,见[s3m-three 业务字段章节](../s3m-three/docs/API.md#业务字段锚点在库内对应关系在外部) |
136
136
  | `projection` | `'perspective' \| 'orthographic'` | `'perspective'` | 投影模式,见[投影](#投影) |
137
137
  | `nearPlaneScale` | `number` | `1` | 近裁剪面缩放系数(`0 < scale < 1`,1 = 不改)。MapLibre 的 near 是硬编码的 `canvasHeight/50`,zoom 16.5 时约合 13 米,相机贴近模型会把楼面整片裁掉;缩放后 fov / far 不变,见[近裁剪面](#近裁剪面贴脸看时不消失) |
@@ -288,8 +288,12 @@ setMaxTriangles(n: number, datasetId?: string): void // 驻留面数软上
288
288
  readonly maxTriangles: number
289
289
  setMaxMemory(bytes: number, datasetId?: string): void // 驻留显存字节软上限,Infinity = 不限制(默认)
290
290
  readonly maxMemory: number
291
- setAnisotropyCap(cap: number): void // 各向异性上限,Infinity = 取 GPU 最大值(默认)
291
+ setAnisotropyCap(cap: number): void // 各向异性上限,Infinity = 取 GPU 最大值(默认);即时应用到已上传纹理
292
292
  readonly anisotropyCap: number
293
+ setColorPipeline(q: 'linear' | 'direct', opts?: { duration?: number; dim?: number }): Promise<void>
294
+ readonly colorPipeline: 'linear' | 'direct' // 图层级;duration > 0 走压暗过渡
295
+ setMaterialQuality(q: 'pbr' | 'lambert'): void // 图层级;原位重建本层材质
296
+ readonly materialQuality: 'pbr' | 'lambert'
293
297
  setMaxTextureSize(n: number): void // 纹理长边像素上限,Infinity = 不限制(默认)
294
298
  readonly maxTextureSize: number
295
299
  readonly maxImageCache: number
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s3m-maplibre",
3
- "version": "0.4.21",
3
+ "version": "0.4.23",
4
4
  "description": "SuperMap S3M 三维模型格式的 MapLibre / Mapbox 原生渲染图层:浏览器内直接解析 .s3mb 瓦片,无需转 3D Tiles,支持多数据集叠加、白膜/按高度/按单体/动态扫描着色、单体级 GPU 拾取与属性查询。基于 s3m-three 渲染内核。",
5
5
  "type": "module",
6
6
  "repository": {
@@ -60,7 +60,7 @@
60
60
  "author": "",
61
61
  "license": "Apache-2.0",
62
62
  "dependencies": {
63
- "s3m-three": "^0.4.21"
63
+ "s3m-three": "^0.4.23"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "three": ">=0.155.0"
package/src/S3MLayer.ts CHANGED
@@ -501,18 +501,41 @@ export class S3MLayer extends HostRenderer {
501
501
  }
502
502
 
503
503
  /**
504
- * 运行时切换材质质感(`'pbr'` | `'lambert'`):原位重建现有 styled 材质,
505
- * 不重拉瓦片、不重建几何。lambert 开销更低,低端设备 / 白模场景适用。
504
+ * 运行时切换**本图层**的材质质感(`'pbr'` | `'lambert'`):原位重建本层的 styled
505
+ * 材质,不重拉瓦片、不重建几何。lambert 开销更低,低端设备 / 白模场景适用。
506
+ *
507
+ * 档位是图层级的:同页别的图层不受影响,所以可以「这一层 pbr、那一层 lambert」。
506
508
  */
507
509
  setMaterialQuality(q: 'pbr' | 'lambert'): void {
508
510
  this.viewer.setMaterialQuality(q);
509
511
  }
510
512
 
511
- /** 当前材质质感档位 */
513
+ /** 当前材质质感档位(本层没指定过就是模块级默认) */
512
514
  get materialQuality(): 'pbr' | 'lambert' {
513
515
  return this.viewer.materialQuality;
514
516
  }
515
517
 
518
+ /**
519
+ * 运行时切换**本图层**的颜色管线(`'linear'` | `'direct'`)。
520
+ *
521
+ * `'direct'` = 官方 iClient3D 的 sRGB 直乘管线(`lightingPreset: 'supermap'` 就是它)。
522
+ * 传 `duration > 0` 走 fade-through:压暗 → 换管线(重建材质 + 重传纹理)→ 亮回来,
523
+ * 不重新下载瓦片。不传 = 立即生效。
524
+ *
525
+ * 同页其它图层不受影响 —— 管线和纹理解码都是图层级的。
526
+ */
527
+ setColorPipeline(
528
+ q: 'linear' | 'direct',
529
+ opts?: { duration?: number; dim?: number }
530
+ ): Promise<void> {
531
+ return this.viewer.setColorPipeline(q, opts);
532
+ }
533
+
534
+ /** 当前颜色管线(本层没指定过就是模块级默认) */
535
+ get colorPipeline(): 'linear' | 'direct' {
536
+ return this.viewer.colorPipeline;
537
+ }
538
+
516
539
  /** 动态设置图层整体透明度 (0.0 ~ 1.0),可带过渡 */
517
540
  setOpacity(opacity: number, transition?: TransitionOptions): void {
518
541
  this.viewer.setOpacity(opacity, transition);