PolylineColorAppearance

new Cesium.PolylineColorAppearance(options)

一种用于带有颜色属性的 GeometryInstance 实例以及 PolylineGeometryGroundPolylineGeometry 的外观。 这样可以将多个具有不同颜色的几何体实例 使用同一个 Primitive 绘制。
Name Type Description
options object optional Object with the following properties:
Name Type Default Description
translucent boolean true optionaltrue 时,几何体预期呈现半透明效果,因此 PolylineColorAppearance#renderState 启用了 alpha 混合。
vertexShaderSource string optional 用于覆盖默认顶点着色器的可选 GLSL 顶点着色器源码。
fragmentShaderSource string optional 用于覆盖默认片元着色器的可选 GLSL 片元着色器源码。
renderState object optional 用于覆盖默认渲染状态的可选渲染状态。
Example:
// A solid white line segment
const primitive = new Cesium.Primitive({
  geometryInstances : new Cesium.GeometryInstance({
    geometry : new Cesium.PolylineGeometry({
      positions : Cesium.Cartesian3.fromDegreesArray([
        0.0, 0.0,
        5.0, 0.0
      ]),
      width : 10.0,
      vertexFormat : Cesium.PolylineColorAppearance.VERTEX_FORMAT
    }),
    attributes : {
      color : Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(1.0, 1.0, 1.0, 1.0))
    }
  }),
  appearance : new Cesium.PolylineColorAppearance({
    translucent : false
  })
});

Members

static constant Cesium.PolylineColorAppearance.VERTEX_FORMAT : VertexFormat

所有 PolylineColorAppearance 实例都兼容的 VertexFormat。 它仅需要一个 position 属性。
true 时,几何体预期是闭合的,因此 PolylineColorAppearance#renderState 启用了背面剔除。 对于 PolylineColorAppearance,此值始终为 false
Default Value: false

readonly fragmentShaderSource : string

片元着色器的 GLSL 源码。
此属性是 Appearance 接口的一部分,但由于使用了完全自定义的片元着色器, PolylineColorAppearance 并不会使用它。
Default Value: undefined
渲染几何体时要使用的 WebGL 固定功能状态。

渲染状态可以在构造 PolylineColorAppearance 实例时显式定义,也可以通过 PolylineColorAppearance#translucent 隐式设置。

true 时,几何体预期呈现半透明效果,因此 PolylineColorAppearance#renderState 启用了 alpha 混合。
Default Value: true
此外观实例所兼容的 VertexFormat。 几何体可以拥有更多的顶点属性且仍然兼容——代价是 潜在的性能开销——但不能拥有更少的顶点属性。
Default Value: PolylineColorAppearance.VERTEX_FORMAT

readonly vertexShaderSource : string

顶点着色器的 GLSL 源码。

Methods

getFragmentShaderSource()string

以过程化方式创建完整的 GLSL 片元着色器源码。
Returns:
完整的 GLSL 片元着色器源码。
创建一个渲染状态。这不是最终的渲染状态实例;相反, 它可以包含与上下文中创建的渲染状态 相同的一部分渲染状态属性。
Returns:
渲染状态。
根据 PolylineColorAppearance#translucent 确定几何体是否半透明。
Returns:
如果外观为半透明则返回 true
需要帮助?获取答案的最快方式是在 Cesium 论坛 上向社区和团队提问。