具有形成顶点的属性和可选索引数据的几何表示
定义原语。几何图形和
Appearance
,它描述了阴影,
可分配给Primitive
进行可视化。Primitive
罐
从许多异构(在许多情况下)几何图形创建以获得性能。
Geometries can be transformed and optimized using functions in GeometryPipeline
.
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 具有以下属性的对象:
|
Example:
// Create geometry with a position attribute and indexed lines.
var positions = new Float64Array([
0.0, 0.0, 0.0,
7500000.0, 0.0, 0.0,
0.0, 7500000.0, 0.0
]);
var 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
包含属性数据。
Attributes are always stored non-interleaved in a Geometry.
There are reserved attribute names with well-known semantics. The following attributes
are created by a Geometry (depending on the provided VertexFormat
.
position
- 3D vertex position. 64-bit floating-point (for precision). 3 components per attribute. SeeVertexFormat#position
.normal
- Normal (normalized), commonly used for lighting. 32-bit floating-point. 3 components per attribute. SeeVertexFormat#normal
.st
- 2D texture coordinate. 32-bit floating-point. 2 components per attribute. SeeVertexFormat#st
.bitangent
- Bitangent (normalized), used for tangent-space effects like bump mapping. 32-bit floating-point. 3 components per attribute. SeeVertexFormat#bitangent
.tangent
- Tangent (normalized), used for tangent-space effects like bump mapping. 32-bit floating-point. 3 components per attribute. SeeVertexFormat#tangent
.
The following attribute names are generally not created by a Geometry, but are added
to a Geometry by a Primitive
or GeometryPipeline
functions to prepare
the geometry for rendering.
position3DHigh
- High 32 bits for encoded 64-bit position computed withGeometryPipeline.encodeAttribute
. 32-bit floating-point. 4 components per attribute.position3DLow
- Low 32 bits for encoded 64-bit position computed withGeometryPipeline.encodeAttribute
. 32-bit floating-point. 4 components per attribute.position3DHigh
- High 32 bits for encoded 64-bit 2D (Columbus view) position computed withGeometryPipeline.encodeAttribute
. 32-bit floating-point. 4 components per attribute.position2DLow
- Low 32 bits for encoded 64-bit 2D (Columbus view) position computed withGeometryPipeline.encodeAttribute
. 32-bit floating-point. 4 components per attribute.color
- RGBA color (normalized) usually fromGeometryInstance#color
. 32-bit floating-point. 4 components per attribute.pickColor
- RGBA color used for picking. 32-bit floating-point. 4 components per attribute.
-
Default Value:
undefined
Example:
geometry.attributes.position = new Cesium.GeometryAttribute({
componentDatatype : Cesium.ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : new Float32Array(0)
});
See:
boundingSphere : BoundingSphere
完全封闭几何体的可选边界球体。这是
常用于扑杀。
-
Default Value:
undefined
可选索引数据,连同
Geometry#primitiveType
-
确定几何体中的基本体。-
Default Value:
undefined
primitiveType : PrimitiveType
几何体中基本体的类型。通常是
PrimitiveType.TRIANGLES
,
但可以根据具体的几何结构而变化。-
Default Value:
undefined
Methods
计算几何体中的顶点数。运行时与
与顶点的数目无关。
Name | Type | Description |
---|---|---|
geometry |
Geometry | 几何学。 |
Returns:
几何体中的顶点数。
Example:
var numVertices = Cesium.Geometry.computeNumberOfVertices(geometry);