A ground primitive represents geometry draped over the terrain in the 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.
Because of the cutting edge nature of this feature in WebGL, it requires the EXT_frag_depth extension, which is currently only supported in Chrome,
Firefox, and Edge. Apple support is expected in iOS 9 and MacOS Safari 9. Android support varies by hardware and IE11 will most likely never support
it. You can use webglreport.com to verify support for your hardware. Finally, this feature is currently only supported in Primitives and not yet
available via the Entity API.
{Object} [options] Object with the following properties:
{Array|GeometryInstance} [options.geometryInstances] The geometry instances to render.
{Boolean} [options.show=true] Determines if this primitive will be shown.
{Boolean} [options.vertexCacheOptimize=false] When true, geometry vertices are optimized for the pre and post-vertex-shader caches.
{Boolean} [options.interleave=false] When true, geometry vertex attributes are interleaved, which can slightly improve rendering performance but increases load time.
{Boolean} [options.compressVertices=true] When true, the geometry vertices are compressed, which will save memory.
{Boolean} [options.releaseGeometryInstances=true] When true, the primitive does not keep a reference to the input geometryInstances to save memory.
{Boolean} [options.allowPicking=true] When true, each geometry instance will only be pickable with Scene#pick When false, GPU memory is saved.
{Boolean} [options.asynchronous=true] Determines if the primitive will be created asynchronously or block until ready.
{Boolean} [options.debugShowBoundingVolume=false] For debugging only. Determines if this primitive's commands' bounding spheres are shown.
{Boolean} [options.debugShowShadowVolume=false] For debugging only. Determines if the shadow volume for each geometry in the primitive is drawn. Must be true on
creation for the volumes to be created before the geometry is released or options.releaseGeometryInstance must be false.
// 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]
}));
A ground primitive represents geometry draped over the terrain in the 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.
Because of the cutting edge nature of this feature in WebGL, it requires the EXT_frag_depth extension, which is currently only supported in Chrome, Firefox, and Edge. Apple support is expected in iOS 9 and MacOS Safari 9. Android support varies by hardware and IE11 will most likely never support it. You can use webglreport.com to verify support for your hardware. Finally, this feature is currently only supported in Primitives and not yet available via the Entity API.
Valid geometries are CircleGeometry, CorridorGeometry, EllipseGeometry, PolygonGeometry, and RectangleGeometry
alias GroundPrimitive
true
, geometry vertices are optimized for the pre and post-vertex-shader caches.true
, geometry vertex attributes are interleaved, which can slightly improve rendering performance but increases load time.true
, the geometry vertices are compressed, which will save memory.true
, the primitive does not keep a reference to the inputgeometryInstances
to save memory.true
, each geometry instance will only be pickable with Scene#pick Whenfalse
, GPU memory is saved.true
on creation for the volumes to be created before the geometry is released or options.releaseGeometryInstance must befalse
.// 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] }));
Appearance
GeometryInstance
Primitive