外观为 An appearance for
GeometryInstance 具有颜色属性的实例和 instances with color attributes and
PolylineGeometry or GroundPolylineGeometry。这允许使用相同的颜色绘制多个几何实例,每个实例具有不同的颜色 . This allows several geometry instances, each with a different color, to be drawn with the same Primitive.
| 名称 Name | 类型 Type | 说明 Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
可选 optional
具有以下属性的对象: Object with the following properties:
|
示例: 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
The
VertexFormat 这一切 that all PolylineColorAppearance 实例兼容。这仅需要一个 instances are compatible with. This requires only a position attribute.
When
true,几何形状预计将是封闭的,因此 , the geometry is expected to be closed so
PolylineColorAppearance#renderState 已启用背面剔除。这总是 has backface culling enabled. This is always false for PolylineColorAppearance.
-
默认值: Default Value:
false
片段着色器的 GLSL 源代码。 The GLSL source code for the fragment shader.
此属性是 This property is part of the
Appearance 接口,但不被使用 interface, but is not used by PolylineColorAppearance 因为使用了完全自定义的片段着色器。 since a fully custom fragment shader is used.
-
默认值: Default Value:
undefined
渲染几何体时使用的 WebGL 固定功能状态。 The WebGL fixed-function state to use when rendering the geometry.
构建时可以显式定义渲染状态 The render state can be explicitly defined when constructing a PolylineColorAppearance
实例,或者通过隐式设置 instance, or it is set implicitly via PolylineColorAppearance#translucent.
When
true,几何体预计会呈现半透明,因此 , the geometry is expected to appear translucent so
PolylineColorAppearance#renderState 启用了 alpha 混合。 has alpha blending enabled.
-
默认值: Default Value:
true
readonly vertexFormat : VertexFormat
The
VertexFormat 该外观实例与之兼容。几何体可以具有更多的顶点属性并且仍然兼容(但会带来潜在的性能成本),但不能有更少的属性。 that this appearance instance is compatible with. A geometry can have more vertex attributes and still be compatible - at a potential performance cost - but it can't have less.
-
默认值: Default Value:
PolylineColorAppearance.VERTEX_FORMAT
顶点着色器的 GLSL 源代码。 The GLSL source code for the vertex shader.
方法 Methods
按程序创建完整的 GLSL 片段着色器源。 Procedurally creates the full GLSL fragment shader source.
返回: Returns:
完整的 GLSL 片段着色器源代码。 The full GLSL fragment shader source.
创建渲染状态。这不是最终的渲染状态实例;相反,它可以包含与上下文中创建的渲染状态相同的渲染状态属性的子集。 Creates a render state. This is not the final render state instance; instead, it can contain a subset of render state properties identical to the render state created in the context.
返回: Returns:
渲染状态。 The render state.
确定几何体是否是半透明的 Determines if the geometry is translucent based on
PolylineColorAppearance#translucent.
返回: Returns:
true 如果外观是半透明的。 if the appearance is translucent.
