var viewer = new Cesium.Viewer('cesiumContainer');
var waterPrimitive = new Cesium.Primitive({
//show:false,// 默认隐藏
allowPicking:false,
geometryInstances : new Cesium.GeometryInstance({
geometry : new Cesium.PolygonGeometry({
polygonHierarchy : new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(waterFace)),//waterFace是一个组成多边形顶点数组[lon,lat,alt]
//extrudedHeight: 0,//注释掉此属性可以只显示水面
perPositionHeight : true//注释掉此属性水面就贴地了
})
}),
// 可以设置内置的水面shader
appearance : new Cesium.EllipsoidSurfaceAppearance({
material : new Cesium.Material({
fabric : {
type : 'Water',
uniforms : {
//baseWaterColor:new Cesium.Color(0.0, 0.0, 1.0, 0.5),
//blendColor: new Cesium.Color(0.0, 0.0, 1.0, 0.5),
//specularMap: 'gray.jpg',
normalMap: 'waterNormals.jpg',
frequency: 1000.0,
animationSpeed: 0.01,
amplitude: 10.0
}
}
}),
fragmentShaderSource:'varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\
gl_FragColor.a=0.5;\n#endif\n}\n'//重写shader,修改水面的透明度
})
});
water=viewer.scene.primitives.add(waterPrimitive);

Cesium添加水面的更多相关文章

  1. cesium添加多个geojson文件并分别控制显示和隐藏

    /*获取geojson数据*/ function get_geojson(name,h,n){ let x=document.getElementById(n); if(x.className === ...

  2. Cesium源码剖析---Post Processing之物体描边(Silhouette)

    Cesium在1.46版本中新增了对整个场景的后期处理(Post Processing)功能,包括模型描边.黑白图.明亮度调整.夜视效果.环境光遮蔽等.对于这么炫酷的功能,我们绝不犹豫,先去翻一翻它的 ...

  3. Unity3D ——强大的跨平台3D游戏开发工具(三)

    第四章 为地形添加水源.水流以及水下的模糊效果 制作好了地形的各种效果,接下来我们给场景添加一些水效果,使场景更加丰富. 第一步:添加水面 由于我在上一次的地形创作中就已经在山峰之间制作了一块洼地,它 ...

  4. cesium3dtiles位置改变

    cesium偏移3dtiles高度var heightOffset = 20.0; var boundingSphere = tileset.boundingSphere; var cartograp ...

  5. Unity 黑暗之光 笔记 第一章

    第一章 设计游戏开始进入场景 1.设置相机视野同步 选中要调整的相机 GameObject - Align With View(快捷键 Ctrl + Shift + F)

  6. CesiumJS新增官方TypeScript类型定义

    Cesium中文网:http://cesiumcn.org/ | 国内快速访问:http://cesium.coinidea.com/ 在当前的1.70版本中,CesiumJS现在附带了正式的Type ...

  7. cesium编程入门(六)添加 3D Tiles,并调整位置,贴地

    添加 3D Tiles,并调整位置 3D Tiles 是什么 3DTiles数据集是cesium小组AnalyticlGraphics与2016年3月定义的一种数据集,3DTiles数据集以分块.分级 ...

  8. Cesium 中两种添加 model 方法的区别

    概述 Cesium 中包含两种添加 model 的方法,分别为: 通过 viewer.entities.add() 函数添加 通过 viewer.scene.primitives.add() 函数添加 ...

  9. cesium编程中级(一)添加示例到Sandcastle

    cesium编程中级(一)添加示例到Sandcastle 添加示例到Sandcastle在cesium编程入门(七)3D Tiles,模型旋转中提到过,这里是一份完整的说明 创建例子 开启node服务 ...

随机推荐

  1. git远程库与本地联系报错fatal: Not a git repository (or any of the parent directories): .git

    在github上新建了一个仓库,然后相与本地的仓库联系起来 $ git remote add origin https://github.com/liona329/learngit.git fatal ...

  2. FaceAlignment blog

    https://blog.csdn.net/app_12062011/article/category/7574425 https://www.jianshu.com/p/e4b9317a817f

  3. android 拍照声音文件路径

    Android拍照音频文件位于\frameworks\base\data\sounds\effects目录,更具不同的平台区分不同音频文件. 例如拍照声音文件位于\frameworks\base\da ...

  4. tpshop全局公共方法

    TPshop 全局公告函数库 前后台可用  这里只列出有哪些方法, 简单描述, 具体的函数体查看 Application\Common\Common\function.php 文件 <?php ...

  5. Python bytes decode() 方法

    描述 bytes decode() 方法以指定的编码格式解码 bytes 对象,默认编码为 'utf-8'. 对应的编码方法:encode() 方法 . 语法 Python bytes decode( ...

  6. 获取Java正在执行的方法

    new Object(){}.getClass().getEnclosingMethod().getName(); Thread.currentThread().getStackTrace()

  7. zabbix 服务器设置邮件报警

    实验条件: Zabbix监控服务器.客户端都已经部署完成,被监控主机已添加完成,Zabbix监控运行正常. 实现目的: Zabbix监控服务器设置邮件报警,当被监控主机宕机或达到触发器预设值进,会自动 ...

  8. ASM - ByteCode插件下载、安装以及相关遇到的问题

    http://asm.ow2.org/eclipse/index.html http://download.forge.objectweb.org/eclipse-update/ http://for ...

  9. spring中基于aop使用ehcache

    我就是对着这个博客看的 http://www.cnblogs.com/ctxsdhy/p/6421016.html

  10. Win7-64位安装TensorFlow-GPU

    1.查看电脑显卡 路径:计算机--属性--设备管理器-显示适配器 2.显卡(GPU)是否支持CUDN https://developer.nvidia.com/cuda-gpus 3.安装 1)CUD ...