具有构成顶点的属性和可选索引数据的几何表示
定义基元。 几何图形和
外观
(描述阴影)、
可以分配给 Primitive
以进行可视化。 Primitive
可以
由许多异构 - 在许多情况下 - 几何图形创建以提高性能。
可以使用 GeometryPipeline
中的函数转换和优化几何图形。
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
对象,具有以下属性:
|
Example:
// Create geometry with a position attribute and indexed lines.
const positions = new Float64Array([
0.0, 0.0, 0.0,
7500000.0, 0.0, 0.0,
0.0, 7500000.0, 0.0
]);
const geometry = new Cesium.Geometry({
attributes : {
position : new Cesium.GeometryAttribute({
componentDatatype : Cesium.ComponentDatatype.DOUBLE,
componentsPerAttribute : 3,
values : positions
})
},
indices : new Uint16Array([0, 1, 1, 2, 2, 0]),
primitiveType : Cesium.PrimitiveType.LINES,
boundingSphere : Cesium.BoundingSphere.fromVertices(positions)
});
Demo:
See:
Members
attributes : GeometryAttributes
属性,构成几何体的顶点。 此对象中的每个属性都对应于一个
GeometryAttribute
包含属性的数据。
属性始终以非交错方式存储在 Geometry 中。
存在具有已知语义的保留属性名称。 以下属性
由 Geometry 创建(取决于提供的 VertexFormat
)。
position
- 3D 顶点位置。 64 位浮点(用于精度)。 每个属性 3 个组件。 参见VertexFormat#position
。normal
- 正常(标准化),通常用于照明。 32 位浮点。 每个属性 3 个组件。 参见VertexFormat#normal
。st
- 2D 纹理坐标。 32 位浮点。 每个属性 2 个组件。 参见VertexFormat#st
。bitangent
- 双切线(标准化),用于凹凸贴图等切线空间效果。 32 位浮点。 每个属性 3 个组件。 参见VertexFormat#bitangent
。tangent
- 切线(规格化),用于凹凸贴图等切线空间效果。 32 位浮点。 每个属性 3 个组件。 参见VertexFormat#tangent
。
以下属性名称通常不是由 Geometry 创建的,而是添加的
通过 Primitive
或 GeometryPipeline
函数准备
用于渲染的几何体。
position3DHigh
- 使用GeometryPipeline.encodeAttribute
计算的编码 64 位的高 32 位。 32 位浮点。 每个属性 4 个组件。position3DLow
- 对于使用GeometryPipeline.encodeAttribute
计算的编码 64 位位置,为低 32 位。 32 位浮点。 每个属性 4 个组件。position2DHigh
- 使用GeometryPipeline.encodeAttribute
计算的编码 64 位 2D(哥伦布视图)位置的高 32 位。 32 位浮点。 每个属性 4 个组件。position2DLow
- 对于使用GeometryPipeline.encodeAttribute
计算的编码 64 位 2D(哥伦布视图)位置,为低 32 位。 32 位浮点。 每个属性 4 个组件。color
- RGBA 颜色(标准化),通常来自GeometryInstance#color
。 32 位浮点。 每个属性 4 个组件。pickColor
- 用于拾取的 RGBA 颜色。 32 位浮点。 每个属性 4 个组件。
Example:
geometry.attributes.position = new Cesium.GeometryAttribute({
componentDatatype : Cesium.ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : new Float32Array(0)
});
See:
boundingSphere : BoundingSphere|undefined
一个完全封闭几何体的可选边界球体。 这是
通常用于剔除。
-
Default Value:
undefined
可选的索引数据 - 以及
Geometry#primitiveType
-
确定几何体中的基元。
-
Default Value:
undefined
primitiveType : PrimitiveType|undefined
几何体中基元的类型。 这通常是
PrimitiveType.TRIANGLES
,
但可以根据特定几何图形而变化。
-
Default Value:
PrimitiveType.TRIANGLES
Methods
计算几何图形中的顶点数。 运行时间与
相对于顶点中的属性数,而不是顶点数。
Name | Type | Description |
---|---|---|
geometry |
Geometry | 几何图形。 |
Returns:
几何体中的顶点数。
Example:
const numVertices = Cesium.Geometry.computeNumberOfVertices(geometry);