GeometryPipeline

几何的内容管道功能。
See:

Methods

static Cesium.GeometryPipeline.compressVertices (geometry) → Geometry

压缩和压缩几何法线属性值以节省内存。
Name Type Description
geometry Geometry 要修改的几何。
Returns:
修改后的 几何 参数,其法线被压缩和压缩。
Example:
geometry = Cesium.GeometryPipeline.compressVertices(geometry);

static Cesium.GeometryPipeline.computeNormal (geometry) → Geometry

通过平均的法线来计算包含 TRIANGLES 的几何图形的每个顶点法线入射到顶点的所有三角形。结果是将新的 normal 属性添加到了几何图形。这假设逆时针缠绕顺序。
Name Type Description
geometry Geometry 要修改的几何。
Returns:
修改后的 几何 带计算的参数 正常 属性。
Throws:
Example:
Cesium.GeometryPipeline.computeNormal(geometry);

static Cesium.GeometryPipeline.computeTangentAndBitangent (geometry) → Geometry

计算包含 TRIANGLES 的几何的每个顶点的切线和切线。结果是将新的 tangent 和 bitangent 属性添加到了几何图形。这假设逆时针缠绕顺序。

基于 计算正切空间基础向量为埃里克·伦盖尔(Eric Lengyel)设计的任意网格 。

Name Type Description
geometry Geometry 要修改的几何。
Returns:
修改后的 几何 带计算的参数 切线 和 双切线 属性。
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' 可选 属性的名称。
length Number 10000.0 可选 每个线段的长度(以米为单位)。将向量指向相反方向可以为负。
Returns:
一个新的 几何 矢量的线段的实例。
Throws:
  • DeveloperError :geometry.attributes必须具有与attributeName参数名称相同的属性。
Example:
var geometry = Cesium.GeometryPipeline.createLineSegmentsForVectors(instance.geometry, 'bitangent', 100000.0);

static Cesium.GeometryPipeline.encodeAttribute (geometry, attributeName, attributeHighName, attributeLowName) → Geometry

将浮点几何属性值编码为两个单独的属性以进行改进渲染精度。

这通常用于创建高精度的位置顶点属性。

Name Type Description
geometry Geometry 要修改的几何。
attributeName String 属性的名称。
attributeHighName String 编码后的高位的属性名称。
attributeLowName String 编码的低位的属性名称。
Returns:
修改后的 几何 参数及其编码属性。
Throws:
Example:
geometry = Cesium.GeometryPipeline.encodeAttribute(geometry, 'position3D', 'position3DHigh', 'position3DLow');

static Cesium.GeometryPipeline.fitToUnsignedShortIndices (geometry) → Array.< Geometry >

如有必要,将一个几何体拆分为多个几何体,以确保 indices 适合无符号短裤。这用于满足WebGL要求不支持unsigned int索引时。

如果几何没有任何 indices ,则此功能无效。

Name Type Description
geometry Geometry 要拆分为多个几何的几何。
Returns:
一组几何图形,每个几何图形都有适合无符号短裤的索引。
Throws:
  • DeveloperError :geometry.primitiveType必须等于PrimitiveType.TRIANGLES,PrimitiveType.LINES或PrimitiveType.POINTS
  • DeveloperError :所有几何属性列表必须具有相同数量的属性。
Example:
var geometries = Cesium.GeometryPipeline.fitToUnsignedShortIndices(geometry);

static Cesium.GeometryPipeline.projectTo2D (geometry, attributeName, attributeName3D, attributeName2D, projection ) → Geometry

将几何体的3D position 属性投影到2D,替换 position 属性具有单独的 position3D 和 position2D 属性。

如果几何没有 position ,则此功能无效。

Name Type Default Description
geometry Geometry 要修改的几何。
attributeName String 属性的名称。
attributeName3D String 3D中的属性名称。
attributeName2D String 二维属性名称。
projection Object new GeographicProjection() 可选 使用的投影。
Returns:
修改后的 几何 与 position3D 和 position2D 属性。
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 可选 GPU的顶点缓存中可以保存的顶点数。
Returns:
修改后的 几何 参数,其索引针对后顶点着色器缓存重新排序。
Throws:
Example:
geometry = Cesium.GeometryPipeline.reorderForPostVertexCache(geometry);
See:

static Cesium.GeometryPipeline.reorderForPreVertexCache (geometry) → Geometry

重新排列几何的属性和 indices ,以从GPU的pre-vertex-shader缓存中获得更好的性能。
Name Type Description
geometry Geometry 要修改的几何。
Returns:
修改后的 几何 参数,其属性和索引针对GPU的pre-vertex-shader缓存重新排序。
Throws:
  • DeveloperError :geometry.attributes中的每个属性数组必须具有相同数量的属性。
Example:
geometry = Cesium.GeometryPipeline.reorderForPreVertexCache(geometry);
See:

static Cesium.GeometryPipeline.toWireframe (geometry) → Geometry

将几何的三角形索引转换为线索引。如果几何图形具有 indices 其 primitiveType 是 TRIANGLES , TRIANGLE_STRIP , TRIANGLE_FAN ,它将转换为 LINES ;否则,几何不会更改。

这通常用于创建线框几何图形以进行视觉调试。

Name Type Description
geometry Geometry 要修改的几何。
Returns:
修改后的 几何 参数,其三角形索引转换为直线。
Throws:
  • DeveloperError :geometry.primitiveType必须为TRIANGLES,TRIANGLE_STRIP或TRIANGLE_FAN。
Example:
geometry = Cesium.GeometryPipeline.toWireframe(geometry);

static Cesium.GeometryPipeline.transformToWorldCoordinates (instance) → GeometryInstance

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