GeometryPipeline

几何图形的内容管道函数。
See:

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的几何体的法线,计算每个顶点normals 所有三角形都与顶点相关。结果是将新的法线属性添加到几何体中。 这假定是逆时针缠绕顺序。
Name Type Description
geometry Geometry 要修改的几何体。
Returns:
使用计算出的normal属性修改后的geometry参数。
Throws:
Example:
Cesium.GeometryPipeline.computeNormal(geometry);

static Cesium.GeometryPipeline.computeTangentAndBitangent(geometry)Geometry

计算包含TRIANGLES的几何体的每个顶点tangents和bitangents。 结果是将新的切线和双切线属性添加到几何体中。 这假定是逆时针缠绕顺序。

Based on Computing Tangent Space Basis Vectors for an Arbitrary Mesh by Eric Lengyel.

Name Type Description
geometry Geometry 要修改的几何体。
Returns:
使用计算出的tangentbitangent属性修改后的geometry参数。
Throws:
Example:
Cesium.GeometryPipeline.computeTangentAndBiTangent(geometry);

static Cesium.GeometryPipeline.createAttributeLocations(geometry)Object

创建将属性名称映射到唯一位置(索引)的对象 用于匹配顶点属性和着色器程序。
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

创建新的Geometry,其中LINES表示提供的 提供的几何体的属性(attributeName)。这是用来 可视化向量属性,如法线、切线和双切线。
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 具有单独的position3Dposition2D属性的属性。

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参数具有position3Dposition2D属性。
Throws:
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:
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转换为线索引。如果几何体有索引 它的primitiveTypeTRIANGLESTRIANGLE_STRIPTRIANGLE_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

将几何体实例转换为世界坐标。这就改变了 实例的modelMatrixMatrix4.IDENTITY,并将 如果存在以下属性:positionnormaltangentbitangent
Name Type Description
instance GeometryInstance 要修改的几何体实例。
Returns:
修改后的instance参数及其属性将转换为世界坐标。
Example:
Cesium.GeometryPipeline.transformToWorldCoordinates(instance);