本文介绍了cesium 动态水面求职学习资料,有助于帮助完成毕业设计以及求职,是一篇很好的资料。
对技术面试,学习经验等有一些体会,在此分享。
项目中有时候为了突出地图上的河流水系,通常会画出轮廓然后再加上水系效果。水系效果简单可以通过设置水面材质(material)来实现,具体(代码)过程如下。
1、准备一张纹理图片
2、封装一个管理函数 addWaterAnimation
export function addWaterAnimation (coordinates, viewer) { const primitive = new Cesium.Primitive({ show: true, geometryInstances: new Cesium.GeometryInstance({ geometry: new Cesium.PolygonGeometry({ polygonHierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(coordinates)), vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT, extrudedHeight: 0, // 只显示水面 height: 0 }) }), appearance: new Cesium.EllipsoidSurfaceAppearance({ aboveGround: true, material: new Cesium.Material({ fabric: { type: 'Water', uniforms: { normalMap: water, // 图片 frequency: 100.0, animationSpeed: 0.01, amplitude: 10.0 } } }) }) }) viewer.scene.primitives.add(primitive) }
一个简单的水系效果就完成了,如果希望添加更多的效果,可以自定义shader,如:水透明化
“`javascript
export function addWaterAnimation (coordinates, viewer) {
const primitive = new Cesium.Primitive({
show: true,
geometryInstances: new Cesium.GeometryInstance({
geometry: new Cesium.PolygonGeometry({
polygonHierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(coordinates)),
vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
extrudedHeight: 0, // 只显示水面
height: 0
})
}),
appearance: new Cesium.EllipsoidSurfaceAppearance({
aboveGround: true,
material: new Cesium.Material({
fabric: {
type: ‘Water’,
uniforms: {
项目中有时候为了突出地图上的河流水系,通常会画出轮廓然后再加上水系效果。水系效果简单可以通过设置水面材质(material)来实现,具体(代码)过程如下。
1、准备一张纹理图片
2、封装一个管理函数 addWaterAnimation
export function addWaterAnimation (coordinates, viewer) { const primitive = new Cesium.Primitive({ show: true, geometryInstances: new Cesium.GeometryInstance({ geometry: new Cesium.PolygonGeometry({ polygonHierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(coordinates)), vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT, extrudedHeight: 0, // 只显示水面 height: 0 }) }), appearance: new Cesium.EllipsoidSurfaceAppearance({ aboveGround: true, material: new Cesium.Material({ fabric: { type: 'Water', uniforms: { normalMap: water, // 图片 frequency: 100.0, animationSpeed: 0.01, amplitude: 10.0 } } }) }) }) viewer.scene.primitives.add(primitive) }
一个简单的水系效果就完成了,如果希望添加更多的效果,可以自定义shader,如:水透明化
“`javascript
export function addWaterAnimation (coordinates, viewer) {
const primitive = new Cesium.Primitive({
show: true,
geometryInstances: new Cesium.GeometryInstance({
geometry: new Cesium.PolygonGeometry({
polygonHierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(coordinates)),
vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
extrudedHeight: 0, // 只显示水面
height: 0
})
}),
appearance: new Cesium.EllipsoidSurfaceAppearance({
aboveGround: true,
material: new Cesium.Material({
fabric: {
type: ‘Water’,
uniforms: {
项目中有时候为了突出地图上的河流水系,通常会画出轮廓然后再加上水系效果。水系效果简单可以通过设置水面材质(material)来实现,具体(代码)过程如下。
1、准备一张纹理图片
2、封装一个管理函数 addWaterAnimation
export function addWaterAnimation (coordinates, viewer) { const primitive = new Cesium.Primitive({ show: true, geometryInstances: new Cesium.GeometryInstance({ geometry: new Cesium.PolygonGeometry({ polygonHierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(coordinates)), vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT, extrudedHeight: 0, // 只显示水面 height: 0 }) }), appearance: new Cesium.EllipsoidSurfaceAppearance({ aboveGround: true, material: new Cesium.Material({ fabric: { type: 'Water', uniforms: { normalMap: water, // 图片 frequency: 100.0, animationSpeed: 0.01, amplitude: 10.0 } } }) }) }) viewer.scene.primitives.add(primitive) }
一个简单的水系效果就完成了,如果希望添加更多的效果,可以自定义shader,如:水透明化
“`javascript
export function addWaterAnimation (coordinates, viewer) {
const primitive = new Cesium.Primitive({
show: true,
geometryInstances: new Cesium.GeometryInstance({
geometry: new Cesium.PolygonGeometry({
polygonHierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(coordinates)),
vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
extrudedHeight: 0, // 只显示水面
height: 0
})
}),
appearance: new Cesium.EllipsoidSurfaceAppearance({
aboveGround: true,
material: new Cesium.Material({
fabric: {
type: ‘Water’,
uniforms: {
部分转自互联网,侵权删除联系
最新评论