帶有顏色屬性和
new PolylineColorAppearance(options)
PolylineGeometry
或GroundPolylineGeometry
的GeometryInstance
實例的外觀。這允許使用相同的Primitive
繪制多個幾何圖形實例,每個實例的顏色都不同。
Parameters:
options
(Object)
Name | Description |
---|---|
options.translucent
Boolean
default true
|
當true 時,幾何體將顯示為半透明,因此PolylineColorAppearance#renderState 啟用了alpha混合。
|
options.vertexShaderSource
String
|
可選的glsl頂點明暗器源覆蓋默認的頂點明暗器。 |
options.fragmentShaderSource
String
|
可選的glsl fragment shader source覆蓋默認的fragment shader。 |
options.renderState
RenderState
|
可選的渲染狀態以覆蓋默認的渲染狀態。 |
Example
// A solid white line segment
var primitive = new bmgl.Primitive({
geometryInstances : new bmgl.GeometryInstance({
geometry : new bmgl.PolylineGeometry({
positions : bmgl.Cartesian3.fromDegreesArray([
0.0, 0.0,
5.0, 0.0
]),
width : 10.0,
vertexFormat : bmgl.PolylineColorAppearance.VERTEX_FORMAT
}),
attributes : {
color : bmgl.ColorGeometryInstanceAttribute.fromColor(new bmgl.Color(1.0, 1.0, 1.0, 1.0))
}
}),
appearance : new bmgl.PolylineColorAppearance({
translucent : false
})
});
Members
(static, constant) VERTEX_FORMAT : VertexFormat
(readonly) closed : Boolean
-
Default Value:
false
(readonly) fragmentShaderSource : String
片段明暗器的glsl源代碼。
material : Material
此屬性是
Appearance
接口的一部分,但PolylineColorAppearance
不使用,因為使用了完全自定義的片段明暗器。
-
Default Value:
undefined
(readonly) renderState : Object
呈現幾何圖形時要使用的WebGL固定函數狀態。
在構造PolylineColorAppearance
實例時,可以顯式定義呈現狀態,或者通過PolylineColorAppearance#translucent
隱式設置呈現狀態。
translucent : Boolean
當
true
時,幾何體將顯示為半透明,因此PolylineColorAppearance#renderState
啟用了alpha混合。
-
Default Value:
true
(readonly) vertexFormat : VertexFormat
此外觀實例與之兼容的
VertexFormat
。幾何體可以有更多的頂點屬性,并且仍然是兼容的(以潛在的性能代價),但是它不能有更少的頂點屬性。
-
Default Value:
PolylineColorAppearance.VERTEX_FORMAT
(readonly) vertexShaderSource : String
頂點明暗器的glsl源代碼。
Methods
getFragmentShaderSource() → {String}
程序創建完整的glsl片段明暗器源。
創建渲染狀態。這不是最終的渲染狀態實例;相反,它可以包含與上下文中創建的渲染狀態相同的渲染狀態屬性的子集。
確定幾何圖形是否基于
PolylineColorAppearance#translucent
半透明。