旋转效果+数字沙盘
旋转
旋转采用的方法是实时改变相机视角,相机视角计算方法采用
var heading = Cesium.Math.toRadians(delTime * angle) + initialHeading;
var pitch = Cesium.Math.toRadians(-30);
var angle = 360 / 60;
设置视角方法
viewer.scene.camera.setView({
destination :position, // 点的坐标
orientation:{
heading: heading,
pitch : pitch,
}
});
viewer.scene.camera.moveBackward(distance);
数字沙盘
沙盘采用墙体绘制即可,首先绘制出模型轮廓面(geojson),如果建模时通过kml指定了模型范围的话也可以直接解析kml文件得到轮廓面。
Wall = viewer.entities.add({
name: "mywall",
wall: {
positions: Cesium.Cartesian3.fromDegreesArrayHeights(positions),
minimumHeights: wallmins,
material: getColorRamp([0.0, 0.05, 0.12, 0.3, 0.5, 0.85, 1.0],true),
},
});
流转土地效果
该效果主要使用了动态墙体纹理与ClassificationPrimitive类
viewer.scene.primitives.add(
new Cesium.ClassificationPrimitive({
geometryInstances:instances,
releaseGeometryInstances:false,
asynchronous:false,
classificationType: Cesium.ClassificationType.CESIUM_3D_TILE,
})
);
农房效果
同理,使用了ClassificationPrimitive类
道路特效
运用了cesium 的 viewer.scene.postProcessStages.bloom
bloom = viewer.scene.postProcessStages.bloom;
bloom.enabled = true;
流动线采用了自定义shader实现的动态纹理
"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\
}"