const Cesium = window.Cesium;
class ShuttleLineMaterialProperty {
constructor(duration, image) {
this._definitionChanged = new Cesium.Event();
this.duration = duration;
this.image = image;
this._time = performance.now();
}
get isConstant() {
return false;
}
get definitionChanged() {
return this._definitionChanged;
}
getType() {
return Cesium.Material.ShuttleLineType;
}
getValue(time, result) {
if (!Cesium.defined(result)) {
result = {};
}
result.image = this.image;
result.time =
((performance.now() - this._time) % this.duration) / this.duration;
return result;
}
equals(other) {
return (
this === other ||
(other instanceof ShuttleLineMaterialProperty &&
this.duration === other.duration)
);
}
}
Object.defineProperties(ShuttleLineMaterialProperty.prototype, {
color: Cesium.createPropertyDescriptor("color"),
duration: Cesium.createPropertyDescriptor("duration"),
});
Cesium.ShuttleLineMaterialProperty = ShuttleLineMaterialProperty;
Cesium.Material.ShuttleLineType = "ShuttleLine";
Cesium.Material.ShuttleLineSource = `
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
vec4 colorImage = texture2D(image, vec2(fract(st.s - time), st.t));
material.alpha = colorImage.a;
material.diffuse = colorImage.rgb * 1.5 ;
return material;
}
`;
Cesium.Material._materialCache.addMaterial(Cesium.Material.ShuttleLineType, {
fabric: {
type: Cesium.Material.ShuttleLineType,
uniforms: {
color: new Cesium.Color(1, 0, 0, 0.5),
image: "",
transparent: true,
time: 20,
},
source: Cesium.Material.ShuttleLineSource,
},
translucent: function () {
return true;
},
});
基于Cesium+VUE实现的流光道路效果,完整demo和源代码,代码未加密/未压缩,可直接调用运行
版权申诉
5星 · 超过95%的资源 105 浏览量
2022-06-13
21:17:05
上传
评论 3
收藏 454KB ZIP 举报
总要学点什么
- 粉丝: 842
- 资源: 29
最新资源
- 20240420-扬州高中小学部风雨操场转换层条件图r.dwg
- 小猫咪邮件在线发送系统源码v1.1,支持添加附件
- 永磁电机铜耗估算表-Excel-v1.0
- 参考资料-人工智能对劳动力市场的影响机制研究.pdf
- 协同供应链集成产品介绍V71sp1.rar
- 上市公司-人工智能的采纳程度面板数据(2003-2021年).xlsx
- 参考资料-人工智能技术应用对就业的影响及作用机制研究-来自制造业企业的微观证据.pdf
- 第5章spring-mvc请求映射处理
- 2023-04-06-项目笔记 - 第一百十六阶段 - 4.4.2.114全局变量的作用域-114 -2024.04.27
- 协同供应链集成产品介绍V70.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
- 4
- 5
- 6
前往页