每个实例几何体属性的值和类型信息。
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
对象,具有以下属性:
|
Throws:
-
DeveloperError : 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
属性中每个组件的数据类型,例如,其中的单个元素
GeometryInstanceAttribute#value
.
一个介于 1 和 4 之间的数字,用于定义属性中的组件数。
例如,具有 x、y 和 z 分量的 position 属性将具有 3 作为
如代码示例所示。
Example:
show : new Cesium.GeometryInstanceAttribute({
componentDatatype : Cesium.ComponentDatatype.UNSIGNED_BYTE,
componentsPerAttribute : 1,
normalize : true,
value : [1.0]
})
当
true
且 componentDatatype
为整数格式时,
表示组件应映射到范围 [0, 1](无符号)
或 [-1, 1](带符号)当它们作为浮点进行访问以进行渲染时。
这在使用 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)
];
存储在类型化数组中的属性的值。 在代码示例中,
values
中的每 3 个元素定义一个属性,因为
componentsPerAttribute
为 3。
Example:
show : new Cesium.GeometryInstanceAttribute({
componentDatatype : Cesium.ComponentDatatype.UNSIGNED_BYTE,
componentsPerAttribute : 1,
normalize : true,
value : [1.0]
})