每个实例几何属性的值和类型信息。 Values and type information for per-instance geometry attributes.
| 名称 Name | 类型 Type | 说明 Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
具有以下属性的对象: Object with the following properties:
|
抛出: Throws:
-
DeveloperError :options.componentsPerAttribute 必须介于 1 和 4 之间。 : options.componentsPerAttribute must be between 1 and 4.
示例: Example:
const instance = new Cesium.GeometryInstance({
geometry : Cesium.BoxGeometry.fromDimensions({
dimensions : new Cesium.Cartesian3(1000000.0, 1000000.0, 500000.0)
}),
modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(0.0, 0.0)), new Cesium.Cartesian3(0.0, 0.0, 1000000.0), new Cesium.Matrix4()),
id : 'box',
attributes : {
color : new Cesium.GeometryInstanceAttribute({
componentDatatype : Cesium.ComponentDatatype.UNSIGNED_BYTE,
componentsPerAttribute : 4,
normalize : true,
value : [255, 255, 0, 255]
})
}
});
另见: See:
成员 Members
componentDatatype : ComponentDatatype
属性中每个组件的数据类型,例如,中的各个元素 The datatype of each component in the attribute, e.g., individual elements in
GeometryInstanceAttribute#value.
1 到 4 之间的数字,定义属性中的组件数量。例如,具有 x、y 和 z 分量的位置属性将具有 3,如代码示例所示。 A number between 1 and 4 that defines the number of components in an attributes. For example, a position attribute with x, y, and z components would have 3 as shown in the code example.
示例: Example:
show : new Cesium.GeometryInstanceAttribute({
componentDatatype : Cesium.ComponentDatatype.UNSIGNED_BYTE,
componentsPerAttribute : 1,
normalize : true,
value : [1.0]
})
When
true and componentDatatype 是整数格式,指示当组件作为浮点进行渲染时应映射到范围 [0, 1](无符号)或 [-1, 1](有符号)。 is an integer format, indicate that the components should be mapped to the range [0, 1] (unsigned) or [-1, 1] (signed) when they are accessed as floating-point for rendering.
这通常在使用存储颜色时使用 This is commonly used when storing colors using ComponentDatatype.UNSIGNED_BYTE.
-
默认值: Default Value:
false
示例: Example:
attribute.componentDatatype = Cesium.ComponentDatatype.UNSIGNED_BYTE;
attribute.componentsPerAttribute = 4;
attribute.normalize = true;
attribute.value = [
Cesium.Color.floatToByte(color.red),
Cesium.Color.floatToByte(color.green),
Cesium.Color.floatToByte(color.blue),
Cesium.Color.floatToByte(color.alpha)
];
存储在类型化数组中的属性值。在代码示例中,每三个元素 The values for the attributes stored in a typed array. In the code example, every three elements in
values 定义一个属性,因为 defines one attributes since
componentsPerAttribute 是 3。 is 3.
示例: Example:
show : new Cesium.GeometryInstanceAttribute({
componentDatatype : Cesium.ComponentDatatype.UNSIGNED_BYTE,
componentsPerAttribute : 1,
normalize : true,
value : [1.0]
})
