new Cesium.GeometryInstance(options)

Geometry instancing allows one Geometry object to be positions in several different locations and colored uniquely. For example, one BoxGeometry can be instanced several times, each with a different modelMatrix to change 其位置、旋转和规模.
Name Type Description
options object 下列属性的对象 :
Name Type Default Description
geometry Geometry | GeometryFactory 几何为例.
modelMatrix Matrix4 Matrix4.IDENTITY optional The model matrix that transforms to transform the geometry from model to world coordinates.
id object optional A user-defined object to return when the instance is picked with Scene#pick or get/set per-instance attributes with Primitive#getGeometryInstanceAttributes.
attributes object optional 如下文示例所示的显示或颜色属性那样的偶联属性.
Example:
// Create geometry for a box, and two instances that refer to it.
// One instance positions the box on the bottom and colored aqua.
// The other instance positions the box on the top and color white.
const geometry = Cesium.BoxGeometry.fromDimensions({
  vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL,
  dimensions : new Cesium.Cartesian3(1000000.0, 1000000.0, 500000.0)
});
const instanceBottom = new Cesium.GeometryInstance({
  geometry : geometry,
  modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 1000000.0), new Cesium.Matrix4()),
  attributes : {
    color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA)
  },
  id : 'bottom'
});
const instanceTop = new Cesium.GeometryInstance({
  geometry : geometry,
  modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 3000000.0), new Cesium.Matrix4()),
  attributes : {
    color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA)
  },
  id : 'top'
});
See:

Members

attributes : object

Per-instance attributes like ColorGeometryInstanceAttribute or ShowGeometryInstanceAttribute. Geometry attributes varying per vertex; these attributes are constant for the entire instance.
Default Value: {}

geometry : Geometry

示现几何.

id : object|undefined

选择实例时返回用户定义的对象,或者用于获取/设置每事件属性.
Default Value: undefined
See:

modelMatrix : Matrix4

将几何学从模型转换成世界坐标的4x4变换矩阵. 当这是身份矩阵时,几何图画在世界坐标, i.e . 地球的 WGS84 坐标. 本地参考框架可以通过提供不同的变换矩阵来使用, 如返回的变换矩阵 by Transforms.eastNorthUpToFixedFrame.
Default Value: Matrix4.IDENTITY
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.