Theme:

BufferGeometry

BufferGeometry is the base class for all mesh, line, and point geometry. It stores vertex data — positions, indices, normals, UVs, colors, and any custom attributes — in GPU-friendly typed-array buffers.

Properties

  • id — Auto-incrementing numeric id (readonly).
  • uuid — Globally unique string id.
  • type — Class name string (e.g. 'BufferGeometry', 'BoxGeometry').
  • index — Optional BufferAttribute of triangle indices, or null for non-indexed geometry.
  • attributes — Dictionary of named BufferAttributes (position, normal, uv, color, …). Access via getAttribute / setAttribute rather than touching this directly.
  • morphAttributes — Dictionary of morph-target attribute arrays.
  • boundingBoxBox3 computed by computeBoundingBox(), otherwise null.
  • drawRange{ start, count } describing which portion of the geometry to draw. Set via setDrawRange.
  • userData — Free-form object for attaching custom data.

Attributes & indices

  • getIndex() — Returns the current index attribute, or null.
  • setIndex(index) — Sets the index from a BufferAttribute or a plain array (auto-picks Uint16/Uint32).
  • getAttribute(name) — Returns the attribute registered under name.
  • setAttribute(name, attribute) — Registers a BufferAttribute under name.
  • deleteAttribute(name) — Removes the named attribute.
  • hasAttribute(name) — Returns true if the attribute exists.
  • setDrawRange(start, count) — Limits rendering to a sub-range of indices/vertices.

Transformations

These bake the transform into the vertex buffers; use them as one-time operations rather than per frame (use Object3D.position/rotation/scale for realtime movement).

  • applyMatrix4(matrix) — Apply an arbitrary 4×4 transform (also transforms normals/tangents).
  • applyQuaternion(q) — Apply a rotation.
  • rotateX(angle) / rotateY(angle) / rotateZ(angle) — Rotate around a world axis (radians).
  • translate(x, y, z) — Translate the vertices.
  • scale(x, y, z) — Scale the vertices.
  • lookAt(vector) — Rotate the geometry so its local +Z faces the given point.
  • center() — Translate the geometry so its bounding box is centered on the origin.

Lifecycle

  • clone() — Return a deep copy.
  • copy(source) — Copy data from another BufferGeometry into this one.
  • toJSON() — Serialize the geometry to a plain JSON object.
  • dispose() — Fire the dispose event and free associated GPU resources. Call when the geometry is no longer needed.