几何体属性的值和类型信息。
Geometry
通常包含一个或多个属性。所有属性一起形成
几何体的顶点。Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | optional
具有以下属性的对象:
|
Throws:
-
DeveloperError : 属性选项必须介于1和4之间。
Example:
var geometry = new Cesium.Geometry({
attributes : {
position : new Cesium.GeometryAttribute({
componentDatatype : Cesium.ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : new Float32Array([
0.0, 0.0, 0.0,
7500000.0, 0.0, 0.0,
0.0, 7500000.0, 0.0
])
})
},
primitiveType : Cesium.PrimitiveType.LINE_LOOP
});
See:
Members
componentDatatype : ComponentDatatype
属性中每个组件的数据类型,例如
GeometryAttribute#values
-
Default Value:
undefined
定义属性中组件数量的介于1和4之间的数字。
例如,具有x、y和z组件的位置属性将具有3个
如代码示例所示。
-
Default Value:
undefined
Example:
attribute.componentDatatype = Cesium.ComponentDatatype.FLOAT;
attribute.componentsPerAttribute = 3;
attribute.values = new Float32Array([
0.0, 0.0, 0.0,
7500000.0, 0.0, 0.0,
0.0, 7500000.0, 0.0
]);
当
true
和componentDatatype
是整数格式时,
指示组件应映射到范围[0,1](无符号)
或[-1,1](有符号),当它们作为浮点访问以进行渲染时。
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.values = new Uint8Array([
Cesium.Color.floatToByte(color.red),
Cesium.Color.floatToByte(color.green),
Cesium.Color.floatToByte(color.blue),
Cesium.Color.floatToByte(color.alpha)
]);
values : Array.<number>|Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array
存储在类型化数组中的属性的
values
。在代码示例中,
值中每三个元素定义一个属性,因为
componentsPerAttribute
是3。-
Default Value:
undefined
Example:
attribute.componentDatatype = Cesium.ComponentDatatype.FLOAT;
attribute.componentsPerAttribute = 3;
attribute.values = new Float32Array([
0.0, 0.0, 0.0,
7500000.0, 0.0, 0.0,
0.0, 7500000.0, 0.0
]);