|
@@ -284,6 +284,14 @@ export default {
|
|
|
that.store.setCockpitTdsc(false);
|
|
|
},
|
|
|
colorFun(color) {
|
|
|
+
|
|
|
+
|
|
|
+ // * `czm_material czm_getMaterial(czm_materialInput materialInput) {...}`: 这是一个名为 `czm_getMaterial` 的函数,它接受一个 `czm_materialInput` 类型的参数并返回一个 `czm_material` 类型的对象。这是 Cesium 中的一个约定,允许你通过编写自定义的 GLSL 代码来定义材质。
|
|
|
+ // * `czm_material material = czm_getDefaultMaterial(materialInput);`: 获取默认的材质设置。
|
|
|
+ // * `vec2 st = materialInput.st;`: 从输入中获取纹理坐标(texture coordinates)。
|
|
|
+ // * `float dis = distance(st, vec2(0.5));`: 计算纹理坐标与中心 `(0.5, 0.5)` 的距离。
|
|
|
+ // * `material.diffuse = color.rgb;`: 设置材质的漫反射颜色为你提供的 `color` 的 RGB 部分。
|
|
|
+ // * `material.alpha = clamp(dis * 2.0, 0.1, 0.7);`: 根据与中心的距离设置材质的透明度(alpha)。使用 `clamp` 函数确保透明度值在 0.1 和 0.7 之间。
|
|
|
const fs = `czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
|
|
|
|
{
|
|
@@ -291,7 +299,7 @@ export default {
|
|
|
vec2 st = materialInput.st;
|
|
|
float dis = distance(st,vec2(0.5));
|
|
|
material.diffuse = color.rgb;
|
|
|
- material.alpha = clamp( dis * 2.0, 0.1, 0.5);
|
|
|
+ material.alpha = clamp( dis * 2.0, 0.1, 0.6);
|
|
|
return material;
|
|
|
}
|
|
|
`
|
|
@@ -357,50 +365,64 @@ export default {
|
|
|
zIndex: 2,
|
|
|
// 设置远近裁条件
|
|
|
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(20000, 9999999999.0),
|
|
|
- show: true
|
|
|
+ show: false
|
|
|
},
|
|
|
properties: obj,
|
|
|
- polygon: {
|
|
|
- zIndex: 1,
|
|
|
- hierarchy: {
|
|
|
- positions: Cesium.Cartesian3.fromDegreesArray(oneDArray),
|
|
|
- },
|
|
|
- // outline: false,
|
|
|
- material: Cesium.Color.fromCssColorString(that.xzqh_color),
|
|
|
- height: 100,
|
|
|
- extrudedHeight: res.properties.extrudedHeight,
|
|
|
- outline: true,
|
|
|
- // outlineColor : Cesium.Color.BLACK
|
|
|
- outlineColor: Cesium.Color.fromCssColorString('#55A1E3'),
|
|
|
- // 设置远近裁条件
|
|
|
- distanceDisplayCondition: new Cesium.DistanceDisplayCondition(20000, 9999999999.0),
|
|
|
- }
|
|
|
+ // polygon: {
|
|
|
+ // zIndex: 1,
|
|
|
+ // hierarchy: {
|
|
|
+ // positions: Cesium.Cartesian3.fromDegreesArray(oneDArray),
|
|
|
+ // },
|
|
|
+ // // outline: false,
|
|
|
+ // material: that.colorFun(Cesium.Color.fromCssColorString("rgba(254, 129, 6, 0.75)")),
|
|
|
+ // height: 100,
|
|
|
+ // extrudedHeight: res.properties.extrudedHeight,
|
|
|
+ // outline: true,
|
|
|
+ // // outlineColor : Cesium.Color.BLACK
|
|
|
+ // outlineColor: Cesium.Color.fromCssColorString('#55A1E3'),
|
|
|
+ // // 设置远近裁条件
|
|
|
+ // distanceDisplayCondition: new Cesium.DistanceDisplayCondition(20000, 9999999999.0),
|
|
|
+ // }
|
|
|
});
|
|
|
|
|
|
|
|
|
- // let polygon = new Cesium.GeometryInstance({
|
|
|
- // geometry: new Cesium.PolygonGeometry({
|
|
|
- // polygonHierarchy: new Cesium.PolygonHierarchy(
|
|
|
- // Cesium.Cartesian3.fromDegreesArray(oneDArray)
|
|
|
- // ),
|
|
|
- // height: 100,
|
|
|
- // extrudedHeight: res.properties.extrudedHeight,
|
|
|
-
|
|
|
- // })
|
|
|
- // })
|
|
|
-
|
|
|
- // let addPolygonGeometry = new Cesium.Primitive({
|
|
|
- // geometryInstances: polygon,
|
|
|
- // appearance: that.colorFun(Cesium.Color.fromCssColorString("rgba(254, 129, 6, 0.1)"))
|
|
|
+ let polygon = new Cesium.GeometryInstance({
|
|
|
+ geometry: new Cesium.PolygonGeometry({
|
|
|
+ polygonHierarchy: new Cesium.PolygonHierarchy(
|
|
|
+ Cesium.Cartesian3.fromDegreesArray(oneDArray)
|
|
|
+ ),
|
|
|
+ height: 100,
|
|
|
+ extrudedHeight: res.properties.extrudedHeight,
|
|
|
|
|
|
- // })
|
|
|
+ })
|
|
|
+ })
|
|
|
|
|
|
- // viewer.scene.primitives.add(addPolygonGeometry)
|
|
|
- })
|
|
|
+ let addPolygonGeometry = new Cesium.Primitive({
|
|
|
+ geometryInstances: polygon,
|
|
|
+ // appearance: that.colorFun(Cesium.Color.fromCssColorString(res.properties.color))
|
|
|
+ appearance: that.colorFun(Cesium.Color.fromCssColorString('#139FF0'))
|
|
|
|
|
|
+ })
|
|
|
|
|
|
+ viewer.scene.primitives.add(addPolygonGeometry)
|
|
|
|
|
|
+ console.log(res.properties.extrudedHeight, "res.properties.extrudedHeight");
|
|
|
|
|
|
+ var positions = Cesium.Cartesian3.fromDegreesArray(oneDArray);
|
|
|
+ viewer.entities.add({
|
|
|
+ name: "立体墙效果",
|
|
|
+ wall: {
|
|
|
+ positions: positions,
|
|
|
+ // 设置高度
|
|
|
+ maximumHeights: new Array(positions.length).fill(res.properties.extrudedHeight),
|
|
|
+ minimumHeights: new Array(positions.length).fill(0),
|
|
|
+ material: new Cesium.DynamicWallMaterialProperty({
|
|
|
+ color: Cesium.Color.fromBytes(0, 255, 255).withAlpha(0.7),
|
|
|
+ duration: 3000
|
|
|
+ }),
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
// init_xzqh() {
|