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

Cesium 自定义Material 系列 (二十二)

作者: haibalai | 来源:发表于2022-02-24 08:46 被阅读0次

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

export interface PMaterialElasticCircle{

color?: any,

speed?: number,

}

对于弹性圆我们叫 MaterialElasticCircle

``javascript import { MaterialProperty } from "../MaterialProperty"; const defaultOption: PMaterialElasticCircle = { color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), speed: 5 } //弹性圆效果 export class MaterialElasticCircle extends MaterialProperty { protected _getType(option: any): string { return "MaterialElasticCircle" } constructor(option = defaultOption) { super(MaterialElasticCircle.prototype, defaultOption, option); } protected _getTranslucent(material: any) { return material.uniforms.color.alpha < 1.0; } protected getSource(option: any): string { return

uniform vec4 color;

uniform float speed;

float circle(vec2 uv, float r, float blur) {

float d = length(uv) * 2.0;

float c = smoothstep(r+blur, r, d);

return c;

}

czm_material czm_getMaterial(czm_materialInput materialInput)

{

czm_material material = czm_getDefaultMaterial(materialInput);

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

相关文章

网友评论

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

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