@metagl/sdk-render 1.0.9 → 1.0.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/lacdt.render.d.ts CHANGED
@@ -233,6 +233,8 @@ interface VolumetricCloudsConfig {
233
233
  cloudThickness?: number;
234
234
  cloudLightIntensity?: number;
235
235
  cloudIntensity?: number;
236
+ cloudOpacityMin?: number;
237
+ cloudOpacityMax?: number;
236
238
  visibility?: CloudVisibilityConfig;
237
239
  }
238
240
  /**
@@ -732,6 +734,8 @@ declare class PostProcessingSystem implements RenderSystem {
732
734
  disable(): void;
733
735
  update(config: Partial<PostProcessingConfig>): void;
734
736
  getStatus(): boolean;
737
+ /** 返回当前已加入队列的自定义 Stage 列表(供 RenderCore 做顺序修正)*/
738
+ getCustomStages(): PostProcessStage[];
735
739
  getConfig(): PostProcessingConfig;
736
740
  saveConfig(): any;
737
741
  destroy(): void;
@@ -1131,6 +1135,10 @@ declare class WaterSystem implements RenderSystem {
1131
1135
  * 直接修改已存在水图元的材质参数
1132
1136
  */
1133
1137
  updateWaterLayerEffect(config: Partial<WaterConfig>): void;
1138
+ /**
1139
+ * 更新单个图元的材质参数
1140
+ */
1141
+ private updateSinglePrimitiveMaterial;
1134
1142
  /**
1135
1143
  * 获取系统状态
1136
1144
  */
@@ -2511,6 +2519,9 @@ declare class Render {
2511
2519
  *
2512
2520
  * 修正方式:直接操作 PostProcessStageCollection 的内部 _stages 数组调整顺序,
2513
2521
  * 不调用 remove()(remove 会 destroy GPU 资源),不触发 Shader 重编译,无视觉闪烁。
2522
+ *
2523
+ * 目标顺序:云 → 大气 → 后处理(whiteBalance/colorAdjustment/...)
2524
+ * 原因:后处理的 exposure 等效果作用在大气之后才正确;大气需读取未经后处理的原始场景。
2514
2525
  */
2515
2526
  private ensurePostProcessStageOrder;
2516
2527
  private registerSystems;
@@ -2535,6 +2546,11 @@ declare class Render {
2535
2546
  * 清除当前预设,关闭所有环境系统
2536
2547
  */
2537
2548
  clearPreset(): void;
2549
+ /**
2550
+ * 重置所有环境系统到默认配置(单一出口)
2551
+ * 等效于 applyConfig(DEFAULT_CONFIG),所有系统参数回到 DefaultConfig.ts 定义的值并禁用。
2552
+ */
2553
+ resetConfig(): void;
2538
2554
  /**
2539
2555
  * 获取当前激活的预设 ID,未激活时返回 null
2540
2556
  */
@@ -2543,6 +2559,19 @@ declare class Render {
2543
2559
  * 启用所有系统
2544
2560
  */
2545
2561
  enableAllSystems(): void;
2562
+ /**
2563
+ * 以 DefaultConfig 参数启用所有环境系统
2564
+ *
2565
+ * 与直接调用 enableSystem() 的区别:
2566
+ * - 先将所有系统参数重置为 DefaultConfig(清除预设残留)
2567
+ * - 再启用所有环境系统
2568
+ *
2569
+ * 解决问题:
2570
+ * "全部开启"按钮点击时,若之前曾应用过预设,系统内部仍持有预设参数
2571
+ * (如 ACES 色调映射 / exposure 1.20 / 暖色温),导致视觉结果与 DefaultConfig 不一致。
2572
+ * 此方法保证"全部开启"始终以 DefaultConfig 参数运行。
2573
+ */
2574
+ enableAllWithDefaults(): void;
2546
2575
  /**
2547
2576
  * 禁用所有系统
2548
2577
  */
@@ -4495,227 +4524,71 @@ declare class CameraUrlManager {
4495
4524
  destroy(): void;
4496
4525
  }
4497
4526
 
4498
- /**
4499
- * 矩形区域定义
4500
- */
4501
- interface RainBounds {
4502
- /** 左上角经度 */
4503
- west: number;
4504
- /** 左上角纬度 */
4505
- north: number;
4506
- /** 右下角经度 */
4507
- east: number;
4508
- /** 右下角纬度 */
4509
- south: number;
4510
- }
4511
- /**
4512
- * 下雨系统配置接口
4513
- */
4514
- interface RainConfig {
4515
- /** 是否启用下雨系统 */
4516
- enabled: boolean;
4517
- /** 雨滴发射率 (个/秒) */
4518
- emissionRate: number;
4519
- /** 雨滴大小 */
4520
- particleSize: number;
4521
- /** 最小生命周期(秒) */
4522
- minimumParticleLife: number;
4523
- /** 最大生命周期(秒) */
4524
- maximumParticleLife: number;
4525
- /** 最小速度 */
4526
- minimumSpeed: number;
4527
- /** 最大速度 */
4528
- maximumSpeed: number;
4529
- /** 雨滴颜色 */
4530
- color: Color;
4531
- /** 重力因子(负值向下,正值向上) */
4532
- gravity: number;
4533
- /** 下雨区域范围(矩形) */
4534
- bounds?: RainBounds;
4535
- /** 相机高度超过此值时隐藏雨滴(单位:米),默认5000 */
4536
- hideAltitude?: number;
4537
- /** 雨滴纹理图片路径,默认 './image/rain.png' */
4538
- imagePath?: string;
4539
- /** 雨滴纹理类型: 'rain' | 'hail' | 'snow' */
4540
- imageType?: 'rain' | 'hail' | 'snow';
4527
+ interface WeatherAreaData {
4528
+ gger: string;
4529
+ minLon: number;
4530
+ maxLon: number;
4531
+ minLat: number;
4532
+ maxLat: number;
4533
+ weatherType: 'rainy' | 'snowy' | 'foggy' | 'sunny';
4541
4534
  }
4542
- /**
4543
- * 默认下雨配置
4544
- */
4545
- declare const defaultRainConfig: RainConfig;
4546
- /**
4547
- * 下雨系统类
4548
- * 负责管理场景中的局部下雨效果
4549
- */
4550
- declare class RainSystem implements RenderSystem {
4551
- private viewer;
4552
- private config;
4553
- private rainParticleSystems;
4554
- private isInitialized;
4555
- private isEnabled;
4556
- private rainImage;
4557
- private hideAltitude;
4558
- private lastAltitudeCheck;
4559
- private readonly altitudeCheckInterval;
4560
- private shaderRainStage;
4561
- private useShaderRain;
4562
- private shaderRainHeight;
4563
- private currentImageType;
4564
- private weatherIconElement;
4565
- private weatherIconVisible;
4566
- constructor(viewer: Viewer, config?: Partial<RainConfig>);
4567
- /**
4568
- * 初始化下雨系统
4569
- */
4570
- initialize(): void;
4571
- /**
4572
- * 在指定矩形范围内创建下雨效果
4573
- */
4574
- private createRainSystemsInBounds;
4575
- /**
4576
- * 创建网格点的下雨粒子系统
4577
- */
4578
- private createGridRainSystem;
4579
- /**
4580
- * 计算发射器模型矩阵
4581
- * 让发射方向向下(旋转使发射器朝向地面)
4582
- */
4583
- private computeEmitterModelMatrix;
4584
- /**
4585
- * 创建雨滴纹理图像 - 使用 Canvas 程序生成细长的雨丝
4586
- */
4587
- private createRainImage;
4588
- /**
4589
- * 创建 Canvas 雨滴纹理
4590
- */
4591
- private createCanvashailImage;
4592
- private createCanvasSnowImage;
4593
- /**
4594
- * 设置雨滴纹理类型
4595
- * @param type 纹理类型: 'rain' | 'hail' | 'snow'
4596
- */
4597
- setRainImageType(type: 'rain' | 'hail' | 'snow'): void;
4598
- /**
4599
- * 设置自定义雨滴纹理路径
4600
- * @param imagePath 纹理图片路径,如 './image/rain.png'
4601
- */
4602
- setRainImage(imagePath: string): void;
4603
- /**
4604
- * 创建着色器雨效(后期处理方式)
4605
- * 参考 natureSimulate.js 的 FS_Rain 实现,兼容 WebGL 2.0
4606
- */
4607
- private createShaderRainStage;
4608
- /**
4609
- * 根据相机高度切换雨效模式
4610
- * 500米以内使用着色器雨效,500米以上使用粒子系统
4611
- */
4612
- private switchRainEffectMode;
4613
- /**
4614
- * 获取相机正下方地形的海拔高度
4615
- */
4616
- private getTerrainHeightBelowCamera;
4617
- /**
4618
- * 应用重力效果 - 雨滴下落
4619
- */
4620
- private applyGravity;
4621
- /**
4622
- * 根据相机高度更新雨滴可见性
4623
- * 当相机高度超过 hideAltitude 时隐藏雨滴,拉近时重新显示
4624
- * 同时更新天气图标的显示状态
4625
- */
4626
- updateCameraVisibility(): void;
4627
- /**
4628
- * 创建天气图标 DOM 元素
4629
- */
4630
- private createWeatherIcon;
4631
- /**
4632
- * 获取当前天气类型的图标信息
4633
- */
4634
- private getWeatherIconInfo;
4635
- /**
4636
- * 显示天气图标
4637
- */
4638
- private showWeatherIcon;
4639
- /**
4640
- * 隐藏天气图标
4641
- */
4642
- private hideWeatherIcon;
4643
- /**
4644
- * 更新天气图标显示内容
4645
- */
4646
- private updateWeatherIconContent;
4647
- /**
4648
- * 启用下雨系统
4649
- */
4650
- enable(): void;
4651
- /**
4652
- * 设置相机高度追踪
4653
- * 在每一帧渲染后检测相机高度,超过阈值时隐藏雨滴
4654
- * 同时根据高度切换着色器雨效和粒子系统
4655
- */
4656
- private cameraTrackingCallback;
4657
- /**
4658
- * 设置相机追踪
4659
- */
4660
- private setupCameraTracking;
4661
- /**
4662
- * 禁用下雨系统
4663
- */
4664
- disable(): void;
4665
- /**
4666
- * 更新系统配置 - 实时天气数据更新的统一公共接口
4667
- * 支持不同天气状态间的动态平滑过渡(例如强度由小雨转大雨,或类型由雨转雪)
4668
- * @param config 部分配置参数,将与现有配置合并
4669
- */
4670
- update(config: Partial<RainConfig>): void;
4671
- /**
4672
- * 更新下雨区域范围
4673
- * @param bounds 新的区域范围
4674
- */
4675
- private updateBounds;
4676
- /**
4677
- * 平滑过渡到新的天气强度
4678
- * @param targetEmissionRate 目标发射率
4679
- * @param duration 过渡持续时间(毫秒)
4680
- */
4681
- transitionToIntensity(targetEmissionRate: number, duration?: number): void;
4682
- /**
4683
- * 平滑过渡到新的天气类型
4684
- * @param targetType 目标天气类型
4685
- * @param duration 过渡持续时间(毫秒)
4686
- */
4687
- transitionToType(targetType: 'rain' | 'hail' | 'snow', duration?: number): void;
4688
- /**
4689
- * 获取系统状态
4690
- */
4691
- getStatus(): boolean;
4692
- /**
4693
- * 设置相机隐藏高度
4694
- * @param altitude 相机高度超过此值时隐藏雨滴(单位:米)
4695
- */
4696
- setHideAltitude(altitude: number): void;
4697
- /**
4698
- * 获取当前相机高度
4699
- */
4700
- getCurrentCameraHeight(): number;
4701
- /**
4702
- * 设置是否启用着色器雨效模式
4703
- * @param enabled 是否启用着色器雨效(相机低于500米时自动切换)
4704
- */
4705
- setShaderRainEnabled(enabled: boolean): void;
4706
- /**
4707
- * 设置着色器雨效切换高度
4708
- * @param height 相机高度低于此值时切换到着色器雨效(单位:米)
4709
- */
4710
- setShaderRainHeight(height: number): void;
4711
- /**
4712
- * 销毁系统
4713
- */
4714
- destroy(): void;
4715
- /**
4716
- * 获取当前配置
4717
- */
4718
- getConfig(): RainConfig;
4535
+ declare class RainSystem {
4536
+ private _viewer;
4537
+ private _effects;
4538
+ private _anchorEntities;
4539
+ private _allAreas;
4540
+ private _lastCameraPosition;
4541
+ private _effectPaused;
4542
+ private _isPageVisible;
4543
+ private _isWindowFocused;
4544
+ private _rainCanvas;
4545
+ private _snowCanvas;
4546
+ private _fogCanvas;
4547
+ private readonly MAX_EFFECTS;
4548
+ private readonly UPDATE_THRESHOLD;
4549
+ private _pendingAdd;
4550
+ private _pendingRemove;
4551
+ private _isUpdating;
4552
+ private _lastUpdateTime;
4553
+ private readonly THROTTLE_MS;
4554
+ private _tickHandler;
4555
+ constructor(viewer: any, Cesium?: any);
4556
+ /**
4557
+ * 从JSON数组加载天气效果
4558
+ */
4559
+ loadFromJson(areas: WeatherAreaData[]): void;
4560
+ private _setupVisibilityHandler;
4561
+ private _updatePauseState;
4562
+ private _setEffectsPaused;
4563
+ private _pauseAllEffects;
4564
+ private _resumeAllEffects;
4565
+ private _startCameraWatch;
4566
+ private _scheduleUpdate;
4567
+ private _computePendingChanges;
4568
+ private _processNextPending;
4569
+ private _updateVisibleEffects;
4570
+ private _getVisibleAreas;
4571
+ /**
4572
+ * 添加单个天气区域
4573
+ */
4574
+ addWeatherArea(area: WeatherAreaData): void;
4575
+ /**
4576
+ * 移除指定区域天气效果
4577
+ */
4578
+ removeWeatherArea(id: string): void;
4579
+ /**
4580
+ * 清空所有天气效果
4581
+ */
4582
+ clearAll(): void;
4583
+ private _createSunnyEffect;
4584
+ private _createRainEffect;
4585
+ private _createSnowEffect;
4586
+ private _createFogEffect;
4587
+ private _createSunCoreCanvas;
4588
+ private _createRainCanvas;
4589
+ private _createSnowCanvas;
4590
+ private _createFogCanvas;
4591
+ private _getParticleSystemMatrix;
4719
4592
  }
4720
4593
 
4721
4594
  declare global {
@@ -4764,4 +4637,4 @@ declare const render: {
4764
4637
  SeaSystem: typeof SeaSystem;
4765
4638
  };
4766
4639
 
4767
- export { AtmosphereControl, type AtmosphereScatteringConfig, AtmosphereScatteringSystem, BuildingControl, BuildingSystem, CameraListener, type CameraListenerConfig, CameraListenerSystem, type CameraListenerSystemConfig, type CameraParams, CameraUrlManager, type CameraUrlManagerConfig, type DirectionalLightConfig, type DistanceFogConfig, DistanceFogSystem, EnvironmentControl, FogControl, type HeightFogConfig, HeightFogSystem, LayerControl, LayerSystem, LightingControl, LightingSystem, PlottingControl, type PostProcessingConfig, PostProcessingControl, PostProcessingSystem, type RainBounds, type RainConfig, RainSystem, Render, type RenderConfig, RenderControl, type SeaConfig, SeaSystem, type ShadowConfig, ShadowControl, ShadowSystem, SidebarControl, TilesetManager, TilesetSearchControl, ToolboxControl, ToolboxSystem, VolumetricCloudControl, type VolumetricCloudsConfig, VolumetricCloudsSystem, type WaterConfig, WaterControl, WaterSystem, defaultRainConfig, render };
4640
+ export { AtmosphereControl, type AtmosphereScatteringConfig, AtmosphereScatteringSystem, BuildingControl, BuildingSystem, CameraListener, type CameraListenerConfig, CameraListenerSystem, type CameraListenerSystemConfig, type CameraParams, CameraUrlManager, type CameraUrlManagerConfig, type DirectionalLightConfig, type DistanceFogConfig, DistanceFogSystem, EnvironmentControl, FogControl, type HeightFogConfig, HeightFogSystem, LayerControl, LayerSystem, LightingControl, LightingSystem, PlottingControl, type PostProcessingConfig, PostProcessingControl, PostProcessingSystem, RainSystem, Render, type RenderConfig, RenderControl, type SeaConfig, SeaSystem, type ShadowConfig, ShadowControl, ShadowSystem, SidebarControl, TilesetManager, TilesetSearchControl, ToolboxControl, ToolboxSystem, VolumetricCloudControl, type VolumetricCloudsConfig, VolumetricCloudsSystem, type WaterConfig, WaterControl, WaterSystem, type WeatherAreaData, render };