"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _cesium = require("cesium");
/**
 *渐变光圈纹理
 * @param {}color 颜色
 * @param {}speed 速率
 * @param {}repeatNum 重复数量
 */
function CesiumGradualLightRingMaterialProperty(options) {
  this._definitionChanged = new _cesium.Event();
  this.color = options.color;
  this.speed = options.speed;
  this.repeatNum = options.repeatNum;
}
CesiumGradualLightRingMaterialProperty.prototype.getType = function () {
  return 'CesiumGradualLightRingMaterialProperty';
};
CesiumGradualLightRingMaterialProperty.prototype.getValue = function (time, result) {
  if (!(0, _cesium.defined)(result)) {
    result = {};
  }
  result.color = _cesium.Property.getValueOrClonedDefault(this.color, time, new _cesium.Color(0.23, 0.67, 0.9, 1.0), result.color);
  result.speed = _cesium.Property.getValueOrClonedDefault(this.speed, time, 1, result.speed);
  result.repeatNum = _cesium.Property.getValueOrClonedDefault(this.repeatNum, time, 5, result.repeatNum);
  return result;
};
CesiumGradualLightRingMaterialProperty.prototype.equals = function (other) {
  return this === other || other instanceof CesiumGradualLightRingMaterialProperty && _cesium.Property.equals(this.color, other.color) && _cesium.Property.equals(this.speed, other.speed) && _cesium.Property.equals(this.repeatNum, other.repeatNum);
};
Object.defineProperties(CesiumGradualLightRingMaterialProperty.prototype, {
  isConstant: {
    get: function get() {
      return false;
    }
  },
  definitionChanged: {
    get: function get() {
      return this._definitionChanged;
    }
  },
  color: (0, _cesium.createPropertyDescriptor)('color'),
  speed: (0, _cesium.createPropertyDescriptor)('speed'),
  repeatNum: (0, _cesium.createPropertyDescriptor)('repeatNum')
});
_cesium.Material.CesiumGradualLightRingMaterialPropertyType = 'CesiumGradualLightRingMaterialProperty';
_cesium.Material.CesiumGradualLightRingMaterialPropertyMaterialSource = "\nfloat iTime= czm_frameNumber/ 100.0;\nfloat pointy (float f) {\n    // return 0.2/(abs(f)+0.2);\n    return 0.01/(abs(f)+0.02);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n    czm_material material = czm_getDefaultMaterial(materialInput);\n    vec2 str = materialInput.st*1.0;\n    //----------------------------------------------------------\n    vec2 uv = str;\n    uv.y=fract(uv.y*repeatNum);\n    vec3 col001 = vec3(0.0);\n    float f001 =fract( abs(uv.y - (iTime*0.5*speed)));\n    col001 = vec3(pointy(f001));\n\n    // vec3 col= vec3(0.93, 0.97, 1) -  vec3(0.7, 0.3, 0.1);//\u989C\u82722\n    vec3 col= color.rgb;//\u989C\u82722\n    material.diffuse =  col*(1.0-str.y)*(1.0-str.y)*(1.0-str.y)*(1.0-str.y)+col001;\n    material.emission =  col+col001;\n    material.alpha = (1.0-str.y);\n    return material;\n    }";
_cesium.Material._materialCache.addMaterial(_cesium.Material.CesiumGradualLightRingMaterialPropertyType, {
  fabric: {
    type: _cesium.Material.CesiumGradualLightRingMaterialPropertyType,
    uniforms: {
      color: new _cesium.Color(0.23, 0.67, 0.9, 1.0),
      speed: 1,
      repeatNum: 5
    },
    source: _cesium.Material.CesiumGradualLightRingMaterialPropertyMaterialSource
  },
  translucent: function translucent() {
    return true;
  }
});
var _default = exports["default"] = CesiumGradualLightRingMaterialProperty;
//# sourceMappingURL=GradualLightRingMaterialProperty.js.map
