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,
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.
Support for the WEBGL_depth_texture extension is required to use GeometryInstances with different PerInstanceColors or materials besides PerInstanceColorAppearance.
Textured GroundPrimitives were designed for notional patterns and are not meant for precisely mapping
textures to terrain - for that use case, use SingleTileImageryProvider
.
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 CircleGeometry
, CorridorGeometry
, EllipseGeometry
, PolygonGeometry
, and RectangleGeometry
.
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | optional
具有以下属性的对象:
|
Example:
// Example 1: Create primitive with a single instance
var 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
var color = new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 0.5); // Both instances must have the same color.
var 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
}
});
var 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
-
Default Value:
true
appearance : Appearance
Appearance
是用来给这个原始人着色的。每个几何体
实例以相同的外观着色。一些表象,比如
PerInstanceColorAppearance
允许给每个实例唯一
属性。-
Default Value:
undefined
-
Default Value:
true
classificationType : ClassificationType
-
Default Value:
ClassificationType.BOTH
true
时,几何体顶点被压缩,这将节省内存。-
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
options.releaseGeometryInstances
,则为undefined
构造原语时为true
。
Changing this property after the primitive is rendered has no effect.
-
Default Value:
undefined
-
Default Value:
false
GroundPrimitive#update
被称为。readonly readyPromise : Promise.<GroundPrimitive>
true
时,原语不保留对输入geometryInstances
的引用以节省内存。-
Default Value:
true
-
Default Value:
true
true
时,几何体顶点针对顶点前后着色器缓存进行了优化。-
Default Value:
true
Methods
Returns:
Name | Type | Description |
---|---|---|
scene |
Scene | 现场。 |
Returns:
true
;否则,返回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 :此对象已销毁,即调用destroy()。
Example:
e = e && e.destroy();
See:
GeometryInstance
的每个实例的可修改属性。Name | Type | Description |
---|---|---|
id |
* | GeometryInstance 的id。 |
Returns:
Throws:
-
DeveloperError :必须在调用getGeometryInstanceAttributes之前调用update。
Example:
var 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
;否则为false
。Viewer
或CesiumWidget
将场景渲染到
获取渲染此基本体所需的draw命令。
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 :对于同步GroundPrimitive,必须调用GroundPrimitive.initializeTerrainHeights()并等待返回的承诺解决。
-
DeveloperError :所有实例几何图形必须具有相同的基本类型。
-
DeveloperError :外观和材质具有相同名称的制服。