Scene
中的封閉幾何體。基本體將幾何體實例與描述完整著色的Appearance
結合起來,包括Material
和RenderState
。大致上,幾何體實例定義結構和位置,外觀定義視覺特征。分離幾何體和外觀允許我們混合和匹配大多數幾何體和外觀,并獨立地添加新的幾何體或外觀。當直接使用ClassificationPrimitive時,此時只支持在所有實例中使用相同顏色的PerInstanceColorAppearance
。對地形或3D瓦片進行分類時,要獲得充分的Appearance
支持,請使用GroundPrimitive
代替。
要正確渲染,此功能需要ext{frag{depth webgl擴展。對于不支持此擴展的硬件,將存在一些視角的渲染工件。
有效幾何圖形為BoxGeometry
、CylinderGeometry
、EllipsoidGeometry
、PolylineVolumeGeometry
和SphereGeometry
。
橢球表面后的幾何圖形,例如CircleGeometry
、CorridorGeometry
、EllipseGeometry
、PolygonGeometry
和RectangleGeometry
,如果是拉伸體積,也有效;否則,將不會渲染它們。
Parameters:
(Object)
Name | Description |
---|---|
options.geometryInstances
(Array | GeometryInstance)
|
要渲染的幾何體實例。這可以是單個實例,也可以是長度為1的數組。 |
options.appearance
Appearance
|
用于呈現原語的外觀。當幾何實例具有顏色屬性時,默認為PerInstanceColorAppearance。 |
options.show
Boolean
default true
|
確定是否顯示此基元。 |
options.vertexCacheOptimize
Boolean
default false
|
當true 時,幾何體頂點將針對頂點前和頂點后明暗器緩存進行優化。
|
options.interleave
Boolean
default false
|
當true 時,幾何頂點屬性交錯,這可以稍微提高渲染性能,但增加加載時間。
|
options.compressVertices
Boolean
default true
|
當true 時,幾何體頂點被壓縮,這將節省內存。
|
options.releaseGeometryInstances
Boolean
default true
|
當true 時,原語不保留對輸入geometryInstances 的引用以保存內存。
|
options.allowPicking
Boolean
default true
|
當true 時,每個幾何體實例只能使用Scene#pick 進行選擇。當false 時,保存GPU內存。
|
options.asynchronous
Boolean
default true
|
確定在準備就緒之前是異步創建基元還是阻止創建基元。如果為false,則必須首先調用initiaterrainheights()。 |
options.classificationType
ClassificationType
default ClassificationType.BOTH
|
確定地形、三維瓦片還是兩者都要分類。 |
options.debugShowBoundingVolume
Boolean
default false
|
僅用于調試。確定是否顯示此基元的命令的邊界球。 |
options.debugShowShadowVolume
Boolean
default false
|
僅用于調試。確定是否繪制基本體中每個幾何體的陰影體積。在釋放幾何圖形或選項之前,要創建的卷在創建時必須為true 。ReleaseGeometryInstance必須為false 。
|
Members
(readonly) allowPicking : Boolean
-
Default Value:
true
(readonly) asynchronous : Boolean
-
Default Value:
true
classificationType : ClassificationType
-
Default Value:
ClassificationType.BOTH
(readonly) compressVertices : Boolean
true
時,幾何體頂點被壓縮,這將節省內存。
-
Default Value:
true
debugShowBoundingVolume : Boolean
為基本體中的每個draw命令繪制邊界球體。
-
Default Value:
false
debugShowShadowVolume : Boolean
為基本體中的每個幾何體繪制陰影體積。
-
Default Value:
false
(readonly) geometryInstances : (Array|GeometryInstance)
options.releaseGeometryInstances
是true
,則可能是undefined
。在呈現基元后更改此屬性沒有效果。
由于使用的渲染技術,所有幾何體實例必須是相同的顏色。如果存在顏色不同的實例,則在第一次嘗試呈現時將拋出DeveloperError
。
-
Default Value:
undefined
(readonly) interleave : Boolean
-
Default Value:
false
(readonly) ready : Boolean
ClassificationPrimitive#update
時將呈現原語。
(readonly) readyPromise : Promise.<ClassificationPrimitive>
(readonly) releaseGeometryInstances : Boolean
true
時,原語不保留對輸入geometryInstances
的引用以保存內存。
-
Default Value:
true
show : Boolean
-
Default Value:
true
(readonly) vertexCacheOptimize : Boolean
true
時,幾何體頂點將針對頂點前和頂點后明暗器緩存進行優化。
-
Default Value:
true
Methods
(static) isSupported(scene) → {Boolean}Parameters:
一旦對象被破壞,就不應使用它;調用除isDestroyed
以外的任何函數都將導致DeveloperError
異常。因此,將返回值(undefined
)賦給對象,如示例中所述。
Throws
-
DeveloperError : 此對象已被銷毀,即調用destroy()。
GeometryInstance
的每個實例可修改屬性。
Parameters:
Example
var attributes = primitive.getGeometryInstanceAttributes('an id');
attributes.color = bmgl.ColorGeometryInstanceAttribute.toValue(bmgl.Color.AQUA);
attributes.show = bmgl.ShowGeometryInstanceAttribute.toValue(true);
Throws
-
DeveloperError : 必須在調用GetGeometryInstanceAttributes之前調用Update。
如果此對象被破壞,則不應使用它;調用除isDestroyed
以外的任何函數都將導致DeveloperError
異常。
Throws
-
DeveloperError : 所有實例幾何必須具有相同的PrimitiveType。
-
DeveloperError : 外觀和材料有一個統一的名稱。
-
DeveloperError : 并非所有幾何體實例都具有相同的顏色屬性。