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
with the same color across all instances is supported at this time when using
ClassificationPrimitive directly.
For full Appearance
support when classifying terrain or 3D Tiles use GroundPrimitive
instead.
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 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
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 |
* |
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
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.
-
DeveloperError : Not all of the geometry instances have the same color attribute.