美文网首页开源
Cesium之淹没分析

Cesium之淹没分析

作者: 魏无献 | 来源:发表于2020-03-24 16:35 被阅读0次

淹没分析原理: 设置一个定时器去 拉升一个面 的高度

核心代码:

startFx() {

            viewer.scene.globe.depthTestAgainstTerrain = true;   //开启深度测试,否则无效

            var waterHeight = 0;

            var entity = viewer.entities.add({

                name: '多边形',

                polygon: {

                    hierarchy: this.FloodPositions,           //范围坐标(Cartesian3类型数组)

                    material: Cesium.Color.RED.withAlpha(0.5)

                }

            });

            entity.polygon.extrudedHeight = new Cesium.CallbackProperty(function (time) {

                return waterHeight;

            }, false);

            var timer = setInterval(() => {

                waterHeight+=2

                if(waterHeight>=1000){      

                    //当水的高度大于或等于最大指定的高度时,清除定时器

                    clearInterval(timer);

                }

            },100);

        }

相关文章

网友评论

    本文标题:Cesium之淹没分析

    本文链接:https://www.haomeiwen.com/subject/qoaoyhtx.html