当前位置:网站首页>Adding custom dynamic arts and Sciences to cesium
Adding custom dynamic arts and Sciences to cesium
2022-07-28 01:21:00 【Yue Yan Shao Falcon】
var viewer = new Cesium.Viewer('cesiumContainer',{});
var lat = 42.006;
var lon = 128.055;
viewer.scene.globe.depthTestAgainstTerrain = true;
// Cancel double click event
viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
// Set up homebutton The location of
Cesium.Camera.DEFAULT_VIEW_RECTANGLE =
Cesium.Rectangle.fromDegrees(lon - 1, lat - 1, lon + 1, lat + 1);//Rectangle(west, south, east, north)
/*
Custom flow texture lines
color Color
duration The duration of the millisecond
*/
function PolylineTrailLinkMaterialProperty(color, duration) {
this._definitionChanged = new Cesium.Event();
this._color = undefined;
this._colorSubscription = undefined;
this.color = color;
this.duration = duration;
this._time = (new Date()).getTime();
}
Cesium.defineProperties(PolylineTrailLinkMaterialProperty.prototype, {
isConstant: {
get: function () {
return false;
}
},
definitionChanged: {
get: function () {
return this._definitionChanged;
}
},
color: Cesium.createPropertyDescriptor('color')
});
PolylineTrailLinkMaterialProperty.prototype.getType = function (time) {
return 'PolylineTrailLink';
}
PolylineTrailLinkMaterialProperty.prototype.getValue = function (time, result) {
if (!Cesium.defined(result)) {
result = {};
}
result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.WHITE, result.color);
result.image = Cesium.Material.PolylineTrailLinkImage;
result.time = (((new Date()).getTime() - this._time) % this.duration) / this.duration;
return result;
}
PolylineTrailLinkMaterialProperty.prototype.equals = function (other) {
return this === other ||
(other instanceof PolylineTrailLinkMaterialProperty &&
Property.equals(this._color, other._color))
}
Cesium.PolylineTrailLinkMaterialProperty = PolylineTrailLinkMaterialProperty;
Cesium.Material.PolylineTrailLinkType = 'PolylineTrailLink';
Cesium.Material.PolylineTrailLinkImage = "../images/colors1.png";
Cesium.Material.PolylineTrailLinkSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n\
{\n\
czm_material material = czm_getDefaultMaterial(materialInput);\n\
vec2 st = materialInput.st;\n\
vec4 colorImage = texture2D(image, vec2(fract(st.s - time), st.t));\n\
material.alpha = colorImage.a * color.a;\n\
material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n\
return material;\n\
}";
Cesium.Material._materialCache.addMaterial(Cesium.Material.PolylineTrailLinkType, {
fabric: {
type: Cesium.Material.PolylineTrailLinkType,
uniforms: {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.5),
image: Cesium.Material.PolylineTrailLinkImage,
time: 0
},
source: Cesium.Material.PolylineTrailLinkSource
},
translucent: function (material) {
return true;
}
});
var greenWall = viewer.entities.add({
name : 'Green wall from surface with outline',
wall : {
positions : Cesium.Cartesian3.fromDegreesArrayHeights(
[-107.0, 43.0, 100000.0,
-97.0, 43.0, 100000.0,
-97.0, 40.0, 100000.0,
-107.0, 40.0, 100000.0,
-107.0, 43.0, 100000.0]),
material: new Cesium.PolylineTrailLinkMaterialProperty(Cesium.Color.GREEN, 3000), // The superposition of red and green becomes yellow .
outline : false
}
});
// Set the initial position
viewer.camera.setView(greenWall);
Details visible Custom arts and Sciences
边栏推荐
- Starfish Os打造的元宇宙生态,跟MetaBell的合作只是开始
- Uni app advanced style framework / production environment
- Knowledge of two-dimensional array
- Safety detection risk
- 浏览器视频帧操作方法 requestVideoFrameCallback() 简介
- JS global function method module exports exports
- 2022/07/27 学习笔记 (day17) 代码块和内部类
- 激光器芯片厂商陕西源杰半导体获广发证券、中信证券等8家投资机构入股
- Oracle error: ora-01722 invalid number
- Swoole Task任务使用
猜你喜欢
随机推荐
Shenzhen Huaqiang announced that it plans to invest no more than 20million yuan in BYD semiconductor
dataworks 传输数据到mysql 中文乱码是什么原因
数据库故障容错之系统时钟故障
浏览器视频帧操作方法 requestVideoFrameCallback() 简介
华为回应美国封锁供应链:他们仍需为5G专利付费
实现ABCD字母递增
诺基亚宣布与博通合作开发5G芯片
Use of swarm task task
Lua快速上手
From functional testing to automated testing, my monthly salary has exceeded 30k+, and I have 6 years of testing experience.
Code random notes_ Hash_ 1002 find common characters
C语言main函数传递参数
Go 语言变量
System clock failure of database fault tolerance
110. In depth introduction to sap ui5 fileuploader control - why do you need a hidden iframe
Un7.13: how to add, delete, modify and query in vs Code?
Realize ABCD letter increment
站在数字零售转型的十字路口,我们需要用新的角度来看待它
Retinanet网络结构详解
Anfulai embedded weekly report no. 275: 2022.07.18--2022.07.24









