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

  • 对于弹性圆效果 我们先定义一下他的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);
posted @ 2022-01-20 17:15  haibalai  阅读(82)  评论(0编辑  收藏  举报