BufferGeometryUtils

A class containing utility functions for BufferGeometry instances.

Methods

.batchMeshes(meshObjs : Array, batchParent : Object3D)

Merges the meshes together to form a batched mesh. This technique is used to reduce the number WebGL draw calls hence to improve rendering performance.

The batching will be performed among the meshes which have the same values of the following properties:

.computeMorphedAttributes(object : Mesh | Line | Points) → Object

object — instance of Mesh, Line, Points.

Returns the morphed attributes (position and normal) of a morphed/skinned object together with the original ones. The returned object includes 4 properties: positionAttribute, normalAttribute, morphedPositionAttribute, and morphedNormalAttribute. Can be helpful for raytracing or applying decals.

.deepCloneAttribute(attribute : BufferAttribute) → BufferAttribute

attribute — instance of BufferAttribute to perform deep clone.

Returns a deep clone of the given attribute.

.estimateBytesUsed(geometry : BufferGeometry) → Float

geometry — instance of BufferGeometry to estimate the memory use of.

Returns the amount of bytes used by all attributes to represent the geometry.

.mergeBufferAttributes(attributes : Array) → BufferAttribute

attributes — array of BufferAttribute instances.

Merges a set of attributes into a single instance. All attributes must have compatible properties and types. If merge does not succeed, the method returns null.

.mergeBufferGeometries(geometries : Array, useGroups : Boolean) → BufferGeometry

Merges a set of geometries into a single instance. All geometries must have compatible attributes. If merge does not succeed, the method returns null.

.mergeGroups(geometry : BufferGeometry) → BufferGeometry

geometry — instance of BufferGeometry to merge the groups of.

Merges the groups for the given geometry.

.mergeVertices(geometry : BufferGeometry, tolerance : Float) → BufferGeometry

Returns a new BufferGeometry with vertices for which all similar vertex attributes (within tolerance) are merged.

.toCreasedNormals(geometry : BufferGeometry, creaseAngle : Float) → BufferGeometry

Creates a new, non-indexed geometry with smooth normals everywhere except faces that meet at an angle greater than the crease angle.

.toTrianglesDrawMode(geometry : BufferGeometry, drawMode : TrianglesDrawMode) → BufferGeometry

Returns a new indexed geometry based on v3d.TrianglesDrawMode draw mode. This mode corresponds to the gl.TRIANGLES WebGL primitive.

Source

For more info on how to obtain the source code of this module see this page.