美文网首页
Cesium 自定义Material 系列 (三)

Cesium 自定义Material 系列 (三)

作者: haibalai | 来源:发表于2022-02-09 11:58 被阅读0次

对于动态流线效果 我们先定义一下他的interface, 方便使用的人知道他的调用参数

export interface PMaterialDynamicFlow{

color?:any,

speed?:number,

opacity?:number,

percent?:number,

}

对于动态流线我们叫 MaterialDynamicFlow

```javascript

import {MaterialProperty} from "./MaterialProperty";

const defaultOption: PMaterialDynamicFlow = {

color: Cesium.Color.AQUA,//颜色

speed: 1,//步长

percent:0.03,//动点占线段长度的百分比

opacity:0.0//背景线段的透明度

}

/**

动态流线--点在线上跑

*/

export class MaterialDynamicFlow extends MaterialProperty{

protected _getType(option: any): string {

return "MaterialDynamicFlow"

}

constructor(option=defaultOption) {

super(MaterialDynamicFlow.prototype, defaultOption, option);

}

protected getSource(option: any): string {

return `

uniform vec4 color;

uniform float speed;

uniform float percent;

uniform float opacity;

czm_material czm_getMaterial(czm_materialInput materialInput)

{

czm_material material = czm_getDefaultMaterial(materialInput);

vec2 st = materialInput.st;

 更多参考https://xiaozhuanlan.com/topic/5341097268

相关文章

网友评论

      本文标题:Cesium 自定义Material 系列 (三)

      本文链接:https://www.haomeiwen.com/subject/vkewkrtx.html