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