几何实例化允许一个
Geometry
对象位于多个
不同的位置和独特的颜色。 例如,一个 BoxGeometry
可以
实例化多次,每次实例化都有不同的 modelMatrix
进行更改
它的位置、旋转和缩放。
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
对象,具有以下属性:
|
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
每个实例的属性,如
ColorGeometryInstanceAttribute
或 ShowGeometryInstanceAttribute
。
Geometry
属性因顶点而异;这些属性对于整个实例都是常量。
-
Default Value:
{}
正在实例化的几何体。
选取实例或用于获取/设置每个实例属性时返回的用户定义对象。
-
Default Value:
undefined
See:
modelMatrix : Matrix4
将几何体从模型转换为世界坐标的 4x4 转换矩阵。
当这是单位矩阵时,几何图形在世界坐标中绘制,即地球的 WGS84 坐标。
可以通过提供不同的转换矩阵来使用本地参考帧,就像返回的矩阵一样
by
Transforms.eastNorthUpToFixedFrame
.
-
Default Value:
Matrix4.IDENTITY