Scene 中用于高亮显示的、包围几何的体积。
图元将几何实例与描述完整着色的 Appearance 结合在一起,包括
Material 和 RenderState。粗略地说,几何实例定义了结构和位置,
而外观定义了视觉特征。将几何和外观解耦使我们能够混合搭配其中的大部分,并相互独立地添加新的几何或外观。
目前,在使用 ClassificationPrimitive 时,仅支持所有实例颜色相同的 PerInstanceColorAppearance。
若要在对地形或 3D Tiles 进行分类时获得完整的 Appearance 支持,请改用 GroundPrimitive。
为了正确渲染,此功能需要 EXT_frag_depth WebGL 扩展。对于不支持此扩展的硬件,在某些视角下会出现渲染伪影。
有效的几何体包括 BoxGeometry、CylinderGeometry、EllipsoidGeometry、PolylineVolumeGeometry 和 SphereGeometry。
遵循椭球体表面的几何体,例如 CircleGeometry、CorridorGeometry、EllipseGeometry、PolygonGeometry 和 RectangleGeometry,
如果是拉伸体积,则同样有效;否则将不会被渲染。
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
包含以下属性的对象:
|
Members
-
Default Value:
true
-
Default Value:
true
classificationType : ClassificationType
-
Default Value:
ClassificationType.BOTH
true 时,几何顶点会被压缩,从而节省内存。
-
Default Value:
true
绘制图元中每个绘制命令的包围球。
-
Default Value:
false
绘制图元中每个几何的阴影体。
-
Default Value:
false
readonly geometryInstances : Array|GeometryInstance
options.releaseGeometryInstances
为 true,则可能为 undefined。
在图元渲染后更改此属性无效。
由于所使用的渲染技术,所有几何实例必须具有相同的颜色。
如果存在颜色不同的实例,则在首次尝试渲染时会抛出 DeveloperError。
-
Default Value:
undefined
-
Default Value:
false
true,则图元将在下一次调用 ClassificationPrimitive#update 时渲染。
true 时,图元不会保留对输入 geometryInstances 的引用,以节省内存。
-
Default Value:
true
-
Default Value:
true
true 时,会对几何顶点进行优化,以适用于顶点着色器前后的缓存。
-
Default Value:
true
Methods
| Name | Type | Description |
|---|---|---|
scene |
Scene | 场景。 |
Returns:
true;否则返回 false
一旦对象被销毁,就不应再使用它;调用除 isDestroyed 以外的任何函数都会导致 DeveloperError 异常。因此,应像示例中那样将返回值(undefined)赋给该对象。
Throws:
-
DeveloperError :此对象已被销毁,即已调用 destroy()。
Example:
e = e && e.destroy();
See:
GeometryInstance 的可修改的逐实例属性。
| Name | Type | Description |
|---|---|---|
id |
* |
GeometryInstance 的 id。 |
Returns:
Throws:
-
DeveloperError :在调用 getGeometryInstanceAttributes 之前必须先调用 update。
Example:
const attributes = primitive.getGeometryInstanceAttributes('an id');
attributes.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.AQUA);
attributes.show = Cesium.ShowGeometryInstanceAttribute.toValue(true);
如果此对象已被销毁,则不应再使用它;调用除 isDestroyed 以外的任何函数都会导致 DeveloperError 异常。
Returns:
true;否则为 false。
Throws:
-
DeveloperError :所有实例几何体必须具有相同的 primitiveType。
-
DeveloperError :Appearance 和材质具有同名的 uniform。
-
DeveloperError :并非所有几何实例都具有相同的颜色属性。
