@vtx/cs-map
Version:
React components for Vortex
86 lines (84 loc) • 4.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _cesium = require("cesium");
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var LineFlowMaterialProperty = exports["default"] = /*#__PURE__*/function () {
function LineFlowMaterialProperty(options) {
_classCallCheck(this, LineFlowMaterialProperty);
this._definitionChanged = new _cesium.Event();
this._color = undefined;
this._speed = undefined;
this._percent = undefined;
this._gradient = undefined;
this.color = options.color;
this.speed = options.speed;
this.percent = options.percent;
this.gradient = options.gradient;
}
return _createClass(LineFlowMaterialProperty, [{
key: "isConstant",
get: function get() {
return false;
}
}, {
key: "definitionChanged",
get: function get() {
return this._definitionChanged;
}
}, {
key: "getType",
value: function getType() {
return _cesium.Material.LineFlowMaterialType;
}
}, {
key: "getValue",
value: function getValue(time, result) {
if (!(0, _cesium.defined)(result)) {
result = {};
}
result.color = _cesium.Property.getValueOrDefault(this._color, time, _cesium.Color.RED, result.color);
result.speed = _cesium.Property.getValueOrDefault(this._speed, time, 5.0, result.speed);
result.percent = _cesium.Property.getValueOrDefault(this._percent, time, 0.1, result.percent);
result.gradient = _cesium.Property.getValueOrDefault(this._gradient, time, 0.01, result.gradient);
return result;
}
}, {
key: "equals",
value: function equals(other) {
return this === other || other instanceof LineFlowMaterialProperty && _cesium.Property.equals(this._color, other._color) && _cesium.Property.equals(this._speed, other._speed) && _cesium.Property.equals(this._percent, other._percent) && _cesium.Property.equals(this._gradient, other._gradient);
}
}]);
}();
Object.defineProperties(LineFlowMaterialProperty.prototype, {
color: (0, _cesium.createPropertyDescriptor)('color'),
speed: (0, _cesium.createPropertyDescriptor)('speed'),
percent: (0, _cesium.createPropertyDescriptor)('percent'),
gradient: (0, _cesium.createPropertyDescriptor)('gradient')
});
_cesium.Material.LineFlowMaterialProperty = 'LineFlowMaterialProperty';
_cesium.Material.LineFlowMaterialType = 'LineFlowMaterialType';
_cesium.Material.LineFlowMaterialSource = "\n uniform vec4 color;\n uniform float speed;\n uniform float percent;\n uniform float gradient;\n\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float t =fract(czm_frameNumber * speed / 1000.0);\n t *= (1.0 + percent);\n float alpha = smoothstep(t- percent, t, st.s) * step(-t, -st.s);\n alpha += gradient;\n material.diffuse = color.rgb;\n material.alpha = alpha;\n return material;\n }\n ";
_cesium.Material._materialCache.addMaterial(_cesium.Material.LineFlowMaterialType, {
fabric: {
type: _cesium.Material.LineFlowMaterialType,
uniforms: {
color: new _cesium.Color(1.0, 0.0, 0.0, 1.0),
speed: 10.0,
percent: 0.1,
gradient: 0.01
},
source: _cesium.Material.LineFlowMaterialSource
},
translucent: function translucent() {
return true;
}
});
//# sourceMappingURL=LineFlowMaterialProperty.js.map