📄 threejs/Core/Nodes/BufferNode

File: BufferNode.md | Updated: 11/15/2025


title: BufferNode category: Core layout: docs

BufferNode

A special type of uniform node which represents array-like data as uniform buffers. The access usually happens via element() which returns an instance of ArrayElementNode. For example:

In general, it is recommended to use the more managed UniformArrayNode since it handles more input types and automatically cares about buffer paddings.

Code Example

const bufferNode = buffer( array, 'mat4', count );
const matrixNode = bufferNode.element( index ); // access a matrix from the buffer

Constructor

new BufferNode( value : Array.<number>, bufferType : string, bufferCount : number )

Constructs a new buffer node.

value | Array-like buffer data.
---|---
bufferType | The data type of the buffer.
bufferCount | The count of buffer elements. Default is 0.

Properties

.bufferCount : number

The uniform node that holds the value of the reference node.

Default is 0.

.bufferType : string

The data type of the buffer.

.isBufferNode : boolean (readonly)

This flag can be used for type testing.

Default is true.

Methods

.getElementType( builder : NodeBuilder ) : string

The data type of the buffer elements.

builder | The current node builder.
---|---

Overrides: UniformNode#getElementType

Returns: The element type.

.getInputType( builder : NodeBuilder ) : string

Overwrites the default implementation to return a fixed value 'buffer'.

builder | The current node builder.
---|---

Overrides: UniformNode#getInputType

Returns: The input type.

Source

src/nodes/accessors/BufferNode.js