Methods
static Cesium.GeometryPipeline.compressVertices(geometry) → Geometry
压缩和压缩几何体法线属性值以节省内存。
Name | Type | Description |
---|---|---|
geometry |
Geometry | 要修改的几何体。 |
Returns:
修改后的
geometry
参数,其法线压缩和压缩。Example:
geometry = Cesium.GeometryPipeline.compressVertices(geometry);
static Cesium.GeometryPipeline.computeNormal(geometry) → Geometry
通过平均包含
TRIANGLES
的几何体的法线,计算每个顶点normal
s
所有三角形都与顶点相关。结果是将新的法线属性添加到几何体中。
这假定是逆时针缠绕顺序。Name | Type | Description |
---|---|---|
geometry |
Geometry | 要修改的几何体。 |
Returns:
使用计算出的
normal
属性修改后的geometry
参数。Throws:
-
DeveloperError : 几何.索引长度必须大于0,并且是3的倍数。
-
DeveloperError : 几何体.primitiveType必须是
PrimitiveType.TRIANGLES
。
Example:
Cesium.GeometryPipeline.computeNormal(geometry);
static Cesium.GeometryPipeline.computeTangentAndBitangent(geometry) → Geometry
计算包含
TRIANGLES
的几何体的每个顶点tangent
s和bitangent
s。
结果是将新的切线和双切线属性添加到几何体中。
这假定是逆时针缠绕顺序。
Based on Computing Tangent Space Basis Vectors for an Arbitrary Mesh by Eric Lengyel.
Name | Type | Description |
---|---|---|
geometry |
Geometry | 要修改的几何体。 |
Returns:
使用计算出的
tangent
和bitangent
属性修改后的geometry
参数。Throws:
-
DeveloperError : 几何.索引长度必须大于0,并且是3的倍数。
-
DeveloperError : 几何体.primitiveType必须是
PrimitiveType.TRIANGLES
。
Example:
Cesium.GeometryPipeline.computeTangentAndBiTangent(geometry);
创建将属性名称映射到唯一位置(索引)的对象
用于匹配顶点属性和着色器程序。
Name | Type | Description |
---|---|---|
geometry |
Geometry | 要为其创建对象的几何体(未修改)。 |
Returns:
具有属性名/索引对的对象。
Example:
var attributeLocations = Cesium.GeometryPipeline.createAttributeLocations(geometry);
// Example output
// {
// 'position' : 0,
// 'normal' : 1
// }
static Cesium.GeometryPipeline.createLineSegmentsForVectors(geometry, attributeName, length) → Geometry
Name | Type | Default | Description |
---|---|---|---|
geometry |
Geometry | 具有属性的Geometry 实例。 |
|
attributeName |
String |
'normal'
|
optional 属性的名称。 |
length |
Number |
10000.0
|
optional 每段线段的长度,以米为单位。如果矢量指向相反的方向,则可以为负值。 |
Returns:
一个新的
Geometry
实例,其中包含向量的线段。Throws:
-
DeveloperError : 几何体.属性必须具有与attributeName参数同名的属性。
Example:
var geometry = Cesium.GeometryPipeline.createLineSegmentsForVectors(instance.geometry, 'bitangent', 100000.0);
static Cesium.GeometryPipeline.encodeAttribute(geometry, attributeName, attributeHighName, attributeLowName) → Geometry
将浮点几何体属性值编码为两个单独的属性以进行改进
渲染精度。
This is commonly used to create high-precision position vertex attributes.
Name | Type | Description |
---|---|---|
geometry |
Geometry | 要修改的几何体。 |
attributeName |
String | 属性的名称。 |
attributeHighName |
String | 编码高位的属性名称。 |
attributeLowName |
String | 编码低位的属性名称。 |
Returns:
修改后的
geometry
参数及其encoded属性。Throws:
-
DeveloperError :几何体必须具有与attributeName参数匹配的属性。
-
DeveloperError :属性componentDatatype必须是ComponentDatatype.DOUBLE.
Example:
geometry = Cesium.GeometryPipeline.encodeAttribute(geometry, 'position3D', 'position3DHigh', 'position3DLow');
static Cesium.GeometryPipeline.fitToUnsignedShortIndices(geometry) → Array.<Geometry>
如果有必要的话,把六百六十五分成六百六十五的几何学
指数适合无符号空头。这是用来满足WebGL要求的
当不支持无符号int索引时。
If the geometry does not have any indices
, this function has no effect.
Name | Type | Description |
---|---|---|
geometry |
Geometry | 要拆分为多个几何体的几何体。 |
Returns:
一组几何图形,每个都有适合于无符号空头的索引。
Throws:
-
DeveloperError : 几何体.primitiveType必须等于基本类型.三角形, 基本类型.LINES,或PrimitiveType.POINTS
-
DeveloperError :所有几何体属性列表必须具有相同数量的属性。
Example:
var geometries = Cesium.GeometryPipeline.fitToUnsignedShortIndices(geometry);
static Cesium.GeometryPipeline.projectTo2D(geometry, attributeName, attributeName3D, attributeName2D, projection) → Geometry
将几何体的三维
position
属性投影到二维,替换position
具有单独的position3D
和position2D
属性的属性。
If the geometry does not have a position
, this function has no effect.
Name | Type | Default | Description |
---|---|---|---|
geometry |
Geometry | 要修改的几何体。 | |
attributeName |
String | 属性的名称。 | |
attributeName3D |
String | 3D中属性的名称。 | |
attributeName2D |
String | 2D中属性的名称。 | |
projection |
Object |
new GeographicProjection()
|
optional 要使用的投影。 |
Returns:
修改后的
geometry
参数具有position3D
和position2D
属性。Throws:
-
DeveloperError :几何体必须具有与attributeName参数匹配的属性。
-
DeveloperError :属性componentDatatype必须是ComponentDatatype.DOUBLE.
-
DeveloperError :无法将点投影到2D。
Example:
geometry = Cesium.GeometryPipeline.projectTo2D(geometry, 'position', 'position3D', 'position2D');
static Cesium.GeometryPipeline.reorderForPostVertexCache(geometry, cacheCapacity) → Geometry
重新排列几何图形的
indices
以获得更好的GPU性能
使用Tipsify算法实现顶点后着色器缓存。如果几何结构primitiveType
不是TRIANGLES
或几何图形没有indices
,此函数无效。Name | Type | Default | Description |
---|---|---|---|
geometry |
Geometry | 要修改的几何体。 | |
cacheCapacity |
Number |
24
|
optional 可以保存在GPU的顶点缓存中的顶点数。 |
Returns:
修改后的
geometry
参数,其索引为顶点后着色器缓存重新排序。Throws:
-
DeveloperError :cacheCapacity必须大于2。
- GeometryPipeline.reorderForPreVertexCache
- Fast Triangle Reordering for Vertex Locality and Reduced Overdraw by Sander, Nehab, and Barczak
Example:
geometry = Cesium.GeometryPipeline.reorderForPostVertexCache(geometry);
See:
static Cesium.GeometryPipeline.reorderForPreVertexCache(geometry) → Geometry
重新排序几何体的属性和
indices
,以从GPU的顶点前着色器缓存获得更好的性能。Name | Type | Description |
---|---|---|
geometry |
Geometry | 要修改的几何体。 |
Returns:
修改后的
geometry
参数,其属性和索引为GPU的顶点前着色器缓存重新排序。Throws:
-
DeveloperError :中的每个属性数组几何体.属性必须具有相同数量的属性。
Example:
geometry = Cesium.GeometryPipeline.reorderForPreVertexCache(geometry);
See:
static Cesium.GeometryPipeline.toWireframe(geometry) → Geometry
将几何体的三角形
indices
转换为线索引。如果几何体有索引
它的primitiveType
是TRIANGLES
TRIANGLE_STRIP
,
TRIANGLE_FAN
,则转换为LINES
;否则,几何图形不会更改。
This is commonly used to create a wireframe geometry for visual debugging.
Name | Type | Description |
---|---|---|
geometry |
Geometry | 要修改的几何体。 |
Returns:
修改后的
geometry
参数,其三角形索引转换为直线。Throws:
-
DeveloperError : 几何体.primitiveType必须是三角形、三角形条或三角形扇形。
Example:
geometry = Cesium.GeometryPipeline.toWireframe(geometry);
static Cesium.GeometryPipeline.transformToWorldCoordinates(instance) → GeometryInstance
Name | Type | Description |
---|---|---|
instance |
GeometryInstance | 要修改的几何体实例。 |
Returns:
修改后的
instance
参数及其属性将转换为世界坐标。Example:
Cesium.GeometryPipeline.transformToWorldCoordinates(instance);