cesium动态水面

原文:

https://blog.csdn.net/qq_31709249/article/details/81303291

使用图片

实现效果:

实现原理:

primitive面+水面材质

由此demo可以学习到一种动态材质的制作方法

uniform参数说明:

原文有许多冗余代码,去掉方便看到核心

//河道关键点数组
var River1Point =[
    115.5985634205044,32.43079913513041,
    116.5985634205044,32.43079913513041,
    116.5985634205044,33.43079913513041,
    115.5985634205044,33.43079913513041,

];
//河道1多边形
var polygon1 = new Cesium.PolygonGeometry({
    polygonHierarchy : new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray(River1Point)),
    extrudedHeight:0,
    height:0,
    vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT
});
var River1=new Cesium.Primitive({
    geometryInstances : new Cesium.GeometryInstance({
        geometry :polygon1
    }),
    appearance : new Cesium.EllipsoidSurfaceAppearance({
        aboveGround : true
    }),
    show : true
});
var  River1_Material =new Cesium.Material({
    fabric : {
        type : 'Water',
        uniforms : {
            normalMap:'./waterNormals.jpg',
            frequency: 100.0,
            animationSpeed: 0.01,
            amplitude: 10.0
        }
    }
});
var scene = viewer.scene;
River1.appearance.material = River1_Material;
scene.primitives.add(River1);           //添加到场景

viewer.camera.setView({
    destination: Cesium.Cartesian3.fromDegrees(  115.5985634205044,32.43079913513041, 300000)
});
发布了243 篇原创文章 · 获赞 36 · 访问量 14万+

猜你喜欢

转载自blog.csdn.net/A873054267/article/details/104037564
今日推荐