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

Cesium 自定义Material 系列 (四)

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

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

export interface PMaterialFlicker{

color?:any,

speed?:number,

}

对于轨迹图片我们叫 MaterialFlicker

```javascript

import { MaterialProperty } from "./MaterialProperty";

const defaultOption: PMaterialFlicker = {

color: Cesium.Color.AQUA,

speed: 20,

}

//闪烁效果

export class MaterialFlicker extends MaterialProperty {

protected _getType(option: any): string {

return "MaterialFlicker"

}

constructor(option=defaultOption) {

super(MaterialFlicker.prototype,defaultOption, option);

}

protected getSource(option: PMaterialFlicker): string {

return `uniform vec4 color;

uniform float speed;

czm_material czm_getMaterial(czm_materialInput materialInput)

{

czm_material material = czm_getDefaultMaterial(materialInput);

float time = fract( czm_frameNumber * speed / 1000.0);

vec2 st = materialInput.st;

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

相关文章

网友评论

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

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