【问题标题】:Cesium Rectangle Primitive With Material?铯矩形基元与材料?
【发布时间】:2017-12-22 23:24:36
【问题描述】:

我正在查看将材质图形应用于矩形的沙堡示例...

var viewer = new Cesium.Viewer('cesiumContainer');

var redRectangle = viewer.entities.add({
    name : 'Red translucent rectangle',
    rectangle : {
        coordinates : Cesium.Rectangle.fromDegrees(-110.0, 20.0, -80.0, 25.0),
        material : Cesium.Color.RED.withAlpha(0.5)
    }
});

有人可以提供如何使用原语 API 执行此操作的示例吗?

【问题讨论】:

    标签: cesium


    【解决方案1】:

    Sandcastle Materials Example 中对此进行了广泛的演示。这是一个仅限于一种材料的版本:

    var viewer = new Cesium.Viewer('cesiumContainer');
    var scene = viewer.scene;
    
    var rectangle = scene.primitives.add(new Cesium.Primitive({
        geometryInstances : new Cesium.GeometryInstance({
            geometry : new Cesium.RectangleGeometry({
                rectangle : Cesium.Rectangle.fromDegrees(-120.0, 20.0, -60.0, 40.0),
                vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT
            })
        }),
        appearance : new Cesium.EllipsoidSurfaceAppearance({
            aboveGround : false,
            material: Cesium.Material.fromType('Color')
        })
    }));
    
    // Default color is translucent red.
    // We change to translucent yellow here as an example:
    rectangle.appearance.material.uniforms.color = Cesium.Color.YELLOW.withAlpha(0.5);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-20
      • 1970-01-01
      • 2022-01-02
      • 2013-10-17
      • 2017-05-02
      相关资源
      最近更新 更多