new PolylineColorAppearance()
这允许使用同一个Primitive绘制多个几何体实例,每个实例都有不同的颜色。
| Name | Type | Default | Description |
|---|---|---|---|
options.translucent |
Boolean | true |
可选
为 true 时,几何体将呈现半透明效果,因此 |
options.vertexShaderSource |
String |
可选
可选的 GLSL 顶点着色器源,用于覆盖默认的顶点着色器。 |
|
options.fragmentShaderSource |
String |
可选
可选的 GLSL 片段着色器源,用于覆盖默认的片段着色器。 |
|
options.renderState |
RenderState |
可选
可选的呈现状态,用于覆盖默认呈现状态。 |
Example
// A solid white line segment
var primitive = new SuperMap3D.Primitive({
geometryInstances : new SuperMap3D.GeometryInstance({
geometry : new SuperMap3D.PolylineGeometry({
positions : SuperMap3D.Cartesian3.fromDegreesArray([
0.0, 0.0,
5.0, 0.0
]),
width : 10.0,
vertexFormat : SuperMap3D.PolylineColorAppearance.VERTEX_FORMAT
}),
attributes : {
color : SuperMap3D.ColorGeometryInstanceAttribute.fromColor(new SuperMap3D.Color(1.0, 1.0, 1.0, 1.0))
}
}),
appearance : new SuperMap3D.PolylineColorAppearance({
translucent : false
})
});
Members
-
(static, constant) VERTEX_FORMATVertexFormat
-
与所有
PolylineColorAppearance实例兼容的VertexFormat顶点格式。这只需要一个位置属性。 -
readonly closedBoolean
-
当为true时,几何体将被关闭
PolylineColorAppearance#renderState已启用背面剔除。- Default Value: false
readonly fragmentShaderSourceString
片段着色器的 GLSL 源代码。
materialMaterial
该属性是 Appearance 界面的一部分,但 PolylineColorAppearance 并未使用,因为使用的是完全自定义的片段着色器。
- Default Value: undefined
readonly renderStateObject
渲染几何体时使用的 WebGL 固定函数状态。
渲染状态可以在构建 PolylineColorAppearance 时显式定义,也可以通过 PolylineColorAppearance#translucent 隐式设置。
实例时显式定义,或通过 PolylineColorAppearance#translucent 隐式设置。
translucentBoolean
为 true 时,几何体将呈现半透明效果,因此 PolylineColorAppearance#renderState 将启用 alpha 混合。
- Default Value: true
readonly vertexFormatVertexFormat
这个外观实例兼容的VertexFormat。一个几何体可以有更多的顶点属性,但仍然是兼容的——以潜在的性能成本为代价——但不能少。
- Default Value:
PolylineColorAppearance.VERTEX_FORMATreadonly vertexShaderSourceString
顶点着色器的 GLSL 源代码。
Methods
-
getFragmentShaderSource(){String}
-
程序化创建完整的 GLSL 片段着色器源。
Returns:
Type Description String 完整的 GLSL 片段着色器源。 -
getRenderState(){Object}
-
创建一个呈现状态。这不是最终的呈现状态实例;相反,它可以包含与上下文中创建的呈现状态相同的呈现状态属性子集。
Returns:
Type Description Object 渲染状态。 -
isTranslucent(){Boolean}
-
根据
PolylineColorAppearance#translucent确定几何体是否半透明。Returns:
Type Description Boolean 如果外观是半透明的,则为 true。