Class BufferGeometry

This is a superefficent class for geometries because it saves all data in buffers. It reduces memory costs and cpu cycles. But it is not as easy to work with because of all the nessecary buffer calculations. It is mainly interesting when working with static objects.

see

src/core/BufferGeometry.js

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(): BufferGeometry

This creates a new BufferGeometry. It also sets several properties to an default value.

Returns

BufferGeometry

Properties

public attributes: BufferAttribute[]

public boundingBox: BoundingBox3D

public boundingSphere: BoundingSphere

public drawcalls: Array<{ start: number; count: number; index: number; }>

public id: number

Unique number of this buffergeometry instance

public name: string

public offsets: Array<{ start: number; count: number; index: number; }>

public uuid: number

Methods

public addAttribute(name: string, attribute: BufferAttribute): any

Parameters

Returns

any

public addAttribute(name: string, array: any, itemSize: number): any

Parameters

  • name: string
  • array: any
  • itemSize: number

Returns

any

public addDrawCall(start: number, count: number, index: number)

Parameters

  • start: number
  • count: number
  • index: number

public applyMatrix(matrix: Matrix4)

Bakes matrix transform directly into vertex coordinates.

Parameters

public clone(): BufferGeometry

Returns

BufferGeometry

public computeBoundingBox()

Computes bounding box of the geometry, updating Geometry.boundingBox attribute. Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are null.

public computeBoundingSphere()

Computes bounding sphere of the geometry, updating Geometry.boundingSphere attribute. Bounding spheres aren't' computed by default. They need to be explicitly computed, otherwise they are null.

public computeOffsets(indexBufferSize: number)

Parameters

  • indexBufferSize: number

public computeTangents()

Computes vertex tangents. Based on http://www.terathon.com/code/tangent.html Geometry must have vertex UVs (layer 0 will be used).

public computeVertexNormals()

Computes vertex normals by averaging face normals.

public dispose()

Disposes the object from memory. You need to call this when you want the bufferGeometry removed while the application is running.

public getAttribute(name: string): any

Parameters

  • name: string

Returns

any

public merge()

public normalizeNormals()

public reorderBuffers(indexBuffer: number, indexMap: Array<number>, vertexCount: number)

Parameters

  • indexBuffer: number
  • indexMap: Array<number>
  • vertexCount: number