You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WallImageTrailMaterialProperty.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * @Author: Caven
  3. * @Date: 2021-02-27 23:53:08
  4. */
  5. import { Cesium } from '@dc-modules/namespace'
  6. import MaterialProperty from '../../MaterialProperty'
  7. class WallImageTrailMaterialProperty extends MaterialProperty {
  8. constructor(options = {}) {
  9. super(options)
  10. this._image = undefined
  11. this._imageSubscription = undefined
  12. this._repeat = undefined
  13. this._repeatSubscription = undefined
  14. this.image = options.image
  15. this.repeat = new Cesium.Cartesian2(
  16. options.repeat?.x || 1,
  17. options.repeat?.y || 1
  18. )
  19. }
  20. getType(time) {
  21. return Cesium.Material.WallImageTrailType
  22. }
  23. getValue(time, result) {
  24. result = Cesium.defaultValue(result, {})
  25. result.color = Cesium.Property.getValueOrUndefined(this._color, time)
  26. result.image = Cesium.Property.getValueOrUndefined(this._image, time)
  27. result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time)
  28. result.speed = this._speed
  29. return result
  30. }
  31. equals(other) {
  32. return (
  33. this === other ||
  34. (other instanceof WallImageTrailMaterialProperty &&
  35. Cesium.Property.equals(this._color, other._color) &&
  36. Cesium.Property.equals(this._image, other._image) &&
  37. Cesium.Property.equals(this._repeat, other._repeat) &&
  38. Cesium.Property.equals(this._speed, other._speed))
  39. )
  40. }
  41. }
  42. Object.defineProperties(WallImageTrailMaterialProperty.prototype, {
  43. image: Cesium.createPropertyDescriptor('image'),
  44. color: Cesium.createPropertyDescriptor('color'),
  45. speed: Cesium.createPropertyDescriptor('speed'),
  46. repeat: Cesium.createPropertyDescriptor('repeat')
  47. })
  48. export default WallImageTrailMaterialProperty