橢球體表面的幾何圖形外觀,如
new EllipsoidSurfaceAppearance(options)
PolygonGeometry
和RectangleGeometry
,支持所有材料,如MaterialAppearance
和MaterialAppearance.MaterialSupport.ALL
。但是,這種外觀需要較少的頂點(diǎn)屬性,因為片段著色程序可以計算normal
、tangent
和bitangent
。
Parameters:
options
(Object)
Name | Description |
---|---|
options.flat
Boolean
default false
|
當(dāng)true 時,片段著色中使用平面著色,這意味著不考慮照明。
|
options.faceForward
Boolean
default options.aboveGround
|
當(dāng)true 時,片段明暗器會根據(jù)需要翻轉(zhuǎn)曲面法線,以確保法線面向查看器以避免出現(xiàn)黑點(diǎn)。當(dāng)幾何圖形的兩邊都應(yīng)該像WallGeometry 那樣加陰影時,這很有用。
|
options.translucent
Boolean
default true
|
當(dāng)true 時,幾何體將顯示為半透明,因此EllipsoidSurfaceAppearance#renderState 啟用了alpha混合。
|
options.aboveGround
Boolean
default false
|
當(dāng)true 時,幾何體應(yīng)位于橢球體的表面上,而不是其上方的恒定高度,因此EllipsoidSurfaceAppearance#renderState 啟用背面剔除。
|
options.material
Material
default Material.ColorType
|
用于確定片段顏色的材質(zhì)。 |
options.vertexShaderSource
String
|
可選的glsl頂點(diǎn)明暗器源覆蓋默認(rèn)的頂點(diǎn)明暗器。 |
options.fragmentShaderSource
String
|
可選的glsl fragment shader source覆蓋默認(rèn)的fragment shader。 |
options.renderState
RenderState
|
可選的渲染狀態(tài)以覆蓋默認(rèn)的渲染狀態(tài)。 |
Example
var primitive = new bmgl.Primitive({
geometryInstances : new bmgl.GeometryInstance({
geometry : new bmgl.PolygonGeometry({
vertexFormat : bmgl.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
// ...
})
}),
appearance : new bmgl.EllipsoidSurfaceAppearance({
material : bmgl.Material.fromType('Stripe')
})
});
Members
(static, constant) VERTEX_FORMAT : VertexFormat
(readonly) aboveGround : Boolean
當(dāng)
true
時,幾何體應(yīng)位于橢球體的表面上,而不是其上方的恒定高度,因此EllipsoidSurfaceAppearance#renderState
啟用背面剔除。
-
Default Value:
false
(readonly) closed : Boolean
當(dāng)
true
時,幾何圖形將關(guān)閉,因此EllipsoidSurfaceAppearance#renderState
啟用背面剔除。如果查看器進(jìn)入幾何圖形,它將不可見。
-
Default Value:
false
(readonly) faceForward : Boolean
當(dāng)
true
時,片段明暗器會根據(jù)需要翻轉(zhuǎn)曲面法線,以確保法線面向查看器以避免出現(xiàn)黑點(diǎn)。當(dāng)幾何圖形的兩邊都應(yīng)該像WallGeometry
那樣加陰影時,這很有用。
-
Default Value:
true
(readonly) flat : Boolean
當(dāng)
true
時,片段著色中使用平面著色,這意味著不考慮照明。
-
Default Value:
false
(readonly) fragmentShaderSource : String
片段明暗器的glsl源代碼。完整片段明暗器源按程序構(gòu)建,考慮到
EllipsoidSurfaceAppearance#material
、EllipsoidSurfaceAppearance#flat
和EllipsoidSurfaceAppearance#faceForward
。使用EllipsoidSurfaceAppearance#getFragmentShaderSource
獲取完整源。
material : Material
用于確定片段顏色的材質(zhì)。與其他
EllipsoidSurfaceAppearance
屬性不同,這不是只讀的,因此外觀的材質(zhì)可以隨時更改。
-
Default Value:
Material.ColorType
(readonly) renderState : Object
呈現(xiàn)幾何圖形時要使用的WebGL固定函數(shù)狀態(tài)。
在構(gòu)造EllipsoidSurfaceAppearance
實(shí)例時,可以顯式定義呈現(xiàn)狀態(tài),也可以通過EllipsoidSurfaceAppearance#translucent
和EllipsoidSurfaceAppearance#aboveGround
隱式設(shè)置呈現(xiàn)狀態(tài)。
translucent : Boolean
當(dāng)
true
時,幾何體將顯示為半透明。
-
Default Value:
true
(readonly) vertexFormat : VertexFormat
此外觀實(shí)例與之兼容的
VertexFormat
。幾何體可以有更多的頂點(diǎn)屬性,并且仍然是兼容的(以潛在的性能代價),但是它不能有更少的頂點(diǎn)屬性。
-
Default Value:
EllipsoidSurfaceAppearance.VERTEX_FORMAT
(readonly) vertexShaderSource : String
頂點(diǎn)明暗器的glsl源代碼。
Methods
getFragmentShaderSource() → {String}
程序創(chuàng)建完整的glsl片段明暗器源。對于
EllipsoidSurfaceAppearance
,這是從EllipsoidSurfaceAppearance#fragmentShaderSource
、EllipsoidSurfaceAppearance#flat
和EllipsoidSurfaceAppearance#faceForward
導(dǎo)出的。
創(chuàng)建渲染狀態(tài)。這不是最終的渲染狀態(tài)實(shí)例;相反,它可以包含與上下文中創(chuàng)建的渲染狀態(tài)相同的渲染狀態(tài)屬性的子集。
確定幾何圖形是否基于
EllipsoidSurfaceAppearance#translucent
和Material#isTranslucent
半透明。