国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

分享:Cesium添加水面效果

2022-11-03 17:32 作者:地理信息技術(shù)雜談  | 我要投稿

Cesium中內(nèi)置了水面效果的shader,通過添加圖元(Primitive),能夠在Cesium的地圖上實現(xiàn)水面流動的效果,借助互聯(lián)網(wǎng)上搜索、并進(jìn)行了修改。

效果實現(xiàn)

下載了一塊水系的geojson數(shù)據(jù),因為按照代碼,需要根據(jù)polygon的坐標(biāo)進(jìn)行勾畫。關(guān)鍵實現(xiàn)代碼:

//_polygonArr?為polygon的坐標(biāo)

? ? ? ? ?let?waterPrimitive?=?new?Cesium.Primitive({

????????????????allowPicking:?false,

????????????????geometryInstances:?new?Cesium.GeometryInstance({

????????????????????geometry:?new?Cesium.PolygonGeometry({

????????????????????????polygonHierarchy:?new?Cesium.PolygonHierarchy(Cesium.Cartesian3

????????????????????????????.fromDegreesArrayHeights(_polygonArr)),

????????????????????????vertexFormat:?Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,

????????????????????})

????????????????}),

????????????????// 使用內(nèi)置的水面shader

????????????????appearance:?new?Cesium.EllipsoidSurfaceAppearance({

????????????????????aboveGround:?true,

????????????????????material:?new?Cesium.Material({

????????????????????????fabric:?{

????????????????????????????type:?'Water',

????????????????????????????uniforms:?{?

????????????????????????????????blendColor:?new?Cesium.Color(0.0,?0.0,?1.0,?0.3),?

? ? ? ? ?? ? ? ? ? ? ? ? ? ? ? ?//設(shè)置水面使用的圖片,

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //此圖片在Cesium源碼Source\Assets\Textures文件夾中

????????????????????????????????normalMap:?'images/waterNormalsSmall.jpg',

?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?//頻率速度設(shè)置

????????????????????????????????frequency:?200.0,

????????????????????????????????animationSpeed:?0.01,

????????????????????????????????amplitude:?10.0

????????????????????????????}

????????????????????????}

????????????????????})

?? ? ? ? ? ??//frameShader代碼也可以根據(jù)需要進(jìn)行修改

????????????????????//?????????????????????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,修改水面的透明度

????????????????})

????????????});

//添加水面數(shù)據(jù)到viewer中

??viewer.scene.primitives.add(waterPrimitive);

效果圖:


分享:Cesium添加水面效果的評論 (共 條)

分享到微博請遵守國家法律
丽江市| 百色市| 福安市| 岳阳市| 武山县| 满城县| 克拉玛依市| 平遥县| 荥阳市| 松潘县| 阳信县| 云安县| 章丘市| 喀什市| 田林县| 梅河口市| 原平市| 钦州市| 桦川县| 甘泉县| 云梦县| 栖霞市| 应城市| 石柱| 赣州市| 那曲县| 洪洞县| 昭平县| 兴化市| 武胜县| 祥云县| 乌什县| 广西| 当雄县| 乐亭县| 徐闻县| 正定县| 苗栗县| 桃江县| 辽阳市| 集贤县|