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 @   haibalai  阅读(198)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示