magic-pixels
    Preparing search index...

    Class BufferGeometry

    minimal BufferGeometry class to provide an API similar to THREE.

    A geometry is plain data; the renderer creates and caches the GPU buffers for it. Adding/removing attributes or changing the index bumps version, which makes the renderer rebuild its buffers. To change the contents of an existing attribute, write into attribute.data and set attribute.needsUpdate = true.

    boundingBox and boundingSphere are the extent of the position attribute in the geometry's own space, computed on demand by computeBoundingBox() / computeBoundingSphere() and cached. Set them to null after changing positions so they are recomputed.

    Index
    attributes: Record<string, BufferAttribute> = {}
    boundingBox: Box3 | null = null

    local-space box around all positions; null until computed

    boundingSphere: Sphere | null = null

    local-space sphere around all positions; null until computed

    count: number = 0
    groups: BufferGroup[] = []
    index: Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike> | null = null
    indexType: 0 | 16 | 32 = 0
    version: number = 0

    Incremented on every structural change (attributes added/removed, index set)

    • Compute (and cache in boundingBox) the axis-aligned box around every vertex of the position attribute, indexed or not. Empty without positions.

      Returns Box3

    • Compute (and cache in boundingSphere) a sphere around every vertex: centred on the bounding box, with the radius of the farthest vertex from that centre. Tighter than the sphere around the box, at the cost of a second pass over the positions.

      Returns Sphere