PolylineColorAppearance

new Cesium.PolylineColorAppearance(options)

具有颜色属性的 GeometryInstance 实例的外观,以及 PolylineGeometryGroundPolylineGeometry。 这允许多个几何体实例(每个实例具有不同的颜色)执行以下操作 使用相同的 Primitive 绘制。
Name Type Description
options object optional 对象,具有以下属性:
Name Type Default Description
translucent boolean true optional 如果为 true,则几何体应显示为半透明,因此 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:
render 状态。
根据 PolylineColorAppearance#translucent 确定几何体是否为半透明。
Returns:
如果外观为半透明,则为 true
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.