UNPKG

@dspacev-bundle/vue-cesium

Version:
72 lines (69 loc) 2.09 kB
import '../../shaders/materials/index.mjs'; import VcLineFlowMaterial from '../../shaders/materials/VcLineFlowMaterial.mjs'; import VcCircleWaveMaterial from '../../shaders/materials/VcCircleWaveMaterial.mjs'; "use strict"; let isExtended = false; class MaterialExtend { static extend(viewer) { var _a; if (isExtended) { return; } const { Material, Color, Cartesian2 } = Cesium; const webgl2 = (_a = viewer.scene.context) == null ? void 0 : _a.webgl2; let shaderSourceTextVcLine = VcLineFlowMaterial; let shaderSourceTextVcCircle = VcCircleWaveMaterial; if (!webgl2) { shaderSourceTextVcLine = shaderSourceTextVcLine.replace(/texture\(/g, "texture2D("); shaderSourceTextVcCircle = shaderSourceTextVcCircle.replace(/texture\(/g, "texture2D("); } Material["VcCircleWave"] = "VcCircleWave"; Cesium.Material["_materialCache"].addMaterial(Material["VcCircleWave"], { fabric: { type: Material["VcCircleWave"], uniforms: { color: new Color(1, 0, 0, 1), time: 1, count: 1, gradient: 0.1 }, source: shaderSourceTextVcCircle }, translucent() { return true; } }); Material["VcLineFlow"] = "VcLineFlow"; Cesium.Material["_materialCache"].addMaterial(Material["VcLineFlow"], { fabric: { type: Material["VcLineFlow"], uniforms: { image: Material.DefaultImageId, color: new Color(1, 1, 1, 1), repeat: new Cartesian2(1, 1), axisY: false, mixt: false, speed: 10, time: -1, hasImage2: false, image2: Material.DefaultImageId, color2: new Color(1, 1, 1), globalAlpha: 1 }, source: shaderSourceTextVcLine }, translucent() { return true; } }); isExtended = true; } static revoke(viewer) { if (!isExtended) { return; } isExtended = false; } } export { MaterialExtend as default }; //# sourceMappingURL=MaterialExtend.mjs.map