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.

WallLineTrailMaterialProperty.js 1.6KB

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