GeometryInstanceAttribute是指定几何实例的属性的类。在Cesium中,一个Primitive可以由GeometryInstance组成,GeometryInstance可以由一些定义几何体的参数,例如position、color和normal,以及需要在渲染过程中使用的附加属性组成。GeometryInstanceAttribute就是被用来定义给定实例的附加属性。
<ComponentDatatype> 组件数据类型<Number> 每个属性组件的数量<Boolean> 是否在传递到着色器之前进行数据范围归一化<Object> 属性_componentDatatype是指属性中每个组件的数据类型,例如FLOAT、BYTE或UNSIGNED_SHORT。
_componentsPerAttribute是指一个属性中所包含的组件数,它必须为1、2、3或4。
_normalize是一个布尔值,表示属性是否应该在传递到着色器之前进行数据归一化处理。_normalize为false表示属性将被视为浮点数,并且不会进行标准化处理。
attribute是一个属性对象,用于存储属性的值和相关信息,例如名称和大小。
<ArrayBufferView> 包含属性数据的二进制缓冲区<ComponentDatatype> 属性组件数据类型<Number> 属性中每个组件的数量<Boolean> 是否需要进行数据归一化<Number> 在二进制缓冲区中属性数据的字节偏移量var instance = new Cesium.GeometryInstance({
geometry : new Cesium.RectangleGeometry({
rectangle : Cesium.Rectangle.fromDegrees(-100.0, 20.0, -90.0, 30.0),
vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL
}),
attributes : {
color : new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 1.0)
}
});
在上面的示例中,GeometryInstanceAttribute用于指定矩形实例的color属性。这里使用了Cesium.ColorGeometryInstanceAttribute来为每个实例定义颜色。由于_componentsPerAttribute在ColorGeometryInstanceAttribute中值为4,因此attribute中的value属性应该是颜色的四个分量的数组。