Scene 要突出显示。 to be highlighted.
基元将几何实例与 A primitive combines geometry instances with an Appearance 描述了完整的阴影,包括 that describes the full shading, including
Material and RenderState。粗略地说,几何实例定义了结构和位置,外观定义了视觉特征。几何图形和外观的解耦使我们能够混合和匹配它们中的大多数,并相互独立地添加新的几何图形或外观。仅 . Roughly, the geometry instance defines the structure and placement, and the appearance defines the visual characteristics. Decoupling geometry and appearance allows us to mix and match most of them and add a new geometry or appearance independently of each other. Only PerInstanceColorAppearance 直接使用 ClassificationPrimitive 时,目前支持在所有实例中使用相同的颜色。对于全 with the same color across all instances is supported at this time when using ClassificationPrimitive directly. For full Appearance 支持对地形或 3D Tiles 使用进行分类 support when classifying terrain or 3D Tiles use GroundPrimitive instead.
为了正确渲染,此功能需要 EXT_frag_depth WebGL 扩展。对于不支持此扩展的硬件,某些视角会出现渲染伪影。 For correct rendering, this feature requires the EXT_frag_depth WebGL extension. For hardware that do not support this extension, there will be rendering artifacts for some viewing angles.
有效的几何形状是 Valid geometries are BoxGeometry, CylinderGeometry, EllipsoidGeometry, PolylineVolumeGeometry, 和 , and SphereGeometry.
遵循椭球体表面的几何形状,例如 Geometries that follow the surface of the ellipsoid, such as CircleGeometry, CorridorGeometry, EllipseGeometry, PolygonGeometry, 和 , and RectangleGeometry,如果它们是拉伸体积也有效;否则,它们将不会被渲染。 , are also valid if they are extruded volumes; otherwise, they will not be rendered.
| 名称 Name | 类型 Type | 说明 Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
可选 optional
具有以下属性的对象: Object with the following properties:
|
成员 Members
true,每个几何实例只能通过以下方式选取 , each geometry instance will only be pickable with Scene#pick。当 . When false,节省了GPU内存。 , GPU memory is saved.
-
默认值: Default Value:
true
-
默认值: Default Value:
true
classificationType : ClassificationType
-
默认值: Default Value:
ClassificationType.BOTH
true,几何顶点被压缩,这将节省内存。 , geometry vertices are compressed, which will save memory.
-
默认值: Default Value:
true
Draws the bounding sphere for each draw command in the primitive.
-
默认值: Default Value:
false
为图元中的每个几何体绘制阴影体积。 Draws the shadow volume for each geometry in the primitive.
-
默认值: Default Value:
false
readonly geometryInstances : Array|GeometryInstance
undefined if options.releaseGeometryInstances
is true 当构造原语时。 when the primitive is constructed.
在渲染图元后更改此属性没有任何效果。 Changing this property after the primitive is rendered has no effect.
由于所使用的渲染技术,所有几何实例必须具有相同的颜色。如果存在具有不同颜色的实例, Because of the rendering technique used, all geometry instances must be the same color. If there is an instance with a differing color, a DeveloperError 将在第一次尝试渲染时抛出。 will be thrown on the first attempt to render.
-
默认值: Default Value:
undefined
-
默认值: Default Value:
false
ClassificationPrimitive#update
被称为。 is called.
true,原语不保留对输入的引用 , the primitive does not keep a reference to the input geometryInstances 以节省内存。 to save memory.
-
默认值: Default Value:
true
-
默认值: Default Value:
true
true,几何顶点针对顶点着色器前和后的缓存进行了优化。 , geometry vertices are optimized for the pre and post-vertex-shader caches.
-
默认值: Default Value:
true
方法 Methods
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
scene |
Scene | 现场。 The scene. |
返回: Returns:
true 是否支持 ClassificationPrimitives;否则,返回 if ClassificationPrimitives are supported; otherwise, returns false
一旦对象被销毁,就不应再使用;调用除 Once an object is destroyed, it should not be used; calling any function other than
isDestroyed 将导致 will result in a DeveloperError 例外。因此,分配返回值( exception. Therefore, assign the return value (undefined) 到对象,如示例中所做的那样。 ) to the object as done in the example.
抛出: Throws:
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
示例: Example:
e = e && e.destroy();
另见: See:
GeometryInstance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
id |
* |
的 ID The id of the GeometryInstance. |
返回: Returns:
抛出: Throws:
-
DeveloperError :必须在调用 getGeometryInstanceAttributes 之前调用 update。 : must call update before calling getGeometryInstanceAttributes.
示例: Example:
const attributes = primitive.getGeometryInstanceAttributes('an id');
attributes.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.AQUA);
attributes.show = Cesium.ShowGeometryInstanceAttribute.toValue(true);
如果该对象被破坏,则不应使用它;调用除 If this object was destroyed, it should not be used; calling any function other than
isDestroyed 将导致 will result in a DeveloperError exception.
返回: Returns:
true 如果该物体被摧毁;否则, if this object was destroyed; otherwise, false.
另见: See:
Viewer or CesiumWidget 渲染场景以获取渲染此图元所需的绘制命令。 render the scene to get the draw commands needed to render this primitive.
不要直接调用该函数。记录此内容只是为了列出渲染场景时可能传播的异常: Do not call this function directly. This is documented just to list the exceptions that may be propagated when the scene is rendered:
抛出: Throws:
-
DeveloperError :所有实例几何图形必须具有相同的primitiveType。 : All instance geometries must have the same primitiveType.
-
DeveloperError :外观和材质具有同名统一。 : Appearance and material have a uniform with the same name.
-
DeveloperError :并非所有几何体实例都具有相同的颜色属性。 : Not all of the geometry instances have the same color attribute.
