Scene.
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,
而外观则定义了视觉特征. 调和几何和外观,让我们可以混合
并匹配其中的大部分,并添加一个新的几何或外观,彼此独立.
需要支持 WEBGL 深度 纹理扩展以使用不同色彩的几何结构 或除彩色外的材料.
纹理地面原型是按名义图案设计的,并非用于精确绘图
地形纹理 - 对于这个使用大小写,使用 SingleTileImageryProvider .
为了正确渲染,这个特性需要EXT frag 深度 WebGL 扩展. 对于不支持此扩展名的硬件, 这里 将会为某些取景角度制作文物.
有效的几何是 CircleGeometry , CorridorGeometry , EllipseGeometry , PolygonGeometry ,和 RectangleGeometry .
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
下列属性的对象 :
|
Example:
// Example 1: Create primitive with a single instance
const rectangleInstance = new Cesium.GeometryInstance({
geometry : new Cesium.RectangleGeometry({
rectangle : Cesium.Rectangle.fromDegrees(-140.0, 30.0, -100.0, 40.0)
}),
id : 'rectangle',
attributes : {
color : new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 0.5)
}
});
scene.primitives.add(new Cesium.GroundPrimitive({
geometryInstances : rectangleInstance
}));
// Example 2: Batch instances
const color = new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 0.5); // Both instances must have the same color.
const rectangleInstance = new Cesium.GeometryInstance({
geometry : new Cesium.RectangleGeometry({
rectangle : Cesium.Rectangle.fromDegrees(-140.0, 30.0, -100.0, 40.0)
}),
id : 'rectangle',
attributes : {
color : color
}
});
const ellipseInstance = new Cesium.GeometryInstance({
geometry : new Cesium.EllipseGeometry({
center : Cesium.Cartesian3.fromDegrees(-105.0, 40.0),
semiMinorAxis : 300000.0,
semiMajorAxis : 400000.0
}),
id : 'ellipse',
attributes : {
color : color
}
});
scene.primitives.add(new Cesium.GroundPrimitive({
geometryInstances : [rectangleInstance, ellipseInstance]
}));
See:
Members
true, each geometry instance will only be pickable with Scene#pick. When false, GPU memory is saved.
-
Default Value:
true
appearance : Appearance
Appearance used to shade this primitive. Each geometry
实例以相同的外观遮蔽。 一些外表,比如说
PerInstanceColorAppearance allow giving each instance unique
properties.
-
Default Value:
undefined
-
Default Value:
true
classificationType : ClassificationType
-
Default Value:
ClassificationType.BOTH
-
Default Value:
true
绘制原始中每个绘图命令的边框.
-
Default Value:
false
为原始的每个几何绘制阴影音量.
-
Default Value:
false
readonly geometryInstances : Array|GeometryInstance
true when the primitive is constructed.
原始化后改变这个属性没有效果.
-
Default Value:
undefined
-
Default Value:
false
GroundPrimitive#update
is called.
true, the primitive does not keep a reference to the input geometryInstances to save memory.
-
Default Value:
true
-
Default Value:
true
-
Default Value:
true
Methods
Returns:
| Name | Type | Description |
|---|---|---|
scene |
Scene | The scene. |
Returns:
true if GroundPrimitives are supported; otherwise, returns false
| Name | Type | Description |
|---|---|---|
scene |
Scene | 目前的场景. |
Returns:
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 |
* |
The id of the GeometryInstance. |
Returns:
Throws:
-
DeveloperError : 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.
Viewer or CesiumWidget render the scene to
获得使这个原始化所需的绘图命令.
不要直接调用此函数 。 记录下来的只是 列出场景拍摄时可能宣传的例外情况:
Throws:
-
DeveloperError : For synchronous GroundPrimitive, you must call GroundPrimitive.initializeTerrainHeights() and wait for the returned promise to resolve.
-
DeveloperError : All instance geometries must have the same primitiveType.
-
DeveloperError : Appearance and material have a uniform with the same name.