Methods
-
staticCesium.GeometryPipeline.compressVertices(geometry) → Geometry
-
Compresses and packs geometry normal attribute values to save memory.
Name Type Description geometryGeometry The geometry to modify. Returns:
The modifiedgeometryargument, with its normals compressed and packed.Example:
geometry = Cesium.GeometryPipeline.compressVertices(geometry); -
staticCesium.GeometryPipeline.computeBinormalAndTangent(geometry) → Geometry
-
Computes per-vertex binormals and tangents for a geometry containing
TRIANGLES. The result is newbinormalandtangentattributes added to the geometry. This assumes a counter-clockwise winding order.Based on Computing Tangent Space Basis Vectors for an Arbitrary Mesh by Eric Lengyel.
Name Type Description geometryGeometry The geometry to modify. Returns:
The modifiedgeometryargument with the computedbinormalandtangentattributes.Throws:
-
DeveloperError : geometry.indices length must be greater than 0 and be a multiple of 3.
-
DeveloperError : geometry.primitiveType must be
PrimitiveType.TRIANGLES.
Example:
Cesium.GeometryPipeline.computeBinormalAndTangent(geometry); -
-
staticCesium.GeometryPipeline.computeNormal(geometry) → Geometry
-
Computes per-vertex normals for a geometry containing
TRIANGLESby averaging the normals of all triangles incident to the vertex. The result is a newnormalattribute added to the geometry. This assumes a counter-clockwise winding order.Name Type Description geometryGeometry The geometry to modify. Returns:
The modifiedgeometryargument with the computednormalattribute.Throws:
-
DeveloperError : geometry.indices length must be greater than 0 and be a multiple of 3.
-
DeveloperError : geometry.primitiveType must be
PrimitiveType.TRIANGLES.
Example:
Cesium.GeometryPipeline.computeNormal(geometry); -
-
Creates an object that maps attribute names to unique locations (indices) for matching vertex attributes and shader programs.
Name Type Description geometryGeometry The geometry, which is not modified, to create the object for. Returns:
An object with attribute name / index pairs.Example:
var attributeLocations = Cesium.GeometryPipeline.createAttributeLocations(geometry); // Example output // { // 'position' : 0, // 'normal' : 1 // } -
staticCesium.GeometryPipeline.createLineSegmentsForVectors(geometry, attributeName, length) → Geometry
-
Creates a new
GeometrywithLINESrepresenting the provided attribute (attributeName) for the provided geometry. This is used to visualize vector attributes like normals, binormals, and tangents.Name Type Default Description geometryGeometry The Geometryinstance with the attribute.attributeNameString 'normal'optional The name of the attribute. lengthNumber 10000.0optional The length of each line segment in meters. This can be negative to point the vector in the opposite direction. Returns:
A newGeometryinstance with line segments for the vector.Throws:
-
DeveloperError : geometry.attributes must have an attribute with the same name as the attributeName parameter.
Example:
var geometry = Cesium.GeometryPipeline.createLineSegmentsForVectors(instance.geometry, 'binormal', 100000.0); -
-
staticCesium.GeometryPipeline.encodeAttribute(geometry, attributeName, attributeHighName, attributeLowName) → Geometry
-
Encodes floating-point geometry attribute values as two separate attributes to improve rendering precision.
This is commonly used to create high-precision position vertex attributes.
Name Type Description geometryGeometry The geometry to modify. attributeNameString The name of the attribute. attributeHighNameString The name of the attribute for the encoded high bits. attributeLowNameString The name of the attribute for the encoded low bits. Returns:
The modifiedgeometryargument, with its encoded attribute.Throws:
-
DeveloperError : geometry must have attribute matching the attributeName argument.
-
DeveloperError : The attribute componentDatatype must be ComponentDatatype.DOUBLE.
Example:
geometry = Cesium.GeometryPipeline.encodeAttribute(geometry, 'position3D', 'position3DHigh', 'position3DLow'); -
-
staticCesium.GeometryPipeline.fitToUnsignedShortIndices(geometry) → Array.<Geometry>
-
Splits a geometry into multiple geometries, if necessary, to ensure that indices in the
indicesfit into unsigned shorts. This is used to meet the WebGL requirements when unsigned int indices are not supported.If the geometry does not have any
indices, this function has no effect.Name Type Description geometryGeometry The geometry to be split into multiple geometries. Returns:
An array of geometries, each with indices that fit into unsigned shorts.Throws:
-
DeveloperError : geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS
-
DeveloperError : All geometry attribute lists must have the same number of attributes.
Example:
var geometries = Cesium.GeometryPipeline.fitToUnsignedShortIndices(geometry); -
-
staticCesium.GeometryPipeline.projectTo2D(geometry, attributeName, attributeName3D, attributeName2D, projection) → Geometry
-
Projects a geometry's 3D
positionattribute to 2D, replacing thepositionattribute with separateposition3Dandposition2Dattributes.If the geometry does not have a
position, this function has no effect.Name Type Default Description geometryGeometry The geometry to modify. attributeNameString The name of the attribute. attributeName3DString The name of the attribute in 3D. attributeName2DString The name of the attribute in 2D. projectionObject new GeographicProjection()optional The projection to use. Returns:
The modifiedgeometryargument withposition3Dandposition2Dattributes.Throws:
-
DeveloperError : geometry must have attribute matching the attributeName argument.
-
DeveloperError : The attribute componentDatatype must be ComponentDatatype.DOUBLE.
-
DeveloperError : Could not project a point to 2D.
Example:
geometry = Cesium.GeometryPipeline.projectTo2D(geometry, 'position', 'position3D', 'position2D'); -
-
staticCesium.GeometryPipeline.reorderForPostVertexCache(geometry, cacheCapacity) → Geometry
-
Reorders a geometry's
indicesto achieve better performance from the GPU's post vertex-shader cache by using the Tipsify algorithm. If the geometryprimitiveTypeis notTRIANGLESor the geometry does not have anindices, this function has no effect.Name Type Default Description geometryGeometry The geometry to modify. cacheCapacityNumber 24optional The number of vertices that can be held in the GPU's vertex cache. Returns:
The modifiedgeometryargument, with its indices reordered for the post-vertex-shader cache.Throws:
-
DeveloperError : cacheCapacity must be greater than two.
- GeometryPipeline.reorderForPreVertexCache
- Fast Triangle Reordering for Vertex Locality and Reduced Overdraw by Sander, Nehab, and Barczak
Example:
geometry = Cesium.GeometryPipeline.reorderForPostVertexCache(geometry);See:
-
-
staticCesium.GeometryPipeline.reorderForPreVertexCache(geometry) → Geometry
-
Reorders a geometry's attributes and
indicesto achieve better performance from the GPU's pre-vertex-shader cache.Name Type Description geometryGeometry The geometry to modify. Returns:
The modifiedgeometryargument, with its attributes and indices reordered for the GPU's pre-vertex-shader cache.Throws:
-
DeveloperError : Each attribute array in geometry.attributes must have the same number of attributes.
Example:
geometry = Cesium.GeometryPipeline.reorderForPreVertexCache(geometry);See:
-
-
staticCesium.GeometryPipeline.toWireframe(geometry) → Geometry
-
Converts a geometry's triangle indices to line indices. If the geometry has an
indicesand itsprimitiveTypeisTRIANGLES,TRIANGLE_STRIP,TRIANGLE_FAN, it is converted toLINES; otherwise, the geometry is not changed.This is commonly used to create a wireframe geometry for visual debugging.
Name Type Description geometryGeometry The geometry to modify. Returns:
The modifiedgeometryargument, with its triangle indices converted to lines.Throws:
-
DeveloperError : geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.
Example:
geometry = Cesium.GeometryPipeline.toWireframe(geometry); -
-
staticCesium.GeometryPipeline.transformToWorldCoordinates(instance) → GeometryInstance
-
Transforms a geometry instance to world coordinates. This changes the instance's
modelMatrixtoMatrix4.IDENTITYand transforms the following attributes if they are present:position,normal,binormal, andtangent.Name Type Description instanceGeometryInstance The geometry instance to modify. Returns:
The modifiedinstanceargument, with its attributes transforms to world coordinates.Example:
Cesium.GeometryPipeline.transformToWorldCoordinates(instance);
