Scene
. The geometry must be from a single GeometryInstance
.
Batching multiple geometries is not yet supported.
A primitive combines the geometry instance 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 the PerInstanceColorAppearance
is supported at this time.
Valid geometries are CircleGeometry
, CorridorGeometry
, EllipseGeometry
, PolygonGeometry
, and RectangleGeometry
.
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
optional
Object with the following properties:
|
Example:
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({
geometryInstance : rectangleInstance
}));
See:
Members
-
When
true
, each geometry instance will only be pickable withScene#pick
. Whenfalse
, GPU memory is saved.-
Default Value:
true
-
Determines if the geometry instances will be created and batched on a web worker.
-
Default Value:
true
-
When
true
, geometry vertices are compressed, which will save memory.-
Default Value:
true
-
This property is for debugging only; it is not for production use nor is it optimized.
Draws the bounding sphere for each draw command in the primitive.
-
Default Value:
false
-
The geometry instance rendered with this primitive. This may be
undefined
ifoptions.releaseGeometryInstances
istrue
when the primitive is constructed.Changing this property after the primitive is rendered has no effect.
-
Default Value:
undefined
-
Determines if geometry vertex attributes are interleaved, which can slightly improve rendering performance.
-
Default Value:
false
-
Determines if the primitive is complete and ready to render. If this property is true, the primitive will be rendered the next time that
GroundPrimitive#update
is called. -
readonlyreadyPromise : Promise.<GroundPrimitive>
-
Gets a promise that resolves when the primitive is ready to render.
-
When
true
, the primitive does not keep a reference to the inputgeometryInstances
to save memory.-
Default Value:
true
-
Determines if the primitive will be shown. This affects all geometry instances in the primitive.
-
Default Value:
true
-
When
true
, geometry vertices are optimized for the pre and post-vertex-shader caches.-
Default Value:
true
Methods
-
Determines if GroundPrimitive rendering is supported.
Name Type Description scene
Scene The scene. Returns:
true
if GroundPrimitives are supported; otherwise, returnsfalse
-
Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.
Once an object is destroyed, it should not be used; calling any function other than
isDestroyed
will result in aDeveloperError
exception. Therefore, assign the return value (undefined
) to the object as done in the example.Returns:
Throws:
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
e = e && e.destroy();
See:
-
-
Returns the modifiable per-instance attributes for a
GeometryInstance
.Name Type Description id
Object The id of the GeometryInstance
.Returns:
The typed array in the attribute's format or undefined if the is no instance with id.Throws:
-
DeveloperError : must call update before calling getGeometryInstanceAttributes.
Example:
var attributes = primitive.getGeometryInstanceAttributes('an id'); attributes.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.AQUA); attributes.show = Cesium.ShowGeometryInstanceAttribute.toValue(true);
-
-
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other than
isDestroyed
will result in aDeveloperError
exception.Returns:
true
if this object was destroyed; otherwise,false
. -
Called when
Viewer
orCesiumWidget
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 : All instance geometries must have the same primitiveType.
-
DeveloperError : Appearance and material have a uniform with the same name.
-