Cesium 自定义Material 系列 (二)

  • 对于轨迹图片效果 我们先定义一下他的interface, 方便使用的人知道他的调用参数
  • export interface PMaterialTrailImage {
  • color?: any;
  • speed?: number;
  • image: string;
  • count?: number;
  • direction?: boolean;
  • order?: boolean;
  • }
  • //color:颜色,duration:时长,url:图片地址,count:分段数量,direction:纵横,order:方向
  • 对于轨迹图片我们叫 MaterialTrailImage

```javascript

import { MaterialProperty } from "./MaterialProperty";
const defaultOption: PMaterialTrailImage = {
color: new Cesium.Color(0.0, 0.0, 1.0, 0.5),
speed: 3000,
image: Cesium.Material.DefaultImageId,
count: 1,
direction: false,
order: false,
}
/**

  • 图片流动效果
    */
    export class MaterialTrailImage extends MaterialProperty {

     

    public _getType(option: PMaterialTrailImage) {
    // 由于参数需要动态变动,所以count有变动,认为是新着色器
    const { direction = false, order = false } = option;
    return MaterialTrailImage${direction}${order}
    }
    constructor(option=defaultOption) {
    super(MaterialTrailImage.prototype, defaultOption, option);
    }
    /**

    • direction(纵横)[boolean]:纵或者横
    • goodPoor(方向)[boolean]:顺或者逆
      */
      getSource(option: PMaterialTrailImage) {
      const { direction = false, order = false } = option;
      const v1 = direction ? "st.t" : "st.s";
posted @ 2022-01-20 16:56  haibalai  阅读(173)  评论(0编辑  收藏  举报