Skip to content

KBE3D / KBCore / Cesium / GeometryPipeline

GeometryPipeline

Content pipeline functions for geometries.

函数

函数描述
toWireframeConverts a geometry's triangle indices to line indices. If the geometry has an indices and its primitiveType is TRIANGLES, TRIANGLE_STRIP, TRIANGLE_FAN, it is converted to LINES; otherwise, the geometry is not changed.

This is commonly used to create a wireframe geometry for visual debugging.

createLineSegmentsForVectorsCreates a new Geometry with LINES representing the provided attribute (attributeName) for the provided geometry. This is used to visualize vector attributes like normals, tangents, and bitangents.
createAttributeLocationsCreates an object that maps attribute names to unique locations (indices) for matching vertex attributes and shader programs.
reorderForPreVertexCacheReorders a geometry's attributes and indices to achieve better performance from the GPU's pre-vertex-shader cache.
reorderForPostVertexCacheReorders a geometry's indices to achieve better performance from the GPU's post vertex-shader cache by using the Tipsify algorithm. If the geometry primitiveType is not TRIANGLES or the geometry does not have an indices, this function has no effect.
fitToUnsignedShortIndicesSplits a geometry into multiple geometries, if necessary, to ensure that indices in the indices fit 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.

projectTo2DProjects a geometry's 3D position attribute to 2D, replacing the position attribute with separate position3D and position2D attributes.

If the geometry does not have a position, this function has no effect.

encodeAttributeEncodes floating-point geometry attribute values as two separate attributes to improve rendering precision.

This is commonly used to create high-precision position vertex attributes.

transformToWorldCoordinatesTransforms a geometry instance to world coordinates. This changes the instance's modelMatrix to Matrix4.IDENTITY and transforms the following attributes if they are present: position, normal, tangent, and bitangent.
computeNormalComputes per-vertex normals for a geometry containing TRIANGLES by averaging the normals of all triangles incident to the vertex. The result is a new normal attribute added to the geometry. This assumes a counter-clockwise winding order.
computeTangentAndBitangentComputes per-vertex tangents and bitangents for a geometry containing TRIANGLES. The result is new tangent and bitangent attributes 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.

compressVerticesCompresses and packs geometry normal attribute values to save memory.

KBE3D @3.0.0 Copyright © 2024-present KBE3D