Appearance
KBE3D / KBCore / Cesium / ClassificationPrimitive
类: ClassificationPrimitive
A classification primitive represents a volume enclosing geometry in the Scene to be highlighted. <p> 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. </p> <p> 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. </p> <p> Valid geometries are BoxGeometry, CylinderGeometry, EllipsoidGeometry, PolylineVolumeGeometry, and SphereGeometry. </p> <p> 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. </p>
参数
Object with the following properties:
参数
The geometry instances to render. This can either be a single instance or an array of length one.
参数
The appearance used to render the primitive. Defaults to PerInstanceColorAppearance when GeometryInstances have a color attribute.
参数
Determines if this primitive will be shown.
参数
When <code>true</code>, geometry vertices are optimized for the pre and post-vertex-shader caches.
参数
When <code>true</code>, geometry vertex attributes are interleaved, which can slightly improve rendering performance but increases load time.
参数
When <code>true</code>, the geometry vertices are compressed, which will save memory.
参数
When <code>true</code>, the primitive does not keep a reference to the input <code>geometryInstances</code> to save memory.
参数
When <code>true</code>, each geometry instance will only be pickable with Scene#pick. When <code>false</code>, GPU memory is saved.
参数
Determines if the primitive will be created asynchronously or block until ready. If false initializeTerrainHeights() must be called first.
参数
Determines whether terrain, 3D Tiles or both will be classified.
参数
For debugging only. Determines if this primitive's commands' bounding spheres are shown.
参数
For debugging only. Determines if the shadow volume for each geometry in the primitive is drawn. Must be <code>true</code> on creation for the volumes to be created before the geometry is released or options.releaseGeometryInstance must be <code>false</code>.
属性
geometryInstances
readonlygeometryInstances:any[] |GeometryInstance
The geometry instance rendered with this primitive. This may be <code>undefined</code> if <code>options.releaseGeometryInstances</code> is <code>true</code> when the primitive is constructed. <p> Changing this property after the primitive is rendered has no effect. </p> <p> Because of the rendering technique used, all geometry instances must be the same color. If there is an instance with a differing color, a <code>DeveloperError</code> will be thrown on the first attempt to render. </p>
show
show:
boolean
Determines if the primitive will be shown. This affects all geometry instances in the primitive.
classificationType
classificationType:
ClassificationType
Determines whether terrain, 3D Tiles or both will be classified.
debugShowBoundingVolume
debugShowBoundingVolume:
boolean
This property is for debugging only; it is not for production use nor is it optimized. <p> Draws the bounding sphere for each draw command in the primitive. </p>
debugShowShadowVolume
debugShowShadowVolume:
boolean
This property is for debugging only; it is not for production use nor is it optimized. <p> Draws the shadow volume for each geometry in the primitive. </p>
vertexCacheOptimize
readonlyvertexCacheOptimize:boolean
When <code>true</code>, geometry vertices are optimized for the pre and post-vertex-shader caches.
interleave
readonlyinterleave:boolean
Determines if geometry vertex attributes are interleaved, which can slightly improve rendering performance.
releaseGeometryInstances
readonlyreleaseGeometryInstances:boolean
When <code>true</code>, the primitive does not keep a reference to the input <code>geometryInstances</code> to save memory.
allowPicking
readonlyallowPicking:boolean
When <code>true</code>, each geometry instance will only be pickable with Scene#pick. When <code>false</code>, GPU memory is saved.
asynchronous
readonlyasynchronous:boolean
Determines if the geometry instances will be created and batched on a web worker.
compressVertices
readonlycompressVertices:boolean
When <code>true</code>, geometry vertices are compressed, which will save memory.
ready
readonlyready:boolean
Determines if the primitive is complete and ready to render. If this property is true, the primitive will be rendered the next time that ClassificationPrimitive#update is called.
方法
isSupported()
staticisSupported(scene:Scene):boolean
Determines if ClassificationPrimitive rendering is supported.
参数
scene
The scene.
返回
boolean
true if ClassificationPrimitives are supported; otherwise, returns false
update()
update():
void
Called when Viewer or CesiumWidget render the scene to get the draw commands needed to render this primitive. <p> Do not call this function directly. This is documented just to list the exceptions that may be propagated when the scene is rendered: </p>
返回
void
getGeometryInstanceAttributes()
getGeometryInstanceAttributes(
id:any):any
Returns the modifiable per-instance attributes for a GeometryInstance.
参数
id
any
The id of the GeometryInstance.
返回
any
The typed array in the attribute's format or undefined if the is no instance with id.
示例
ts
const attributes = primitive.getGeometryInstanceAttributes('an id');
attributes.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.AQUA);
attributes.show = Cesium.ShowGeometryInstanceAttribute.toValue(true);isDestroyed()
isDestroyed():
boolean
Returns true if this object was destroyed; otherwise, false. <p> If this object was destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception. </p>
返回
boolean
true if this object was destroyed; otherwise, false.
destroy()
destroy():
void
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. <p> Once an object is destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception. Therefore, assign the return value (<code>undefined</code>) to the object as done in the example. </p>
返回
void
示例
ts
e = e && e.destroy();构造函数
构造函数
new ClassificationPrimitive(
options?: {geometryInstances?:any[] |GeometryInstance;appearance?:Appearance;show?:boolean;vertexCacheOptimize?:boolean;interleave?:boolean;compressVertices?:boolean;releaseGeometryInstances?:boolean;allowPicking?:boolean;asynchronous?:boolean;classificationType?:ClassificationType;debugShowBoundingVolume?:boolean;debugShowShadowVolume?:boolean; }):ClassificationPrimitive
参数
options?
geometryInstances?
any[] | GeometryInstance
appearance?
show?
boolean
vertexCacheOptimize?
boolean
interleave?
boolean
compressVertices?
boolean
releaseGeometryInstances?
boolean
allowPicking?
boolean
asynchronous?
boolean
classificationType?
debugShowBoundingVolume?
boolean
debugShowShadowVolume?
boolean
返回
ClassificationPrimitive
